From a1a7753655612e13632126c003f4004aaa63d793 Mon Sep 17 00:00:00 2001 From: "timeless%mac.com" Date: Thu, 14 Sep 2006 05:57:51 +0000 Subject: [PATCH] Bugzilla Bug 78619 View-source: pages have a view source option [Remove view source option] patch by bzbarsky@mit.edu r=timeless sr=alecf --- suite/browser/navigator.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/suite/browser/navigator.js b/suite/browser/navigator.js index 0ba62ee63c56..591911143d3e 100644 --- a/suite/browser/navigator.js +++ b/suite/browser/navigator.js @@ -811,8 +811,12 @@ function loadURI(uri) function BrowserLoadURL() { var url = gURLBar.value; - loadURI(getShortcutOrURI(url)); - _content.focus(); + if (url.match(/^view-source:/)) { + BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null); + } else { + loadURI(getShortcutOrURI(url)); + _content.focus(); + } } function getShortcutOrURI(url) @@ -899,11 +903,16 @@ function BrowserViewSource() if (focusedWindow) var docCharset = "charset=" + focusedWindow.document.characterSet; - //now try to open a view-source window while inheriting the charset (if any) + BrowserViewSourceOfURL(_content.location, docCharset); +} + +function BrowserViewSourceOfURL(url, charset) +{ + // try to open a view-source window while inheriting the charset (if any) openDialog("chrome://navigator/content/viewSource.xul", "_blank", "scrollbars,resizable,chrome,dialog=no", - _content.location, docCharset); + url, charset); } // doc=null for regular page, doc=owner document for frame.