Skip to content

Commit

Permalink
Backed out 3 changesets (bug 1703953) for causing multiple failures. …
Browse files Browse the repository at this point in the history
…CLOSED TREE

Backed out changeset 871a1fac289e (bug 1703953)
Backed out changeset 8151244bda18 (bug 1703953)
Backed out changeset eaf6d4c353be (bug 1703953)
  • Loading branch information
crisscozmuta committed Mar 29, 2022
1 parent a753693 commit 4eec7e2
Show file tree
Hide file tree
Showing 66 changed files with 180 additions and 334 deletions.
2 changes: 1 addition & 1 deletion browser/actors/AboutReaderChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class AboutReaderChild extends JSWindowActorChild {
!this.isAboutReader &&
this.contentWindow &&
this.contentWindow.windowRoot &&
this.contentWindow.HTMLDocument.isInstance(this.document) &&
this.document instanceof this.contentWindow.HTMLDocument &&
!this.document.mozSyntheticDocument
);
}
Expand Down
35 changes: 16 additions & 19 deletions browser/actors/ContextMenuChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class ContextMenuChild extends JSWindowActorChild {
if (node.nodeType == node.TEXT_NODE) {
// Add this text to our collection.
text += " " + node.data;
} else if (this.contentWindow.HTMLImageElement.isInstance(node)) {
} else if (node instanceof this.contentWindow.HTMLImageElement) {
// If it has an "alt" attribute, add that.
let altText = node.getAttribute("alt");
if (altText && altText != "") {
Expand Down Expand Up @@ -463,11 +463,11 @@ class ContextMenuChild extends JSWindowActorChild {
}

_isTargetATextBox(node) {
if (this.contentWindow.HTMLInputElement.isInstance(node)) {
if (node instanceof this.contentWindow.HTMLInputElement) {
return node.mozIsTextField(false);
}

return this.contentWindow.HTMLTextAreaElement.isInstance(node);
return node instanceof this.contentWindow.HTMLTextAreaElement;
}

/**
Expand Down Expand Up @@ -800,9 +800,9 @@ class ContextMenuChild extends JSWindowActorChild {
if (node.containingShadowRoot?.isUAWidget()) {
const host = node.containingShadowRoot.host;
if (
this.contentWindow.HTMLMediaElement.isInstance(host) ||
this.contentWindow.HTMLEmbedElement.isInstance(host) ||
this.contentWindow.HTMLObjectElement.isInstance(host)
host instanceof this.contentWindow.HTMLMediaElement ||
host instanceof this.contentWindow.HTMLEmbedElement ||
host instanceof this.contentWindow.HTMLObjectElement
) {
node = host;
}
Expand Down Expand Up @@ -973,10 +973,10 @@ class ContextMenuChild extends JSWindowActorChild {
imageText: context.target.title || context.target.alt,
};
const { SVGAnimatedLength } = context.target.ownerGlobal;
if (SVGAnimatedLength.isInstance(context.imageInfo.height)) {
if (context.imageInfo.height instanceof SVGAnimatedLength) {
context.imageInfo.height = context.imageInfo.height.animVal.value;
}
if (SVGAnimatedLength.isInstance(context.imageInfo.width)) {
if (context.imageInfo.width instanceof SVGAnimatedLength) {
context.imageInfo.width = context.imageInfo.width.animVal.value;
}

Expand Down Expand Up @@ -1033,11 +1033,9 @@ class ContextMenuChild extends JSWindowActorChild {
descURL
);
}
} else if (
this.contentWindow.HTMLCanvasElement.isInstance(context.target)
) {
} else if (context.target instanceof this.contentWindow.HTMLCanvasElement) {
context.onCanvas = true;
} else if (this.contentWindow.HTMLVideoElement.isInstance(context.target)) {
} else if (context.target instanceof this.contentWindow.HTMLVideoElement) {
const mediaURL = context.target.currentSrc || context.target.src;

if (this._isMediaURLReusable(mediaURL)) {
Expand All @@ -1063,7 +1061,7 @@ class ContextMenuChild extends JSWindowActorChild {
} else {
context.onVideo = true;
}
} else if (this.contentWindow.HTMLAudioElement.isInstance(context.target)) {
} else if (context.target instanceof this.contentWindow.HTMLAudioElement) {
context.onAudio = true;
const mediaURL = context.target.currentSrc || context.target.src;

Expand Down Expand Up @@ -1094,7 +1092,7 @@ class ContextMenuChild extends JSWindowActorChild {
}

context.onKeywordField = editFlags & SpellCheckHelper.KEYWORD;
} else if (this.contentWindow.HTMLHtmlElement.isInstance(context.target)) {
} else if (context.target instanceof this.contentWindow.HTMLHtmlElement) {
const bodyElt = context.target.ownerDocument.body;

if (bodyElt) {
Expand Down Expand Up @@ -1143,13 +1141,12 @@ class ContextMenuChild extends JSWindowActorChild {
// Be consistent with what hrefAndLinkNodeForClickEvent
// does in browser.js
(this._isXULTextLinkLabel(elem) ||
(this.contentWindow.HTMLAnchorElement.isInstance(elem) &&
(elem instanceof this.contentWindow.HTMLAnchorElement &&
elem.href) ||
(this.contentWindow.SVGAElement.isInstance(elem) &&
(elem instanceof this.contentWindow.SVGAElement &&
(elem.href || elem.hasAttributeNS(XLINK_NS, "href"))) ||
(this.contentWindow.HTMLAreaElement.isInstance(elem) &&
elem.href) ||
this.contentWindow.HTMLLinkElement.isInstance(elem) ||
(elem instanceof this.contentWindow.HTMLAreaElement && elem.href) ||
elem instanceof this.contentWindow.HTMLLinkElement ||
elem.getAttributeNS(XLINK_NS, "type") == "simple")
) {
// Target is a link or a descendant of a link.
Expand Down
56 changes: 28 additions & 28 deletions browser/actors/PageInfoChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class PageInfoChild extends JSWindowActorChild {
}

// One swi^H^H^Hif-else to rule them all.
if (content.HTMLImageElement.isInstance(elem)) {
if (elem instanceof content.HTMLImageElement) {
addMedia(
elem.src,
"img",
Expand All @@ -184,7 +184,7 @@ class PageInfoChild extends JSWindowActorChild {
false,
!elem.hasAttribute("alt")
);
} else if (content.SVGImageElement.isInstance(elem)) {
} else if (elem instanceof content.SVGImageElement) {
try {
// Note: makeURLAbsolute will throw if either the baseURI is not a valid URI
// or the URI formed from the baseURI and the URL is not a valid URI.
Expand All @@ -197,17 +197,17 @@ class PageInfoChild extends JSWindowActorChild {
addMedia(href, "img", "", elem, false);
}
} catch (e) {}
} else if (content.HTMLVideoElement.isInstance(elem)) {
} else if (elem instanceof content.HTMLVideoElement) {
addMedia(elem.currentSrc, "video", "", elem, false);
} else if (content.HTMLAudioElement.isInstance(elem)) {
} else if (elem instanceof content.HTMLAudioElement) {
addMedia(elem.currentSrc, "audio", "", elem, false);
} else if (content.HTMLLinkElement.isInstance(elem)) {
} else if (elem instanceof content.HTMLLinkElement) {
if (elem.rel && /\bicon\b/i.test(elem.rel)) {
addMedia(elem.href, "link", "", elem, false);
}
} else if (
content.HTMLInputElement.isInstance(elem) ||
content.HTMLButtonElement.isInstance(elem)
elem instanceof content.HTMLInputElement ||
elem instanceof content.HTMLButtonElement
) {
if (elem.type.toLowerCase() == "image") {
addMedia(
Expand All @@ -219,9 +219,9 @@ class PageInfoChild extends JSWindowActorChild {
!elem.hasAttribute("alt")
);
}
} else if (content.HTMLObjectElement.isInstance(elem)) {
} else if (elem instanceof content.HTMLObjectElement) {
addMedia(elem.data, "object", this.getValueText(elem), elem, false);
} else if (content.HTMLEmbedElement.isInstance(elem)) {
} else if (elem instanceof content.HTMLEmbedElement) {
addMedia(elem.src, "embed", "", elem, false);
}

Expand All @@ -240,12 +240,12 @@ class PageInfoChild extends JSWindowActorChild {
let imageText;
if (
!isBG &&
!content.SVGImageElement.isInstance(item) &&
!content.ImageDocument.isInstance(document)
!(item instanceof content.SVGImageElement) &&
!(document instanceof content.ImageDocument)
) {
imageText = item.title || item.alt;

if (!imageText && !content.HTMLImageElement.isInstance(item)) {
if (!imageText && !(item instanceof content.HTMLImageElement)) {
imageText = this.getValueText(item);
}
}
Expand All @@ -255,9 +255,9 @@ class PageInfoChild extends JSWindowActorChild {
result.numFrames = 1;

if (
content.HTMLObjectElement.isInstance(item) ||
content.HTMLEmbedElement.isInstance(item) ||
content.HTMLLinkElement.isInstance(item)
item instanceof content.HTMLObjectElement ||
item instanceof content.HTMLEmbedElement ||
item instanceof content.HTMLLinkElement
) {
result.mimeType = item.type;
}
Expand Down Expand Up @@ -290,13 +290,13 @@ class PageInfoChild extends JSWindowActorChild {
}
}

result.HTMLLinkElement = content.HTMLLinkElement.isInstance(item);
result.HTMLInputElement = content.HTMLInputElement.isInstance(item);
result.HTMLImageElement = content.HTMLImageElement.isInstance(item);
result.HTMLObjectElement = content.HTMLObjectElement.isInstance(item);
result.SVGImageElement = content.SVGImageElement.isInstance(item);
result.HTMLVideoElement = content.HTMLVideoElement.isInstance(item);
result.HTMLAudioElement = content.HTMLAudioElement.isInstance(item);
result.HTMLLinkElement = item instanceof content.HTMLLinkElement;
result.HTMLInputElement = item instanceof content.HTMLInputElement;
result.HTMLImageElement = item instanceof content.HTMLImageElement;
result.HTMLObjectElement = item instanceof content.HTMLObjectElement;
result.SVGImageElement = item instanceof content.SVGImageElement;
result.HTMLVideoElement = item instanceof content.HTMLVideoElement;
result.HTMLAudioElement = item instanceof content.HTMLAudioElement;

if (isBG) {
// Items that are showing this image as a background
Expand All @@ -307,7 +307,7 @@ class PageInfoChild extends JSWindowActorChild {
img.src = url;
result.naturalWidth = img.naturalWidth;
result.naturalHeight = img.naturalHeight;
} else if (!content.SVGImageElement.isInstance(item)) {
} else if (!(item instanceof content.SVGImageElement)) {
// SVG items do not have integer values for height or width,
// so we must handle them differently in order to correctly
// serialize
Expand All @@ -318,7 +318,7 @@ class PageInfoChild extends JSWindowActorChild {
result.height = item.height;
}

if (content.SVGImageElement.isInstance(item)) {
if (item instanceof content.SVGImageElement) {
result.SVGImageElementWidth = item.width.baseVal.value;
result.SVGImageElementHeight = item.height.baseVal.value;
}
Expand All @@ -337,9 +337,9 @@ class PageInfoChild extends JSWindowActorChild {

// Form input elements don't generally contain information that is useful to our callers, so return nothing.
if (
content.HTMLInputElement.isInstance(node) ||
content.HTMLSelectElement.isInstance(node) ||
content.HTMLTextAreaElement.isInstance(node)
node instanceof content.HTMLInputElement ||
node instanceof content.HTMLSelectElement ||
node instanceof content.HTMLTextAreaElement
) {
return valueText;
}
Expand All @@ -357,7 +357,7 @@ class PageInfoChild extends JSWindowActorChild {
} else if (nodeType == content.Node.ELEMENT_NODE) {
// And elements can have more text inside them.
// Images are special, we want to capture the alt text as if the image weren't there.
if (content.HTMLImageElement.isInstance(childNode)) {
if (childNode instanceof content.HTMLImageElement) {
valueText += " " + this.getAltText(childNode);
} else {
valueText += " " + this.getValueText(childNode);
Expand Down
2 changes: 1 addition & 1 deletion browser/actors/PluginChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PluginChild extends JSWindowActorChild {
* document that GMP is being used in.
*/
async onPluginCrashed(aEvent) {
if (!this.contentWindow.PluginCrashedEvent.isInstance(aEvent)) {
if (!(aEvent instanceof this.contentWindow.PluginCrashedEvent)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion browser/components/attribution/AttributionCode.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ var AttributionCode = {
try {
bytes = await AttributionIOUtils.read(attributionFile.path);
} catch (ex) {
if (DOMException.isInstance(ex) && ex.name == "NotFoundError") {
if (ex instanceof DOMException && ex.name == "NotFoundError") {
log.debug(
`getAttrDataAsync: !exists("${
attributionFile.path
Expand Down
2 changes: 1 addition & 1 deletion browser/components/customizableui/CustomizableUI.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ var CustomizableUIInternal = {
if (aWidget.onBuild) {
node = aWidget.onBuild(aDocument);
}
if (!node || !aDocument.defaultView.XULElement.isInstance(node)) {
if (!node || !(node instanceof aDocument.defaultView.XULElement)) {
log.error(
"Custom widget with id " +
aWidget.id +
Expand Down
2 changes: 1 addition & 1 deletion browser/components/newtab/lib/PersistentCache.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ this.PersistentCache = class PersistentCache {
data = await IOUtils.readJSON(filepath);
} catch (error) {
if (
!DOMException.isInstance(error) ||
!(error instanceof DOMException) ||
error.name !== "NotFoundError"
) {
Cu.reportError(
Expand Down
10 changes: 5 additions & 5 deletions browser/components/search/SearchOneOffs.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,13 @@ class SearchOneOffs {
} else {
let newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
if (
(KeyboardEvent.isInstance(aEvent) && aEvent.altKey) ^ newTabPref &&
(aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref &&
!this.window.gBrowser.selectedTab.isEmpty
) {
where = "tab";
}
if (
MouseEvent.isInstance(aEvent) &&
aEvent instanceof MouseEvent &&
(aEvent.button == 1 || aEvent.getModifierState("Accel"))
) {
where = "tab";
Expand Down Expand Up @@ -903,17 +903,17 @@ class SearchOneOffs {

let target = event.originalTarget;

if (KeyboardEvent.isInstance(event) && this.selectedButton) {
if (event instanceof KeyboardEvent && this.selectedButton) {
return true;
}
if (
MouseEvent.isInstance(event) &&
event instanceof MouseEvent &&
target.classList.contains("searchbar-engine-one-off-item")
) {
return true;
}
if (
this.window.XULCommandEvent.isInstance(event) &&
event instanceof this.window.XULCommandEvent &&
target.classList.contains("search-one-offs-context-open-in-new-tab")
) {
return true;
Expand Down
7 changes: 2 additions & 5 deletions browser/components/sessionstore/SessionFile.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,9 @@ var SessionFileInternal = {
.add(Date.now() - startMs);
break;
} catch (ex) {
if (DOMException.isInstance(ex) && ex.name == "NotFoundError") {
if (ex instanceof DOMException && ex.name == "NotFoundError") {
exists = false;
} else if (
DOMException.isInstance(ex) &&
ex.name == "NotAllowedError"
) {
} else if (ex instanceof DOMException && ex.name == "NotAllowedError") {
// The file might be inaccessible due to wrong permissions
// or similar failures. We'll just count it as "corrupted".
console.error("Could not read session file ", ex);
Expand Down
2 changes: 1 addition & 1 deletion browser/components/translation/BingTranslator.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ BingTranslator.prototype = {
*/
_chunkFailed(aError) {
if (
XMLHttpRequest.isInstance(aError) &&
aError instanceof XMLHttpRequest &&
[400, 401].includes(aError.status)
) {
let body = aError.responseText;
Expand Down
2 changes: 1 addition & 1 deletion browser/components/translation/YandexTranslator.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ YandexTranslator.prototype = {
* @param aError [optional] The XHR object of the request that failed.
*/
_chunkFailed(aError) {
if (XMLHttpRequest.isInstance(aError)) {
if (aError instanceof XMLHttpRequest) {
let body = aError.responseText;
let json = { code: 0 };
try {
Expand Down
2 changes: 1 addition & 1 deletion browser/components/urlbar/UrlbarController.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ class TelemetryEvent {
} else if (event.type == "blur") {
action = "blur";
} else {
action = MouseEvent.isInstance(event) ? "click" : "enter";
action = event instanceof MouseEvent ? "click" : "enter";
}
let method = action == "blur" ? "abandonment" : "engagement";
let value = this._startEventInfo.interactionType;
Expand Down
Loading

0 comments on commit 4eec7e2

Please sign in to comment.