Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1231213 - Add OptionalServiceWorkerData to RemoteWorkerData. r=asuth
Browse files Browse the repository at this point in the history
  • Loading branch information
perryjiang committed Aug 13, 2019
1 parent f6effa2 commit 96aef86
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
22 changes: 22 additions & 0 deletions dom/workers/remoteworkers/RemoteWorkerTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,37 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

include ClientIPCTypes;
include IPCServiceWorkerDescriptor;
include IPCServiceWorkerRegistrationDescriptor;
include PBackgroundSharedTypes;
include URIParams;
include DOMTypes;

using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::StorageAccess from "mozilla/dom/ClientIPCUtils.h";

namespace mozilla {
namespace dom {

struct KeyAndPermissions {
nsCString key;
Permission[] permissions;
};

struct ServiceWorkerData {
KeyAndPermissions[] permissionsByKey;
IPCServiceWorkerDescriptor descriptor;
IPCServiceWorkerRegistrationDescriptor registrationDescriptor;
nsString cacheName;
uint32_t loadFlags;
};

union OptionalServiceWorkerData {
void_t;
ServiceWorkerData;
};

struct RemoteWorkerData
{
// This should only be used for devtools.
Expand Down Expand Up @@ -46,6 +67,7 @@ struct RemoteWorkerData
StorageAccess storageAccess;

bool isSharedWorker;
OptionalServiceWorkerData serviceWorkerData;
};

// ErrorData/ErrorDataNote correspond to WorkerErrorReport/WorkerErrorNote
Expand Down
2 changes: 1 addition & 1 deletion dom/workers/sharedworkers/SharedWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ already_AddRefed<SharedWorker> SharedWorker::Constructor(
nsString(aScriptURL), baseURL, resolvedScriptURL, name,
loadingPrincipalInfo, principalInfo, storagePrincipalInfo,
loadInfo.mDomain, isSecureContext, ipcClientInfo, loadInfo.mReferrerInfo,
storageAllowed, true /* sharedWorker */);
storageAllowed, void_t() /* OptionalServiceWorkerData */);

PSharedWorkerChild* pActor = actorChild->SendPSharedWorkerConstructor(
remoteWorkerData, loadInfo.mWindowID, portIdentifier);
Expand Down
6 changes: 6 additions & 0 deletions netwerk/ipc/NeckoMessageUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ struct Permission {
capability(aCapability),
expireType(aExpireType),
expireTime(aExpireTime) {}

bool operator==(const Permission& aOther) const {
return aOther.origin == origin && aOther.type == type &&
aOther.capability == capability && aOther.expireType == expireType &&
aOther.expireTime == expireTime;
}
};

template <>
Expand Down

0 comments on commit 96aef86

Please sign in to comment.