Backed out changeset a04d4a573863 (bug 914435)

This commit is contained in:
Ryan VanderMeulen 2013-09-16 22:45:27 -04:00
parent 7c7706caf5
commit a8611fca57
3 changed files with 24 additions and 71 deletions

View File

@ -159,11 +159,10 @@ 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":
@ -869,19 +868,17 @@ SocialToolbar = {
toggleNotificationsCommand.setAttribute("hidden", !socialEnabled);
let parent = document.getElementById("social-notification-panel");
while (parent.hasChildNodes()) {
let frame = parent.firstChild;
SharedFrame.forgetGroup(frame.id);
parent.removeChild(frame);
}
let tbi = document.getElementById("social-provider-button");
if (tbi) {
// buttons after social-provider-button are ambient icons, remove the
// button and the attached shared frame.
// buttons after social-provider-button are ambient icons
while (tbi.nextSibling) {
let tb = tbi.nextSibling;
let nid = tb.getAttribute("notificationFrameId");
let frame = document.getElementById(nid);
if (frame) {
SharedFrame.forgetGroup(frame.id);
parent.removeChild(frame);
}
tbi.parentNode.removeChild(tb);
tbi.parentNode.removeChild(tbi.nextSibling);
}
}
},

View File

@ -2,36 +2,18 @@
* 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 manifests = [{ // normal provider
name: "provider example.com",
let manifest = { // normal provider
name: "provider 1",
origin: "https://example.com",
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
iconURL: "https://example.com/browser/browser/base/content/test/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/moz.png",
}];
};
function test() {
waitForExplicitFinish();
// 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();
});
runSocialTestWithProvider(manifest, function (finishcb) {
runSocialTests(tests, undefined, undefined, finishcb);
});
}
@ -55,7 +37,7 @@ var tests = {
},
testProfileSet: function(next) {
let statusIcon = document.getElementById("social-provider-button").style.listStyleImage;
is(statusIcon, "url(\"" + manifests[0].iconURL + "\")", "manifest iconURL is showing");
is(statusIcon, "url(\"" + manifest.iconURL + "\")", "manifest iconURL is showing");
let profile = {
portrait: "https://example.com/portrait.jpg",
userName: "trickster",
@ -185,32 +167,14 @@ var tests = {
}, "statusIcon was never found");
},
testProfileUnset: function(next) {
let panel = document.getElementById("social-notification-panel");
// load the status button for provider 2
let provider = Social._getProviderFromOrigin(manifests[1].origin);
let id = SocialStatus._toolbarHelper.idFromOrgin(provider.origin);
let btn = document.getElementById(id)
ok(btn, "got a status button");
// cheat a little, we want the iframe for the status button to be created,
// not testing the statusbutton itself here.
SocialStatus._attachNotificatonPanel(btn, provider);
let numIcons = Object.keys(Social.provider.ambientNotificationIcons).length;
let ambientIcons = document.querySelectorAll("#social-toolbar-item > toolbarbutton[type='badged']");
is(numIcons, ambientIcons.length, "all ambient icons exist");
is(panel.childNodes.length, ambientIcons.length + 1, "frames all exist");
// we need to wait until after social:profile-changed has completed
waitForNotification("social:profile-changed", function() {
// let the notifications finish first
executeSoon(function() {
let icons = document.querySelectorAll("#social-toolbar-item > toolbarbutton[type='badged']");
is(icons.length, 0, "ambient icons have been removed");
is(panel.childNodes.length, 1, "frame still exists");
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");
@ -230,5 +194,5 @@ var tests = {
is(cmd.getAttribute("checked"), enabled ? "true" : "false");
Services.prefs.clearUserPref("social.toast-notifications.enabled");
next();
}
},
}

View File

@ -298,14 +298,6 @@ 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"]