mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 788100 - Remove social.initialize-response message. r=jaws
This commit is contained in:
parent
78b3d11180
commit
8fddaf0512
@ -29,10 +29,12 @@ var tests = {
|
||||
|
||||
function triggerIconPanel() {
|
||||
let statusIcons = document.getElementById("social-status-iconbox");
|
||||
ok(!statusIcons.firstChild.hidden, "status icon is visible");
|
||||
// Click the button to trigger its contentPanel
|
||||
let panel = document.getElementById("social-notification-panel");
|
||||
EventUtils.synthesizeMouseAtCenter(statusIcons.firstChild, {});
|
||||
waitForCondition(function() statusIcons.firstChild && !statusIcons.firstChild.hidden,
|
||||
function() {
|
||||
// Click the button to trigger its contentPanel
|
||||
let panel = document.getElementById("social-notification-panel");
|
||||
EventUtils.synthesizeMouseAtCenter(statusIcons.firstChild, {});
|
||||
}, "Status icon didn't become non-hidden");
|
||||
}
|
||||
|
||||
let port = Social.provider.getWorkerPort();
|
||||
@ -40,6 +42,10 @@ var tests = {
|
||||
port.onmessage = function (e) {
|
||||
let topic = e.data.topic;
|
||||
switch (topic) {
|
||||
case "test-init-done":
|
||||
iconsReady = true;
|
||||
checkNext();
|
||||
break;
|
||||
case "got-panel-message":
|
||||
ok(true, "got panel message");
|
||||
// Check the panel isn't in our history.
|
||||
@ -67,24 +73,5 @@ var tests = {
|
||||
}
|
||||
}
|
||||
port.postMessage({topic: "test-init"});
|
||||
|
||||
// Our worker sets up ambient notification at the same time as it responds to
|
||||
// the workerAPI initialization. If it's already initialized, we can
|
||||
// immediately check the icons, otherwise wait for initialization by
|
||||
// observing the topic sent out by the social service.
|
||||
if (Social.provider.workerAPI.initialized) {
|
||||
iconsReady = true;
|
||||
checkNext();
|
||||
} else {
|
||||
Services.obs.addObserver(function obs() {
|
||||
Services.obs.removeObserver(obs, "social:ambient-notification-changed");
|
||||
// Let the other observers (like the one that updates the UI) run before
|
||||
// checking the icons.
|
||||
executeSoon(function () {
|
||||
iconsReady = true;
|
||||
checkNext();
|
||||
});
|
||||
}, "social:ambient-notification-changed", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ onconnect = function(e) {
|
||||
switch (topic) {
|
||||
case "test-init":
|
||||
testPort = port;
|
||||
port.postMessage({topic: "test-init-done"});
|
||||
break;
|
||||
case "sidebar-message":
|
||||
sidebarPort = port;
|
||||
@ -69,7 +70,6 @@ onconnect = function(e) {
|
||||
case "social.initialize":
|
||||
// This is the workerAPI port, respond and set up a notification icon.
|
||||
apiPort = port;
|
||||
port.postMessage({topic: "social.initialize-response"});
|
||||
let profile = {
|
||||
portrait: "https://example.com/portrait.jpg",
|
||||
userName: "trickster",
|
||||
|
@ -23,8 +23,6 @@ function WorkerAPI(provider, port) {
|
||||
this._port = port;
|
||||
this._port.onmessage = this._handleMessage.bind(this);
|
||||
|
||||
this.initialized = false;
|
||||
|
||||
// Send an "intro" message so the worker knows this is the port
|
||||
// used for the api.
|
||||
// later we might even include an API version - version 0 for now!
|
||||
@ -54,9 +52,6 @@ WorkerAPI.prototype = {
|
||||
},
|
||||
|
||||
handlers: {
|
||||
"social.initialize-response": function (data) {
|
||||
this.initialized = true;
|
||||
},
|
||||
"social.user-profile": function (data) {
|
||||
this._provider.updateUserProfile(data);
|
||||
},
|
||||
|
@ -24,24 +24,6 @@ function test() {
|
||||
}
|
||||
|
||||
let tests = {
|
||||
testInitializeWorker: function(next) {
|
||||
ok(provider.workerAPI, "provider has a workerAPI");
|
||||
is(provider.workerAPI.initialized, false, "workerAPI is not yet initialized");
|
||||
|
||||
let port = provider.getWorkerPort();
|
||||
ok(port, "should be able to get a port from the provider");
|
||||
|
||||
port.onmessage = function onMessage(event) {
|
||||
let topic = event.data.topic;
|
||||
if (topic == "test-initialization-complete") {
|
||||
is(provider.workerAPI.initialized, true, "workerAPI is now initialized");
|
||||
port.close();
|
||||
next();
|
||||
}
|
||||
}
|
||||
port.postMessage({topic: "test-initialization"});
|
||||
},
|
||||
|
||||
testProfile: function(next) {
|
||||
let expect = {
|
||||
portrait: "https://example.com/portrait.jpg",
|
||||
@ -58,12 +40,15 @@ let tests = {
|
||||
is(profile.displayName, expect.displayName, "displayName is set");
|
||||
is(profile.profileURL, expect.profileURL, "profileURL is set");
|
||||
|
||||
// see below - if not for bug 788368 we could close this earlier.
|
||||
port.close();
|
||||
next();
|
||||
}
|
||||
Services.obs.addObserver(ob, "social:profile-changed", false);
|
||||
let port = provider.getWorkerPort();
|
||||
port.postMessage({topic: "test-profile", data: expect});
|
||||
port.close();
|
||||
// theoretically we should be able to close the port here, but bug 788368
|
||||
// means that if we do, the worker never sees the test-profile message.
|
||||
},
|
||||
|
||||
testAmbientNotification: function(next) {
|
||||
|
@ -17,7 +17,6 @@ onconnect = function(e) {
|
||||
switch (topic) {
|
||||
case "social.initialize":
|
||||
apiPort = port;
|
||||
apiPort.postMessage({topic: "social.initialize-response"});
|
||||
break;
|
||||
case "test-initialization":
|
||||
testerPort = port;
|
||||
|
Loading…
Reference in New Issue
Block a user