Skip to content

Commit

Permalink
Bug 1561435 - Format gfx/, a=automatic-formatting
Browse files Browse the repository at this point in the history
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35903
  • Loading branch information
Victor Porof committed Jul 5, 2019
1 parent f37a83b commit 1e9a54e
Show file tree
Hide file tree
Showing 10 changed files with 844 additions and 286 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ module.exports = {
"overrides": [{
"files": [
"devtools/**",
"gfx/**",
"gradle/**",
"hal/**",
"image/**",
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ toolkit/components/telemetry/datareporting-prefs.js
toolkit/components/telemetry/healthreport-prefs.js

# Ignore all top-level directories for now.
gfx/**
gradle/**
hal/**
image/**
Expand Down
87 changes: 57 additions & 30 deletions gfx/layers/apz/test/mochitest/FissionTestHelperChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,36 @@ class FissionTestHelperChild extends JSWindowActorChild {
// namespace.

let cw = this.cw();
Cu.exportFunction((cond, msg) => this.sendAsyncMessage("ok", {cond, msg}),
cw, { defineAs: "ok" });
Cu.exportFunction((a, b, msg) => this.sendAsyncMessage("is", {a, b, msg}),
cw, { defineAs: "is" });
Cu.exportFunction(
(cond, msg) => this.sendAsyncMessage("ok", { cond, msg }),
cw,
{ defineAs: "ok" }
);
Cu.exportFunction(
(a, b, msg) => this.sendAsyncMessage("is", { a, b, msg }),
cw,
{ defineAs: "is" }
);

let FissionTestHelper = Cu.createObjectIn(cw, { defineAs: "FissionTestHelper" });
FissionTestHelper.startTestPromise =
new cw.Promise(
Cu.exportFunction(
(resolve) => {
this._startTestPromiseResolver = resolve;
},
cw));
let FissionTestHelper = Cu.createObjectIn(cw, {
defineAs: "FissionTestHelper",
});
FissionTestHelper.startTestPromise = new cw.Promise(
Cu.exportFunction(resolve => {
this._startTestPromiseResolver = resolve;
}, cw)
);

Cu.exportFunction(this.subtestDone.bind(this),
FissionTestHelper, { defineAs: "subtestDone" });
Cu.exportFunction(this.subtestDone.bind(this), FissionTestHelper, {
defineAs: "subtestDone",
});

Cu.exportFunction(this.sendToOopif.bind(this),
FissionTestHelper, { defineAs: "sendToOopif" });
Cu.exportFunction(this.fireEventInEmbedder.bind(this),
FissionTestHelper, { defineAs: "fireEventInEmbedder" });
Cu.exportFunction(this.sendToOopif.bind(this), FissionTestHelper, {
defineAs: "sendToOopif",
});
Cu.exportFunction(this.fireEventInEmbedder.bind(this), FissionTestHelper, {
defineAs: "fireEventInEmbedder",
});
}

// Called by the subtest to indicate completion to the top-level browser-chrome
Expand All @@ -67,12 +76,15 @@ class FissionTestHelperChild extends JSWindowActorChild {
let msgId = ++this._msgCounter;
let cw = this.cw();
let responsePromise = new cw.Promise(
Cu.exportFunction(
(resolve) => {
this._oopifResponsePromiseResolvers[msgId] = resolve;
},
cw));
this.sendAsyncMessage("EmbedderToOopif", {browsingContextId, msgId, stringToEval});
Cu.exportFunction(resolve => {
this._oopifResponsePromiseResolvers[msgId] = resolve;
}, cw)
);
this.sendAsyncMessage("EmbedderToOopif", {
browsingContextId,
msgId,
stringToEval,
});
return responsePromise;
}

Expand All @@ -81,7 +93,7 @@ class FissionTestHelperChild extends JSWindowActorChild {
// things that happen. The embedder can use promiseOneEvent from
// helper_fission_utils.js to listen for these events.
fireEventInEmbedder(eventType, data) {
this.sendAsyncMessage("OopifToEmbedder", {eventType, data});
this.sendAsyncMessage("OopifToEmbedder", { eventType, data });
}

handleEvent(evt) {
Expand All @@ -91,7 +103,9 @@ class FissionTestHelperChild extends JSWindowActorChild {
// is fired by the content. See comments in fission_subtest_init().
// Once bug 1557486 is fixed we can just register the FissionTestHelper:Init
// event directly instead of DOMWindowCreated.
this.contentWindow.addEventListener("FissionTestHelper:Init", this, { wantUntrusted: true });
this.contentWindow.addEventListener("FissionTestHelper:Init", this, {
wantUntrusted: true,
});
break;
case "FissionTestHelper:Init":
this.initialize();
Expand All @@ -107,22 +121,35 @@ class FissionTestHelperChild extends JSWindowActorChild {
break;
case "FromEmbedder":
let evalResult = this.contentWindow.eval(msg.data.stringToEval);
this.sendAsyncMessage("OopifToEmbedder", {msgId: msg.data.msgId, evalResult});
this.sendAsyncMessage("OopifToEmbedder", {
msgId: msg.data.msgId,
evalResult,
});
break;
case "FromOopif":
if (typeof msg.data.msgId == "number") {
if (!(msg.data.msgId in this._oopifResponsePromiseResolvers)) {
dump("Error: FromOopif got a message with unknown numeric msgId in " + this.contentWindow.location.href + "\n");
dump(
"Error: FromOopif got a message with unknown numeric msgId in " +
this.contentWindow.location.href +
"\n"
);
}
this._oopifResponsePromiseResolvers[msg.data.msgId](msg.data.evalResult);
this._oopifResponsePromiseResolvers[msg.data.msgId](
msg.data.evalResult
);
delete this._oopifResponsePromiseResolvers[msg.data.msgId];
} else if (typeof msg.data.eventType == "string") {
let cw = this.cw();
let event = new cw.Event(msg.data.eventType);
event.data = Cu.cloneInto(msg.data.data, cw);
this.contentWindow.dispatchEvent(event);
} else {
dump("Warning: Unrecognized FromOopif message received in " + this.contentWindow.location.href + "\n");
dump(
"Warning: Unrecognized FromOopif message received in " +
this.contentWindow.location.href +
"\n"
);
}
break;
}
Expand Down
36 changes: 28 additions & 8 deletions gfx/layers/apz/test/mochitest/FissionTestHelperParent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var EXPORTED_SYMBOLS = ["FissionTestHelperParent"];
class FissionTestHelperParent extends JSWindowActorParent {
constructor() {
super();
this._testCompletePromise = new Promise((resolve) => {
this._testCompletePromise = new Promise(resolve => {
this._testCompletePromiseResolver = resolve;
});
}
Expand Down Expand Up @@ -42,11 +42,18 @@ class FissionTestHelperParent extends JSWindowActorParent {
receiveMessage(msg) {
switch (msg.name) {
case "ok":
FissionTestHelperParent.SimpleTest.ok(msg.data.cond, this.docURI() + " | " + msg.data.msg);
FissionTestHelperParent.SimpleTest.ok(
msg.data.cond,
this.docURI() + " | " + msg.data.msg
);
break;

case "is":
FissionTestHelperParent.SimpleTest.is(msg.data.a, msg.data.b, this.docURI() + " | " + msg.data.msg);
FissionTestHelperParent.SimpleTest.is(
msg.data.a,
msg.data.b,
this.docURI() + " | " + msg.data.msg
);
break;

case "Test:Complete":
Expand All @@ -56,14 +63,24 @@ class FissionTestHelperParent extends JSWindowActorParent {
case "EmbedderToOopif":
// This relays messages from the embedder to an OOP-iframe. The browsing
// context id in the message data identifies the OOP-iframe.
let oopifBrowsingContext = BrowsingContext.get(msg.data.browsingContextId);
let oopifBrowsingContext = BrowsingContext.get(
msg.data.browsingContextId
);
if (oopifBrowsingContext == null) {
FissionTestHelperParent.SimpleTest.ok(false, "EmbedderToOopif couldn't find oopif");
FissionTestHelperParent.SimpleTest.ok(
false,
"EmbedderToOopif couldn't find oopif"
);
break;
}
let oopifActor = oopifBrowsingContext.currentWindowGlobal.getActor("FissionTestHelper");
let oopifActor = oopifBrowsingContext.currentWindowGlobal.getActor(
"FissionTestHelper"
);
if (!oopifActor) {
FissionTestHelperParent.SimpleTest.ok(false, "EmbedderToOopif couldn't find oopif actor");
FissionTestHelperParent.SimpleTest.ok(
false,
"EmbedderToOopif couldn't find oopif actor"
);
break;
}
oopifActor.sendAsyncMessage("FromEmbedder", msg.data);
Expand All @@ -74,7 +91,10 @@ class FissionTestHelperParent extends JSWindowActorParent {
// window which is embedding it.
let embedderActor = this.embedderWindow().getActor("FissionTestHelper");
if (!embedderActor) {
FissionTestHelperParent.SimpleTest.ok(false, "OopifToEmbedder couldn't find embedder");
FissionTestHelperParent.SimpleTest.ok(
false,
"OopifToEmbedder couldn't find embedder"
);
break;
}
embedderActor.sendAsyncMessage("FromOopif", msg.data);
Expand Down
Loading

0 comments on commit 1e9a54e

Please sign in to comment.