diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc
index cd7b2ede3ae7..7d2e5befd6d6 100644
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -382,7 +382,7 @@
label="&viewPageSourceCmd.label;"
accesskey="&viewPageSourceCmd.accesskey;"
oncommand="BrowserViewSource(gContextMenu.browser);"
- observes="canViewSource"/>
+ observes="isImage"/>
-
+
@@ -174,7 +174,6 @@
oncommand="gPopupBlockerObserver.dontShowMessage();"/>
-
@@ -232,9 +231,7 @@
+ command="View:PageSource"/>
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 93340060b9c6..4998dce4573f 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4049,10 +4049,6 @@ var XULBrowserWindow = {
delete this.isImage;
return this.isImage = document.getElementById("isImage");
},
- get canViewSource () {
- delete this.canViewSource;
- return this.canViewSource = document.getElementById("canViewSource");
- },
init: function () {
// Initialize the security button's state and tooltip text.
@@ -4210,7 +4206,6 @@ var XULBrowserWindow = {
if (aRequest) {
let msg = "";
let location;
- let canViewSource = true;
// Get the URI either from a channel or a pseudo-object
if (aRequest instanceof nsIChannel || "URI" in aRequest) {
location = aRequest.URI;
@@ -4219,9 +4214,6 @@ var XULBrowserWindow = {
if (location.scheme == "keyword" && aWebProgress.isTopLevel)
gBrowser.userTypedValue = null;
- canViewSource = !Services.prefs.getBoolPref("view_source.tab") ||
- location.scheme != "view-source";
-
if (location.spec != "about:blank") {
switch (aStatus) {
case Components.results.NS_ERROR_NET_TIMEOUT:
@@ -4235,18 +4227,10 @@ var XULBrowserWindow = {
this.setDefaultStatus(msg);
// Disable menu entries for images, enable otherwise
- if (browser.documentContentType && BrowserUtils.mimeTypeIsTextBased(browser.documentContentType)) {
+ if (browser.documentContentType && BrowserUtils.mimeTypeIsTextBased(browser.documentContentType))
this.isImage.removeAttribute('disabled');
- } else {
- canViewSource = false;
+ else
this.isImage.setAttribute('disabled', 'true');
- }
-
- if (canViewSource) {
- this.canViewSource.removeAttribute('disabled');
- } else {
- this.canViewSource.setAttribute('disabled', 'true');
- }
}
this.isBusy = false;
diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini
index 0556e28261fd..a192bbb08ab5 100644
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -475,7 +475,6 @@ skip-if = os == "linux" || e10s # Bug 1073339 - Investigate autocomplete test un
[browser_urlbar_search_healthreport.js]
[browser_urlbar_searchsettings.js]
[browser_utilityOverlay.js]
-[browser_viewSourceInTabOnViewSource.js]
[browser_visibleFindSelection.js]
[browser_visibleLabel.js]
[browser_visibleTabs.js]
diff --git a/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js b/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js
deleted file mode 100644
index 4aec2a64e2f3..000000000000
--- a/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js
+++ /dev/null
@@ -1,31 +0,0 @@
-add_task(function*() {
- yield new Promise((resolve) => {
- SpecialPowers.pushPrefEnv({"set": [
- ["view_source.tab", true],
- ]}, resolve);
- });
-});
-
-add_task(function* test_regular_page() {
- function* test_expect_view_source_enabled(browser) {
- ok(!XULBrowserWindow.canViewSource.hasAttribute("disabled"),
- "View Source should be enabled");
- }
-
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "http://example.com",
- }, test_expect_view_source_enabled);
-});
-
-add_task(function* test_view_source_page() {
- function* test_expect_view_source_disabled(browser) {
- ok(XULBrowserWindow.canViewSource.hasAttribute("disabled"),
- "View Source should be disabled");
- }
-
- yield BrowserTestUtils.withNewTab({
- gBrowser,
- url: "view-source:http://example.com",
- }, test_expect_view_source_disabled);
-});