Bug 1201535 - Open view source tabs with about:blank. r=bz

Loading a view source tab as "about:blank" gets us the fresh tab we need without
making redundant requests.  The view source module will retrieve the actual data
as needed.
This commit is contained in:
J. Ryan Stinnett 2015-09-22 13:33:55 -05:00
Родитель f40c529084
Коммит eab474923e
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -2373,7 +2373,6 @@ function BrowserViewSourceOfDocument(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
@ -2384,7 +2383,12 @@ function BrowserViewSourceOfDocument(aArgsOrDocument) {
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
});