Backed out changeset 3ca1f19e4c2a (bug 792968) for mochitest-oth failures

This commit is contained in:
Benjamin Peterson 2012-09-23 12:25:39 -04:00
parent d78b3767d6
commit 25758be060
15 changed files with 22 additions and 22 deletions

View File

@ -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);
},

View File

@ -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")

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -645,7 +645,7 @@
<method name="_parseActionUrl">
<parameter name="aUrl"/>
<body><![CDATA[
if (!aUrl.startsWith("moz-action:"))
if (!/^moz-action:/.test(aUrl))
return null;
// url is in the format moz-action:ACTION,PARAM
@ -1615,7 +1615,7 @@
// otherwise just rely on the panel id for common arrowpanels.
let type = this._panel.firstChild.getAttribute("popupid") ||
this._panel.id;
if (type.startsWith("password-"))
if (/^password-/.test(type))
return "passwords";
if (type == "editBookmarkPanel")
return "bookmarks";

View File

@ -12,7 +12,7 @@ function testBrokenCert() {
window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
// Confirm that we are displaying the contributed error page, not the default
ok(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
ok(/^about:certerror/.test(gBrowser.contentDocument.documentURI), "Broken page should go to about:certerror, not about:neterror");
// Confirm that the expert section is collapsed
var expertDiv = gBrowser.contentDocument.getElementById("expertContent");

View File

@ -864,7 +864,7 @@ DownloadsDataItem.prototype = {
// The download database may contain targets stored as file URLs or native
// paths. This can still be true for previously stored items, even if new
// items are stored using their file URL. See also bug 239948 comment 12.
if (this.file.startsWith("file:")) {
if (/^file:/.test(this.file)) {
// Assume the file URL we obtained from the downloads database or from the
// "spec" property of the target has the UTF-8 charset.
let fileUrl = NetUtil.newURI(this.file).QueryInterface(Ci.nsIFileURL);

View File

@ -1340,7 +1340,7 @@ FeedWriter.prototype = {
_setFaviconForWebReader:
function FW__setFaviconForWebReader(aReaderUrl, aMenuItem) {
var readerURI = makeURI(aReaderUrl);
if (!/^https?$/.test(readerURI.scheme)) {
if (!/^https?/.test(readerURI.scheme)) {
// Don't try to get a favicon for non http(s) URIs.
return;
}

View File

@ -1425,13 +1425,13 @@ let PlacesControllerDragHelper = {
if (ip.isTag && ip.orientation == Ci.nsITreeView.DROP_ON &&
dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
dragged.uri.startsWith("place:")))
/^place:/.test(dragged.uri)))
return false;
// The following loop disallows the dropping of a folder on itself or
// on any of its descendants.
if (dragged.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER ||
dragged.uri.startsWith("place:")) {
/^place:/.test(dragged.uri)) {
let parentId = ip.itemId;
while (parentId != PlacesUtils.placesRootId) {
if (dragged.concreteId == parentId || dragged.id == parentId)

View File

@ -1887,7 +1887,7 @@ var gApplicationsPane = {
// that template (i.e. with %s in the template replaced by the URL of the
// content being handled).
if (/^https?$/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
if (/^https?/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
return uri.prePath + "/favicon.ico";
return "";

View File

@ -1874,7 +1874,7 @@ var gApplicationsPane = {
// they'll only visit URLs derived from that template (i.e. with %s
// in the template replaced by the URL of the content being handled).
if (/^https?$/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
if (/^https?/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
return uri.prePath + "/favicon.ico";
return "";

View File

@ -51,7 +51,7 @@
url = decodeURIComponent(match[1]);
// If this is a view-source page, then get then real URI of the page
if (url.startsWith("view-source:"))
if (/^view-source\:/.test(url))
url = url.slice(12);
return url;
}

View File

@ -50,7 +50,7 @@ function onTabPinned() {
// with moz-anno:favicon automatically redirects to the default favIcon
// if the given url is invalid
ok(iconSrc.startsWith("moz-anno:favicon:"),
ok(/^moz-anno:favicon:/.test(iconSrc),
"The icon url starts with moz-anno:favicon so the default fav icon would be displayed");
// At this point, as an additional integrity check we could also verify