From b4d3e9c048529acfc1d38a463838da5ebe616ba1 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sat, 21 Jul 2012 19:48:19 -0400 Subject: [PATCH 01/16] Bug 773500 Part 1:Store z-component of transform-origin as 0 rather than null when it is omitted. r=dbaron --- layout/style/nsCSSParser.cpp | 2 +- layout/style/nsCSSValue.cpp | 2 +- layout/style/nsStyleAnimation.cpp | 16 ---------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1f5b37cfbde..fda93478b8e 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -8362,7 +8362,7 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective) nsCSSValue depth; if (!ParseVariant(depth, VARIANT_LENGTH | VARIANT_CALC, nsnull) || !nsLayoutUtils::Are3DTransformsEnabled()) { - depth.Reset(); + depth.SetFloatValue(0.0f, eCSSUnit_Pixel); } value.SetTripletValue(position.mXValue, position.mYValue, depth); } diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 5447ff0fe99..397d4af5b7e 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -423,10 +423,10 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue, void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue) { // triplet should not be used for null/inherit/initial values - // Only allow Null for the z component NS_ABORT_IF_FALSE(aValue && aValue->mXValue.GetUnit() != eCSSUnit_Null && aValue->mYValue.GetUnit() != eCSSUnit_Null && + aValue->mZValue.GetUnit() != eCSSUnit_Null && aValue->mXValue.GetUnit() != eCSSUnit_Inherit && aValue->mYValue.GetUnit() != eCSSUnit_Inherit && aValue->mZValue.GetUnit() != eCSSUnit_Inherit && diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp index 199043230eb..b3b3cc39027 100644 --- a/layout/style/nsStyleAnimation.cpp +++ b/layout/style/nsStyleAnimation.cpp @@ -1781,13 +1781,6 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty, nsCSSValueTriplet triplet1(*aValue1.GetCSSValueTripletValue()); nsCSSValueTriplet triplet2(*aValue2.GetCSSValueTripletValue()); - if (triplet1.mZValue.GetUnit() == eCSSUnit_Null) { - triplet1.mZValue.SetFloatValue(0.0, eCSSUnit_Pixel); - } - if (triplet2.mZValue.GetUnit() == eCSSUnit_Null) { - triplet2.mZValue.SetFloatValue(0.0, eCSSUnit_Pixel); - } - nsCSSUnit unit[3]; unit[0] = GetCommonUnit(aProperty, triplet1.mXValue.GetUnit(), triplet2.mXValue.GetUnit()); @@ -1816,11 +1809,6 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty, } } - if (result->mZValue.GetUnit() == eCSSUnit_Pixel && - result->mZValue.GetFloatValue() == 0.0f) { - result->mZValue.Reset(); - } - aResultValue.SetAndAdoptCSSValueTripletValue(result.forget(), eUnit_CSSValueTriplet); return true; @@ -2673,10 +2661,6 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty, triplet->mZValue)) { return false; } - if (triplet->mZValue.GetUnit() == eCSSUnit_Pixel && - triplet->mZValue.GetFloatValue() == 0.0f) { - triplet->mZValue.Reset(); - } aComputedValue.SetAndAdoptCSSValueTripletValue(triplet.forget(), eUnit_CSSValueTriplet); break; From 6c02265ed9cad1e4ca17d83e80752cd8d6490c37 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sat, 21 Jul 2012 19:48:33 -0400 Subject: [PATCH 02/16] Bug 773500 Part 2: nsStyleAnimation should null check z-component of nsCSSValueTriplet r=dbaron --- layout/style/nsStyleAnimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp index b3b3cc39027..246ac7a1d50 100644 --- a/layout/style/nsStyleAnimation.cpp +++ b/layout/style/nsStyleAnimation.cpp @@ -563,7 +563,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty, unit[2] = GetCommonUnit(aProperty, triplet1->mZValue.GetUnit(), triplet2->mZValue.GetUnit()); if (unit[0] == eCSSUnit_Null || unit[1] == eCSSUnit_Null || - unit[0] == eCSSUnit_URL) { + unit[2] == eCSSUnit_Null) { return false; } @@ -1789,7 +1789,7 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty, unit[2] = GetCommonUnit(aProperty, triplet1.mZValue.GetUnit(), triplet2.mZValue.GetUnit()); if (unit[0] == eCSSUnit_Null || unit[1] == eCSSUnit_Null || - unit[0] == eCSSUnit_Null || unit[0] == eCSSUnit_URL) { + unit[2] == eCSSUnit_Null) { return false; } From 40f1fac70688a07bab7085f7592ec40e8114e5a8 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 21 Jul 2012 17:14:25 -0700 Subject: [PATCH 03/16] Bug 758258 - Tests. r=sicking --- caps/tests/mochitest/Makefile.in | 8 +- ...ncipal_extendedorigin_appid_appstatus.html | 258 +++++++++++++++--- 2 files changed, 229 insertions(+), 37 deletions(-) diff --git a/caps/tests/mochitest/Makefile.in b/caps/tests/mochitest/Makefile.in index e7a3b564e53..4ddf8cd816b 100644 --- a/caps/tests/mochitest/Makefile.in +++ b/caps/tests/mochitest/Makefile.in @@ -18,9 +18,11 @@ MOCHITEST_FILES = test_bug423375.html \ test_disallowInheritPrincipal.html \ $(NULL) -# Temporarily disabled for orange -# MOCHITEST_CHROME_FILES = test_principal_extendedorigin_appid_appstatus.html \ -# $(NULL) +# extendedOrigin test doesn't work on Windows, see bug 776296. +ifneq ($(OS_ARCH),WINNT) +MOCHITEST_CHROME_FILES = test_principal_extendedorigin_appid_appstatus.html \ + $(NULL) +endif test_bug292789.html : % : %.in $(PYTHON) $(topsrcdir)/config/Preprocessor.py \ diff --git a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html b/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html index 8a0d1a87144..34f896bc330 100644 --- a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html +++ b/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html @@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
-
 
From 38a7f3af0d758f96f526453db262698db617a539 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 21 Jul 2012 17:39:41 -0700 Subject: [PATCH 04/16] Bug 775408 - Rename nsIDocShell::SetIsBrowser() to SetIsBrowserElement(). r=jlebar --- content/base/src/nsFrameLoader.cpp | 2 +- docshell/base/nsDocShell.cpp | 2 +- docshell/base/nsIDocShell.idl | 4 ++-- dom/browser-element/BrowserElementChild.js | 2 +- toolkit/components/social/FrameWorker.jsm | 2 +- toolkit/identity/Sandbox.jsm | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index e38aa243ab5..e049968fc62 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -1597,7 +1597,7 @@ nsFrameLoader::MaybeCreateDocShell() EnsureMessageManager(); if (OwnerIsBrowserFrame()) { - mDocShell->SetIsBrowser(); + mDocShell->SetIsBrowserElement(); nsCOMPtr os = services::GetObserverService(); if (os) { diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index cc3c63f0602..f3407599108 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -11992,7 +11992,7 @@ nsDocShell::GetCanExecuteScripts(bool *aResult) } NS_IMETHODIMP -nsDocShell::SetIsBrowser() +nsDocShell::SetIsBrowserElement() { if (mIsBrowserFrame) { NS_ERROR("You should not call SetIsBrowser() more than once."); diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 0ac6e609c91..f95f54901fa 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -39,7 +39,7 @@ interface nsIWebBrowserPrint; interface nsIVariant; interface nsIPrivacyTransitionObserver; -[scriptable, builtinclass, uuid(ef5a9aba-fe75-410c-a216-fe9b71a6661c)] +[scriptable, builtinclass, uuid(be5a675b-b675-4443-af75-510530eab5fa)] interface nsIDocShell : nsISupports { /** @@ -584,7 +584,7 @@ interface nsIDocShell : nsISupports * * This method should not be called more than once. */ - void setIsBrowser(); + void setIsBrowserElement(); /** * Returns true iff the docshell is marked as a browser frame. diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 0608e2b16d5..3d4ea863d2d 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -59,7 +59,7 @@ BrowserElementChild.prototype = { BrowserElementPromptService.mapWindowToBrowserElementChild(content, this); - docShell.setIsBrowser(); + docShell.setIsBrowserElement(); docShell.QueryInterface(Ci.nsIWebProgress) .addProgressListener(this._progressListener, Ci.nsIWebProgress.NOTIFY_LOCATION | diff --git a/toolkit/components/social/FrameWorker.jsm b/toolkit/components/social/FrameWorker.jsm index 252ee8a252a..8f85201673d 100644 --- a/toolkit/components/social/FrameWorker.jsm +++ b/toolkit/components/social/FrameWorker.jsm @@ -243,7 +243,7 @@ function makeHiddenFrame() { // TODO: disable media (bug 759964) // Mark this docShell as a "browserFrame", to break script access to e.g. window.top - docShell.setIsBrowser(); + docShell.setIsBrowserElement(); return iframe; } diff --git a/toolkit/identity/Sandbox.jsm b/toolkit/identity/Sandbox.jsm index 6de75deae07..4eb7a4d57bb 100644 --- a/toolkit/identity/Sandbox.jsm +++ b/toolkit/identity/Sandbox.jsm @@ -93,7 +93,7 @@ Sandbox.prototype = { .getInterface(Ci.nsIDocShell); // Mark this docShell as a "browserFrame", to break script access to e.g. window.top - docShell.setIsBrowser(); + docShell.setIsBrowserElement(); // Stop about:blank from being loaded. docShell.stop(Ci.nsIWebNavigation.STOP_NETWORK); From 77caa7b0024f65efcdf019dafbb06c00a6978ef5 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 21 Jul 2012 17:16:11 -0700 Subject: [PATCH 05/16] Bug 770532 - Make new nsIPrincipal and nsIDocShell attributes work in content process. r=jlebar --- content/base/src/nsFrameLoader.cpp | 28 ++++++++++++++++++++++++++-- dom/ipc/ContentChild.cpp | 6 ++++-- dom/ipc/ContentChild.h | 3 ++- dom/ipc/ContentParent.cpp | 8 +++++--- dom/ipc/ContentParent.h | 7 ++++--- dom/ipc/PContent.ipdl | 2 +- dom/ipc/TabChild.cpp | 22 +++++++++++++++++----- dom/ipc/TabChild.h | 10 ++++++---- 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index e049968fc62..92b85bbd4ac 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -1971,6 +1971,31 @@ nsFrameLoader::TryRemoteBrowser() return false; } + PRUint32 appId = 0; + bool isBrowserElement = false; + + if (OwnerIsBrowserFrame()) { + isBrowserElement = true; + + if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) { + nsAutoString manifest; + mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest); + + nsCOMPtr appsService = do_GetService(APPS_SERVICE_CONTRACTID); + if (!appsService) { + NS_ERROR("Apps Service is not available!"); + return NS_ERROR_FAILURE; + } + + appsService->GetAppLocalIdByManifestURL(manifest, &appId); + + // If the frame is actually an app, we should not mark it as a browser. + if (appId != nsIScriptSecurityManager::NO_APP_ID) { + isBrowserElement = false; + } + } + } + // If our owner has no app manifest URL, then this is equivalent to // ContentParent::GetNewOrUsed(). nsAutoString appManifest; @@ -1978,8 +2003,7 @@ nsFrameLoader::TryRemoteBrowser() ContentParent* parent = ContentParent::GetForApp(appManifest); NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!"); - mRemoteBrowser = parent->CreateTab(chromeFlags, - /* aIsBrowserFrame = */ OwnerIsBrowserFrame()); + mRemoteBrowser = parent->CreateTab(chromeFlags, isBrowserElement, appId); if (mRemoteBrowser) { nsCOMPtr element = do_QueryInterface(mOwnerContent); mRemoteBrowser->SetOwnerElement(element); diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 5ea9aae15ef..65a059cd3ac 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -396,9 +396,11 @@ ContentChild::AllocPCompositor(ipc::Transport* aTransport, } PBrowserChild* -ContentChild::AllocPBrowser(const PRUint32& aChromeFlags, const bool& aIsBrowserFrame) +ContentChild::AllocPBrowser(const PRUint32& aChromeFlags, + const bool& aIsBrowserElement, + const PRUint32& aAppId) { - nsRefPtr iframe = new TabChild(aChromeFlags, aIsBrowserFrame); + nsRefPtr iframe = new TabChild(aChromeFlags, aIsBrowserElement, aAppId); return NS_SUCCEEDED(iframe->Init()) ? iframe.forget().get() : NULL; } diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 98960ee7484..ffebd3eca91 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -63,7 +63,8 @@ public: base::ProcessId aOtherProcess) MOZ_OVERRIDE; virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags, - const bool& aIsBrowserFrame); + const bool& aIsBrowserElement, + const PRUint32& aAppId); virtual bool DeallocPBrowser(PBrowserChild*); virtual PDeviceStorageRequestChild* AllocPDeviceStorageRequest(const DeviceStorageParams&); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index e806423b6b1..fc3103ddb20 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -430,9 +430,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why) } TabParent* -ContentParent::CreateTab(PRUint32 aChromeFlags, bool aIsBrowserFrame) +ContentParent::CreateTab(PRUint32 aChromeFlags, bool aIsBrowserElement, PRUint32 aAppId) { - return static_cast(SendPBrowserConstructor(aChromeFlags, aIsBrowserFrame)); + return static_cast(SendPBrowserConstructor(aChromeFlags, aIsBrowserElement, aAppId)); } void @@ -834,7 +834,9 @@ ContentParent::AllocPCompositor(ipc::Transport* aTransport, } PBrowserParent* -ContentParent::AllocPBrowser(const PRUint32& aChromeFlags, const bool& aIsBrowserFrame) +ContentParent::AllocPBrowser(const PRUint32& aChromeFlags, + const bool& aIsBrowserElement, + const PRUint32& aAppId) { TabParent* parent = new TabParent(); if (parent){ diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 027138731a9..eabe2dd3eac 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -69,10 +69,11 @@ public: /** * Create a new tab. * - * |aIsBrowserFrame| indicates whether this tab is part of an + * |aIsBrowserElement| indicates whether this tab is part of an *