Bug 1291971 - Part 1, enable controller idlharness test. r=smaug. draft
authorShih-Chiang Chien <schien@mozilla.com>
Tue, 04 Oct 2016 00:22:34 +0200
changeset 430812 eca8bec6b6200247fbc9c743c13822f02373cc3d
parent 430811 b1d9c28147c773cd6a4ba28cedb1518f8b627845
child 430813 b7c35259a04d1ba19a9e095349f7877c2d2aeeb8
push id33907
push userschien@mozilla.com
push dateFri, 28 Oct 2016 06:37:18 +0000
reviewerssmaug
bugs1291971
milestone52.0a1
Bug 1291971 - Part 1, enable controller idlharness test. r=smaug. MozReview-Commit-ID: bDuOdLpPDh
dom/presentation/Presentation.cpp
dom/presentation/Presentation.h
dom/presentation/PresentationConnection.cpp
dom/presentation/PresentationConnection.h
dom/presentation/PresentationReceiver.cpp
dom/presentation/PresentationReceiver.h
dom/presentation/PresentationService.cpp
dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html
dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html
dom/webidl/Presentation.webidl
dom/webidl/PresentationConnectionCloseEvent.webidl
dom/webidl/PresentationConnectionClosedEvent.webidl
dom/webidl/moz.build
testing/web-platform/meta/presentation-api/controlling-ua/idlharness.html.ini
--- a/dom/presentation/Presentation.cpp
+++ b/dom/presentation/Presentation.cpp
@@ -12,31 +12,35 @@
 #include "mozilla/dom/Promise.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIDocShell.h"
 #include "nsIPresentationService.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsJSUtils.h"
 #include "nsNetUtil.h"
+#include "nsPIDOMWindow.h"
 #include "nsSandboxFlags.h"
 #include "nsServiceManagerUtils.h"
 #include "PresentationReceiver.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED(Presentation, DOMEventTargetHelper,
-                                   mDefaultRequest, mReceiver)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Presentation,
+                                      mWindow,
+                                      mDefaultRequest, mReceiver)
 
-NS_IMPL_ADDREF_INHERITED(Presentation, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(Presentation, DOMEventTargetHelper)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(Presentation)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(Presentation)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Presentation)
-NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Presentation)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
 
 /* static */ already_AddRefed<Presentation>
 Presentation::Create(nsPIDOMWindowInner* aWindow)
 {
   RefPtr<Presentation> presentation = new Presentation(aWindow);
   return presentation.forget();
 }
 
@@ -83,17 +87,17 @@ Presentation::HasReceiverSupport(JSConte
 
   nsCOMPtr<nsIURI> docURI = inner->GetDocumentURI();
   return NS_SUCCEEDED(securityManager->CheckSameOriginURI(presentationURI,
                                                           docURI,
                                                           false));
 }
 
 Presentation::Presentation(nsPIDOMWindowInner* aWindow)
-  : DOMEventTargetHelper(aWindow)
+  : mWindow(aWindow)
 {
 }
 
 Presentation::~Presentation()
 {
 }
 
 /* virtual */ JSObject*
@@ -105,17 +109,17 @@ Presentation::WrapObject(JSContext* aCx,
 
 void
 Presentation::SetDefaultRequest(PresentationRequest* aRequest)
 {
   if (IsInPresentedContent()) {
     return;
   }
 
-  nsCOMPtr<nsIDocument> doc = GetOwner() ? GetOwner()->GetExtantDoc() : nullptr;
+  nsCOMPtr<nsIDocument> doc = mWindow ? mWindow->GetExtantDoc() : nullptr;
   if (NS_WARN_IF(!doc)) {
     return;
   }
 
   if (doc->GetSandboxFlags() & SANDBOXED_PRESENTATION) {
     return;
   }
 
@@ -141,29 +145,36 @@ Presentation::GetReceiver()
     RefPtr<PresentationReceiver> receiver = mReceiver;
     return receiver.forget();
   }
 
   if (!IsInPresentedContent()) {
     return nullptr;
   }
 
-  mReceiver = PresentationReceiver::Create(GetOwner());
+  mReceiver = PresentationReceiver::Create(mWindow);
   if (NS_WARN_IF(!mReceiver)) {
     MOZ_ASSERT(mReceiver);
     return nullptr;
   }
 
   RefPtr<PresentationReceiver> receiver = mReceiver;
   return receiver.forget();
 }
 
 bool
 Presentation::IsInPresentedContent() const
 {
-  nsCOMPtr<nsIDocShell> docShell = GetOwner()->GetDocShell();
+  if (!mWindow) {
+    return false;
+  }
+
+  nsCOMPtr<nsIDocShell> docShell = mWindow->GetDocShell();
   MOZ_ASSERT(docShell);
 
   nsAutoString presentationURL;
   nsContentUtils::GetPresentationURL(docShell, presentationURL);
 
   return !presentationURL.IsEmpty();
 }
