From 2e0e50636fb38354ca4957e3713dd8434e0347ed Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 13 Apr 2018 10:55:02 +0200 Subject: Fix: Findbar broken (basic) Issue #138 --- application/palemoon/base/content/browser.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'application/palemoon/base/content/browser.js') diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 8b3fa0b4f..981ab5f0f 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -65,6 +65,9 @@ XPCOMUtils.defineLazyGetter(window, "gFindBar", function() { return findbar; }); +XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", + "resource://gre/modules/BrowserUtils.jsm"); + XPCOMUtils.defineLazyGetter(this, "gPrefService", function() { return Services.prefs; }); @@ -3426,26 +3429,6 @@ function updateCharacterEncodingMenuState() } } -/** - * Returns true if |aMimeType| is text-based, false otherwise. - * - * @param aMimeType - * The MIME type to check. - * - * If adding types to this function, please also check the similar - * function in findbar.xml - */ -function mimeTypeIsTextBased(aMimeType) -{ - return aMimeType.startsWith("text/") || - aMimeType.endsWith("+xml") || - aMimeType == "application/x-javascript" || - aMimeType == "application/javascript" || - aMimeType == "application/json" || - aMimeType == "application/xml" || - aMimeType == "mozilla.application/cached-xul"; -} - var XULBrowserWindow = { // Stored Status, Link and Loading values status: "", @@ -3669,7 +3652,7 @@ var XULBrowserWindow = { this.setDefaultStatus(msg); // Disable menu entries for images, enable otherwise - if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType)) + if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType)) this.isImage.removeAttribute('disabled'); else this.isImage.setAttribute('disabled', 'true'); @@ -3717,7 +3700,7 @@ var XULBrowserWindow = { } // Disable menu entries for images, enable otherwise - if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType)) + if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType)) this.isImage.removeAttribute('disabled'); else this.isImage.setAttribute('disabled', 'true'); -- cgit v1.2.3