mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207490 - Part 5: Remove use of expression closure from browser/base/content/test/social/. r=Gijs
This commit is contained in:
parent
8974346fb4
commit
2d6d614230
@ -253,12 +253,12 @@ var tests = {
|
||||
let port1 = openChat(Social.providers[1], function() {
|
||||
let port2 = openChat(Social.providers[2], function() {
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
waitForCondition(function() chats.children.length == Social.providers.length,
|
||||
waitForCondition(() => chats.children.length == Social.providers.length,
|
||||
function() {
|
||||
ok(true, "one chat window per provider opened");
|
||||
// test logout of a single provider
|
||||
port2.postMessage({topic: "test-logout"});
|
||||
waitForCondition(function() chats.children.length == Social.providers.length - 1,
|
||||
waitForCondition(() => chats.children.length == Social.providers.length - 1,
|
||||
function() {
|
||||
Task.spawn(closeAllChats).then(next);
|
||||
},
|
||||
@ -288,7 +288,7 @@ var tests = {
|
||||
ok(true, "got a chat window opened");
|
||||
if (opened) {
|
||||
port.postMessage({topic: "test-logout"});
|
||||
waitForCondition(function() document.getElementById("pinnedchats").firstChild == null,
|
||||
waitForCondition(() => document.getElementById("pinnedchats").firstChild == null,
|
||||
function() {
|
||||
next();
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ function openChatViaWorkerMessage(port, data, callback) {
|
||||
let chatbar = getChatBar();
|
||||
let numExpected = chatbar.childElementCount + 1;
|
||||
port.postMessage({topic: "test-worker-chat", data: data});
|
||||
waitForCondition(function() chatbar.childElementCount == numExpected,
|
||||
waitForCondition(() => chatbar.childElementCount == numExpected,
|
||||
function() {
|
||||
// so the child has been added, but we don't know if it
|
||||
// has been intialized - re-request it and the callback
|
||||
@ -107,7 +107,7 @@ function test() {
|
||||
// tab.linkedBrowser.contentWindow.focus()
|
||||
// but instead we must do:
|
||||
tab.linkedBrowser.contentDocument.getElementById("theinput").focus();
|
||||
waitForCondition(function() isTabFocused(), cb, "tab should have focus");
|
||||
waitForCondition(() => isTabFocused(), cb, "tab should have focus");
|
||||
}
|
||||
let postSubTest = function(cb) {
|
||||
Task.spawn(closeAllChats).then(cb);
|
||||
@ -144,7 +144,7 @@ var tests = {
|
||||
ok(isTabFocused(), "tab should still be focused");
|
||||
// re-request the same chat via user event.
|
||||
openChatViaUser();
|
||||
waitForCondition(function() isChatFocused(chatbar.selectedChat),
|
||||
waitForCondition(() => isChatFocused(chatbar.selectedChat),
|
||||
function() {
|
||||
is(chatbar.childElementCount, 1, "still exactly 1 chat open");
|
||||
is(chatbar.selectedChat, chatbar.firstElementChild, "chat should be selected");
|
||||
@ -162,7 +162,7 @@ var tests = {
|
||||
let chatbar = getChatBar();
|
||||
openChatViaUser();
|
||||
ok(chatbar.firstElementChild, "chat opened");
|
||||
waitForCondition(function() isChatFocused(chatbar.selectedChat),
|
||||
waitForCondition(() => isChatFocused(chatbar.selectedChat),
|
||||
function() {
|
||||
is(chatbar.selectedChat, chatbar.firstElementChild, "chat is selected");
|
||||
next();
|
||||
|
@ -134,7 +134,7 @@ var tests = {
|
||||
function() { // the "load" callback.
|
||||
todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads.");
|
||||
let chat = getChatBar().selectedChat;
|
||||
waitForCondition(function() chat.content != null && chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0,
|
||||
waitForCondition(() => chat.content != null && chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0,
|
||||
function() {
|
||||
chat.close();
|
||||
next();
|
||||
@ -162,14 +162,14 @@ var tests = {
|
||||
chat.swapWindows().then(
|
||||
chat => {
|
||||
ok(!!chat.content, "we have chat content 1");
|
||||
waitForCondition(function() chat.content != null && chat.contentDocument.readyState == "complete",
|
||||
waitForCondition(() => chat.content != null && chat.contentDocument.readyState == "complete",
|
||||
function() {
|
||||
// now go offline and reload the chat - about:socialerror should be loaded.
|
||||
goOffline().then(function() {
|
||||
ok(!!chat.content, "we have chat content 2");
|
||||
chat.contentDocument.location.reload();
|
||||
info("chat reload called");
|
||||
waitForCondition(function() chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0,
|
||||
waitForCondition(() => chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0,
|
||||
function() {
|
||||
chat.close();
|
||||
next();
|
||||
|
@ -157,7 +157,7 @@ var tests = {
|
||||
EventUtils.synthesizeMouseAtCenter(btn, {});
|
||||
// wait for the button to be marked, click to open panel
|
||||
is(btn.panel.state, "closed", "panel should not be visible yet");
|
||||
waitForCondition(function() btn.isMarked, function() {
|
||||
waitForCondition(() => btn.isMarked, function() {
|
||||
EventUtils.synthesizeMouseAtCenter(btn, {});
|
||||
}, "button is marked");
|
||||
break;
|
||||
@ -174,7 +174,7 @@ var tests = {
|
||||
} else {
|
||||
// page should no longer be marked
|
||||
port.close();
|
||||
waitForCondition(function() !btn.isMarked, function() {
|
||||
waitForCondition(() => !btn.isMarked, function() {
|
||||
// cleanup after the page has been unmarked
|
||||
ensureBrowserTabClosed(tab).then(() => {
|
||||
ok(btn.disabled, "button is disabled");
|
||||
@ -245,7 +245,7 @@ var tests = {
|
||||
ok(true, "test-init-done received");
|
||||
ok(provider.profile.userName, "profile was set by test worker");
|
||||
port.postMessage({topic: "test-logout"});
|
||||
waitForCondition(function() !provider.profile.userName,
|
||||
waitForCondition(() => !provider.profile.userName,
|
||||
function() {
|
||||
// when the provider has not indicated to us that a user is
|
||||
// logged in, the first click opens the page.
|
||||
@ -268,7 +268,7 @@ var tests = {
|
||||
} else {
|
||||
// page should no longer be marked
|
||||
port.close();
|
||||
waitForCondition(function() !btn.isMarked, function() {
|
||||
waitForCondition(() => !btn.isMarked, function() {
|
||||
// cleanup after the page has been unmarked
|
||||
ensureBrowserTabClosed(tab).then(() => {
|
||||
ok(btn.disabled, "button is disabled");
|
||||
|
@ -52,7 +52,7 @@ var tests = {
|
||||
oneWorkerTest(p);
|
||||
}
|
||||
|
||||
waitForCondition(function() messageReceived == Social.providers.length,
|
||||
waitForCondition(() => messageReceived == Social.providers.length,
|
||||
next, "received messages from all workers",
|
||||
/* increase timeout because shutting down a child process is slow */ 60);
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ var tests = {
|
||||
SocialService.addProvider(manifest, function() {
|
||||
SocialService.addProvider(manifest2, function (provider) {
|
||||
SocialSidebar.show();
|
||||
waitForCondition(function() SocialSidebar.opened,
|
||||
waitForCondition(() => SocialSidebar.opened,
|
||||
function() {
|
||||
ok(SocialSidebar.opened, "first window sidebar is open");
|
||||
openWindowAndWaitForInit(window, function(w1) {
|
||||
@ -140,7 +140,7 @@ var tests = {
|
||||
SocialService.addProvider(manifest, function() {
|
||||
openWindowAndWaitForInit(window, function(w1) {
|
||||
w1.SocialSidebar.show();
|
||||
waitForCondition(function() w1.SocialSidebar.opened,
|
||||
waitForCondition(() => w1.SocialSidebar.opened,
|
||||
function() {
|
||||
ok(Services.prefs.prefHasUserValue("social.sidebar.provider"), "global state set");
|
||||
ok(!SocialSidebar.opened, "1. main sidebar is still closed");
|
||||
|
@ -154,7 +154,7 @@ function runSocialTestWithProvider(manifest, callback, finishcallback) {
|
||||
registerCleanupFunction(function () {
|
||||
finishSocialTest(true);
|
||||
});
|
||||
waitForCondition(function() provider.enabled,
|
||||
waitForCondition(() => provider.enabled,
|
||||
function() {
|
||||
info("provider has been enabled");
|
||||
callback(finishSocialTest);
|
||||
@ -589,7 +589,7 @@ function resizeAndCheckWidths(first, second, third, checks, cb) {
|
||||
checkPopup();
|
||||
ok(sizedOk, count+": window resized correctly");
|
||||
function collapsedObserver(r, m) {
|
||||
if ([first, second, third].filter(function(item) !item.collapsed).length == numExpectedVisible) {
|
||||
if ([first, second, third].filter(item => !item.collapsed).length == numExpectedVisible) {
|
||||
if (m) {
|
||||
m.disconnect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user