+
+} // namespace dom
+} // namespace mozilla
--- a/dom/presentation/Presentation.h
+++ b/dom/presentation/Presentation.h
@@ -2,53 +2,64 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_Presentation_h
 #define mozilla_dom_Presentation_h
 
-#include "mozilla/DOMEventTargetHelper.h"
+#include "nsCOMPtr.h"
+#include "nsCycleCollectionParticipant.h"
+#include "nsISupportsImpl.h"
+#include "nsWrapperCache.h"
+
+class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class Promise;
 class PresentationReceiver;
 class PresentationRequest;
 
-class Presentation final : public DOMEventTargetHelper
+class Presentation final : public nsISupports
+                         , public nsWrapperCache
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Presentation,
-                                           DOMEventTargetHelper)
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Presentation)
 
   static already_AddRefed<Presentation> Create(nsPIDOMWindowInner* aWindow);
 
   static bool HasReceiverSupport(JSContext* aCx, JSObject* aGlobal);
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
+  nsPIDOMWindowInner* GetParentObject() const
+  {
+    return mWindow;
+  }
+
   // WebIDL (public APIs)
   void SetDefaultRequest(PresentationRequest* aRequest);
 
   already_AddRefed<PresentationRequest> GetDefaultRequest() const;
 
   already_AddRefed<PresentationReceiver> GetReceiver();
 
 private:
   explicit Presentation(nsPIDOMWindowInner* aWindow);
 
-  ~Presentation();
+  virtual ~Presentation();
 
   bool IsInPresentedContent() const;
 
   RefPtr<PresentationRequest> mDefaultRequest;
   RefPtr<PresentationReceiver> mReceiver;
+  nsCOMPtr<nsPIDOMWindowInner> mWindow;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_Presentation_h
--- a/dom/presentation/PresentationConnection.cpp
+++ b/dom/presentation/PresentationConnection.cpp
@@ -7,17 +7,17 @@
 #include "PresentationConnection.h"
 
 #include "ControllerConnectionCollection.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessageEvent.h"
 #include "mozilla/dom/MessageEventBinding.h"
-#include "mozilla/dom/PresentationConnectionClosedEvent.h"
+#include "mozilla/dom/PresentationConnectionCloseEvent.h"
 #include "mozilla/ErrorNames.h"
 #include "mozilla/DebugOnly.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIPresentationService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsStringStream.h"
 #include "PresentationConnectionList.h"
@@ -429,17 +429,17 @@ PresentationConnection::ProcessStateChan
                                                          message))) {
           mozilla::GetErrorName(aReason, message);
           message.InsertLiteral("Internal error: ", 0);
         }
         CopyUTF8toUTF16(message, errorMsg);
       }
 
       Unused <<
