diff --git a/browser/base/content/browser-feeds.js b/browser/base/content/browser-feeds.js index 7bba3954082..5c5d4b2a892 100644 --- a/browser/base/content/browser-feeds.js +++ b/browser/base/content/browser-feeds.js @@ -95,7 +95,7 @@ var FeedHandler = { var feedURI = makeURI(href, document.characterSet); // Use the feed scheme so X-Moz-Is-Feed will be set // The value doesn't matter - if (/^https?$/.test(feedURI.scheme)) + if (/^https?/.test(feedURI.scheme)) href = "feed:" + href; this.loadFeed(href, event); }, diff --git a/browser/base/content/browser-safebrowsing.js b/browser/base/content/browser-safebrowsing.js index a34233d0db6..96cf1f35897 100644 --- a/browser/base/content/browser-safebrowsing.js +++ b/browser/base/content/browser-safebrowsing.js @@ -8,7 +8,7 @@ var gSafeBrowsing = { setReportPhishingMenu: function() { // A phishing page will have a specific about:blocked content documentURI - var isPhishingPage = content.document.documentURI.startsWith("about:blocked?e=phishingBlocked"); + var isPhishingPage = /^about:blocked\?e=phishingBlocked/.test(content.document.documentURI); // Show/hide the appropriate menu item. document.getElementById("menu_HelpPopup_reportPhishingtoolmenu") diff --git a/browser/base/content/browser-tabPreviews.js b/browser/base/content/browser-tabPreviews.js index c90480b143b..2e0c082c598 100644 --- a/browser/base/content/browser-tabPreviews.js +++ b/browser/base/content/browser-tabPreviews.js @@ -735,7 +735,7 @@ var allTabs = { }, handleEvent: function allTabs_handleEvent(event) { - if (event.type.startsWith("Tab")) { + if (/^Tab/.test(event.type)) { var tab = event.target; if (event.type != "TabOpen") var preview = this._getPreview(tab); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index e3f72f435a8..917719d46fb 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2521,13 +2521,13 @@ let BrowserOnClick = { // If the event came from an ssl error page, it is probably either the "Add // Exception…" or "Get me out of here!" button - if (ownerDoc.documentURI.startsWith("about:certerror")) { + if (/^about:certerror/.test(ownerDoc.documentURI)) { this.onAboutCertError(originalTarget, ownerDoc); } - else if (ownerDoc.documentURI.startsWith("about:blocked")) { + else if (/^about:blocked/.test(ownerDoc.documentURI)) { this.onAboutBlocked(originalTarget, ownerDoc); } - else if (ownerDoc.documentURI.startsWith("about:neterror")) { + else if (/^about:neterror/.test(ownerDoc.documentURI)) { this.onAboutNetError(originalTarget, ownerDoc); } else if (/^about:home$/i.test(ownerDoc.documentURI)) { @@ -4481,7 +4481,7 @@ var TabsProgressListener = { if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && Components.isSuccessCode(aStatus) && - aWebProgress.DOMWindow.document.documentURI.startsWith("about:")) { + /^about:/.test(aWebProgress.DOMWindow.document.documentURI)) { aBrowser.addEventListener("click", BrowserOnClick, true); aBrowser.addEventListener("pagehide", function onPageHide(event) { if (event.target.defaultView.frameElement) diff --git a/browser/base/content/pageinfo/pageInfo.js b/browser/base/content/pageinfo/pageInfo.js index 27a42d8594c..cbabcab36ae 100644 --- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -161,7 +161,7 @@ gImageView.getCellProperties = function(row, col, props) { var item = gImageView.data[row][COL_IMAGE_NODE]; if (!checkProtocol(data) || item instanceof HTMLEmbedElement || - (item instanceof HTMLObjectElement && !item.type.startsWith("image/")) + (item instanceof HTMLObjectElement && !/^image\//.test(item.type))) props.AppendElement(this._brokenAtom); if (col.element.id == "image-address") @@ -945,7 +945,7 @@ function makePreview(row) mimeType = getContentTypeFromHeaders(cacheEntry); // if we have a data url, get the MIME type from the url - if (!mimeType && url.startsWith("data:")) { + if (!mimeType && /^data:/.test(url)) { let dataMimeType = /^data:(image\/[^;,]+)/i.exec(url); if (dataMimeType) mimeType = dataMimeType[1].toLowerCase(); @@ -987,7 +987,7 @@ function makePreview(row) if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement || item instanceof HTMLImageElement || item instanceof SVGImageElement || - (item instanceof HTMLObjectElement && mimeType.startsWith("image/")) || isBG) && isProtocolAllowed) { + (item instanceof HTMLObjectElement && /^image\//.test(mimeType)) || isBG) && isProtocolAllowed) { newImage.setAttribute("src", url); physWidth = newImage.width || 0; physHeight = newImage.height || 0; diff --git a/browser/base/content/pageinfo/permissions.js b/browser/base/content/pageinfo/permissions.js index 511139bd1f7..210327802ed 100644 --- a/browser/base/content/pageinfo/permissions.js +++ b/browser/base/content/pageinfo/permissions.js @@ -83,7 +83,7 @@ function onLoadPermission() var uri = gDocument.documentURIObject; var permTab = document.getElementById("permTab"); - if (/^https?$/.test(uri.scheme)) { + if(/^https?/.test(uri.scheme)) { gPermURI = uri; var hostText = document.getElementById("hostText"); hostText.value = gPermURI.host; diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index f69a29d0fe2..344da99d995 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -645,7 +645,7 @@