mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Backed out changeset 7e47807067a6 (bug 1316683) for Windows bustage. r=backout
This commit is contained in:
parent
9093d5f005
commit
20fb8455d6
@ -1168,7 +1168,8 @@ nsScriptSecurityManager::
|
||||
{
|
||||
NS_ENSURE_STATE(aLoadContext);
|
||||
OriginAttributes docShellAttrs;
|
||||
aLoadContext->GetOriginAttributes(docShellAttrs);
|
||||
bool result = aLoadContext->GetOriginAttributes(docShellAttrs);
|
||||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> prin =
|
||||
BasePrincipal::CreateCodebasePrincipal(aURI, docShellAttrs);
|
||||
|
@ -12,6 +12,30 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
bool
|
||||
nsILoadContext::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
mozilla::dom::AutoJSAPI jsapi;
|
||||
bool ok = jsapi.Init(xpc::PrivilegedJunkScope());
|
||||
NS_ENSURE_TRUE(ok, false);
|
||||
JS::Rooted<JS::Value> v(jsapi.cx());
|
||||
nsresult rv = GetOriginAttributes(&v);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
NS_ENSURE_TRUE(v.isObject(), false);
|
||||
JS::Rooted<JSObject*> obj(jsapi.cx(), &v.toObject());
|
||||
|
||||
// If we're JS-implemented, the object will be left in a different (System-Principaled)
|
||||
// scope, so we may need to enter its compartment.
|
||||
MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)));
|
||||
JSAutoCompartment ac(jsapi.cx(), obj);
|
||||
|
||||
mozilla::OriginAttributes attrs;
|
||||
ok = attrs.Init(jsapi.cx(), v);
|
||||
NS_ENSURE_TRUE(ok, false);
|
||||
aAttrs = attrs;
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
|
||||
@ -157,12 +181,6 @@ LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
LoadContext::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
aAttrs = mOriginAttributes;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadContext::GetUseTrackingProtection(bool* aUseTrackingProtection)
|
||||
{
|
||||
|
@ -111,8 +111,6 @@ public:
|
||||
private:
|
||||
~LoadContext() {}
|
||||
|
||||
void GetOriginAttributes(mozilla::OriginAttributes& aAttrs) override;
|
||||
|
||||
nsWeakPtr mTopFrameElement;
|
||||
uint64_t mNestedFrameId;
|
||||
bool mIsContent;
|
||||
|
@ -62,7 +62,9 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
||||
aLoadContext->GetIsContent(&mIsContent);
|
||||
aLoadContext->GetUseRemoteTabs(&mUseRemoteTabs);
|
||||
aLoadContext->GetUseTrackingProtection(&mUseTrackingProtection);
|
||||
aLoadContext->GetOriginAttributes(mOriginAttributes);
|
||||
if (!aLoadContext->GetOriginAttributes(mOriginAttributes)) {
|
||||
NS_WARNING("GetOriginAttributes failed");
|
||||
}
|
||||
} else {
|
||||
mIsNotNull = false;
|
||||
mIsPrivateBitValid = false;
|
||||
|
@ -14944,9 +14944,3 @@ nsDocShell::GetAwaitingLargeAlloc(bool* aResult)
|
||||
*aResult = static_cast<TabChild*>(tabChild.get())->IsAwaitingLargeAlloc();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsDocShell::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
aAttrs = mOriginAttributes;
|
||||
}
|
||||
|
@ -806,8 +806,6 @@ protected:
|
||||
|
||||
void UpdateGlobalHistoryTitle(nsIURI* aURI);
|
||||
|
||||
void GetOriginAttributes(mozilla::OriginAttributes& aAttrs) override;
|
||||
|
||||
// Dimensions of the docshell
|
||||
nsIntRect mBounds;
|
||||
nsString mName;
|
||||
|
@ -20,7 +20,7 @@ interface nsIDOMElement;
|
||||
* can be queried for various information about where the load is
|
||||
* happening.
|
||||
*/
|
||||
[builtinclass, scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
|
||||
[scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
|
||||
interface nsILoadContext : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -139,8 +139,10 @@ interface nsILoadContext : nsISupports
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
/**
|
||||
* The C++ getter for origin attributes.
|
||||
*
|
||||
* Defined in LoadContext.cpp
|
||||
*/
|
||||
NS_IMETHOD_(void) GetOriginAttributes(mozilla::OriginAttributes& aAttrs) = 0;
|
||||
bool GetOriginAttributes(mozilla::OriginAttributes& aAttrs);
|
||||
#endif
|
||||
%}
|
||||
};
|
||||
|
@ -444,7 +444,7 @@ protected:
|
||||
// implement one interface.
|
||||
|
||||
// XXXbz I wish we could just derive the _allcaps thing from _i
|
||||
#define DECL_SHIM(_i, _allcaps, _customfwd) \
|
||||
#define DECL_SHIM(_i, _allcaps) \
|
||||
class _i##Shim final : public nsIInterfaceRequestor, \
|
||||
public _i \
|
||||
{ \
|
||||
@ -459,25 +459,17 @@ protected:
|
||||
NS_DECL_ISUPPORTS \
|
||||
NS_FORWARD_NSIINTERFACEREQUESTOR(mIfReq->) \
|
||||
NS_FORWARD_##_allcaps(mRealPtr->) \
|
||||
_customfwd \
|
||||
private: \
|
||||
nsCOMPtr<nsIInterfaceRequestor> mIfReq; \
|
||||
nsCOMPtr<_i> mRealPtr; \
|
||||
};
|
||||
|
||||
#define DECL_FORWARD_CPP_GETORIGINATTRIBUTES \
|
||||
NS_IMETHODIMP_(void) \
|
||||
GetOriginAttributes(mozilla::OriginAttributes& aAttrs) override \
|
||||
{ \
|
||||
mRealPtr->GetOriginAttributes(aAttrs); \
|
||||
}
|
||||
DECL_SHIM(nsILoadContext, NSILOADCONTEXT, DECL_FORWARD_CPP_GETORIGINATTRIBUTES)
|
||||
DECL_SHIM(nsIProgressEventSink, NSIPROGRESSEVENTSINK, )
|
||||
DECL_SHIM(nsIChannelEventSink, NSICHANNELEVENTSINK, )
|
||||
DECL_SHIM(nsISecurityEventSink, NSISECURITYEVENTSINK, )
|
||||
DECL_SHIM(nsIApplicationCacheContainer, NSIAPPLICATIONCACHECONTAINER, )
|
||||
DECL_SHIM(nsILoadContext, NSILOADCONTEXT)
|
||||
DECL_SHIM(nsIProgressEventSink, NSIPROGRESSEVENTSINK)
|
||||
DECL_SHIM(nsIChannelEventSink, NSICHANNELEVENTSINK)
|
||||
DECL_SHIM(nsISecurityEventSink, NSISECURITYEVENTSINK)
|
||||
DECL_SHIM(nsIApplicationCacheContainer, NSIAPPLICATIONCACHECONTAINER)
|
||||
#undef DECL_SHIM
|
||||
#undef DECL_FORWARD_CPP_GETORIGINATTRIBUTES
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3020,7 +3020,6 @@ public:
|
||||
NS_IMETHOD SetPrivateBrowsing(bool) NO_IMPL
|
||||
NS_IMETHOD GetIsInIsolatedMozBrowserElement(bool*) NO_IMPL
|
||||
NS_IMETHOD GetOriginAttributes(JS::MutableHandleValue) NO_IMPL
|
||||
NS_IMETHOD_(void) GetOriginAttributes(mozilla::OriginAttributes& aAttrs) override {}
|
||||
NS_IMETHOD GetUseRemoteTabs(bool*) NO_IMPL
|
||||
NS_IMETHOD SetRemoteTabs(bool) NO_IMPL
|
||||
NS_IMETHOD GetUseTrackingProtection(bool*) NO_IMPL
|
||||
|
@ -815,7 +815,8 @@ nsDOMOfflineResourceList::CacheKeys()
|
||||
nsAutoCString originSuffix;
|
||||
if (loadContext) {
|
||||
mozilla::OriginAttributes oa;
|
||||
loadContext->GetOriginAttributes(oa);
|
||||
bool ok = loadContext->GetOriginAttributes(oa);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
|
||||
|
||||
oa.CreateSuffix(originSuffix);
|
||||
}
|
||||
|
@ -276,14 +276,6 @@ OfflineCacheUpdateParent::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
OfflineCacheUpdateParent::GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
if (mLoadingPrincipal) {
|
||||
aAttrs = mLoadingPrincipal->OriginAttributesRef();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetUseTrackingProtection(bool* aUseTrackingProtection)
|
||||
{
|
||||
|
@ -54,8 +54,6 @@ public:
|
||||
private:
|
||||
~OfflineCacheUpdateParent();
|
||||
|
||||
void GetOriginAttributes(mozilla::OriginAttributes& aAttrs) override;
|
||||
|
||||
bool mIPCClosed;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||
|
Loading…
x
Reference in New Issue
Block a user