diff --git a/caps/idl/nsIScriptSecurityManager.idl b/caps/idl/nsIScriptSecurityManager.idl index f12b7c63fc8..1195ad5d7dc 100644 --- a/caps/idl/nsIScriptSecurityManager.idl +++ b/caps/idl/nsIScriptSecurityManager.idl @@ -9,7 +9,7 @@ interface nsIURI; interface nsIChannel; -[scriptable, uuid(bd94820d-4fd5-4d57-a40e-406ee72d27b7)] +[scriptable, uuid(cdb27711-492b-4973-938b-de81ac124658)] interface nsIScriptSecurityManager : nsIXPCSecurityManager { ///////////////// Security Checks ////////////////// @@ -84,6 +84,21 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager in nsIURI uri, in unsigned long flags); + /** + * Check that content from "from" can load "uri". + * + * Will return error code NS_ERROR_DOM_BAD_URI if the load request + * should be denied. + * + * @param from the URI causing the load + * @param uri the URI that is being loaded + * @param flags the permission set, see above + * + * @deprecated Use checkLoadURIWithPrincipal instead of this function. + */ + [deprecated] void checkLoadURI(in nsIURI from, in nsIURI uri, + in unsigned long flags); + /** * Similar to checkLoadURIWithPrincipal but there are two differences: * @@ -97,6 +112,15 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager in AUTF8String uri, in unsigned long flags); + /** + * Same as CheckLoadURI but takes string arguments for ease of use + * by scripts + * + * @deprecated Use checkLoadURIStrWithPrincipal instead of this function. + */ + [deprecated] void checkLoadURIStr(in AUTF8String from, in AUTF8String uri, + in unsigned long flags); + /** * Check that the function 'funObj' is allowed to run on 'targetObj' * @@ -236,18 +260,6 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager [noscript,notxpcom] nsIPrincipal getCxSubjectPrincipal(in JSContextPtr cx); [noscript,notxpcom] nsIPrincipal getCxSubjectPrincipalAndFrame(in JSContextPtr cx, out JSStackFramePtr fp); - - - const unsigned long NO_APP_ID = 0; - const unsigned long UNKNOWN_APP_ID = 4294967295; // PR_UINT32_MAX - - /** - * Returns the extended origin for the uri. - * appId can be NO_APP_ID, UNKWOWN_APP_ID or a valid app id. - * inMozBrowser has to be true if the uri is inside a mozbrowser iframe. - */ - AUTF8String getExtendedOrigin(in nsIURI uri, in unsigned long appId, - in boolean inMozBrowser); }; %{C++ diff --git a/caps/include/nsPrincipal.h b/caps/include/nsPrincipal.h index 82b9ce5a9c6..5b691f1d672 100644 --- a/caps/include/nsPrincipal.h +++ b/caps/include/nsPrincipal.h @@ -153,11 +153,6 @@ public: virtual void GetScriptLocation(nsACString& aStr) MOZ_OVERRIDE; void SetURI(nsIURI* aURI); - /** - * Computes the puny-encoded origin of aURI. - */ - static nsresult GetOriginForURI(nsIURI* aURI, char **aOrigin); - nsCOMPtr mDomain; nsCOMPtr mCodebase; // If mCodebaseImmutable is true, mCodebase is non-null and immutable diff --git a/caps/src/nsPrincipal.cpp b/caps/src/nsPrincipal.cpp index 1df8feb065e..b516e6a07e4 100644 --- a/caps/src/nsPrincipal.cpp +++ b/caps/src/nsPrincipal.cpp @@ -656,17 +656,18 @@ nsPrincipal::GetScriptLocation(nsACString &aStr) } } -/* static */ nsresult -nsPrincipal::GetOriginForURI(nsIURI* aURI, char **aOrigin) +NS_IMETHODIMP +nsPrincipal::GetOrigin(char **aOrigin) { - if (!aURI) { - return NS_ERROR_FAILURE; - } - *aOrigin = nsnull; - nsCOMPtr origin = NS_GetInnermostURI(aURI); + nsCOMPtr origin; + if (mCodebase) { + origin = NS_GetInnermostURI(mCodebase); + } + if (!origin) { + NS_ASSERTION(mCert, "No Domain or Codebase for a non-cert principal"); return NS_ERROR_FAILURE; } @@ -682,9 +683,8 @@ nsPrincipal::GetOriginForURI(nsIURI* aURI, char **aOrigin) rv = origin->GetAsciiHost(hostPort); // Some implementations return an empty string, treat it as no support // for asciiHost by that implementation. - if (hostPort.IsEmpty()) { + if (hostPort.IsEmpty()) rv = NS_ERROR_FAILURE; - } } PRInt32 port; @@ -701,7 +701,6 @@ nsPrincipal::GetOriginForURI(nsIURI* aURI, char **aOrigin) nsCAutoString scheme; rv = origin->GetScheme(scheme); NS_ENSURE_SUCCESS(rv, rv); - *aOrigin = ToNewCString(scheme + NS_LITERAL_CSTRING("://") + hostPort); } else { @@ -712,19 +711,12 @@ nsPrincipal::GetOriginForURI(nsIURI* aURI, char **aOrigin) // both fall back to GetSpec. That needs to be fixed. rv = origin->GetAsciiSpec(spec); NS_ENSURE_SUCCESS(rv, rv); - *aOrigin = ToNewCString(spec); } return *aOrigin ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } -NS_IMETHODIMP -nsPrincipal::GetOrigin(char **aOrigin) -{ - return GetOriginForURI(mCodebase, aOrigin); -} - NS_IMETHODIMP nsPrincipal::Equals(nsIPrincipal *aOther, bool *aResult) { diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index d2a5b82b90d..d135d87c3a2 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -60,7 +60,6 @@ #include "mozilla/dom/BindingUtils.h" #include "mozilla/StandardInteger.h" #include "mozilla/ClearOnShutdown.h" -#include "nsIAppsService.h" using namespace mozilla; using namespace mozilla::dom; @@ -1263,6 +1262,25 @@ nsScriptSecurityManager::CheckLoadURIFromScript(JSContext *cx, nsIURI *aURI) return NS_ERROR_DOM_BAD_URI; } +NS_IMETHODIMP +nsScriptSecurityManager::CheckLoadURI(nsIURI *aSourceURI, nsIURI *aTargetURI, + PRUint32 aFlags) +{ + // FIXME: bug 327244 -- this function should really die... Really truly. + NS_PRECONDITION(aSourceURI, "CheckLoadURI called with null source URI"); + NS_ENSURE_ARG_POINTER(aSourceURI); + + // Note: this is not _quite_ right if aSourceURI has + // NS_NULLPRINCIPAL_SCHEME, but we'll just extract the scheme in + // CheckLoadURIWithPrincipal anyway, so this is good enough. This method + // really needs to go away.... + nsCOMPtr sourcePrincipal; + nsresult rv = CreateCodebasePrincipal(aSourceURI, + getter_AddRefs(sourcePrincipal)); + NS_ENSURE_SUCCESS(rv, rv); + return CheckLoadURIWithPrincipal(sourcePrincipal, aTargetURI, aFlags); +} + /** * Helper method to handle cases where a flag passed to * CheckLoadURIWithPrincipal means denying loading if the given URI has certain @@ -1569,6 +1587,30 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag, return NS_OK; } +NS_IMETHODIMP +nsScriptSecurityManager::CheckLoadURIStr(const nsACString& aSourceURIStr, + const nsACString& aTargetURIStr, + PRUint32 aFlags) +{ + // FIXME: bug 327244 -- this function should really die... Really truly. + nsCOMPtr source; + nsresult rv = NS_NewURI(getter_AddRefs(source), aSourceURIStr, + nsnull, nsnull, sIOService); + NS_ENSURE_SUCCESS(rv, rv); + + // Note: this is not _quite_ right if aSourceURI has + // NS_NULLPRINCIPAL_SCHEME, but we'll just extract the scheme in + // CheckLoadURIWithPrincipal anyway, so this is good enough. This method + // really needs to go away.... + nsCOMPtr sourcePrincipal; + rv = CreateCodebasePrincipal(source, + getter_AddRefs(sourcePrincipal)); + NS_ENSURE_SUCCESS(rv, rv); + + return CheckLoadURIStrWithPrincipal(sourcePrincipal, aTargetURIStr, + aFlags); +} + NS_IMETHODIMP nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal, const nsACString& aTargetURIStr, @@ -3552,40 +3594,6 @@ nsScriptSecurityManager::InitPrefs() return NS_OK; } -NS_IMETHODIMP -nsScriptSecurityManager::GetExtendedOrigin(nsIURI* aURI, - PRUint32 aAppId, - bool aInMozBrowser, - nsACString& aExtendedOrigin) -{ - MOZ_ASSERT(aURI); - - if (aAppId == UNKNOWN_APP_ID) { - aExtendedOrigin.Truncate(); - return NS_OK; - } - - // Fallback. - if (aAppId == nsIScriptSecurityManager::NO_APP_ID && !aInMozBrowser) { - nsCAutoString origin; - nsPrincipal::GetOriginForURI(aURI, getter_Copies(origin)); - - aExtendedOrigin.Assign(origin); - return NS_OK; - } - - nsCAutoString origin; - nsPrincipal::GetOriginForURI(aURI, getter_Copies(origin)); - - // aExtendedOrigin = origin + " " + aAppId + " " + int(aInMozBrowser) - aExtendedOrigin.Assign(origin + NS_LITERAL_CSTRING("@")); - aExtendedOrigin.AppendInt(aAppId); - aExtendedOrigin.Append(aInMozBrowser ? NS_LITERAL_CSTRING("t") - : NS_LITERAL_CSTRING("f")); - - return NS_OK; -} - /////////////////////////////////////////////////////////////////////////////// // The following code prints the contents of the policy DB to the console. #ifdef DEBUG_CAPS_HACKER diff --git a/caps/tests/mochitest/Makefile.in b/caps/tests/mochitest/Makefile.in index 2bbc74239de..9773c04f99b 100644 --- a/caps/tests/mochitest/Makefile.in +++ b/caps/tests/mochitest/Makefile.in @@ -18,9 +18,6 @@ MOCHITEST_FILES = test_bug423375.html \ test_disallowInheritPrincipal.html \ $(NULL) -MOCHITEST_CHROME_FILES = test_principal_extendedorigin_appid_appstatus.html \ - $(NULL) - test_bug292789.html : % : %.in $(PYTHON) $(topsrcdir)/config/Preprocessor.py \ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@ diff --git a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html b/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html deleted file mode 100644 index 4021ef4ee74..00000000000 --- a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - Test for nsIPrincipal extendedOrigin, appStatus and appId - - - - -Mozilla Bug 758258 -

-
- -
-
-
-
- - diff --git a/content/base/src/contentAreaDropListener.js b/content/base/src/contentAreaDropListener.js index 964605267d8..870054f3e51 100644 --- a/content/base/src/contentAreaDropListener.js +++ b/content/base/src/contentAreaDropListener.js @@ -66,12 +66,12 @@ ContentAreaDropListener.prototype = uriString = uriString.replace(/^\s*|\s*$/g, ''); let uri; - let ioService = Cc["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService); try { // Check that the uri is valid first and return an empty string if not. // It may just be plain text and should be ignored here - uri = ioService.newURI(uriString, null, null); + uri = Cc["@mozilla.org/network/io-service;1"]. + getService(Components.interfaces.nsIIOService). + newURI(uriString, null, null); } catch (ex) { } if (!uri) return uriString; @@ -85,10 +85,10 @@ ContentAreaDropListener.prototype = flags |= secMan.DISALLOW_INHERIT_PRINCIPAL; // Use file:/// as the default uri so that drops of file URIs are always allowed - let principal = sourceNode ? sourceNode.principal - : secMan.getCodebasePrincipal(ioService.newURI("file:///", null, null)); - - secMan.checkLoadURIStrWithPrincipal(principal, uriString, flags); + if (sourceNode) + secMan.checkLoadURIStrWithPrincipal(sourceNode.nodePrincipal, uriString, flags); + else + secMan.checkLoadURIStr("file:///", uriString, flags); return uriString; }, diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 37444f7fb05..2fbb03a8aaf 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3087,7 +3087,7 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData) // should really be the same thing). Note that this code can run // before the current URI of the webnavigation has been updated, so we // can't assert equality here. - refresher->SetupRefreshURIFromHeader(mDocumentURI, NodePrincipal(), + refresher->SetupRefreshURIFromHeader(mDocumentURI, NS_ConvertUTF16toUTF8(aData)); } } diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index e38aa243ab5..3dc0df2205f 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -80,7 +80,6 @@ #include "mozilla/unused.h" #include "mozilla/dom/Element.h" #include "mozilla/layout/RenderFrameParent.h" -#include "nsIAppsService.h" #include "jsapi.h" @@ -1110,29 +1109,14 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, return NS_ERROR_NOT_IMPLEMENTED; } - bool ourContentBoundary, otherContentBoundary; - ourDocshell->GetIsContentBoundary(&ourContentBoundary); - otherDocshell->GetIsContentBoundary(&otherContentBoundary); - if (ourContentBoundary != otherContentBoundary) { + bool weAreBrowserFrame = false; + bool otherIsBrowserFrame = false; + ourDocshell->GetIsBrowserFrame(&weAreBrowserFrame); + otherDocshell->GetIsBrowserFrame(&otherIsBrowserFrame); + if (weAreBrowserFrame != otherIsBrowserFrame) { return NS_ERROR_NOT_IMPLEMENTED; } - if (ourContentBoundary) { - bool ourIsBrowser, otherIsBrowser; - ourDocshell->GetIsBrowserElement(&ourIsBrowser); - otherDocshell->GetIsBrowserElement(&otherIsBrowser); - if (ourIsBrowser != otherIsBrowser) { - return NS_ERROR_NOT_IMPLEMENTED; - } - - bool ourIsApp, otherIsApp; - ourDocshell->GetIsApp(&ourIsApp); - otherDocshell->GetIsApp(&otherIsApp); - if (ourIsApp != otherIsApp) { - return NS_ERROR_NOT_IMPLEMENTED; - } - } - if (mInSwap || aOther->mInSwap) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1477,24 +1461,6 @@ nsFrameLoader::MaybeCreateDocShell() mDocShell = do_CreateInstance("@mozilla.org/docshell;1"); NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); - if (OwnerIsBrowserFrame() && - mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) { - nsCOMPtr appsService = - do_GetService(APPS_SERVICE_CONTRACTID); - if (!appsService) { - NS_ERROR("Apps Service is not available!"); - return NS_ERROR_FAILURE; - } - - nsAutoString manifest; - mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest); - - PRUint32 appId; - appsService->GetAppLocalIdByManifestURL(manifest, &appId); - - mDocShell->SetAppId(appId); - } - if (!mNetworkCreated) { nsCOMPtr history = do_QueryInterface(mDocShell); if (history) { @@ -1597,7 +1563,7 @@ nsFrameLoader::MaybeCreateDocShell() EnsureMessageManager(); if (OwnerIsBrowserFrame()) { - mDocShell->SetIsBrowser(); + mDocShell->SetIsBrowserFrame(true); nsCOMPtr os = services::GetObserverService(); if (os) { diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index afe9df24375..84c986d70bb 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -241,7 +241,6 @@ txMozillaXMLOutput::endDocument(nsresult aResult) do_QueryInterface(win->GetDocShell()); if (refURI) { refURI->SetupRefreshURIFromHeader(mDocument->GetDocBaseURI(), - mDocument->NodePrincipal(), mRefreshString); } } diff --git a/docshell/base/nsDSURIContentListener.cpp b/docshell/base/nsDSURIContentListener.cpp index 5feabc4c572..da67d4de492 100644 --- a/docshell/base/nsDSURIContentListener.cpp +++ b/docshell/base/nsDSURIContentListener.cpp @@ -311,9 +311,9 @@ bool nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIRequest *request, parentDocShellItem) { nsCOMPtr curDocShell = do_QueryInterface(curDocShellItem); - bool isContentBoundary; - curDocShell->GetIsContentBoundary(&isContentBoundary); - if (isContentBoundary) { + bool browserFrame = false; + curDocShell->GetIsBrowserFrame(&browserFrame); + if (browserFrame) { break; } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index d31fa7877ce..3ac4f9d328c 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -763,7 +763,6 @@ nsDocShell::nsDocShell(): #ifdef DEBUG mInEnsureScriptEnv(false), #endif - mAppId(nsIScriptSecurityManager::NO_APP_ID), mParentCharsetSource(0) { mHistoryID = ++gDocshellIDCounter; @@ -5529,7 +5528,6 @@ nsDocShell::ForceRefreshURI(nsIURI * aURI, nsresult nsDocShell::SetupRefreshURIFromHeader(nsIURI * aBaseURI, - nsIPrincipal* aPrincipal, const nsACString & aHeader) { // Refresh headers are parsed with the following format in mind @@ -5571,8 +5569,6 @@ nsDocShell::SetupRefreshURIFromHeader(nsIURI * aBaseURI, // when done, seconds is 0 or the given number of seconds // uriAttrib is empty or the URI specified - MOZ_ASSERT(aPrincipal); - nsCAutoString uriAttrib; PRInt32 seconds = 0; bool specifiesSeconds = false; @@ -5737,8 +5733,9 @@ nsDocShell::SetupRefreshURIFromHeader(nsIURI * aBaseURI, (NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) { rv = securityManager-> - CheckLoadURIWithPrincipal(aPrincipal, uri, - nsIScriptSecurityManager::LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT); + CheckLoadURI(aBaseURI, uri, + nsIScriptSecurityManager:: + LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT); if (NS_SUCCEEDED(rv)) { bool isjs = true; @@ -5774,16 +5771,8 @@ NS_IMETHODIMP nsDocShell::SetupRefreshURI(nsIChannel * aChannel) refreshHeader); if (!refreshHeader.IsEmpty()) { - nsCOMPtr secMan = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr principal; - rv = secMan->GetChannelPrincipal(aChannel, getter_AddRefs(principal)); - NS_ENSURE_SUCCESS(rv, rv); - SetupReferrerFromChannel(aChannel); - rv = SetupRefreshURIFromHeader(mCurrentURI, principal, refreshHeader); + rv = SetupRefreshURIFromHeader(mCurrentURI, refreshHeader); if (NS_SUCCEEDED(rv)) { return NS_REFRESHURI_HEADER_FOUND; } @@ -12024,145 +12013,52 @@ nsDocShell::GetCanExecuteScripts(bool *aResult) } NS_IMETHODIMP -nsDocShell::SetIsBrowser() +nsDocShell::GetIsBrowserFrame(bool *aOut) { - if (mIsBrowserFrame) { - NS_ERROR("You should not call SetIsBrowser() more than once."); - return NS_OK; - } + NS_ENSURE_ARG_POINTER(aOut); + *aOut = mIsBrowserFrame; + return NS_OK; +} - mIsBrowserFrame = true; +NS_IMETHODIMP +nsDocShell::SetIsBrowserFrame(bool aValue) +{ + // Disallow transitions from browser frame to not-browser-frame. Once a + // browser frame, always a browser frame. (Otherwise, observers of + // docshell-marked-as-browser-frame would have to distinguish between + // newly-created browser frames and frames which went from true to false back + // to true.) + NS_ENSURE_STATE(!mIsBrowserFrame || aValue); + bool wasBrowserFrame = mIsBrowserFrame; + mIsBrowserFrame = aValue; + if (aValue && !wasBrowserFrame) { nsCOMPtr os = services::GetObserverService(); if (os) { - os->NotifyObservers(GetAsSupports(this), - "docshell-marked-as-browser-frame", NULL); + os->NotifyObservers(GetAsSupports(this), + "docshell-marked-as-browser-frame", NULL); } - - return NS_OK; + } + return NS_OK; } -nsDocShell::FrameType -nsDocShell::GetInheritedFrameType() +NS_IMETHODIMP +nsDocShell::GetContainedInBrowserFrame(bool *aOut) { - FrameType type = GetFrameType(); + *aOut = false; - if (type != eFrameTypeRegular) { - return type; + if (mIsBrowserFrame) { + *aOut = true; + return NS_OK; } nsCOMPtr parentAsItem; GetSameTypeParent(getter_AddRefs(parentAsItem)); nsCOMPtr parent = do_QueryInterface(parentAsItem); - if (!parent) { - return eFrameTypeRegular; - } - - return static_cast(parent.get())->GetInheritedFrameType(); -} - -nsDocShell::FrameType -nsDocShell::GetFrameType() -{ - if (mAppId != nsIScriptSecurityManager::NO_APP_ID) { - return eFrameTypeApp; - } - - return mIsBrowserFrame ? eFrameTypeBrowser : eFrameTypeRegular; -} - -NS_IMETHODIMP -nsDocShell::GetIsBrowserElement(bool* aIsBrowser) -{ - *aIsBrowser = (GetFrameType() == eFrameTypeBrowser); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetIsApp(bool* aIsApp) -{ - *aIsApp = (GetFrameType() == eFrameTypeApp); - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetIsContentBoundary(bool* aIsContentBoundary) -{ - switch (GetFrameType()) { - case eFrameTypeRegular: - *aIsContentBoundary = false; - break; - case eFrameTypeBrowser: - case eFrameTypeApp: - *aIsContentBoundary = true; - break; + if (parent) { + return parent->GetContainedInBrowserFrame(aOut); } return NS_OK; } - -NS_IMETHODIMP -nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement) -{ - *aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser); - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetIsInApp(bool* aIsInApp) -{ - *aIsInApp = (GetInheritedFrameType() == eFrameTypeApp); - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetIsBelowContentBoundary(bool* aIsInContentBoundary) -{ - switch (GetInheritedFrameType()) { - case eFrameTypeRegular: - *aIsInContentBoundary = false; - break; - case eFrameTypeBrowser: - case eFrameTypeApp: - *aIsInContentBoundary = true; - break; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::SetAppId(PRUint32 aAppId) -{ - MOZ_ASSERT(mAppId == nsIScriptSecurityManager::NO_APP_ID); - MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID); - - mAppId = aAppId; - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetAppId(PRUint32* aAppId) -{ - if (mAppId != nsIScriptSecurityManager::NO_APP_ID) { - MOZ_ASSERT(GetFrameType() == eFrameTypeApp); - - *aAppId = mAppId; - return NS_OK; - } - - MOZ_ASSERT(GetFrameType() != eFrameTypeApp); - - nsCOMPtr parentAsItem; - GetSameTypeParent(getter_AddRefs(parentAsItem)); - - nsCOMPtr parent = do_QueryInterface(parentAsItem); - if (!parent) { - *aAppId = nsIScriptSecurityManager::NO_APP_ID; - return NS_OK; - } - - return parent->GetAppId(aAppId); -} diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 574f08577f6..cd57499032e 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -664,15 +664,6 @@ protected: bool JustStartedNetworkLoad(); - enum FrameType { - eFrameTypeRegular = 0x0, // 0000 - eFrameTypeBrowser = 0x1, // 0001 - eFrameTypeApp = 0x2 // 0010 - }; - - FrameType GetInheritedFrameType(); - FrameType GetFrameType(); - // hash of session storages, keyed by domain nsInterfaceHashtable mStorages; @@ -824,8 +815,6 @@ protected: nsRefPtr mTiming; - PRUint32 mAppId; - private: nsCOMPtr mForcedCharset; nsCOMPtr mParentCharset; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 2f8b2be4037..c19e63afb04 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -39,7 +39,7 @@ interface nsIWebBrowserPrint; interface nsIVariant; interface nsIPrivacyTransitionObserver; -[scriptable, builtinclass, uuid(c98f0f21-fe96-4f06-9978-0a9422a789fa)] +[scriptable, builtinclass, uuid(89ea9f32-18ec-413b-9e2c-ce9a4c851b1c)] interface nsIDocShell : nsISupports { /** @@ -589,64 +589,21 @@ interface nsIDocShell : nsISupports */ void addWeakPrivacyTransitionObserver(in nsIPrivacyTransitionObserver obs); - /** - * Mark the docshell as a browser frame. - * This should be used for