author | J. Ryan Stinnett <jryans@gmail.com> |
Tue, 22 Sep 2015 13:33:55 -0500 | |
changeset 264295 | 82fd00bfb1dd714660b060465642f103c2d72f08 |
parent 264294 | 8045d8fcbfe5474276037faccb5863746830326b |
child 264296 | 83e1422aecc8b79316839b5bcbd16b859c2f0426 |
push id | 65590 |
push user | kwierso@gmail.com |
push date | Fri, 25 Sep 2015 00:14:23 +0000 |
treeherder | mozilla-inbound@0ab67cace54f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 1201535 |
milestone | 44.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2368,28 +2368,32 @@ function BrowserViewSourceOfDocument(aAr args = { browser, outerWindowID, URL }; } else { args = aArgsOrDocument; } let viewInternal = () => { let inTab = Services.prefs.getBoolPref("view_source.tab"); if (inTab) { - let viewSourceURL = `view-source:${args.URL}`; let tabBrowser = gBrowser; // In the case of sidebars and chat windows, gBrowser is defined but null, // because no #content element exists. For these cases, we need to find // the most recent browser window. // In the case of popups, we need to find a non-popup browser window. if (!tabBrowser || !window.toolbar.visible) { // This returns only non-popup browser windows by default. let browserWindow = RecentWindow.getMostRecentBrowserWindow(); tabBrowser = browserWindow.gBrowser; } - let tab = tabBrowser.loadOneTab(viewSourceURL, { + // `viewSourceInBrowser` will load the source content from the page + // descriptor for the tab (when possible) or fallback to the network if + // that fails. Either way, the view source module will manage the tab's + // location, so use "about:blank" here to avoid unnecessary redundant + // requests. + let tab = tabBrowser.loadOneTab("about:blank", { relatedToCurrent: true, inBackground: false }); args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab); top.gViewSourceUtils.viewSourceInBrowser(args); } else { top.gViewSourceUtils.viewSource(args); }