mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 836766 drop minimized requirment on chats opened from worker, r=markh
This commit is contained in:
parent
780239d0c2
commit
2eccc44ef3
@ -105,47 +105,6 @@ var tests = {
|
||||
}
|
||||
port.postMessage({topic: "test-init", data: { id: 1 }});
|
||||
},
|
||||
// In this case the *worker* opens a chat (so minimized is specified).
|
||||
// The worker then makes the same call again - as that second call also
|
||||
// specifies "minimized" the chat should *not* be restored.
|
||||
testWorkerChatWindowMinimized: function(next) {
|
||||
const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
|
||||
let port = Social.provider.getWorkerPort();
|
||||
let seen_opened = false;
|
||||
ok(port, "provider has a port");
|
||||
port.postMessage({topic: "test-init"});
|
||||
port.onmessage = function (e) {
|
||||
let topic = e.data.topic;
|
||||
switch (topic) {
|
||||
case "got-chatbox-message":
|
||||
ok(true, "got a chat window opened");
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
if (!seen_opened) {
|
||||
// first time we got the opened message, so minimize the chat then
|
||||
// re-request the same chat to be opened - we should get the
|
||||
// message again and the chat should be restored.
|
||||
ok(chats.selectedChat.minimized, "chatbox from worker opened as minimized");
|
||||
seen_opened = true;
|
||||
port.postMessage({topic: "test-worker-chat", data: chatUrl});
|
||||
// Sadly there is no notification we can use to know the chat was
|
||||
// re-opened :( So we ask the chat window to "ping" us - by then
|
||||
// the second request should have made it.
|
||||
chats.selectedChat.iframe.contentWindow.wrappedJSObject.pingWorker();
|
||||
} else {
|
||||
// This is the second time we've seen this message - there should
|
||||
// be exactly 1 chat open and it should still be minimized.
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
ok(chats.selectedChat.minimized, "chat still minimized")
|
||||
chats.selectedChat.close();
|
||||
is(chats.selectedChat, null, "should only have been one chat open");
|
||||
port.close();
|
||||
next();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
port.postMessage({topic: "test-worker-chat", data: chatUrl});
|
||||
},
|
||||
testManyChats: function(next) {
|
||||
// open enough chats to overflow the window, then check
|
||||
// if the menupopup is visible
|
||||
@ -189,6 +148,7 @@ var tests = {
|
||||
},
|
||||
testWorkerChatWindow: function(next) {
|
||||
const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
let port = Social.provider.getWorkerPort();
|
||||
ok(port, "provider has a port");
|
||||
port.postMessage({topic: "test-init"});
|
||||
@ -197,8 +157,7 @@ var tests = {
|
||||
switch (topic) {
|
||||
case "got-chatbox-message":
|
||||
ok(true, "got a chat window opened");
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
ok(chats.selectedChat.minimized, "chatbox from worker opened as minimized");
|
||||
ok(chats.selectedChat, "chatbox from worker opened");
|
||||
while (chats.selectedChat) {
|
||||
chats.selectedChat.close();
|
||||
}
|
||||
@ -209,6 +168,7 @@ var tests = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok(!chats.selectedChat, "chats are all closed");
|
||||
port.postMessage({topic: "test-worker-chat", data: chatUrl});
|
||||
},
|
||||
testCloseSelf: function(next) {
|
||||
|
@ -167,7 +167,7 @@ var tests = {
|
||||
});
|
||||
},
|
||||
|
||||
// Open a chat via the worker - it will open minimized and not have focus.
|
||||
// Open a chat via the worker - it will open and not have focus.
|
||||
// Then open the same chat via a sidebar message - it will be restored but
|
||||
// should still not have grabbed focus.
|
||||
testNoFocusOnAutoRestore: function(next) {
|
||||
@ -176,7 +176,6 @@ var tests = {
|
||||
startTestAndWaitForSidebar(function(port) {
|
||||
openChatViaWorkerMessage(port, chatUrl, function() {
|
||||
is(chatbar.childElementCount, 1, "exactly 1 chat open");
|
||||
ok(chatbar.firstElementChild.minimized, "chat is minimized");
|
||||
// bug 865086 opening minimized still sets the window as selected
|
||||
todo(chatbar.selectedChat != chatbar.firstElementChild, "chat is not selected");
|
||||
ok(isTabFocused(), "tab should be focused");
|
||||
|
@ -78,7 +78,7 @@ WorkerAPI.prototype = {
|
||||
data: results});
|
||||
},
|
||||
'social.request-chat': function(data) {
|
||||
openChatWindow(null, this._provider, data, null, "minimized");
|
||||
openChatWindow(null, this._provider, data);
|
||||
},
|
||||
'social.notification-create': function(data) {
|
||||
if (!Services.prefs.getBoolPref("social.toast-notifications.enabled"))
|
||||
|
Loading…
Reference in New Issue
Block a user