-        NS_WARN_IF(NS_FAILED(DispatchConnectionClosedEvent(reason, errorMsg)));
+        NS_WARN_IF(NS_FAILED(DispatchConnectionCloseEvent(reason, errorMsg)));
 
       return RemoveFromLoadGroup();
     }
     case PresentationConnectionState::Terminated: {
       // Ensure onterminate event is fired.
       RefPtr<AsyncEventDispatcher> asyncDispatcher =
         new AsyncEventDispatcher(this, NS_LITERAL_STRING("terminate"), false);
       Unused << NS_WARN_IF(NS_FAILED(asyncDispatcher->PostDOMEvent()));
@@ -528,32 +528,32 @@ PresentationConnection::DoReceiveMessage
       return NS_ERROR_FAILURE;
     }
   }
 
   return DispatchMessageEvent(jsData);
 }
 
 nsresult
-PresentationConnection::DispatchConnectionClosedEvent(
+PresentationConnection::DispatchConnectionCloseEvent(
   PresentationConnectionClosedReason aReason,
   const nsAString& aMessage,
   bool aDispatchNow)
 {
   if (mState != PresentationConnectionState::Closed) {
     MOZ_ASSERT(false, "The connection state should be closed.");
     return NS_ERROR_FAILURE;
   }
 
-  PresentationConnectionClosedEventInit init;
+  PresentationConnectionCloseEventInit init;
   init.mReason = aReason;
   init.mMessage = aMessage;
 
-  RefPtr<PresentationConnectionClosedEvent> closedEvent =
-    PresentationConnectionClosedEvent::Constructor(this,
+  RefPtr<PresentationConnectionCloseEvent> closedEvent =
+    PresentationConnectionCloseEvent::Constructor(this,
                                                    NS_LITERAL_STRING("close"),
                                                    init);
   closedEvent->SetTrusted(true);
 
   if (aDispatchNow) {
     bool ignore;
     return DOMEventTargetHelper::DispatchEvent(closedEvent, &ignore);
   }
@@ -737,17 +737,17 @@ PresentationConnection::AsyncCloseConnec
     NS_NewRunnableFunction([this, message]() -> void {
       // Set |mState| to |PresentationConnectionState::Closed| here to avoid
       // calling |ProcessStateChanged|.
       mState = PresentationConnectionState::Closed;
 
       // Make sure dispatching the event and closing the connection are invoked
       // at the same time by setting |aDispatchNow| to true.
       Unused << NS_WARN_IF(NS_FAILED(
-        DispatchConnectionClosedEvent(PresentationConnectionClosedReason::Error,
+        DispatchConnectionCloseEvent(PresentationConnectionClosedReason::Error,
                                       message,
                                       true)));
 
       nsCOMPtr<nsIPresentationService> service =
         do_GetService(PRESENTATION_SERVICE_CONTRACTID);
       if(NS_WARN_IF(!service)) {
         return;
       }
--- a/dom/presentation/PresentationConnection.h
+++ b/dom/presentation/PresentationConnection.h
@@ -6,17 +6,17 @@
 
 #ifndef mozilla_dom_PresentationConnection_h
 #define mozilla_dom_PresentationConnection_h
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/dom/PresentationConnectionBinding.h"
-#include "mozilla/dom/PresentationConnectionClosedEventBinding.h"
+#include "mozilla/dom/PresentationConnectionCloseEventBinding.h"
 #include "nsIPresentationListener.h"
 #include "nsIRequest.h"
 #include "nsWeakReference.h"
 
 namespace mozilla {
 namespace dom {
 
 class Blob;
@@ -92,17 +92,17 @@ private:
   ~PresentationConnection();
 
   bool Init();
 
   void Shutdown();
 
   nsresult ProcessStateChanged(nsresult aReason);
 
-  nsresult DispatchConnectionClosedEvent(PresentationConnectionClosedReason aReason,
+  nsresult DispatchConnectionCloseEvent(PresentationConnectionClosedReason aReason,
                                          const nsAString& aMessage,
                                          bool aDispatchNow = false);
 
   nsresult DispatchMessageEvent(JS::Handle<JS::Value> aData);
 
   nsresult ProcessConnectionWentAway();
 
   nsresult AddIntoLoadGroup();
--- a/dom/presentation/PresentationReceiver.cpp
+++ b/dom/presentation/PresentationReceiver.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "PresentationReceiver.h"
 
 #include "mozilla/dom/PresentationReceiverBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "nsContentUtils.h"
 #include "nsIPresentationService.h"
+#include "nsPIDOMWindow.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "PresentationConnection.h"
 #include "PresentationConnectionList.h"
 #include "PresentationLog.h"
 
 namespace mozilla {
 namespace dom {
--- a/dom/presentation/PresentationReceiver.h
+++ b/dom/presentation/PresentationReceiver.h
@@ -2,18 +2,24 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_PresentationReceiver_h
 #define mozilla_dom_PresentationReceiver_h
 
+#include "mozilla/ErrorResult.h"
+#include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIPresentationListener.h"
+#include "nsWrapperCache.h"
+#include "nsString.h"
+
+class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class PresentationConnection;
 class PresentationConnectionList;
 class Promise;
 
@@ -25,17 +31,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PresentationReceiver)
   NS_DECL_NSIPRESENTATIONRESPONDINGLISTENER
 
   static already_AddRefed<PresentationReceiver> Create(nsPIDOMWindowInner* aWindow);
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
-  nsISupports* GetParentObject() const
+  nsPIDOMWindowInner* GetParentObject() const
   {
     return mOwner;
   }
 
   // WebIDL (public APIs)
   already_AddRefed<Promise> GetConnectionList(ErrorResult& aRv);
 
 private:
--- a/dom/presentation/PresentationService.cpp
+++ b/dom/presentation/PresentationService.cpp
@@ -791,17 +791,17 @@ PresentationService::CloseSession(const 
 
   RefPtr<PresentationSessionInfo> info = GetSessionInfo(aSessionId, aRole);
   if (NS_WARN_IF(!info)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   if (aClosedReason == nsIPresentationService::CLOSED_REASON_WENTAWAY) {
     // Remove nsIPresentationSessionListener since we don't want to dispatch
-    // PresentationConnectionClosedEvent if the page is went away.
+    // PresentationConnectionCloseEvent if the page is went away.
     info->SetListener(nullptr);
   }
 
   return info->Close(NS_OK, nsIPresentationSessionListener::STATE_CLOSED);
 }
 
 NS_IMETHODIMP
 PresentationService::TerminateSession(const nsAString& aSessionId,
--- a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html
+++ b/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_inproc.html
@@ -6,13 +6,13 @@
   <head>
     <meta charset="utf-8">
     <title>Test for B2G Presentation API when sender and receiver at the same side</title>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   </head>
   <body>
     <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1258600">
-      Test for PresentationConnectionClosedEvent with wentaway reason</a>
+      Test for PresentationConnectionCloseEvent with wentaway reason</a>
     <script type="application/javascript;version=1.8" src="test_presentation_1ua_connection_wentaway.js">
     </script>
   </body>
 </html>
--- a/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html
+++ b/dom/presentation/tests/mochitest/test_presentation_1ua_connection_wentaway_oop.html
@@ -6,13 +6,13 @@
   <head>
     <meta charset="utf-8">
     <title>Test for B2G Presentation API when sender and receiver at the same side</title>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   </head>
   <body>
     <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1258600">
-      Test for PresentationConnectionClosedEvent with wentaway reason</a>
+      Test for PresentationConnectionCloseEvent with wentaway reason</a>
     <script type="application/javascript;version=1.8" src="test_presentation_1ua_connection_wentaway.js">
     </script>
   </body>
 </html>
--- a/dom/webidl/Presentation.webidl
+++ b/dom/webidl/Presentation.webidl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Pref="dom.presentation.enabled"]
-interface Presentation : EventTarget {
+interface Presentation {
  /*
   * This should be used by the UA as the default presentation request for the
   * controller. When the UA wishes to initiate a PresentationConnection on the
   * controller's behalf, it MUST start a presentation connection using the default
   * presentation request (as if the controller had called |defaultRequest.start()|).
   *
   * Only used by controlling browsing context (senders).
   *
rename from dom/webidl/PresentationConnectionClosedEvent.webidl
rename to dom/webidl/PresentationConnectionCloseEvent.webidl
--- a/dom/webidl/PresentationConnectionClosedEvent.webidl
+++ b/dom/webidl/PresentationConnectionCloseEvent.webidl
@@ -17,25 +17,25 @@ enum PresentationConnectionClosedReason
   "closed",
 
   // The connection is closed because the destination browsing context
   // that owned the connection navigated or was discarded.
   "wentaway"
 };
 
 [Constructor(DOMString type,
-             PresentationConnectionClosedEventInit eventInitDict),
+             PresentationConnectionCloseEventInit eventInitDict),
  Pref="dom.presentation.enabled"]
-interface PresentationConnectionClosedEvent : Event
+interface PresentationConnectionCloseEvent : Event
 {
   readonly attribute PresentationConnectionClosedReason reason;
 
   // The message is a human readable description of
   // how the communication channel encountered an error.
   // It is empty when the closed reason is closed or wentaway.
   readonly attribute DOMString message;
 };
 
-dictionary PresentationConnectionClosedEventInit : EventInit
+dictionary PresentationConnectionCloseEventInit : EventInit
 {
   required PresentationConnectionClosedReason reason;
   DOMString message = "";
 };
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -761,17 +761,17 @@ GENERATED_EVENTS_WEBIDL_FILES = [
     'MozSettingsTransactionEvent.webidl',
     'MozStkCommandEvent.webidl',
     'PageTransitionEvent.webidl',
     'PerformanceEntryEvent.webidl',
     'PluginCrashedEvent.webidl',
     'PopStateEvent.webidl',
     'PopupBlockedEvent.webidl',
     'PresentationConnectionAvailableEvent.webidl',
-    'PresentationConnectionClosedEvent.webidl',
+    'PresentationConnectionCloseEvent.webidl',
     'ProgressEvent.webidl',
     'RecordErrorEvent.webidl',
     'ScrollViewChangeEvent.webidl',
     'ServiceWorkerMessageEvent.webidl',
     'StyleRuleChangeEvent.webidl',
     'StyleSheetApplicableStateChangeEvent.webidl',
     'StyleSheetChangeEvent.webidl',
     'TCPServerSocketEvent.webidl',
--- a/testing/web-platform/meta/presentation-api/controlling-ua/idlharness.html.ini
+++ b/testing/web-platform/meta/presentation-api/controlling-ua/idlharness.html.ini
@@ -1,216 +1,6 @@
 [idlharness.html]
   type: testharness
-  expected: ERROR
-  [Navigator interface: attribute presentation]
-    expected: FAIL
-
-  [Presentation interface: existence and properties of interface object]
-    expected: FAIL
-
-  [Presentation interface object length]
-    expected: FAIL
-
-  [Presentation interface object name]
-    expected: FAIL
-
-  [Presentation interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [Presentation interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [Presentation interface: attribute defaultRequest]
-    expected: FAIL
-
-  [Presentation must be primary interface of navigator.presentation]
-    expected: FAIL
-
-  [Stringification of navigator.presentation]
-    expected: FAIL
-
-  [Presentation interface: navigator.presentation must inherit property "defaultRequest" with the proper type (0)]
-    expected: FAIL
-
-  [PresentationRequest interface: existence and properties of interface object]
-    expected: FAIL
-
-  [PresentationRequest interface object length]
-    expected: FAIL
-
-  [PresentationRequest interface object name]
-    expected: FAIL
-
-  [PresentationRequest interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [PresentationRequest interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [PresentationRequest interface: operation start()]
-    expected: FAIL
-
-  [PresentationRequest interface: operation reconnect(DOMString)]
-    expected: FAIL
-
-  [PresentationRequest interface: operation getAvailability()]
-    expected: FAIL
-
-  [PresentationRequest interface: attribute onconnectionavailable]
-    expected: FAIL
-
-  [PresentationRequest must be primary interface of navigator.presentation.defaultRequest]
-    expected: FAIL
-
-  [Stringification of navigator.presentation.defaultRequest]
-    expected: FAIL
-
-  [PresentationRequest interface: navigator.presentation.defaultRequest must inherit property "start" with the proper type (0)]
-    expected: FAIL
-
-  [PresentationRequest interface: navigator.presentation.defaultRequest must inherit property "reconnect" with the proper type (1)]
-    expected: FAIL
-
-  [PresentationRequest interface: calling reconnect(DOMString) on navigator.presentation.defaultRequest with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [PresentationRequest interface: navigator.presentation.defaultRequest must inherit property "getAvailability" with the proper type (2)]
-    expected: FAIL
-
-  [PresentationRequest interface: navigator.presentation.defaultRequest must inherit property "onconnectionavailable" with the proper type (3)]
-    expected: FAIL
-
-  [PresentationRequest must be primary interface of new PresentationRequest("/presentation-api/receiving-ua/idlharness.html")]
-    expected: FAIL
-
-  [Stringification of new PresentationRequest("/presentation-api/receiving-ua/idlharness.html")]
-    expected: FAIL
-
-  [PresentationRequest interface: new PresentationRequest("/presentation-api/receiving-ua/idlharness.html") must inherit property "start" with the proper type (0)]
-    expected: FAIL
-
-  [PresentationRequest interface: new PresentationRequest("/presentation-api/receiving-ua/idlharness.html") must inherit property "reconnect" with the proper type (1)]
-    expected: FAIL
-
-  [PresentationRequest interface: calling reconnect(DOMString) on new PresentationRequest("/presentation-api/receiving-ua/idlharness.html") with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [PresentationRequest interface: new PresentationRequest("/presentation-api/receiving-ua/idlharness.html") must inherit property "getAvailability" with the proper type (2)]
-    expected: FAIL
-
-  [PresentationRequest interface: new PresentationRequest("/presentation-api/receiving-ua/idlharness.html") must inherit property "onconnectionavailable" with the proper type (3)]
-    expected: FAIL
-
-  [PresentationAvailability interface: existence and properties of interface object]
-    expected: FAIL
-
-  [PresentationAvailability interface object length]
-    expected: FAIL
-
-  [PresentationAvailability interface object name]
-    expected: FAIL
-
-  [PresentationAvailability interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [PresentationAvailability interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [PresentationAvailability interface: attribute value]
-    expected: FAIL
-
-  [PresentationAvailability interface: attribute onchange]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface: existence and properties of interface object]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface object length]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface object name]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [PresentationConnectionAvailableEvent interface: attribute connection]
-    expected: FAIL
-
-  [PresentationConnection interface: existence and properties of interface object]
-    expected: FAIL
-
-  [PresentationConnection interface object length]
-    expected: FAIL
-
-  [PresentationConnection interface object name]
-    expected: FAIL
-
-  [PresentationConnection interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [PresentationConnection interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute id]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute state]
-    expected: FAIL
-
-  [PresentationConnection interface: operation close()]
-    expected: FAIL
-
-  [PresentationConnection interface: operation terminate()]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute onconnect]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute onclose]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute onterminate]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute binaryType]
-    expected: FAIL
-
-  [PresentationConnection interface: attribute onmessage]
-    expected: FAIL
-
-  [PresentationConnection interface: operation send(DOMString)]
-    expected: FAIL
-
-  [PresentationConnection interface: operation send(Blob)]
-    expected: FAIL
-
-  [PresentationConnection interface: operation send(ArrayBuffer)]
-    expected: FAIL
-
-  [PresentationConnection interface: operation send(ArrayBufferView)]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface: existence and properties of interface object]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface object length]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface object name]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface: existence and properties of interface prototype object]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface: existence and properties of interface prototype object's "constructor" property]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface: attribute reason]
-    expected: FAIL
-
-  [PresentationConnectionClosedEvent interface: attribute message]
-    expected: FAIL
-
+  prefs: [dom.presentation.enabled: true,
+          dom.presentation.controller.enabled: true,
+          dom.presentation.discovery.enabled: true,
+          dom.presentation.device.name: "Firefox"]