From 6365f16e57f50fb95bb270f36956ee9b2c18aa75 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 28 Jun 2017 15:52:01 +0200 Subject: [PATCH 1/5] Backed out changeset a1e773337202 (bug 1350633) --- dom/ipc/PBrowser.ipdl | 11 +++++------ dom/ipc/TabChild.cpp | 8 -------- dom/ipc/TabChild.h | 10 ---------- dom/ipc/TabParent.cpp | 23 ++++++++++++----------- dom/ipc/TabParent.h | 2 ++ ipc/ipdl/sync-messages.ini | 2 ++ widget/PuppetWidget.cpp | 8 ++------ 7 files changed, 23 insertions(+), 41 deletions(-) diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index aaa22ac10529..47434665ea20 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -149,6 +149,11 @@ parent: async PPaymentRequest(); + /** + * Return native data of root widget + */ + nested(inside_cpow) sync GetWidgetNativeData() returns (WindowsHandle value); + /** * Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the * widget's shareable window on the chrome side. Only used on Windows. @@ -889,12 +894,6 @@ child: */ async SetOriginAttributes(OriginAttributes aOriginAttributes); - /** - * Pass the current handle for the current native widget to the content - * process, so it can be used by PuppetWidget. - */ - async SetWidgetNativeData(WindowsHandle aHandle); - /* * FIXME: write protocol! diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 42c9611cd1d8..ee255a52b23e 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -411,7 +411,6 @@ TabChild::TabChild(nsIContentChild* aManager, , mPendingDocShellPreserveLayers(false) , mPendingDocShellReceivedMessage(false) , mPendingDocShellBlockers(0) - , mWidgetNativeData(0) { nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast(this))); // for capture by the lambda mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId, @@ -3212,13 +3211,6 @@ TabChild::RecvSetOriginAttributes(const OriginAttributes& aOriginAttributes) return IPC_OK(); } -mozilla::ipc::IPCResult -TabChild::RecvSetWidgetNativeData(const WindowsHandle& aWidgetNativeData) -{ - mWidgetNativeData = aWidgetNativeData; - return IPC_OK(); -} - mozilla::plugins::PPluginWidgetChild* TabChild::AllocPPluginWidgetChild() { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index cdfffab99dc2..6f99f397d070 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -697,12 +697,6 @@ public: void AddPendingDocShellBlocker(); void RemovePendingDocShellBlocker(); - // The HANDLE object for the widget this TabChild in. - WindowsHandle WidgetNativeData() - { - return mWidgetNativeData; - } - protected: virtual ~TabChild(); @@ -744,8 +738,6 @@ protected: virtual mozilla::ipc::IPCResult RecvSetOriginAttributes(const OriginAttributes& aOriginAttributes) override; - virtual mozilla::ipc::IPCResult RecvSetWidgetNativeData(const WindowsHandle& aWidgetNativeData) override; - private: void HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid); @@ -889,8 +881,6 @@ private: bool mPendingDocShellReceivedMessage; uint32_t mPendingDocShellBlockers; - WindowsHandle mWidgetNativeData; - DISALLOW_EVIL_CONSTRUCTORS(TabChild); }; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 9e4067ba6e77..aa7626dc7e50 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -292,17 +292,6 @@ TabParent::SetOwnerElement(Element* aElement) AddWindowListeners(); TryCacheDPIAndScale(); - - // Try to send down WidgetNativeData, now that this TabParent is associated - // with a widget. - nsCOMPtr widget = GetTopLevelWidget(); - if (widget) { - WindowsHandle widgetNativeData = reinterpret_cast( - widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW)); - if (widgetNativeData) { - Unused << SendSetWidgetNativeData(widgetNativeData); - } - } } void @@ -2326,6 +2315,18 @@ TabParent::GetTopLevelWidget() return nullptr; } +mozilla::ipc::IPCResult +TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue) +{ + *aValue = 0; + nsCOMPtr widget = GetTopLevelWidget(); + if (widget) { + *aValue = reinterpret_cast( + widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW)); + } + return IPC_OK(); +} + mozilla::ipc::IPCResult TabParent::RecvSetNativeChildOfShareableWindow(const uintptr_t& aChildWindow) { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 066d310b1fc2..5155e1d3c3b1 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -305,6 +305,8 @@ public: virtual mozilla::ipc::IPCResult RecvGetWidgetRounding(int32_t* aValue) override; + virtual mozilla::ipc::IPCResult RecvGetWidgetNativeData(WindowsHandle* aValue) override; + virtual mozilla::ipc::IPCResult RecvSetNativeChildOfShareableWindow(const uintptr_t& childWindow) override; virtual mozilla::ipc::IPCResult RecvDispatchFocusToTopLevelWindow() override; diff --git a/ipc/ipdl/sync-messages.ini b/ipc/ipdl/sync-messages.ini index d0c29db57e68..13f975c671d4 100644 --- a/ipc/ipdl/sync-messages.ini +++ b/ipc/ipdl/sync-messages.ini @@ -821,6 +821,8 @@ description = description = [PBrowser::PPluginWidget] description = +[PBrowser::GetWidgetNativeData] +description = [PBrowser::DispatchFocusToTopLevelWindow] description = [PBrowser::NotifyIMEFocus] diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 643e6c2ca20d..c47151485a94 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1189,14 +1189,10 @@ PuppetWidget::GetNativeData(uint32_t aDataType) { switch (aDataType) { case NS_NATIVE_SHAREABLE_WINDOW: { - // NOTE: We can not have a tab child in some situations, such as when we're - // rendering to a fake widget for thumbnails. - if (!mTabChild) { - NS_WARNING("Need TabChild to get the nativeWindow from!"); - } + MOZ_ASSERT(mTabChild, "Need TabChild to get the nativeWindow from!"); mozilla::WindowsHandle nativeData = 0; if (mTabChild) { - nativeData = mTabChild->WidgetNativeData(); + mTabChild->SendGetWidgetNativeData(&nativeData); } return (void*)nativeData; } From ba466337dd07886c2911561ba856f597f7facf98 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 28 Jun 2017 15:52:04 +0200 Subject: [PATCH 2/5] Backed out changeset 4364536ae549 (bug 1343728) --- dom/ipc/ContentChild.cpp | 130 +++++++------------------------------ dom/ipc/ContentParent.cpp | 55 +++++++--------- dom/ipc/ContentParent.h | 10 ++- dom/ipc/DOMTypes.ipdlh | 24 ------- dom/ipc/PBrowser.ipdl | 10 ++- dom/ipc/PContent.ipdl | 38 +++++++---- dom/ipc/TabParent.cpp | 30 +++------ dom/ipc/TabParent.h | 17 +++-- ipc/ipdl/sync-messages.ini | 4 ++ 9 files changed, 117 insertions(+), 201 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 4c939328d5e9..05fef44a9ef8 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -859,17 +859,6 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener, uint32_t maxTouchPoints = 0; DimensionInfo dimensionInfo; - nsCOMPtr parentTopInnerWindow; - if (aParent) { - nsCOMPtr parentTopWindow = - nsPIDOMWindowOuter::From(aParent)->GetTop(); - if (parentTopWindow) { - parentTopInnerWindow = parentTopWindow->GetCurrentInnerWindow(); - } - } - - // Send down the request to open the window. - RefPtr windowCreated; if (aIframeMoz) { MOZ_ASSERT(aTabOpener); nsAutoCString url; @@ -882,11 +871,10 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener, url.SetIsVoid(true); } - // NOTE: BrowserFrameOpenWindowPromise is the same type as - // CreateWindowPromise, and this code depends on that fact. - windowCreated = - newChild->SendBrowserFrameOpenWindow(aTabOpener, renderFrame, NS_ConvertUTF8toUTF16(url), - name, NS_ConvertUTF8toUTF16(features)); + newChild->SendBrowserFrameOpenWindow(aTabOpener, renderFrame, NS_ConvertUTF8toUTF16(url), + name, NS_ConvertUTF8toUTF16(features), + aWindowIsNew, &textureFactoryIdentifier, + &layersId, &compositorOptions, &maxTouchPoints); } else { nsAutoCString baseURIString; float fullZoom; @@ -895,98 +883,30 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener, return rv; } - windowCreated = - SendCreateWindow(aTabOpener, newChild, renderFrame, - aChromeFlags, aCalledFromJS, aPositionSpecified, - aSizeSpecified, - features, - baseURIString, - fullZoom); - } - - // Await the promise being resolved. When the promise is resolved, we'll set - // the `ready` local variable, which will cause us to exit our nested event - // loop. - // - // NOTE: We need to run this callback on the StableStateEventTarget because we - // need to resolve our runnable and exit from the nested event loop before - // processing any events which were sent after the reply to CreateWindow was - // sent. - bool ready = false; - windowCreated->Then(nsContentUtils::GetStableStateEventTarget(), __func__, - [&] (const CreatedWindowInfo& info) { - MOZ_RELEASE_ASSERT(NS_IsMainThread(), - "windowCreated->Then must run on the main thread"); - rv = info.rv(); - *aWindowIsNew = info.windowOpened(); - frameScripts = info.frameScripts(); - urlToLoad = info.urlToLoad(); - textureFactoryIdentifier = info.textureFactoryIdentifier(); - layersId = info.layersId(); - compositorOptions = info.compositorOptions(); - maxTouchPoints = info.maxTouchPoints(); - dimensionInfo = info.dimensions(); - ready = true; - }, - [&] (const CreateWindowPromise::RejectValueType aReason) { - MOZ_RELEASE_ASSERT(NS_IsMainThread(), - "windowCreated->Then must run on the main thread"); - NS_WARNING("windowCreated promise rejected"); - rv = NS_ERROR_NOT_AVAILABLE; - ready = true; - }); - - // ======================= - // Begin Nested Event Loop - // ======================= - - // We have to wait for a response from either SendCreateWindow or - // SendBrowserFrameOpenWindow with information we're going to need to return - // from this function, So we spin a nested event loop until they get back to - // us. - - // Prevent the docshell from becoming active while the nested event loop is - // spinning. - newChild->AddPendingDocShellBlocker(); - auto removePendingDocShellBlocker = MakeScopeExit([&] { - if (newChild) { - newChild->RemovePendingDocShellBlocker(); + if (!SendCreateWindow(aTabOpener, newChild, renderFrame, + aChromeFlags, aCalledFromJS, aPositionSpecified, + aSizeSpecified, + features, + baseURIString, + fullZoom, + &rv, + aWindowIsNew, + &frameScripts, + &urlToLoad, + &textureFactoryIdentifier, + &layersId, + &compositorOptions, + &maxTouchPoints, + &dimensionInfo)) { + PRenderFrameChild::Send__delete__(renderFrame); + return NS_ERROR_NOT_AVAILABLE; } - }); - // Suspend our window if we have one to make sure we don't re-enter it. - if (parentTopInnerWindow) { - parentTopInnerWindow->Suspend(); + if (NS_FAILED(rv)) { + PRenderFrameChild::Send__delete__(renderFrame); + return rv; + } } - - { - AutoNoJSAPI nojsapi; - - // Spin the event loop until we get a response. Callers of this function - // already have to guard against an inner event loop spinning in the - // non-e10s case because of the need to spin one to create a new chrome - // window. - SpinEventLoopUntil([&] () { return ready; }); - MOZ_RELEASE_ASSERT(ready, - "We are on the main thread, so we should not exit this " - "loop without ready being true."); - } - - if (parentTopInnerWindow) { - parentTopInnerWindow->Resume(); - } - - // ===================== - // End Nested Event Loop - // ===================== - - // Handle the error which we got back from the parent process, if we got - // one. - if (NS_FAILED(rv)) { - PRenderFrameChild::Send__delete__(renderFrame); - return rv; - } - if (!*aWindowIsNew) { PRenderFrameChild::Send__delete__(renderFrame); return NS_ERROR_ABORT; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6b8d0203e551..89f382541473 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -4664,30 +4664,25 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab, const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, - CreateWindowResolver&& aResolve) + nsresult* aResult, + bool* aWindowIsNew, + InfallibleTArray* aFrameScripts, + nsCString* aURLToLoad, + TextureFactoryIdentifier* aTextureFactoryIdentifier, + uint64_t* aLayersId, + CompositorOptions* aCompositorOptions, + uint32_t* aMaxTouchPoints, + DimensionInfo* aDimensions) { - nsresult rv = NS_OK; - CreatedWindowInfo cwi; - // We always expect to open a new window here. If we don't, it's an error. - cwi.windowOpened() = true; - cwi.layersId() = 0; - cwi.maxTouchPoints() = 0; - - // Make sure to resolve the resolver when this function exits, even if we - // failed to generate a valid response. - auto resolveOnExit = MakeScopeExit([&] { - // Copy over the nsresult, and then resolve. - cwi.rv() = rv; - aResolve(cwi); - }); + *aWindowIsNew = true; + *aResult = NS_OK; TabParent* newTab = TabParent::GetFrom(aNewTab); MOZ_ASSERT(newTab); auto destroyNewTabOnError = MakeScopeExit([&] { - // We always expect to open a new window here. If we don't, it's an error. - if (!cwi.windowOpened() || NS_FAILED(rv)) { + if (!*aWindowIsNew || NS_FAILED(*aResult)) { if (newTab) { newTab->Destroy(); } @@ -4698,7 +4693,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab, // we must have an opener. newTab->SetHasContentOpener(true); - TabParent::AutoUseNewTab aunt(newTab, &cwi.urlToLoad()); + TabParent::AutoUseNewTab aunt(newTab, aURLToLoad); const uint64_t nextTabParentId = ++sNextTabParentId; sNextTabParents.Put(nextTabParentId, newTab); @@ -4707,35 +4702,35 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab, CommonCreateWindow(aThisTab, /* aSetOpener = */ true, aChromeFlags, aCalledFromJS, aPositionSpecified, aSizeSpecified, nullptr, aFeatures, aBaseURI, aFullZoom, - nextTabParentId, NullString(), rv, - newRemoteTab, &cwi.windowOpened()); + nextTabParentId, NullString(), *aResult, + newRemoteTab, aWindowIsNew); if (!ipcResult) { return ipcResult; } - if (NS_WARN_IF(NS_FAILED(rv))) { + if (NS_WARN_IF(NS_FAILED(*aResult))) { return IPC_OK(); } if (sNextTabParents.GetAndRemove(nextTabParentId).valueOr(nullptr)) { - cwi.windowOpened() = false; + *aWindowIsNew = false; } MOZ_ASSERT(TabParent::GetFrom(newRemoteTab) == newTab); - newTab->SwapFrameScriptsFrom(cwi.frameScripts()); + newTab->SwapFrameScriptsFrom(*aFrameScripts); RenderFrameParent* rfp = static_cast(aRenderFrame); if (!newTab->SetRenderFrame(rfp) || - !newTab->GetRenderFrameInfo(&cwi.textureFactoryIdentifier(), &cwi.layersId())) { - rv = NS_ERROR_FAILURE; + !newTab->GetRenderFrameInfo(aTextureFactoryIdentifier, aLayersId)) { + *aResult = NS_ERROR_FAILURE; } - cwi.compositorOptions() = rfp->GetCompositorOptions(); + *aCompositorOptions = rfp->GetCompositorOptions(); nsCOMPtr widget = newTab->GetWidget(); - if (widget) { - cwi.maxTouchPoints() = widget->GetMaxTouchPoints(); - cwi.dimensions() = newTab->GetDimensionInfo(); - } + *aMaxTouchPoints = widget ? widget->GetMaxTouchPoints() : 0; + + // NOTE: widget must be set for this to return a meaningful value. + *aDimensions = widget ? newTab->GetDimensionInfo() : DimensionInfo(); return IPC_OK(); } diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index cae28e17b927..776c2d9c45f6 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -536,7 +536,15 @@ public: const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, - CreateWindowResolver&& aResolve) override; + nsresult* aResult, + bool* aWindowIsNew, + InfallibleTArray* aFrameScripts, + nsCString* aURLToLoad, + layers::TextureFactoryIdentifier* aTextureFactoryIdentifier, + uint64_t* aLayersId, + mozilla::layers::CompositorOptions* aCompositorOptions, + uint32_t* aMaxTouchPoints, + DimensionInfo* aDimensions) override; virtual mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess( PBrowserParent* aThisTab, diff --git a/dom/ipc/DOMTypes.ipdlh b/dom/ipc/DOMTypes.ipdlh index 820e9b09851c..aad65c7c7118 100644 --- a/dom/ipc/DOMTypes.ipdlh +++ b/dom/ipc/DOMTypes.ipdlh @@ -22,8 +22,6 @@ using CSSRect from "Units.h"; using CSSSize from "Units.h"; using mozilla::LayoutDeviceIntPoint from "Units.h"; using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h"; -using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; -using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h"; namespace mozilla { namespace dom { @@ -98,27 +96,5 @@ struct DimensionInfo LayoutDeviceIntPoint chromeDisp; }; -struct FrameScriptInfo -{ - nsString url; - bool runInGlobalScope; -}; - -/** - * The information required to complete a window creation request. - */ -struct CreatedWindowInfo -{ - nsresult rv; - bool windowOpened; - FrameScriptInfo[] frameScripts; - nsCString urlToLoad; - TextureFactoryIdentifier textureFactoryIdentifier; - uint64_t layersId; - CompositorOptions compositorOptions; - uint32_t maxTouchPoints; - DimensionInfo dimensions; -}; - } // namespace dom } // namespace mozilla diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 47434665ea20..f8c1cafe53dd 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -459,9 +459,13 @@ parent: * * @param opener the PBrowser whose content called window.open. */ - async BrowserFrameOpenWindow(PBrowser opener, PRenderFrame renderFrame, - nsString aURL, nsString aName, nsString aFeatures) - returns (CreatedWindowInfo window); + sync BrowserFrameOpenWindow(PBrowser opener, PRenderFrame renderFrame, + nsString aURL, nsString aName, nsString aFeatures) + returns (bool windowOpened, + TextureFactoryIdentifier textureFactoryIdentifier, + uint64_t layersId, + CompositorOptions compositorOptions, + uint32_t maxTouchPoints); /** * Tells the containing widget whether the given input block results in a diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 96d877a528ce..40a2789842c1 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -177,6 +177,14 @@ struct DomainPolicyClone URIParams[] superWhitelist; }; + + +struct FrameScriptInfo +{ + nsString url; + bool runInGlobalScope; +}; + struct AndroidSystemInfo { nsString device; @@ -982,17 +990,25 @@ parent: sync GetGraphicsDeviceInitData() returns (ContentDeviceData aData); - async CreateWindow(nullable PBrowser aThisTab, - PBrowser aNewTab, - PRenderFrame aRenderFrame, - uint32_t aChromeFlags, - bool aCalledFromJS, - bool aPositionSpecified, - bool aSizeSpecified, - nsCString aFeatures, - nsCString aBaseURI, - float aFullZoom) - returns (CreatedWindowInfo window); + sync CreateWindow(nullable PBrowser aThisTab, + PBrowser aNewTab, + PRenderFrame aRenderFrame, + uint32_t aChromeFlags, + bool aCalledFromJS, + bool aPositionSpecified, + bool aSizeSpecified, + nsCString aFeatures, + nsCString aBaseURI, + float aFullZoom) + returns (nsresult rv, + bool windowOpened, + FrameScriptInfo[] frameScripts, + nsCString urlToLoad, + TextureFactoryIdentifier textureFactoryIdentifier, + uint64_t layersId, + CompositorOptions compositorOptions, + uint32_t maxTouchPoints, + DimensionInfo dimensions); async CreateWindowInDifferentProcess( PBrowser aThisTab, diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index aa7626dc7e50..9a060b5821b0 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2580,31 +2580,21 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener, const nsString& aURL, const nsString& aName, const nsString& aFeatures, - BrowserFrameOpenWindowResolver&& aResolve) + bool* aOutWindowOpened, + TextureFactoryIdentifier* aTextureFactoryIdentifier, + uint64_t* aLayersId, + CompositorOptions* aCompositorOptions, + uint32_t* aMaxTouchPoints) { - CreatedWindowInfo cwi; - cwi.rv() = NS_OK; - cwi.layersId() = 0; - cwi.maxTouchPoints() = 0; - BrowserElementParent::OpenWindowResult opened = BrowserElementParent::OpenWindowOOP(TabParent::GetFrom(aOpener), this, aRenderFrame, aURL, aName, aFeatures, - &cwi.textureFactoryIdentifier(), - &cwi.layersId()); - cwi.compositorOptions() = - static_cast(aRenderFrame)->GetCompositorOptions(); - cwi.windowOpened() = (opened == BrowserElementParent::OPEN_WINDOW_ADDED); + aTextureFactoryIdentifier, aLayersId); + *aCompositorOptions = static_cast(aRenderFrame)->GetCompositorOptions(); + *aOutWindowOpened = (opened == BrowserElementParent::OPEN_WINDOW_ADDED); nsCOMPtr widget = GetWidget(); - if (widget) { - cwi.maxTouchPoints() = widget->GetMaxTouchPoints(); - cwi.dimensions() = GetDimensionInfo(); - } - - // Resolve the request with the information we collected. - aResolve(cwi); - - if (!cwi.windowOpened()) { + *aMaxTouchPoints = widget ? widget->GetMaxTouchPoints() : 0; + if (!*aOutWindowOpened) { Destroy(); } return IPC_OK(); diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 5155e1d3c3b1..da9ec83b52aa 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -165,13 +165,16 @@ public: virtual mozilla::ipc::IPCResult RecvSetHasBeforeUnload(const bool& aHasBeforeUnload) override; - virtual mozilla::ipc::IPCResult - RecvBrowserFrameOpenWindow(PBrowserParent* aOpener, - PRenderFrameParent* aRenderFrame, - const nsString& aURL, - const nsString& aName, - const nsString& aFeatures, - BrowserFrameOpenWindowResolver&& aResolve) override; + virtual mozilla::ipc::IPCResult RecvBrowserFrameOpenWindow(PBrowserParent* aOpener, + PRenderFrameParent* aRenderFrame, + const nsString& aURL, + const nsString& aName, + const nsString& aFeatures, + bool* aOutWindowOpened, + TextureFactoryIdentifier* aTextureFactoryIdentifier, + uint64_t* aLayersId, + CompositorOptions* aCompositorOptions, + uint32_t* aMaxTouchPoints) override; virtual mozilla::ipc::IPCResult RecvSyncMessage(const nsString& aMessage, diff --git a/ipc/ipdl/sync-messages.ini b/ipc/ipdl/sync-messages.ini index 13f975c671d4..ee36aa65fcd1 100644 --- a/ipc/ipdl/sync-messages.ini +++ b/ipc/ipdl/sync-messages.ini @@ -843,6 +843,8 @@ description = description = [PBrowser::GetWidgetRounding] description = +[PBrowser::BrowserFrameOpenWindow] +description = [PBrowser::RequestNativeKeyBindings] description = [PBrowser::GetTabCount] @@ -911,6 +913,8 @@ description = description = [PContent::GetGraphicsDeviceInitData] description = +[PContent::CreateWindow] +description = [PContent::GetAndroidSystemInfo] description = [PContent::UngrabPointer] From 058c1e8ff581f7cb0575f7383b44777f290162c4 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 28 Jun 2017 15:52:06 +0200 Subject: [PATCH 3/5] Backed out changeset edbd391db6d8 (bug 1343728) --- dom/base/nsContentUtils.cpp | 59 ------------------------------------- dom/base/nsContentUtils.h | 12 -------- 2 files changed, 71 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index b2dd845f69e1..931ca8fae063 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -326,7 +326,6 @@ nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr; nsIParser* nsContentUtils::sXMLFragmentParser = nullptr; nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr; bool nsContentUtils::sFragmentParsingActive = false; -nsISerialEventTarget* nsContentUtils::sStableStateEventTarget = nullptr; #if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP)) bool nsContentUtils::sDOMWindowDumpEnabled; @@ -520,52 +519,6 @@ class SameOriginCheckerImpl final : public nsIChannelEventSink, NS_DECL_NSIINTERFACEREQUESTOR }; -class StableStateEventTarget final : public nsISerialEventTarget -{ -public: - NS_DECL_THREADSAFE_ISUPPORTS - NS_DECL_NSIEVENTTARGET_FULL -private: - ~StableStateEventTarget() {} -}; - -NS_IMPL_ISUPPORTS(StableStateEventTarget, nsISerialEventTarget); - -bool -StableStateEventTarget::IsOnCurrentThreadInfallible() -{ - return true; -} - -NS_IMETHODIMP -StableStateEventTarget::IsOnCurrentThread(bool* aResult) -{ - *aResult = true; - return NS_OK; -} - -NS_IMETHODIMP -StableStateEventTarget::Dispatch(already_AddRefed aEvent, uint32_t aFlags) -{ - if (NS_WARN_IF(!CycleCollectedJSContext::Get())) { - return NS_ERROR_UNEXPECTED; - } - nsContentUtils::RunInStableState(Move(aEvent)); - return NS_OK; -} - -NS_IMETHODIMP -StableStateEventTarget::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) -{ - return Dispatch(nsCOMPtr(aEvent).forget(), aFlags); -} - -NS_IMETHODIMP -StableStateEventTarget::DelayedDispatch(already_AddRefed aEvent, uint32_t aDelay) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - } // namespace /** @@ -777,9 +730,6 @@ nsContentUtils::Init() Unused << nsRFPService::GetOrCreate(); - RefPtr stableStateEventTarget = new StableStateEventTarget(); - stableStateEventTarget.forget(&sStableStateEventTarget); - nsCOMPtr uuidGenerator = do_GetService("@mozilla.org/uuid-generator;1", &rv); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -2206,8 +2156,6 @@ nsContentUtils::Shutdown() NS_IF_RELEASE(sSameOriginChecker); - NS_IF_RELEASE(sStableStateEventTarget); - if (sUserInteractionObserver) { sUserInteractionObserver->Shutdown(); NS_RELEASE(sUserInteractionObserver); @@ -5713,13 +5661,6 @@ nsContentUtils::RunInMetastableState(already_AddRefed aRunnable) CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable)); } -/* static */ -nsISerialEventTarget* -nsContentUtils::GetStableStateEventTarget() -{ - return sStableStateEventTarget; -} - void nsContentUtils::EnterMicroTask() { diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index da3b8c3ecb4d..ae3c5fd2ad18 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -1879,16 +1879,6 @@ public: */ static void RunInMetastableState(already_AddRefed aRunnable); - /** - * Returns a nsISerialEventTarget which will run any event dispatched to it - * once the event loop has reached a "stable state". Runnables dispatched to - * this event target must not cause any queued events to be processed (i.e. - * must not spin the event loop). - * - * See RunInStableState for more information about stable states - */ - static nsISerialEventTarget* GetStableStateEventTarget(); - // Call EnterMicroTask when you're entering JS execution. // Usually the best way to do this is to use nsAutoMicroTask. static void EnterMicroTask(); @@ -3237,8 +3227,6 @@ private: */ static bool sFragmentParsingActive; - static nsISerialEventTarget* sStableStateEventTarget; - static nsString* sShiftText; static nsString* sControlText; static nsString* sMetaText; From 0a8e2e111d7fc3efc02d4e4490dfbf94085d3df8 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 28 Jun 2017 15:52:09 +0200 Subject: [PATCH 4/5] Backed out changeset c3ac91f3aeb9 (bug 1343728) --- gfx/layers/CompositorTypes.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/gfx/layers/CompositorTypes.h b/gfx/layers/CompositorTypes.h index d4e6aa5ce630..4b0e4c1b5102 100644 --- a/gfx/layers/CompositorTypes.h +++ b/gfx/layers/CompositorTypes.h @@ -197,18 +197,6 @@ struct TextureFactoryIdentifier , mUsingAdvancedLayers(false) , mSyncHandle(aSyncHandle) {} - - bool operator==(const TextureFactoryIdentifier& aOther) const { - return - mParentBackend == aOther.mParentBackend && - mParentProcessType == aOther.mParentProcessType && - mMaxTextureSize == aOther.mMaxTextureSize && - mCompositorUseANGLE == aOther.mCompositorUseANGLE && - mSupportsTextureBlitting == aOther.mSupportsTextureBlitting && - mSupportsPartialUploads == aOther.mSupportsPartialUploads && - mSupportsComponentAlpha == aOther.mSupportsComponentAlpha && - mSyncHandle == aOther.mSyncHandle; - } }; /** From 152c0296f8a10f81185ee88dfb4114ec3882b4c6 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 28 Jun 2017 15:53:58 +0200 Subject: [PATCH 5/5] Backed out changeset e9dfba832730 (bug 1343728) for incomplete backout / making bug 1375293 worse on a CLOSED TREE --HG-- extra : amend_source : 4c9ee2458a3413a2fe6f0b3e7785d1b2f211137f --- dom/ipc/TabChild.cpp | 64 ++++++++++---------------------------------- dom/ipc/TabChild.h | 11 -------- 2 files changed, 14 insertions(+), 61 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index ee255a52b23e..6ed458950f72 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -407,10 +407,6 @@ TabChild::TabChild(nsIContentChild* aManager, #if defined(ACCESSIBILITY) , mTopLevelDocAccessibleChild(nullptr) #endif - , mPendingDocShellIsActive(false) - , mPendingDocShellPreserveLayers(false) - , mPendingDocShellReceivedMessage(false) - , mPendingDocShellBlockers(0) { nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast(this))); // for capture by the lambda mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId, @@ -2366,26 +2362,20 @@ TabChild::RecvDestroy() return IPC_OK(); } -void -TabChild::AddPendingDocShellBlocker() +mozilla::ipc::IPCResult +TabChild::RecvSetDocShellIsActive(const bool& aIsActive, + const bool& aPreserveLayers, + const uint64_t& aLayerObserverEpoch) { - mPendingDocShellBlockers++; -} - -void -TabChild::RemovePendingDocShellBlocker() -{ - mPendingDocShellBlockers--; - if (!mPendingDocShellBlockers && mPendingDocShellReceivedMessage) { - mPendingDocShellReceivedMessage = false; - InternalSetDocShellIsActive(mPendingDocShellIsActive, - mPendingDocShellPreserveLayers); + // Since SetDocShellIsActive requests come in from both the hang monitor + // channel and the PContent channel, we have an ordering problem. This code + // ensures that we respect the order in which the requests were made and + // ignore stale requests. + if (mLayerObserverEpoch >= aLayerObserverEpoch) { + return IPC_OK(); } -} + mLayerObserverEpoch = aLayerObserverEpoch; -void -TabChild::InternalSetDocShellIsActive(bool aIsActive, bool aPreserveLayers) -{ auto clearForcePaint = MakeScopeExit([&] { // We might force a paint, or we might already have painted and this is a // no-op. In either case, once we exit this scope, we need to alert the @@ -2411,7 +2401,7 @@ TabChild::InternalSetDocShellIsActive(bool aIsActive, bool aPreserveLayers) // We send the current layer observer epoch to the compositor so that // TabParent knows whether a layer update notification corresponds to the // latest SetDocShellIsActive request that was made. - mPuppetWidget->GetLayerManager()->SetLayerObserverEpoch(mLayerObserverEpoch); + mPuppetWidget->GetLayerManager()->SetLayerObserverEpoch(aLayerObserverEpoch); } // docshell is consider prerendered only if not active yet @@ -2425,8 +2415,8 @@ TabChild::InternalSetDocShellIsActive(bool aIsActive, bool aPreserveLayers) // notification to fire in the parent (so that it knows that the child has // updated its epoch). ForcePaintNoOp does that. if (IPCOpen()) { - Unused << SendForcePaintNoOp(mLayerObserverEpoch); - return; + Unused << SendForcePaintNoOp(aLayerObserverEpoch); + return IPC_OK(); } } @@ -2467,33 +2457,7 @@ TabChild::InternalSetDocShellIsActive(bool aIsActive, bool aPreserveLayers) } else if (!aPreserveLayers) { MakeHidden(); } -} -mozilla::ipc::IPCResult -TabChild::RecvSetDocShellIsActive(const bool& aIsActive, - const bool& aPreserveLayers, - const uint64_t& aLayerObserverEpoch) -{ - // Since requests to change the active docshell come in from both the hang - // monitor channel and the PContent channel, we have an ordering problem. This - // code ensures that we respect the order in which the requests were made and - // ignore stale requests. - if (mLayerObserverEpoch >= aLayerObserverEpoch) { - return IPC_OK(); - } - mLayerObserverEpoch = aLayerObserverEpoch; - - // If we're currently waiting for window opening to complete, we need to hold - // off on setting the docshell active. We queue up the values we're receiving - // in the mWindowOpenDocShellActiveStatus. - if (mPendingDocShellBlockers > 0) { - mPendingDocShellReceivedMessage = true; - mPendingDocShellIsActive = aIsActive; - mPendingDocShellPreserveLayers = aPreserveLayers; - return IPC_OK(); - } - - InternalSetDocShellIsActive(aIsActive, aPreserveLayers); return IPC_OK(); } diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 6f99f397d070..581e34dab259 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -694,9 +694,6 @@ public: } #endif - void AddPendingDocShellBlocker(); - void RemovePendingDocShellBlocker(); - protected: virtual ~TabChild(); @@ -793,9 +790,6 @@ private: const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId); - void InternalSetDocShellIsActive(bool aIsActive, - bool aPreserveLayers); - class DelayedDeleteRunnable; TextureFactoryIdentifier mTextureFactoryIdentifier; @@ -876,11 +870,6 @@ private: PDocAccessibleChild* mTopLevelDocAccessibleChild; #endif - bool mPendingDocShellIsActive; - bool mPendingDocShellPreserveLayers; - bool mPendingDocShellReceivedMessage; - uint32_t mPendingDocShellBlockers; - DISALLOW_EVIL_CONSTRUCTORS(TabChild); };