Bug 1291971 - Part 1, enable controller idlharness test. r=smaug.

MozReview-Commit-ID: bDuOdLpPDh

--HG--
rename : dom/webidl/PresentationConnectionClosedEvent.webidl => dom/webidl/PresentationConnectionCloseEvent.webidl
extra : rebase_source : eca8bec6b6200247fbc9c743c13822f02373cc3d
This commit is contained in:
Shih-Chiang Chien 2016-10-04 00:22:34 +02:00
Родитель b089580c49
Коммит e51e9349e9
13 изменённых файлов: 69 добавлений и 250 удалений

Просмотреть файл

@ -17,21 +17,25 @@
#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)
@ -88,7 +92,7 @@ Presentation::HasReceiverSupport(JSContext* aCx, JSObject* aGlobal)
}
Presentation::Presentation(nsPIDOMWindowInner* aWindow)
: DOMEventTargetHelper(aWindow)
: mWindow(aWindow)
{
}
@ -110,7 +114,7 @@ Presentation::SetDefaultRequest(PresentationRequest* aRequest)
return;
}
nsCOMPtr<nsIDocument> doc = GetOwner() ? GetOwner()->GetExtantDoc() : nullptr;
nsCOMPtr<nsIDocument> doc = mWindow ? mWindow->GetExtantDoc() : nullptr;
if (NS_WARN_IF(!doc)) {
return;
}
@ -146,7 +150,7 @@ Presentation::GetReceiver()
return nullptr;
}
mReceiver = PresentationReceiver::Create(GetOwner());
mReceiver = PresentationReceiver::Create(mWindow);
if (NS_WARN_IF(!mReceiver)) {
MOZ_ASSERT(mReceiver);
return nullptr;
@ -159,7 +163,11 @@ Presentation::GetReceiver()
bool
Presentation::IsInPresentedContent() const
{
nsCOMPtr<nsIDocShell> docShell = GetOwner()->GetDocShell();
if (!mWindow) {
return false;
}
nsCOMPtr<nsIDocShell> docShell = mWindow->GetDocShell();
MOZ_ASSERT(docShell);
nsAutoString presentationURL;
@ -167,3 +175,6 @@ Presentation::IsInPresentedContent() const
return !presentationURL.IsEmpty();
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,7 +7,12 @@
#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 {
@ -16,12 +21,12 @@ 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);
@ -30,6 +35,11 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsPIDOMWindowInner* GetParentObject() const
{
return mWindow;
}
// WebIDL (public APIs)
void SetDefaultRequest(PresentationRequest* aRequest);
@ -40,12 +50,13 @@ public:
private:
explicit Presentation(nsPIDOMWindowInner* aWindow);
~Presentation();
virtual ~Presentation();
bool IsInPresentedContent() const;
RefPtr<PresentationRequest> mDefaultRequest;
RefPtr<PresentationReceiver> mReceiver;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
};
} // namespace dom

Просмотреть файл

@ -12,7 +12,7 @@
#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"
@ -434,7 +434,7 @@ PresentationConnection::ProcessStateChanged(nsresult aReason)
}
Unused <<
NS_WARN_IF(NS_FAILED(DispatchConnectionClosedEvent(reason, errorMsg)));
NS_WARN_IF(NS_FAILED(DispatchConnectionCloseEvent(reason, errorMsg)));
return RemoveFromLoadGroup();
}
@ -533,7 +533,7 @@ PresentationConnection::DoReceiveMessage(const nsACString& aData, bool aIsBinary
}
nsresult
PresentationConnection::DispatchConnectionClosedEvent(
PresentationConnection::DispatchConnectionCloseEvent(
PresentationConnectionClosedReason aReason,
const nsAString& aMessage,
bool aDispatchNow)
@ -543,12 +543,12 @@ PresentationConnection::DispatchConnectionClosedEvent(
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);
@ -742,7 +742,7 @@ PresentationConnection::AsyncCloseConnectionWithErrorMsg(const nsAString& aMessa
// 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)));

Просмотреть файл

@ -11,7 +11,7 @@
#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"
@ -97,7 +97,7 @@ private:
nsresult ProcessStateChanged(nsresult aReason);
nsresult DispatchConnectionClosedEvent(PresentationConnectionClosedReason aReason,
nsresult DispatchConnectionCloseEvent(PresentationConnectionClosedReason aReason,
const nsAString& aMessage,
bool aDispatchNow = false);

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/dom/Promise.h"
#include "nsContentUtils.h"
#include "nsIPresentationService.h"
#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "PresentationConnection.h"

Просмотреть файл

@ -7,8 +7,14 @@
#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 {
@ -30,7 +36,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsISupports* GetParentObject() const
nsPIDOMWindowInner* GetParentObject() const
{
return mOwner;
}

Просмотреть файл

@ -796,7 +796,7 @@ PresentationService::CloseSession(const nsAString& aSessionId,
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);
}

Просмотреть файл

@ -11,7 +11,7 @@
</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>

Просмотреть файл

@ -11,7 +11,7 @@
</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>

Просмотреть файл

@ -5,7 +5,7 @@
*/
[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

Просмотреть файл

@ -22,9 +22,9 @@ enum PresentationConnectionClosedReason
};
[Constructor(DOMString type,
PresentationConnectionClosedEventInit eventInitDict),
PresentationConnectionCloseEventInit eventInitDict),
Pref="dom.presentation.enabled"]
interface PresentationConnectionClosedEvent : Event
interface PresentationConnectionCloseEvent : Event
{
readonly attribute PresentationConnectionClosedReason reason;
@ -34,7 +34,7 @@ interface PresentationConnectionClosedEvent : Event
readonly attribute DOMString message;
};
dictionary PresentationConnectionClosedEventInit : EventInit
dictionary PresentationConnectionCloseEventInit : EventInit
{
required PresentationConnectionClosedReason reason;
DOMString message = "";

Просмотреть файл

@ -766,7 +766,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'PopStateEvent.webidl',
'PopupBlockedEvent.webidl',
'PresentationConnectionAvailableEvent.webidl',
'PresentationConnectionClosedEvent.webidl',
'PresentationConnectionCloseEvent.webidl',
'ProgressEvent.webidl',
'RecordErrorEvent.webidl',
'ScrollViewChangeEvent.webidl',

Просмотреть файл

@ -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"]