Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Attempt #1 at fixing Bug 617499 - Add an e10s test to verify behavior…
Browse files Browse the repository at this point in the history
… of async messages sent by Firefox while the addon process is making a synchronous call
  • Loading branch information
toolness committed Dec 8, 2010
1 parent d78a463 commit 985418d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/api-utils/tests/e10s-samples/bug-617499-e10s-adapter.js
@@ -0,0 +1,17 @@
if (this.sendMessage) {
// TODO: register receiver for async msg.
registerReceiver("asyncy", function() {
console.log("i am an async message from firefox");
});
exports.go = function() {
console.log("about to send sync message to firefox");
callMessage("superpower");
console.log("returned from sync message to firefox");
};
} else {
exports.register = function(process) {
process.registerReceiver("superpower", function(name) {
process.sendMessage("asyncy");
});
};
}
4 changes: 4 additions & 0 deletions packages/api-utils/tests/e10s-samples/bug-617499-main.js
@@ -0,0 +1,4 @@
exports.main = function(options, callbacks) {
require("e10s-samples/bug-617499").go();
callbacks.quit();
}
1 change: 1 addition & 0 deletions packages/api-utils/tests/e10s-samples/bug-617499.js
@@ -0,0 +1 @@
throw new Error("This code should never be loaded in the Firefox process!");
10 changes: 10 additions & 0 deletions packages/api-utils/tests/test-e10s.js
Expand Up @@ -143,6 +143,16 @@ exports.testAdapterOnlyModule = makeConsoleTest({
]
});

exports.testSyncCallReturnValueArrivesAfterAsyncMsgSends = makeConsoleTest({
main: "e10s-samples/bug-617499-main",
expect: [
["log", "about to send sync message to firefox"],
["log", "i am an async message from firefox"],
["log", "returned from sync message to firefox"],
["quit", "OK"]
]
});

exports.testCommonJSCompliance = function(test) {
if (xulApp.is("Firefox") &&
xulApp.versionInRange(xulApp.version, "4.0b7", "4.0b8pre")) {
Expand Down

0 comments on commit 985418d

Please sign in to comment.