mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Backed out changeset 562910144a3a (bug 1286746)
This commit is contained in:
parent
f7e965e3bf
commit
566ed8c855
@ -1146,20 +1146,16 @@ Port.prototype = {
|
||||
|
||||
receiveMessage(msg) {
|
||||
if (msg.name == this.disconnectName) {
|
||||
this.disconnectByOtherEnd();
|
||||
}
|
||||
},
|
||||
if (this.disconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
disconnectByOtherEnd() {
|
||||
if (this.disconnected) {
|
||||
return;
|
||||
}
|
||||
for (let listener of this.disconnectListeners) {
|
||||
listener();
|
||||
}
|
||||
|
||||
for (let listener of this.disconnectListeners) {
|
||||
listener();
|
||||
this.handleDisconnection();
|
||||
}
|
||||
|
||||
this.handleDisconnection();
|
||||
},
|
||||
|
||||
disconnect() {
|
||||
@ -1286,8 +1282,8 @@ Messenger.prototype = {
|
||||
let portId = `${gNextPortId++}-${Services.appinfo.processType}`;
|
||||
let port = new Port(this.context, messageManager, name, portId, null);
|
||||
let msg = {name, portId};
|
||||
this._sendMessage(messageManager, "Extension:Connect", msg, recipient)
|
||||
.catch(e => port.disconnectByOtherEnd());
|
||||
// TODO: Disconnect the port if no response?
|
||||
this._sendMessage(messageManager, "Extension:Connect", msg, recipient);
|
||||
return port.api();
|
||||
},
|
||||
|
||||
|
@ -63,7 +63,6 @@ skip-if = buildapp == 'b2g' # JavaScript error: jar:remoteopenfile:///data/local
|
||||
[test_ext_runtime_connect.html]
|
||||
skip-if = (os == 'android' || buildapp == 'b2g') # port.sender.tab is undefined on b2g. Bug 1258975 on android.
|
||||
[test_ext_runtime_connect_twoway.html]
|
||||
[test_ext_runtime_connect_no_receiver.html]
|
||||
skip-if = (os == 'android' || buildapp == 'b2g') # port.sender.tab is undefined on b2g. Bug 1258975 on android.
|
||||
[test_ext_runtime_connect2.html]
|
||||
skip-if = (os == 'android' || buildapp == 'b2g') # port.sender.tab is undefined on b2g. Bug 1258975 on android.
|
||||
|
@ -1,35 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebExtension test</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
add_task(function* test_connect_without_listener() {
|
||||
function backgroundScript() {
|
||||
let port = browser.runtime.connect();
|
||||
port.onDisconnect.addListener(() => {
|
||||
browser.test.notifyPass("port.onDisconnect was called");
|
||||
});
|
||||
}
|
||||
let extensionData = {
|
||||
background: `(${backgroundScript})();`,
|
||||
};
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
|
||||
yield extension.awaitFinish("port.onDisconnect was called");
|
||||
|
||||
yield extension.unload();
|
||||
});
|
||||
</script>
|
||||
</body>
|
Loading…
Reference in New Issue
Block a user