Bug 1449631 part 1. Remove JS uses of nsIDOMEventTarget. r=smaug

MozReview-Commit-ID: CCHCZjMgInu
This commit is contained in:
Boris Zbarsky 2018-04-05 13:42:40 -04:00
Родитель 25b7539ba9
Коммит a4c5e65aa3
12 изменённых файлов: 15 добавлений и 14 удалений

Просмотреть файл

@ -23,7 +23,7 @@ function test() {
observe(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
ok(false, "Alert window opened");
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
win.addEventListener("load", function() {
win.close();
}, {once: true});

Просмотреть файл

@ -98,7 +98,7 @@ var windowObserver = {
return;
}
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
win.addEventListener("load", function(event) {
if (win.location == UCT_URI) {

Просмотреть файл

@ -46,7 +46,7 @@ interface nsIScriptContext;
interface nsIDOMEventListener;
interface nsIDOMEvent;
[scriptable, builtinclass, uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)]
[uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)]
interface nsIDOMEventTarget : nsISupports
{
/**

Просмотреть файл

@ -31,7 +31,7 @@ SpecialPowers.pushPrefEnv({'set':[
is(result.processType, SpecialPowers.Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT,
"The frame script is running in a real distinct child process");
ok(result.hasCorrectInterface,
"docshell.chromeEventHandler has nsIDOMEventTarget interface");
"docshell.chromeEventHandler has EventTarget interface");
});
@ -52,7 +52,8 @@ SpecialPowers.pushPrefEnv({'set':[
var chromeEventHandler = docShell.chromeEventHandler;
sendAsyncMessage("chromeEventHandler", {
processType: Services.appinfo.processType,
hasCorrectInterface: chromeEventHandler instanceof Ci.nsIDOMEventTarget
hasCorrectInterface: chromeEventHandler &&
EventTarget.isInstance(chromeEventHandler),
});
/*

Просмотреть файл

@ -426,7 +426,9 @@ class FilteringMessageManagerMap extends Map {
broker = new this._constructor(this.messageName, this.callback, target);
this.set(target, broker);
if (target instanceof Ci.nsIDOMEventTarget) {
// XXXbz if target is really known to be a MessageListenerManager,
// do we need this isInstance check?
if (EventTarget.isInstance(target)) {
let onUnload = event => {
target.removeEventListener("unload", onUnload);
this.delete(target);

Просмотреть файл

@ -89,7 +89,7 @@ add_task(async function test_setup() {
Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", win);
}, win);

Просмотреть файл

@ -75,7 +75,7 @@ add_task(async function test() {
if (aTopic == "domwindowclosed")
Services.ww.unregisterNotification(notification);
else if (aTopic == "domwindowopened") {
let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let targetWin = aSubject;
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", targetWin);
}, targetWin);

Просмотреть файл

@ -86,7 +86,7 @@ add_task(async function test() {
if (aTopic == "domwindowclosed")
Services.ww.unregisterNotification(notification);
else if (aTopic == "domwindowopened") {
let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let targetWin = aSubject;
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", targetWin);
}, targetWin);

Просмотреть файл

@ -366,7 +366,6 @@ function openTabPrompt(domWin, tabPrompt, args) {
let frameMM = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIContentFrameMessageManager);
frameMM.QueryInterface(Ci.nsIDOMEventTarget);
// We provide a callback so the prompt can close itself. We don't want to
// wait for this event loop to return... Otherwise the presence of other
@ -447,7 +446,6 @@ function openRemotePrompt(domWin, args, tabPrompt) {
let closed = false;
let frameMM = docShell.getInterface(Ci.nsIContentFrameMessageManager);
frameMM.QueryInterface(Ci.nsIDOMEventTarget);
// It should be hard or impossible to cause a window to create multiple
// prompts, but just in case, give our prompt an ID.

Просмотреть файл

@ -14,7 +14,7 @@ let UCTObserver = {
closed: PromiseUtils.defer(),
observe(aSubject, aTopic, aData) {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
switch (aTopic) {
case "domwindowopened":

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function test_unknownContentType_dialog_layout() {
closed: PromiseUtils.defer(),
observe(aSubject, aTopic, aData) {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
switch (aTopic) {
case "domwindowopened":

Просмотреть файл

@ -168,7 +168,7 @@ this.__defineGetter__("gCallback", function() {
*/
const gWindowObserver = {
observe: function WO_observe(aSubject, aTopic, aData) {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
let win = aSubject;
if (aTopic == "domwindowclosed") {
if (win.location != URI_UPDATE_PROMPT_DIALOG) {