mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 914435 fix toolbaritem handling of ambient frames, r=markh
This commit is contained in:
parent
c755fcdfda
commit
e35ed0705d
@ -159,10 +159,11 @@ SocialUI = {
|
||||
}
|
||||
break;
|
||||
case "social:profile-changed":
|
||||
// make sure anything that happens here only affects the provider for
|
||||
// which the profile is changing, and that anything we call actually
|
||||
// needs to change based on profile data.
|
||||
if (this._matchesCurrentProvider(data)) {
|
||||
SocialToolbar.updateProvider();
|
||||
SocialMarks.update();
|
||||
SocialChatBar.update();
|
||||
}
|
||||
break;
|
||||
case "social:frameworker-error":
|
||||
@ -1446,9 +1447,19 @@ SocialStatus = {
|
||||
removeProvider: function(origin) {
|
||||
if (!Social.allowMultipleWorkers)
|
||||
return;
|
||||
this._removeFrame(origin);
|
||||
this._toolbarHelper.removeProviderButton(origin);
|
||||
},
|
||||
|
||||
_removeFrame: function(origin) {
|
||||
let notificationFrameId = "social-status-" + origin;
|
||||
let frame = document.getElementById(notificationFrameId);
|
||||
if (frame) {
|
||||
SharedFrame.forgetGroup(frame.id);
|
||||
frame.parentNode.removeChild(frame);
|
||||
}
|
||||
},
|
||||
|
||||
get _toolbarHelper() {
|
||||
delete this._toolbarHelper;
|
||||
this._toolbarHelper = new ToolbarHelper("social-status-button", this._createButton.bind(this));
|
||||
|
@ -31,6 +31,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
social_panel.html \
|
||||
social_mark.html \
|
||||
social_sidebar.html \
|
||||
social_sidebar_empty.html \
|
||||
social_chat.html \
|
||||
social_flyout.html \
|
||||
social_window.html \
|
||||
|
@ -2,18 +2,36 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
let manifest = { // normal provider
|
||||
let manifests = [{
|
||||
name: "provider 1",
|
||||
origin: "https://example.com",
|
||||
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
|
||||
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
|
||||
iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
|
||||
};
|
||||
}, { // used for testing install
|
||||
name: "provider test1",
|
||||
origin: "https://test1.example.com",
|
||||
statusURL: "https://test1.example.com/browser/browser/base/content/test/social/social_panel.html",
|
||||
iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
|
||||
}];
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
runSocialTestWithProvider(manifest, function (finishcb) {
|
||||
runSocialTests(tests, undefined, undefined, finishcb);
|
||||
// required to test status button in combination with the toolbaritem
|
||||
Services.prefs.setBoolPref("social.allowMultipleWorkers", true);
|
||||
|
||||
// Preset the currentSet so the statusbutton is in the toolbar on addition. We
|
||||
// bypass the SocialStatus class here since it requires the manifest already
|
||||
// be installed.
|
||||
let tbh = SocialStatus._toolbarHelper;
|
||||
tbh.setPersistentPosition(tbh.idFromOrgin(manifests[1].origin));
|
||||
|
||||
runSocialTestWithProvider(manifests, function (finishcb) {
|
||||
runSocialTests(tests, undefined, undefined, function() {
|
||||
Services.prefs.clearUserPref("social.allowMultipleWorkers");
|
||||
SocialStatus.removePosition(manifests[1].origin);
|
||||
finishcb();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -37,7 +55,7 @@ var tests = {
|
||||
},
|
||||
testProfileSet: function(next) {
|
||||
let statusIcon = document.getElementById("social-provider-button").style.listStyleImage;
|
||||
is(statusIcon, "url(\"" + manifest.iconURL + "\")", "manifest iconURL is showing");
|
||||
is(statusIcon, "url(\"" + manifests[0].iconURL + "\")", "manifest iconURL is showing");
|
||||
let profile = {
|
||||
portrait: "https://example.com/portrait.jpg",
|
||||
userName: "trickster",
|
||||
@ -166,16 +184,6 @@ var tests = {
|
||||
document.getElementById("menu_ToolsPopup").openPopup();
|
||||
}, "statusIcon was never found");
|
||||
},
|
||||
testProfileUnset: function(next) {
|
||||
Social.provider.updateUserProfile({});
|
||||
// check dom values
|
||||
let ambientIcons = document.querySelectorAll("#social-toolbar-item > box");
|
||||
for (let ambientIcon of ambientIcons) {
|
||||
ok(ambientIcon.collapsed, "ambient icon (" + ambientIcon.id + ") is collapsed");
|
||||
}
|
||||
|
||||
next();
|
||||
},
|
||||
testMenuitemsExist: function(next) {
|
||||
let toggleSidebarMenuitems = document.getElementsByClassName("social-toggle-sidebar-menuitem");
|
||||
is(toggleSidebarMenuitems.length, 2, "Toggle Sidebar menuitems exist");
|
||||
@ -194,5 +202,5 @@ var tests = {
|
||||
is(cmd.getAttribute("checked"), enabled ? "true" : "false");
|
||||
Services.prefs.clearUserPref("social.toast-notifications.enabled");
|
||||
next();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,24 @@ function openWindowAndWaitForInit(callback) {
|
||||
}, topic, false);
|
||||
}
|
||||
|
||||
function closeOneWindow(cb) {
|
||||
let w = createdWindows.pop();
|
||||
if (!w) {
|
||||
cb();
|
||||
return;
|
||||
}
|
||||
waitForCondition(function() w.closed,
|
||||
function() {
|
||||
closeOneWindow(cb);
|
||||
}, "window did not close");
|
||||
w.close();
|
||||
}
|
||||
|
||||
function postTestCleanup(cb) {
|
||||
for (let w of createdWindows)
|
||||
w.close();
|
||||
createdWindows = [];
|
||||
Services.prefs.clearUserPref("social.enabled");
|
||||
cb();
|
||||
closeOneWindow(function() {
|
||||
Services.prefs.clearUserPref("social.enabled");
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
let manifest = { // normal provider
|
||||
|
@ -298,6 +298,14 @@ function checkSocialUI(win) {
|
||||
is(numGoodTests, numTests, "The Social UI tests succeeded.")
|
||||
}
|
||||
|
||||
function waitForNotification(topic, cb) {
|
||||
function observer(subject, topic, data) {
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
cb();
|
||||
}
|
||||
Services.obs.addObserver(observer, topic, false);
|
||||
}
|
||||
|
||||
// blocklist testing
|
||||
function updateBlocklist(aCallback) {
|
||||
var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
|
||||
|
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<p>This is a test social sidebar.</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user