diff options
Diffstat (limited to 'dom/workers')
-rw-r--r-- | dom/workers/WorkerPrivate.cpp | 3 | ||||
-rw-r--r-- | dom/workers/WorkerPrivate.h | 6 | ||||
-rw-r--r-- | dom/workers/WorkerScope.cpp | 7 | ||||
-rw-r--r-- | dom/workers/WorkerScope.h | 3 | ||||
-rw-r--r-- | dom/workers/Workers.h | 1 |
5 files changed, 20 insertions, 0 deletions
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 5edf7dc4a5..1d9459cd07 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1759,6 +1759,7 @@ WorkerLoadInfo::StealFrom(WorkerLoadInfo& aOther) mPrincipalInfo = aOther.mPrincipalInfo.forget(); mDomain = aOther.mDomain; + mOrigin = aOther.mOrigin; mServiceWorkerCacheName = aOther.mServiceWorkerCacheName; mWindowID = aOther.mWindowID; mServiceWorkerID = aOther.mServiceWorkerID; @@ -3623,6 +3624,8 @@ WorkerPrivateParent<Derived>::SetPrincipal(nsIPrincipal* aPrincipal, mLoadInfo.mPrincipalInfo = new PrincipalInfo(); mLoadInfo.mOriginAttributes = nsContentUtils::GetOriginAttributes(aLoadGroup); + nsContentUtils::GetUTFOrigin(aPrincipal, mLoadInfo.mOrigin); + MOZ_ALWAYS_SUCCEEDS( PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)); } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index ee84448068..b638c1ef11 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -624,6 +624,12 @@ public: return mLoadInfo.mPrincipal; } + const nsAString& + Origin() const + { + return mLoadInfo.mOrigin; + } + nsILoadGroup* GetLoadGroup() const { diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 081f0f1065..ec42364b52 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -357,6 +357,13 @@ WorkerGlobalScope::Btoa(const nsAString& aBtoa, nsAString& aOutput, ErrorResult& } void +WorkerGlobalScope::GetOrigin(nsAString& aOrigin) const +{ + mWorkerPrivate->AssertIsOnWorkerThread(); + aOrigin = mWorkerPrivate->Origin(); +} + +void WorkerGlobalScope::Dump(const Optional<nsAString>& aString) const { mWorkerPrivate->AssertIsOnWorkerThread(); diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 43b6d633ca..8d06152da2 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -145,6 +145,9 @@ public: void Btoa(const nsAString& aBtoa, nsAString& aOutput, ErrorResult& aRv) const; + void + GetOrigin(nsAString& aOrigin) const; + IMPL_EVENT_HANDLER(online) IMPL_EVENT_HANDLER(offline) diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index b7d75b09c8..6b0a0158d2 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -245,6 +245,7 @@ struct WorkerLoadInfo nsAutoPtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo; nsCString mDomain; + nsString mOrigin; // Derived from mPrincipal; can be used on worker threads. nsString mServiceWorkerCacheName; |