зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 059753ec9117 (bug 1315105) for test failures in own test
--HG-- extra : rebase_source : de2846d1205d3e885c1040379f2816629a925d22
This commit is contained in:
Родитель
f1b50a1663
Коммит
51614d31e4
|
@ -607,97 +607,6 @@ addMessageListener("Browser:AppTab", function(message) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let PrerenderContentHandler = {
|
|
||||||
init() {
|
|
||||||
this._pending = [];
|
|
||||||
this._idMonotonic = 0;
|
|
||||||
this._initialized = true;
|
|
||||||
addMessageListener("Prerender:Canceled", this);
|
|
||||||
addMessageListener("Prerender:Swapped", this);
|
|
||||||
},
|
|
||||||
|
|
||||||
get initialized() {
|
|
||||||
return !!this._initialized;
|
|
||||||
},
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
|
||||||
switch (aMessage.name) {
|
|
||||||
case "Prerender:Canceled": {
|
|
||||||
for (let i = 0; i < this._pending.length; ++i) {
|
|
||||||
if (this._pending[i].id === aMessage.data.id) {
|
|
||||||
if (this._pending[i].failure) {
|
|
||||||
this._pending[i].failure.run();
|
|
||||||
}
|
|
||||||
// Remove the item from the array
|
|
||||||
this._pending.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "Prerender:Swapped": {
|
|
||||||
for (let i = 0; i < this._pending.length; ++i) {
|
|
||||||
if (this._pending[i].id === aMessage.data.id) {
|
|
||||||
if (this._pending[i].success) {
|
|
||||||
this._pending[i].success.run();
|
|
||||||
}
|
|
||||||
// Remove the item from the array
|
|
||||||
this._pending.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
startPrerenderingDocument(aHref, aReferrer) {
|
|
||||||
// XXX: Make this constant a pref
|
|
||||||
if (this._pending.length >= 2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let id = ++this._idMonotonic;
|
|
||||||
sendAsyncMessage("Prerender:Request", {
|
|
||||||
href: aHref.spec,
|
|
||||||
referrer: aReferrer ? aReferrer.spec : null,
|
|
||||||
id: id,
|
|
||||||
});
|
|
||||||
|
|
||||||
this._pending.push({
|
|
||||||
href: aHref,
|
|
||||||
referrer: aReferrer,
|
|
||||||
id: id,
|
|
||||||
success: null,
|
|
||||||
failure: null,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
shouldSwitchToPrerenderedDocument(aHref, aReferrer, aSuccess, aFailure) {
|
|
||||||
// Check if we think there is a prerendering document pending for the given
|
|
||||||
// href and referrer. If we think there is one, we will send a message to
|
|
||||||
// the parent process asking it to do a swap, and hook up the success and
|
|
||||||
// failure listeners.
|
|
||||||
for (let i = 0; i < this._pending.length; ++i) {
|
|
||||||
let p = this._pending[i];
|
|
||||||
if (p.href.equals(aHref) && p.referrer.equals(aReferrer)) {
|
|
||||||
p.success = aSuccess;
|
|
||||||
p.failure = aFailure;
|
|
||||||
sendAsyncMessage("Prerender:Swap", {id: p.id});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
|
|
||||||
// We only want to initialize the PrerenderContentHandler in the content
|
|
||||||
// process. Outside of the content process, this should be unused.
|
|
||||||
PrerenderContentHandler.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
var WebBrowserChrome = {
|
var WebBrowserChrome = {
|
||||||
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
|
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
|
||||||
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
|
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
|
||||||
|
@ -721,20 +630,6 @@ var WebBrowserChrome = {
|
||||||
reloadInFreshProcess: function(aDocShell, aURI, aReferrer) {
|
reloadInFreshProcess: function(aDocShell, aURI, aReferrer) {
|
||||||
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer, true);
|
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer, true);
|
||||||
return true;
|
return true;
|
||||||
},
|
|
||||||
|
|
||||||
startPrerenderingDocument: function(aHref, aReferrer) {
|
|
||||||
if (PrerenderContentHandler.initialized) {
|
|
||||||
PrerenderContentHandler.startPrerenderingDocument(aHref, aReferrer);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
shouldSwitchToPrerenderedDocument: function(aHref, aReferrer, aSuccess, aFailure) {
|
|
||||||
if (PrerenderContentHandler.initialized) {
|
|
||||||
return PrerenderContentHandler.shouldSwitchToPrerenderedDocument(
|
|
||||||
aHref, aReferrer, aSuccess, aFailure);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1500,7 +1500,6 @@
|
||||||
<parameter name="aPostData"/>
|
<parameter name="aPostData"/>
|
||||||
<parameter name="aLoadInBackground"/>
|
<parameter name="aLoadInBackground"/>
|
||||||
<parameter name="aAllowThirdPartyFixup"/>
|
<parameter name="aAllowThirdPartyFixup"/>
|
||||||
<parameter name="aIsPrerendered"/>
|
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var aReferrerPolicy;
|
var aReferrerPolicy;
|
||||||
|
@ -1536,7 +1535,6 @@
|
||||||
aRelatedBrowser = params.relatedBrowser;
|
aRelatedBrowser = params.relatedBrowser;
|
||||||
aOriginPrincipal = params.originPrincipal;
|
aOriginPrincipal = params.originPrincipal;
|
||||||
aOpener = params.opener;
|
aOpener = params.opener;
|
||||||
aIsPrerendered = params.isPrerendered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
|
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
|
||||||
|
@ -1559,8 +1557,7 @@
|
||||||
userContextId: aUserContextId,
|
userContextId: aUserContextId,
|
||||||
originPrincipal: aOriginPrincipal,
|
originPrincipal: aOriginPrincipal,
|
||||||
relatedBrowser: aRelatedBrowser,
|
relatedBrowser: aRelatedBrowser,
|
||||||
opener: aOpener,
|
opener: aOpener });
|
||||||
isPrerendered: aIsPrerendered });
|
|
||||||
if (!bgLoad)
|
if (!bgLoad)
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
|
|
||||||
|
@ -1938,7 +1935,7 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
// Supported parameters:
|
// Supported parameters:
|
||||||
// userContextId, remote, remoteType, isPreloadBrowser,
|
// userContextId, remote, remoteType, isPreloadBrowser,
|
||||||
// uriIsAboutBlank, permanentKey, isPrerendered
|
// uriIsAboutBlank, permanentKey
|
||||||
|
|
||||||
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
|
|
||||||
|
@ -1950,10 +1947,6 @@
|
||||||
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
|
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
|
||||||
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
|
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
|
||||||
|
|
||||||
if (aParams.isPrerendered) {
|
|
||||||
b.setAttribute("prerendered", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aParams.userContextId) {
|
if (aParams.userContextId) {
|
||||||
b.setAttribute("usercontextid", aParams.userContextId);
|
b.setAttribute("usercontextid", aParams.userContextId);
|
||||||
}
|
}
|
||||||
|
@ -2042,7 +2035,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Supported parameters:
|
// Supported parameters:
|
||||||
// forceNotRemote, preferredRemoteType, userContextId, isPrerendered
|
// forceNotRemote, preferredRemoteType, userContextId
|
||||||
|
|
||||||
let uriIsAboutBlank = !aURI || aURI == "about:blank";
|
let uriIsAboutBlank = !aURI || aURI == "about:blank";
|
||||||
|
|
||||||
|
@ -2075,8 +2068,7 @@
|
||||||
uriIsAboutBlank: uriIsAboutBlank,
|
uriIsAboutBlank: uriIsAboutBlank,
|
||||||
userContextId: aParams.userContextId,
|
userContextId: aParams.userContextId,
|
||||||
relatedBrowser: aParams.relatedBrowser,
|
relatedBrowser: aParams.relatedBrowser,
|
||||||
opener: aParams.opener,
|
opener: aParams.opener});
|
||||||
isPrerendered: aParams.isPrerendered});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let notificationbox = this.getNotificationBox(browser);
|
let notificationbox = this.getNotificationBox(browser);
|
||||||
|
@ -2136,7 +2128,6 @@
|
||||||
<parameter name="aPostData"/>
|
<parameter name="aPostData"/>
|
||||||
<parameter name="aOwner"/>
|
<parameter name="aOwner"/>
|
||||||
<parameter name="aAllowThirdPartyFixup"/>
|
<parameter name="aAllowThirdPartyFixup"/>
|
||||||
<parameter name="aIsPrerendered"/>
|
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -2179,7 +2170,6 @@
|
||||||
aOriginPrincipal = params.originPrincipal;
|
aOriginPrincipal = params.originPrincipal;
|
||||||
aDisallowInheritPrincipal = params.disallowInheritPrincipal;
|
aDisallowInheritPrincipal = params.disallowInheritPrincipal;
|
||||||
aOpener = params.opener;
|
aOpener = params.opener;
|
||||||
aIsPrerendered = params.isPrerendered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
||||||
|
@ -2197,10 +2187,6 @@
|
||||||
t.setAttribute("label", aURI);
|
t.setAttribute("label", aURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aIsPrerendered) {
|
|
||||||
t.setAttribute("hidden", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aUserContextId) {
|
if (aUserContextId) {
|
||||||
t.setAttribute("usercontextid", aUserContextId);
|
t.setAttribute("usercontextid", aUserContextId);
|
||||||
ContextualIdentityService.setTabStyle(t);
|
ContextualIdentityService.setTabStyle(t);
|
||||||
|
@ -2253,7 +2239,6 @@
|
||||||
userContextId: aUserContextId,
|
userContextId: aUserContextId,
|
||||||
relatedBrowser: aRelatedBrowser,
|
relatedBrowser: aRelatedBrowser,
|
||||||
opener: aOpener,
|
opener: aOpener,
|
||||||
isPrerendered: aIsPrerendered,
|
|
||||||
};
|
};
|
||||||
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
|
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
|
||||||
let b = t.linkedBrowser;
|
let b = t.linkedBrowser;
|
||||||
|
@ -4805,74 +4790,6 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "Prerender:Request": {
|
|
||||||
let sendCancelPrerendering = () => {
|
|
||||||
browser.frameloader.messageManager.
|
|
||||||
sendAsyncMessage("Prerender:Canceled", { id: data.id });
|
|
||||||
};
|
|
||||||
|
|
||||||
let tab = this.getTabForBrowser(browser);
|
|
||||||
if (!tab) {
|
|
||||||
// No tab?
|
|
||||||
sendCancelPrerendering();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tab.hidden) {
|
|
||||||
// Skip prerender on hidden tab.
|
|
||||||
sendCancelPrerendering();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.canGoForward) {
|
|
||||||
// Skip prerender on history navigation as we don't support it
|
|
||||||
// yet. Remove this check once bug 1323650 is implemented.
|
|
||||||
sendCancelPrerendering();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.href) {
|
|
||||||
// If we don't have data.href, loadOneTab will load about:blank
|
|
||||||
// which is meaningless for prerendering.
|
|
||||||
sendCancelPrerendering();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let groupedSHistory = browser.frameLoader.ensureGroupedSHistory();
|
|
||||||
|
|
||||||
let newTab = this.loadOneTab(data.href, {
|
|
||||||
referrerURI: (data.referrer ? makeURI(data.referrer) : null),
|
|
||||||
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
|
|
||||||
postData: null,
|
|
||||||
allowThirdPartyFixup: true,
|
|
||||||
relatedToCurrent: true,
|
|
||||||
isPrerendered: true,
|
|
||||||
});
|
|
||||||
let partialSHistory = newTab.linkedBrowser.frameLoader.partialSessionHistory;
|
|
||||||
groupedSHistory.addPrerenderingPartialSHistory(partialSHistory, data.id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Prerender:Cancel": {
|
|
||||||
let groupedSHistory = browser.frameLoader.groupedSessionHistory;
|
|
||||||
if (groupedSHistory) {
|
|
||||||
groupedSHistory.cancelPrerendering(data.id);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "Prerender:Swap": {
|
|
||||||
let frameloader = browser.frameLoader;
|
|
||||||
let groupedSHistory = browser.frameLoader.groupedSessionHistory;
|
|
||||||
if (groupedSHistory) {
|
|
||||||
groupedSHistory.activatePrerendering(data.id).then(
|
|
||||||
() => frameloader.messageManager.sendAsyncMessage("Prerender:Swapped", data),
|
|
||||||
() => frameloader.messageManager.sendAsyncMessage("Prerender:Canceled", data),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
]]></body>
|
]]></body>
|
||||||
|
@ -5005,11 +4922,6 @@
|
||||||
this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind");
|
this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind");
|
||||||
Services.prefs.addObserver("accessibility.typeaheadfind", this, false);
|
Services.prefs.addObserver("accessibility.typeaheadfind", this, false);
|
||||||
messageManager.addMessageListener("Findbar:Keypress", this);
|
messageManager.addMessageListener("Findbar:Keypress", this);
|
||||||
|
|
||||||
// Add listeners for prerender messages
|
|
||||||
messageManager.addMessageListener("Prerender:Request", this);
|
|
||||||
messageManager.addMessageListener("Prerender:Cancel", this);
|
|
||||||
messageManager.addMessageListener("Prerender:Swap", this);
|
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
|
||||||
|
|
|
@ -1575,7 +1575,6 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||||
srcdoc,
|
srcdoc,
|
||||||
sourceDocShell,
|
sourceDocShell,
|
||||||
baseURI,
|
baseURI,
|
||||||
false,
|
|
||||||
nullptr, // No nsIDocShell
|
nullptr, // No nsIDocShell
|
||||||
nullptr); // No nsIRequest
|
nullptr); // No nsIRequest
|
||||||
}
|
}
|
||||||
|
@ -5362,8 +5361,8 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||||
nsContentUtils::GetSystemPrincipal(), nullptr,
|
nsContentUtils::GetSystemPrincipal(), nullptr,
|
||||||
INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
|
INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
|
||||||
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
|
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
|
||||||
nullptr, true, NullString(), this, nullptr, false,
|
nullptr, true, NullString(), this, nullptr, nullptr,
|
||||||
nullptr, nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -5455,7 +5454,6 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
||||||
srcdoc, // srcdoc argument for iframe
|
srcdoc, // srcdoc argument for iframe
|
||||||
this, // For reloads we are the source
|
this, // For reloads we are the source
|
||||||
baseURI,
|
baseURI,
|
||||||
false,
|
|
||||||
nullptr, // No nsIDocShell
|
nullptr, // No nsIDocShell
|
||||||
nullptr); // No nsIRequest
|
nullptr); // No nsIRequest
|
||||||
}
|
}
|
||||||
|
@ -7952,8 +7950,7 @@ nsDocShell::EnsureContentViewer()
|
||||||
nsresult
|
nsresult
|
||||||
nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||||
nsIURI* aBaseURI,
|
nsIURI* aBaseURI,
|
||||||
bool aTryToSaveOldPresentation,
|
bool aTryToSaveOldPresentation)
|
||||||
bool aCheckPermitUnload)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocument> blankDoc;
|
nsCOMPtr<nsIDocument> blankDoc;
|
||||||
nsCOMPtr<nsIContentViewer> viewer;
|
nsCOMPtr<nsIContentViewer> viewer;
|
||||||
|
@ -7986,32 +7983,31 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||||
bool hadTiming = mTiming;
|
bool hadTiming = mTiming;
|
||||||
bool toBeReset = MaybeInitTiming();
|
bool toBeReset = MaybeInitTiming();
|
||||||
if (mContentViewer) {
|
if (mContentViewer) {
|
||||||
if (aCheckPermitUnload) {
|
// We've got a content viewer already. Make sure the user
|
||||||
// We've got a content viewer already. Make sure the user
|
// permits us to discard the current document and replace it
|
||||||
// permits us to discard the current document and replace it
|
// with about:blank. And also ensure we fire the unload events
|
||||||
// with about:blank. And also ensure we fire the unload events
|
// in the current document.
|
||||||
// in the current document.
|
|
||||||
|
|
||||||
// Unload gets fired first for
|
// Unload gets fired first for
|
||||||
// document loaded from the session history.
|
// document loaded from the session history.
|
||||||
mTiming->NotifyBeforeUnload();
|
mTiming->NotifyBeforeUnload();
|
||||||
|
|
||||||
bool okToUnload;
|
bool okToUnload;
|
||||||
rv = mContentViewer->PermitUnload(&okToUnload);
|
rv = mContentViewer->PermitUnload(&okToUnload);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && !okToUnload) {
|
if (NS_SUCCEEDED(rv) && !okToUnload) {
|
||||||
// The user chose not to unload the page, interrupt the load.
|
// The user chose not to unload the page, interrupt the load.
|
||||||
MaybeResetInitTiming(toBeReset);
|
MaybeResetInitTiming(toBeReset);
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
|
||||||
if (mTiming) {
|
|
||||||
mTiming->NotifyUnloadAccepted(mCurrentURI);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mSavingOldViewer = aTryToSaveOldPresentation &&
|
mSavingOldViewer = aTryToSaveOldPresentation &&
|
||||||
CanSavePresentation(LOAD_NORMAL, nullptr, nullptr);
|
CanSavePresentation(LOAD_NORMAL, nullptr, nullptr);
|
||||||
|
|
||||||
|
if (mTiming) {
|
||||||
|
mTiming->NotifyUnloadAccepted(mCurrentURI);
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure to blow away our mLoadingURI just in case. No loads
|
// Make sure to blow away our mLoadingURI just in case. No loads
|
||||||
// from inside this pagehide.
|
// from inside this pagehide.
|
||||||
mLoadingURI = nullptr;
|
mLoadingURI = nullptr;
|
||||||
|
@ -8095,12 +8091,6 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal)
|
||||||
return CreateAboutBlankContentViewer(aPrincipal, nullptr);
|
return CreateAboutBlankContentViewer(aPrincipal, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocShell::ForceCreateAboutBlankContentViewer(nsIPrincipal* aPrincipal)
|
|
||||||
{
|
|
||||||
return CreateAboutBlankContentViewer(aPrincipal, nullptr, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsDocShell::CanSavePresentation(uint32_t aLoadType,
|
nsDocShell::CanSavePresentation(uint32_t aLoadType,
|
||||||
nsIRequest* aNewRequest,
|
nsIRequest* aNewRequest,
|
||||||
|
@ -9582,7 +9572,7 @@ public:
|
||||||
nsIInputStream* aHeadersData, uint32_t aLoadType,
|
nsIInputStream* aHeadersData, uint32_t aLoadType,
|
||||||
nsISHEntry* aSHEntry, bool aFirstParty,
|
nsISHEntry* aSHEntry, bool aFirstParty,
|
||||||
const nsAString& aSrcdoc, nsIDocShell* aSourceDocShell,
|
const nsAString& aSrcdoc, nsIDocShell* aSourceDocShell,
|
||||||
nsIURI* aBaseURI, bool aCheckForPrerender)
|
nsIURI* aBaseURI)
|
||||||
: mSrcdoc(aSrcdoc)
|
: mSrcdoc(aSrcdoc)
|
||||||
, mDocShell(aDocShell)
|
, mDocShell(aDocShell)
|
||||||
, mURI(aURI)
|
, mURI(aURI)
|
||||||
|
@ -9600,7 +9590,6 @@ public:
|
||||||
, mFirstParty(aFirstParty)
|
, mFirstParty(aFirstParty)
|
||||||
, mSourceDocShell(aSourceDocShell)
|
, mSourceDocShell(aSourceDocShell)
|
||||||
, mBaseURI(aBaseURI)
|
, mBaseURI(aBaseURI)
|
||||||
, mCheckForPrerender(aCheckForPrerender)
|
|
||||||
{
|
{
|
||||||
// Make sure to keep null things null as needed
|
// Make sure to keep null things null as needed
|
||||||
if (aTypeHint) {
|
if (aTypeHint) {
|
||||||
|
@ -9620,7 +9609,7 @@ public:
|
||||||
NullString(), mPostData, mHeadersData,
|
NullString(), mPostData, mHeadersData,
|
||||||
mLoadType, mSHEntry, mFirstParty,
|
mLoadType, mSHEntry, mFirstParty,
|
||||||
mSrcdoc, mSourceDocShell, mBaseURI,
|
mSrcdoc, mSourceDocShell, mBaseURI,
|
||||||
mCheckForPrerender, nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -9645,7 +9634,6 @@ private:
|
||||||
bool mFirstParty;
|
bool mFirstParty;
|
||||||
nsCOMPtr<nsIDocShell> mSourceDocShell;
|
nsCOMPtr<nsIDocShell> mSourceDocShell;
|
||||||
nsCOMPtr<nsIURI> mBaseURI;
|
nsCOMPtr<nsIURI> mBaseURI;
|
||||||
bool mCheckForPrerender;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9718,7 +9706,6 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
const nsAString& aSrcdoc,
|
const nsAString& aSrcdoc,
|
||||||
nsIDocShell* aSourceDocShell,
|
nsIDocShell* aSourceDocShell,
|
||||||
nsIURI* aBaseURI,
|
nsIURI* aBaseURI,
|
||||||
bool aCheckForPrerender,
|
|
||||||
nsIDocShell** aDocShell,
|
nsIDocShell** aDocShell,
|
||||||
nsIRequest** aRequest)
|
nsIRequest** aRequest)
|
||||||
{
|
{
|
||||||
|
@ -10078,7 +10065,6 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
aSrcdoc,
|
aSrcdoc,
|
||||||
aSourceDocShell,
|
aSourceDocShell,
|
||||||
aBaseURI,
|
aBaseURI,
|
||||||
aCheckForPrerender,
|
|
||||||
aDocShell,
|
aDocShell,
|
||||||
aRequest);
|
aRequest);
|
||||||
if (rv == NS_ERROR_NO_CONTENT) {
|
if (rv == NS_ERROR_NO_CONTENT) {
|
||||||
|
@ -10149,7 +10135,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
aTriggeringPrincipal, principalToInherit,
|
aTriggeringPrincipal, principalToInherit,
|
||||||
aFlags, aTypeHint, aPostData, aHeadersData,
|
aFlags, aTypeHint, aPostData, aHeadersData,
|
||||||
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
|
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
|
||||||
aSourceDocShell, aBaseURI, false);
|
aSourceDocShell, aBaseURI);
|
||||||
return NS_DispatchToCurrentThread(ev);
|
return NS_DispatchToCurrentThread(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10536,25 +10522,6 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
mTiming->NotifyUnloadAccepted(mCurrentURI);
|
mTiming->NotifyUnloadAccepted(mCurrentURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browserChrome3 && aCheckForPrerender) {
|
|
||||||
nsCOMPtr<nsIRunnable> ev =
|
|
||||||
new InternalLoadEvent(this, aURI, aOriginalURI, aLoadReplace,
|
|
||||||
aReferrer, aReferrerPolicy,
|
|
||||||
aTriggeringPrincipal, principalToInherit,
|
|
||||||
aFlags, aTypeHint, aPostData, aHeadersData,
|
|
||||||
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
|
|
||||||
aSourceDocShell, aBaseURI, false);
|
|
||||||
// We don't need any success handler since in that case
|
|
||||||
// OnPartialSessionHistoryDeactive would be called, and it would ensure
|
|
||||||
// docshell loads about:blank.
|
|
||||||
bool shouldSwitch = false;
|
|
||||||
rv = browserChrome3->ShouldSwitchToPrerenderedDocument(
|
|
||||||
aURI, mCurrentURI, nullptr, ev, &shouldSwitch);
|
|
||||||
if (NS_SUCCEEDED(rv) && shouldSwitch) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Whenever a top-level browsing context is navigated, the user agent MUST
|
// Whenever a top-level browsing context is navigated, the user agent MUST
|
||||||
// lock the orientation of the document to the document's default
|
// lock the orientation of the document to the document's default
|
||||||
// orientation. We don't explicitly check for a top-level browsing context
|
// orientation. We don't explicitly check for a top-level browsing context
|
||||||
|
@ -12558,7 +12525,6 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||||
srcdoc,
|
srcdoc,
|
||||||
nullptr, // Source docshell, see comment above
|
nullptr, // Source docshell, see comment above
|
||||||
baseURI,
|
baseURI,
|
||||||
false,
|
|
||||||
nullptr, // No nsIDocShell
|
nullptr, // No nsIDocShell
|
||||||
nullptr); // No nsIRequest
|
nullptr); // No nsIRequest
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -14064,7 +14030,6 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||||
NullString(), // No srcdoc
|
NullString(), // No srcdoc
|
||||||
this, // We are the source
|
this, // We are the source
|
||||||
nullptr, // baseURI not needed
|
nullptr, // baseURI not needed
|
||||||
true, // Check for prerendered doc
|
|
||||||
aDocShell, // DocShell out-param
|
aDocShell, // DocShell out-param
|
||||||
aRequest); // Request out-param
|
aRequest); // Request out-param
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -14721,14 +14686,6 @@ nsDocShell::GetCommandManager()
|
||||||
return mCommandManager;
|
return mCommandManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocShell::GetIsProcessLocked(bool* aIsLocked)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aIsLocked);
|
|
||||||
*aIsLocked = GetProcessLockReason() != PROCESS_LOCK_NONE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetProcessLockReason(uint32_t* aReason)
|
nsDocShell::GetProcessLockReason(uint32_t* aReason)
|
||||||
{
|
{
|
||||||
|
|
|
@ -327,8 +327,7 @@ protected:
|
||||||
// passed in, the about:blank principal will end up being used.
|
// passed in, the about:blank principal will end up being used.
|
||||||
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||||
nsIURI* aBaseURI,
|
nsIURI* aBaseURI,
|
||||||
bool aTryToSaveOldPresentation = true,
|
bool aTryToSaveOldPresentation = true);
|
||||||
bool aCheckPermitUnload = true);
|
|
||||||
nsresult CreateContentViewer(const nsACString& aContentType,
|
nsresult CreateContentViewer(const nsACString& aContentType,
|
||||||
nsIRequest* aRequest,
|
nsIRequest* aRequest,
|
||||||
nsIStreamListener** aContentHandler);
|
nsIStreamListener** aContentHandler);
|
||||||
|
|
|
@ -187,11 +187,10 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
in nsIInputStream aHeadersStream,
|
in nsIInputStream aHeadersStream,
|
||||||
in unsigned long aLoadFlags,
|
in unsigned long aLoadFlags,
|
||||||
in nsISHEntry aSHEntry,
|
in nsISHEntry aSHEntry,
|
||||||
in boolean aFirstParty,
|
in boolean firstParty,
|
||||||
in AString aSrcdoc,
|
in AString aSrcdoc,
|
||||||
in nsIDocShell aSourceDocShell,
|
in nsIDocShell aSourceDocShell,
|
||||||
in nsIURI aBaseURI,
|
in nsIURI aBaseURI,
|
||||||
in boolean aCheckForPrerender,
|
|
||||||
out nsIDocShell aDocShell,
|
out nsIDocShell aDocShell,
|
||||||
out nsIRequest aRequest);
|
out nsIRequest aRequest);
|
||||||
|
|
||||||
|
@ -674,13 +673,6 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
*/
|
*/
|
||||||
void createAboutBlankContentViewer(in nsIPrincipal aPrincipal);
|
void createAboutBlankContentViewer(in nsIPrincipal aPrincipal);
|
||||||
|
|
||||||
/**
|
|
||||||
* Like createAboutBlankContentViewer, but don't check for permit unload.
|
|
||||||
* Only used by special session history operation.
|
|
||||||
* @param aPrincipal the principal to use for the new document.
|
|
||||||
*/
|
|
||||||
[noscript] void forceCreateAboutBlankContentViewer(in nsIPrincipal aPrincipal);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upon getting, returns the canonical encoding label of the document
|
* Upon getting, returns the canonical encoding label of the document
|
||||||
* currently loaded into this docshell.
|
* currently loaded into this docshell.
|
||||||
|
@ -1115,12 +1107,7 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
* A DocShell is locked to the current process if it would be
|
* A DocShell is locked to the current process if it would be
|
||||||
* content-observable for a process switch to occur before performing a
|
* content-observable for a process switch to occur before performing a
|
||||||
* navigation load. It is important to ensure that a DocShell is not process
|
* navigation load. It is important to ensure that a DocShell is not process
|
||||||
* locked before performing process changing loads.
|
* locked before perfoming process changing loads.
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isProcessLocked;
|
|
||||||
/**
|
|
||||||
* Return PROCESS_LOCK_NONE if docShell is not locked to current process,
|
|
||||||
* otherwise return the reason why process is locked.
|
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute unsigned long processLockReason;
|
[infallible] readonly attribute unsigned long processLockReason;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -510,10 +510,7 @@ nsSHistory::OnPartialSessionHistoryDeactive()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point we've swapped out to an invisble tab, and can not prompt here.
|
if (NS_FAILED(mRootDocShell->CreateAboutBlankContentViewer(nullptr))) {
|
||||||
// The check should have been done in nsDocShell::InternalLoad, so we'd
|
|
||||||
// just force docshell to load about:blank.
|
|
||||||
if (NS_FAILED(mRootDocShell->ForceCreateAboutBlankContentViewer(nullptr))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,16 +225,7 @@ GroupedSHistory::PurgePartialHistories(uint32_t aLastPartialIndexToKeep)
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
GroupedSHistory::GroupedHistoryEnabled() {
|
GroupedSHistory::GroupedHistoryEnabled() {
|
||||||
static bool sGroupedSHistoryEnabled = false;
|
return Preferences::GetBool("browser.groupedhistory.enabled", false);
|
||||||
static bool sGroupedSHistoryPrefCached = false;
|
|
||||||
if (!sGroupedSHistoryPrefCached) {
|
|
||||||
sGroupedSHistoryPrefCached = true;
|
|
||||||
Preferences::AddBoolVarCache(&sGroupedSHistoryEnabled,
|
|
||||||
"browser.groupedhistory.enabled",
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sGroupedSHistoryEnabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -85,7 +85,7 @@ Link::CancelDNSPrefetch(nsWrapperCache::FlagsType aDeferredFlag,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Link::TryDNSPrefetchPreconnectOrPrefetchOrPrerender()
|
Link::TryDNSPrefetchPreconnectOrPrefetch()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mElement->IsInComposedDoc());
|
MOZ_ASSERT(mElement->IsInComposedDoc());
|
||||||
if (!ElementHasHref()) {
|
if (!ElementHasHref()) {
|
||||||
|
@ -128,14 +128,6 @@ Link::TryDNSPrefetchPreconnectOrPrefetchOrPrerender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkTypes & nsStyleLinkElement::ePRERENDER) {
|
|
||||||
nsCOMPtr<nsIURI> uri(GetURI());
|
|
||||||
if (uri && mElement->OwnerDoc()) {
|
|
||||||
mElement->OwnerDoc()->PrerenderHref(uri);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (linkTypes & nsStyleLinkElement::eDNS_PREFETCH) {
|
if (linkTypes & nsStyleLinkElement::eDNS_PREFETCH) {
|
||||||
if (nsHTMLDNSPrefetch::IsAllowed(mElement->OwnerDoc())) {
|
if (nsHTMLDNSPrefetch::IsAllowed(mElement->OwnerDoc())) {
|
||||||
nsHTMLDNSPrefetch::PrefetchLow(this);
|
nsHTMLDNSPrefetch::PrefetchLow(this);
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
nsWrapperCache::FlagsType aRequestedFlag);
|
nsWrapperCache::FlagsType aRequestedFlag);
|
||||||
|
|
||||||
// This is called by HTMLLinkElement.
|
// This is called by HTMLLinkElement.
|
||||||
void TryDNSPrefetchPreconnectOrPrefetchOrPrerender();
|
void TryDNSPrefetchPreconnectOrPrefetch();
|
||||||
void CancelPrefetch();
|
void CancelPrefetch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -716,14 +716,6 @@ nsContentSink::ProcessLink(const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||||
PrefetchHref(aHref, mDocument, hasPrefetch);
|
PrefetchHref(aHref, mDocument, hasPrefetch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkTypes & nsStyleLinkElement::ePRERENDER) {
|
|
||||||
nsCOMPtr<nsIURI> href;
|
|
||||||
nsresult rv = NS_NewURI(getter_AddRefs(href), aHref);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
mDocument->PrerenderHref(href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aHref.IsEmpty() && (linkTypes & nsStyleLinkElement::eDNS_PREFETCH)) {
|
if (!aHref.IsEmpty() && (linkTypes & nsStyleLinkElement::eDNS_PREFETCH)) {
|
||||||
PrefetchDNS(aHref);
|
PrefetchDNS(aHref);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2918,73 +2918,6 @@ nsIDocument::IsScriptTracking(const nsACString& aURL) const
|
||||||
return mTrackingScripts.Contains(aURL);
|
return mTrackingScripts.Contains(aURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
nsIDocument::PrerenderHref(nsIURI* aHref)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aHref);
|
|
||||||
|
|
||||||
static bool sPrerenderEnabled = false;
|
|
||||||
static bool sPrerenderPrefCached = false;
|
|
||||||
if (!sPrerenderPrefCached) {
|
|
||||||
sPrerenderPrefCached = true;
|
|
||||||
Preferences::AddBoolVarCache(&sPrerenderEnabled,
|
|
||||||
"dom.linkPrerender.enabled",
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if prerender is enabled
|
|
||||||
if (!sPrerenderEnabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> referrer = GetDocumentURI();
|
|
||||||
bool urisMatch = false;
|
|
||||||
aHref->EqualsExceptRef(referrer, &urisMatch);
|
|
||||||
if (urisMatch) {
|
|
||||||
// Prerender current document isn't quite meaningful, and we may not be able
|
|
||||||
// to load it out of process.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
|
|
||||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(docShell);
|
|
||||||
NS_ENSURE_TRUE(webNav, false);
|
|
||||||
|
|
||||||
bool canGoForward = false;
|
|
||||||
nsresult rv = webNav->GetCanGoForward(&canGoForward);
|
|
||||||
if (NS_FAILED(rv) || canGoForward) {
|
|
||||||
// Skip prerender on history navigation as we don't support it yet.
|
|
||||||
// Remove this check once bug 1323650 is implemented.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the document is in prerender state. We don't prerender in a
|
|
||||||
// prerendered document.
|
|
||||||
if (docShell->GetIsPrerendered()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adopting an out-of-process prerendered document is conceptually similar to
|
|
||||||
// switching dochshell's process, since it's the same browsing context from
|
|
||||||
// other browsing contexts' perspective. If we're locked in current process,
|
|
||||||
// we can not prerender out-of-process.
|
|
||||||
if (docShell->GetIsProcessLocked()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TabChild* tabChild = TabChild::GetFrom(docShell);
|
|
||||||
NS_ENSURE_TRUE(tabChild, false);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWebBrowserChrome3> wbc3;
|
|
||||||
tabChild->GetWebBrowserChrome(getter_AddRefs(wbc3));
|
|
||||||
NS_ENSURE_TRUE(wbc3, false);
|
|
||||||
|
|
||||||
rv = wbc3->StartPrerenderingDocument(aHref, referrer);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetApplicationCache(nsIApplicationCache **aApplicationCache)
|
nsDocument::GetApplicationCache(nsIApplicationCache **aApplicationCache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2881,8 +2881,6 @@ public:
|
||||||
void NoteScriptTrackingStatus(const nsACString& aURL, bool isTracking);
|
void NoteScriptTrackingStatus(const nsACString& aURL, bool isTracking);
|
||||||
bool IsScriptTracking(const nsACString& aURL) const;
|
bool IsScriptTracking(const nsACString& aURL) const;
|
||||||
|
|
||||||
bool PrerenderHref(nsIURI* aHref);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,9 +162,7 @@ static uint32_t ToLinkMask(const nsAString& aLink, nsIPrincipal* aPrincipal)
|
||||||
return nsStyleLinkElement::eHTMLIMPORT;
|
return nsStyleLinkElement::eHTMLIMPORT;
|
||||||
else if (aLink.EqualsLiteral("preconnect"))
|
else if (aLink.EqualsLiteral("preconnect"))
|
||||||
return nsStyleLinkElement::ePRECONNECT;
|
return nsStyleLinkElement::ePRECONNECT;
|
||||||
else if (aLink.EqualsLiteral("prerender"))
|
else
|
||||||
return nsStyleLinkElement::ePRERENDER;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,7 @@ public:
|
||||||
eNEXT = 0x00000008,
|
eNEXT = 0x00000008,
|
||||||
eALTERNATE = 0x00000010,
|
eALTERNATE = 0x00000010,
|
||||||
eHTMLIMPORT = 0x00000020,
|
eHTMLIMPORT = 0x00000020,
|
||||||
ePRECONNECT = 0x00000040,
|
ePRECONNECT = 0x00000040
|
||||||
ePRERENDER = 0x00000080
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The return value is a bitwise or of 0 or more RelValues.
|
// The return value is a bitwise or of 0 or more RelValues.
|
||||||
|
|
|
@ -169,7 +169,7 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsInComposedDoc()) {
|
if (IsInComposedDoc()) {
|
||||||
TryDNSPrefetchPreconnectOrPrefetchOrPrerender();
|
TryDNSPrefetchPreconnectOrPrefetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
|
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
|
||||||
|
@ -389,7 +389,7 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
if ((aName == nsGkAtoms::rel || aName == nsGkAtoms::href) &&
|
if ((aName == nsGkAtoms::rel || aName == nsGkAtoms::href) &&
|
||||||
IsInComposedDoc()) {
|
IsInComposedDoc()) {
|
||||||
TryDNSPrefetchPreconnectOrPrefetchOrPrerender();
|
TryDNSPrefetchPreconnectOrPrefetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStyleSheetInternal(nullptr, nullptr,
|
UpdateStyleSheetInternal(nullptr, nullptr,
|
||||||
|
|
|
@ -108,8 +108,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1069772
|
||||||
|
|
||||||
function makePrerenderedBrowserActive(browser) {
|
function makePrerenderedBrowserActive(browser) {
|
||||||
let promise = waitForVisibilityChange(browser);
|
let promise = waitForVisibilityChange(browser);
|
||||||
browser.removeAttribute('prerendered');
|
browser.setAttribute('prerendered', false);
|
||||||
browser.frameLoader.makePrerenderedLoaderActive();
|
browser.makePrerenderedBrowserActive();
|
||||||
return promise.then(() => browser);
|
return promise.then(() => browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1271240
|
||||||
}
|
}
|
||||||
|
|
||||||
function makePrerenderedBrowserActive(browser) {
|
function makePrerenderedBrowserActive(browser) {
|
||||||
browser.frameLoader.makePrerenderedLoaderActive();
|
browser.makePrerenderedBrowserActive();
|
||||||
return browser;
|
return browser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
interface nsIDocShell;
|
interface nsIDocShell;
|
||||||
interface nsIInputStream;
|
interface nsIInputStream;
|
||||||
interface nsIRunnable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsIWebBrowserChrome3 is an extension to nsIWebBrowserChrome2.
|
* nsIWebBrowserChrome3 is an extension to nsIWebBrowserChrome2.
|
||||||
|
@ -61,36 +60,4 @@ interface nsIWebBrowserChrome3 : nsIWebBrowserChrome2
|
||||||
bool reloadInFreshProcess(in nsIDocShell aDocShell,
|
bool reloadInFreshProcess(in nsIDocShell aDocShell,
|
||||||
in nsIURI aURI,
|
in nsIURI aURI,
|
||||||
in nsIURI aReferrer);
|
in nsIURI aReferrer);
|
||||||
|
|
||||||
/**
|
|
||||||
* Tell the browser to start prerendering the given document. This prerendering
|
|
||||||
* _must_ be for the toplevel document.
|
|
||||||
*
|
|
||||||
* @param aHref The URI to begin prerendering
|
|
||||||
* @param aReferrer The URI of the document requesting the prerender.
|
|
||||||
*/
|
|
||||||
void startPrerenderingDocument(in nsIURI aHref, in nsIURI aReferrer);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if there's a prerendered document which matches given URI /
|
|
||||||
* referrer, and try to switch to the prerendered document immediately if
|
|
||||||
* there is.
|
|
||||||
*
|
|
||||||
* @param aHref
|
|
||||||
* The URI which is being loaded.
|
|
||||||
* @param aReferrer
|
|
||||||
* The referrer for the current load.
|
|
||||||
* @param aSuccess
|
|
||||||
* (Optional) a runnable which will be run if the swap is successful.
|
|
||||||
* @param aFailure
|
|
||||||
* (Optional) a runnable which will be run if the swap is not
|
|
||||||
* successful. Note it's not invoked if the function returns false.
|
|
||||||
*
|
|
||||||
* @return True if there is a matched prerendered document to swap with,
|
|
||||||
* false otherwise.
|
|
||||||
*/
|
|
||||||
bool shouldSwitchToPrerenderedDocument(in nsIURI aHref,
|
|
||||||
in nsIURI aReferrer,
|
|
||||||
in nsIRunnable aSuccess,
|
|
||||||
in nsIRunnable aFailure);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -307,6 +307,17 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="makePrerenderedBrowserActive">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
let frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
|
||||||
|
if (frameLoader) {
|
||||||
|
frameLoader.makePrerenderedLoaderActive();
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<property name="imageDocument"
|
<property name="imageDocument"
|
||||||
readonly="true">
|
readonly="true">
|
||||||
<getter>
|
<getter>
|
||||||
|
|
|
@ -423,24 +423,6 @@ NS_IMETHODIMP nsContentTreeOwner::ReloadInFreshProcess(nsIDocShell* aDocShell,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsContentTreeOwner::StartPrerenderingDocument(nsIURI* aHref,
|
|
||||||
nsIURI* aReferrer)
|
|
||||||
{
|
|
||||||
NS_WARNING("Cannot prerender a document in the parent process");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsContentTreeOwner::ShouldSwitchToPrerenderedDocument(nsIURI* aHref,
|
|
||||||
nsIURI* aReferrer,
|
|
||||||
nsIRunnable* aSuccess,
|
|
||||||
nsIRunnable* aFailure,
|
|
||||||
bool* aRetval)
|
|
||||||
{
|
|
||||||
NS_WARNING("Cannot switch to prerendered document in the parent process");
|
|
||||||
*aRetval = false;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// nsContentTreeOwner::nsIWebBrowserChrome2
|
// nsContentTreeOwner::nsIWebBrowserChrome2
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
Загрузка…
Ссылка в новой задаче