author | Ben Kelly <ben@wanderview.com> |
Wed, 15 Feb 2017 15:12:37 -0500 | |
changeset 343122 | 7430d14ff90f432deee834e227d89f5700fe6de9 |
parent 343121 | fe960e54cc30c906643e94b2ff0a64cb51df74c6 |
child 343123 | b185531eed21f500813ac04566703eedcaba3004 |
push id | 31369 |
push user | kwierso@gmail.com |
push date | Thu, 16 Feb 2017 00:18:40 +0000 |
treeherder | mozilla-central@e9b926463f9e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | asuth |
bugs | 1339844 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/webidl/Client.webidl +++ b/dom/webidl/Client.webidl @@ -1,38 +1,49 @@ /* -*- 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/. * * The origin of this IDL file is - * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * https://w3c.github.io/ServiceWorker/#client-interface * */ [Exposed=ServiceWorker] interface Client { readonly attribute USVString url; + + // Remove frameType in bug 1290936 readonly attribute FrameType frameType; + + readonly attribute ClientType type; readonly attribute DOMString id; + // Implement reserved in bug 1264177 + // readonly attribute boolean reserved; + [Throws] void postMessage(any message, optional sequence<object> transfer = []); }; [Exposed=ServiceWorker] interface WindowClient : Client { readonly attribute VisibilityState visibilityState; readonly attribute boolean focused; + // Implement ancestorOrigins in bug 1264180 + // [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; + [Throws, NewObject] Promise<WindowClient> focus(); [Throws, NewObject] Promise<WindowClient> navigate(USVString url); }; +// Remove FrameType in bug 1290936 enum FrameType { "auxiliary", "top-level", "nested", "none" };
--- a/dom/workers/ServiceWorkerClient.cpp +++ b/dom/workers/ServiceWorkerClient.cpp @@ -29,17 +29,18 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(ServiceW NS_IMPL_CYCLE_COLLECTING_RELEASE(ServiceWorkerClient) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerClient) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END ServiceWorkerClientInfo::ServiceWorkerClientInfo(nsIDocument* aDoc) - : mWindowId(0) + : mType(ClientType::Window) + , mWindowId(0) , mFrameType(FrameType::None) { MOZ_ASSERT(aDoc); nsresult rv = aDoc->GetOrCreateId(mClientId); if (NS_FAILED(rv)) { NS_WARNING("Failed to get the UUID of the document."); } @@ -77,16 +78,22 @@ ServiceWorkerClientInfo::ServiceWorkerCl } JSObject* ServiceWorkerClient::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { return ClientBinding::Wrap(aCx, this, aGivenProto); } +ClientType +ServiceWorkerClient::Type() const +{ + return mType; +} + namespace { class ServiceWorkerClientPostMessageRunnable final : public Runnable , public StructuredCloneHolder { uint64_t mWindowId;
--- a/dom/workers/ServiceWorkerClient.h +++ b/dom/workers/ServiceWorkerClient.h @@ -34,16 +34,17 @@ public: explicit ServiceWorkerClientInfo(nsIDocument* aDoc); const nsString& ClientId() const { return mClientId; } private: + const mozilla::dom::ClientType mType; nsString mClientId; uint64_t mWindowId; nsString mUrl; // Window Clients VisibilityState mVisibilityState; bool mFocused; FrameType mFrameType; @@ -54,16 +55,17 @@ class ServiceWorkerClient : public nsISu { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClient) ServiceWorkerClient(nsISupports* aOwner, const ServiceWorkerClientInfo& aClientInfo) : mOwner(aOwner) + , mType(aClientInfo.mType) , mId(aClientInfo.mClientId) , mUrl(aClientInfo.mUrl) , mWindowId(aClientInfo.mWindowId) , mFrameType(aClientInfo.mFrameType) { MOZ_ASSERT(aOwner); } @@ -85,28 +87,32 @@ public: } mozilla::dom::FrameType FrameType() const { return mFrameType; } + mozilla::dom::ClientType + Type() const; + void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage, const Sequence<JSObject*>& aTransferable, ErrorResult& aRv); JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; protected: virtual ~ServiceWorkerClient() { } private: nsCOMPtr<nsISupports> mOwner; + const ClientType mType; nsString mId; nsString mUrl; protected: uint64_t mWindowId; mozilla::dom::FrameType mFrameType; };