mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
Issue #1797 - Implement WindowOrWorkerGlobalScope.origin
Resolves #1797
This commit is contained in:
parent
0e23f7bde9
commit
13c48d24b0
8 changed files with 30 additions and 3 deletions
|
|
@ -9892,6 +9892,13 @@ nsGlobalWindow::Btoa(const nsAString& aBinaryData,
|
|||
aError = nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::GetOrigin(nsAString& aOrigin)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
nsContentUtils::GetUTFOrigin(GetPrincipal(), aOrigin);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindow::nsIDOMEventTarget
|
||||
//*****************************************************************************
|
||||
|
|
|
|||
|
|
@ -958,6 +958,7 @@ public:
|
|||
mozilla::ErrorResult& aError);
|
||||
void Btoa(const nsAString& aBinaryData, nsAString& aAsciiBase64String,
|
||||
mozilla::ErrorResult& aError);
|
||||
void GetOrigin(nsAString& aOrigin);
|
||||
mozilla::dom::DOMStorage* GetSessionStorage(mozilla::ErrorResult& aError);
|
||||
mozilla::dom::DOMStorage*
|
||||
GetLocalStorage(mozilla::ErrorResult& aError);
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@
|
|||
// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface WindowOrWorkerGlobalScope {
|
||||
// XXXbz We don't implement 'origin' yet on either window or worker globals.
|
||||
// See bug 1306170.
|
||||
// [Replaceable] readonly attribute USVString origin;
|
||||
// .origin on Window or Worker globals
|
||||
[Replaceable] readonly attribute USVString origin;
|
||||
|
||||
// base64 utility methods
|
||||
[Throws]
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -624,6 +624,12 @@ public:
|
|||
return mLoadInfo.mPrincipal;
|
||||
}
|
||||
|
||||
const nsAString&
|
||||
Origin() const
|
||||
{
|
||||
return mLoadInfo.mOrigin;
|
||||
}
|
||||
|
||||
nsILoadGroup*
|
||||
GetLoadGroup() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -356,6 +356,13 @@ WorkerGlobalScope::Btoa(const nsAString& aBtoa, nsAString& aOutput, ErrorResult&
|
|||
aRv = nsContentUtils::Btoa(aBtoa, aOutput);
|
||||
}
|
||||
|
||||
void
|
||||
WorkerGlobalScope::GetOrigin(nsAString& aOrigin) const
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
aOrigin = mWorkerPrivate->Origin();
|
||||
}
|
||||
|
||||
void
|
||||
WorkerGlobalScope::Dump(const Optional<nsAString>& aString) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue