Bug 1397426 - Add hasLayers to nsITabParent and use it in the async tab switcher. r=billm

This is necessary because sometimes the async tab switcher will instantiate when
there already exists some background tabs that are rendering via print preview. When
that happens, it's important for the state to be set correctly for them so that we
don't accidentally treat them as still loading, and wait (forever) for them to report
having finished loading.

MozReview-Commit-ID: 2dwo5WlXlgJ

--HG--
extra : rebase_source : 4b1e2fb945f1dc4591c56f836a1caa9adeea9eb4
extra : source : 53bb2bc2b67673572dafc3093280fa72973b3d32
This commit is contained in:
Mike Conley 2017-11-17 09:55:29 -08:00
Родитель 5ece45274a
Коммит 63f3a642a0
5 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -4485,7 +4485,9 @@
}
for (let ppBrowser of this.tabbrowser._printPreviewBrowsers) {
let ppTab = this.tabbrowser.getTabForBrowser(ppBrowser);
this.setTabState(ppTab, this.STATE_LOADING);
let state = ppBrowser.hasLayers ? this.STATE_LOADED
: this.STATE_LOADING;
this.setTabState(ppTab, state);
}
},

Просмотреть файл

@ -32,6 +32,12 @@ interface nsITabParent : nsISupports
*/
void renderLayers(in bool aEnabled);
/**
* True if layers are being rendered and the compositor has reported
* receiving them.
*/
readonly attribute boolean hasLayers;
/**
* Whether this tabParent is in prerender mode.
*/

Просмотреть файл

@ -2994,6 +2994,13 @@ TabParent::RenderLayers(bool aEnabled)
return NS_OK;
}
NS_IMETHODIMP
TabParent::GetHasLayers(bool* aResult)
{
*aResult = mHasLayers;
return NS_OK;
}
NS_IMETHODIMP
TabParent::PreserveLayers(bool aPreserveLayers)
{

Просмотреть файл

@ -304,6 +304,14 @@
</body>
</method>
<property name="hasLayers" readonly="true">
<getter>
<![CDATA[
return this.docShellIsActive;
]]>
</getter>
</property>
<property name="imageDocument"
readonly="true">
<getter>

Просмотреть файл

@ -260,6 +260,16 @@
]]></body>
</method>
<property name="hasLayers" readonly="true">
<getter><![CDATA[
let {frameLoader} = this;
if (frameLoader.tabParent) {
return frameLoader.tabParent.hasLayers;
}
return false;
]]></getter>
</property>
<field name="_manifestURI"/>
<property name="manifestURI"
onget="return this._manifestURI"