Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
IrisHsiao committed May 8, 2017
2 parents e0f12d7 + 0b74891 commit b223516
Show file tree
Hide file tree
Showing 1,210 changed files with 514,309 additions and 25,277 deletions.
37 changes: 15 additions & 22 deletions browser/base/content/browser-addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,18 @@ const gExtensionsNotifications = {
ExtensionsUI.off("change", this.boundUpdate);
},

_createAddonButton(text, icon, callback) {
let button = document.createElement("toolbarbutton");
button.setAttribute("label", text);
const DEFAULT_EXTENSION_ICON =
"chrome://mozapps/skin/extensions/extensionGeneric.svg";
button.setAttribute("image", icon || DEFAULT_EXTENSION_ICON);
button.className = "addon-banner-item";

button.addEventListener("click", callback);
PanelUI.addonNotificationContainer.appendChild(button);
},

updateAlerts() {
let sideloaded = ExtensionsUI.sideloaded;
let updates = ExtensionsUI.updates;
Expand All @@ -509,32 +521,21 @@ const gExtensionsNotifications = {
PanelUI.showBadgeOnlyNotification("addon-alert");
}

let container = document.getElementById("PanelUI-footer-addons");
let container = PanelUI.addonNotificationContainer;

while (container.firstChild) {
container.firstChild.remove();
}

const DEFAULT_EXTENSION_ICON =
"chrome://mozapps/skin/extensions/extensionGeneric.svg";
let items = 0;
for (let update of updates) {
if (++items > 4) {
break;
}

let button = document.createElement("toolbarbutton");
let text = gNavigatorBundle.getFormattedString("webextPerms.updateMenuItem", [update.addon.name]);
button.setAttribute("label", text);

let icon = update.addon.iconURL || DEFAULT_EXTENSION_ICON;
button.setAttribute("image", icon);

button.addEventListener("click", evt => {
this._createAddonButton(text, update.addon.iconURL, evt => {
ExtensionsUI.showUpdate(gBrowser, update);
});

container.appendChild(button);
}

let appName;
Expand All @@ -547,18 +548,10 @@ const gExtensionsNotifications = {
appName = brandBundle.getString("brandShortName");
}

let button = document.createElement("toolbarbutton");
let text = gNavigatorBundle.getFormattedString("webextPerms.sideloadMenuItem", [addon.name, appName]);
button.setAttribute("label", text);

let icon = addon.iconURL || DEFAULT_EXTENSION_ICON;
button.setAttribute("image", icon);

button.addEventListener("click", evt => {
this._createAddonButton(text, addon.iconURL, evt => {
ExtensionsUI.showSideloaded(gBrowser, addon);
});

container.appendChild(button);
}
},
};
Expand Down
3 changes: 2 additions & 1 deletion browser/base/content/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,8 @@ toolbarpaletteitem[place="palette"][hidden] {
max-width: 10em;
}

#main-window[customizing=true] .PanelUI-notification-menu-item {
#main-window[customizing=true] .addon-banner-item,
#main-window[customizing=true] .panel-banner-item {
display: none;
}

Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/test/appUpdate/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function processStep({notificationId, button, beforeClick, cleanup}) {
return;
}

let notification = document.getElementById(`PanelUI-${notificationId}-notification`);
let notification = document.getElementById(`appMenu-${notificationId}-notification`);
is(notification.hidden, false, `${notificationId} notification is showing`);
if (beforeClick) {
yield Task.spawn(beforeClick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ var whitelist = new Set([
// Bug 1348533
{file: "chrome://mozapps/skin/downloads/buttons.png", platforms: ["macosx"]},
{file: "chrome://mozapps/skin/downloads/downloadButtons.png", platforms: ["linux", "win"]},
// Bug 1348555
{file: "chrome://mozapps/skin/extensions/dictionaryGeneric-16.png"},
{file: "chrome://mozapps/skin/extensions/search.png", platforms: ["macosx"]},
{file: "chrome://mozapps/skin/extensions/themeGeneric-16.png"},
// Bug 1348556
{file: "chrome://mozapps/skin/plugins/pluginBlocked.png"},
// Bug 1348558
Expand All @@ -235,8 +231,6 @@ var whitelist = new Set([
{file: "resource://gre/modules/Manifest.jsm"},
// Bug 1351089
{file: "resource://gre/modules/PresentationDeviceInfoManager.jsm"},
// Bug 1351658
{file: "resource://gre/modules/PropertyListUtils.jsm", platforms: ["linux", "win"]},
// Bug 1351097
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
// Bug 1351637
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ add_task(function* () {
// Find the menu entries for sideloaded extensions
yield PanelUI.show();

let addons = document.getElementById("PanelUI-footer-addons");
let addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 4, "Have 4 menu entries for sideloaded extensions");

// Click the first sideloaded extension
Expand Down Expand Up @@ -226,7 +226,7 @@ add_task(function* () {
// Should still have 3 entries in the hamburger menu
yield PanelUI.show();

addons = document.getElementById("PanelUI-footer-addons");
addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 3, "Have 3 menu entries for sideloaded extensions");

// Click the second sideloaded extension and wait for the notification
Expand Down Expand Up @@ -260,7 +260,7 @@ add_task(function* () {
// Should still have 2 entries in the hamburger menu
yield PanelUI.show();

addons = document.getElementById("PanelUI-footer-addons");
addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 2, "Have 2 menu entries for sideloaded extensions");

// Close the hamburger menu and go directly to the addons manager
Expand Down Expand Up @@ -299,7 +299,7 @@ add_task(function* () {
// Should still have 1 entry in the hamburger menu
yield PanelUI.show();

addons = document.getElementById("PanelUI-footer-addons");
addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 1, "Have 1 menu entry for sideloaded extensions");

// Close the hamburger menu and go to the detail page for this addon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function* backgroundUpdateTest(url, id, checkIconFn) {
// Find the menu entry for the update
yield PanelUI.show();

let addons = document.getElementById("PanelUI-footer-addons");
let addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 1, "Have a menu entry for the update");

// Click the menu item
Expand Down Expand Up @@ -121,7 +121,7 @@ function* backgroundUpdateTest(url, id, checkIconFn) {
is(getBadgeStatus(), "", "Addon alert badge should be gone");

yield PanelUI.show();
addons = document.getElementById("PanelUI-footer-addons");
addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 0, "Update menu entries should be gone");
yield PanelUI.hide();

Expand All @@ -135,7 +135,7 @@ function* backgroundUpdateTest(url, id, checkIconFn) {
// Find the menu entry for the update
yield PanelUI.show();

addons = document.getElementById("PanelUI-footer-addons");
addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 1, "Have a menu entry for the update");

// Click the menu item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function testNoPrompt(origUrl, id) {
is(getBadgeStatus(), "", "Should not have addon alert badge");

await PanelUI.show();
let addons = document.getElementById("PanelUI-footer-addons");
let addons = PanelUI.addonNotificationContainer;
is(addons.children.length, 0, "Have 0 updates in the PanelUI menu");
await PanelUI.hide();

Expand Down
3 changes: 1 addition & 2 deletions browser/base/content/test/webrtc/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ skip-if = (os == "linux" && debug) # linux: bug 976544
[browser_devices_get_user_media_multi_process.js]
skip-if = e10s && (asan || debug) # bug 1347625
[browser_devices_get_user_media_screen.js]
skip-if = (os == "linux") || (os == "win" && !debug) # bug 1320994 for linux opt, bug 1338038 for windows and linux debug
[browser_devices_get_user_media_tear_off_tab.js]
[browser_devices_get_user_media_unprompted_access.js]
[browser_devices_get_user_media_unprompted_access_in_frame.js]
[browser_devices_get_user_media_unprompted_access_tear_off_tab.js]
skip-if = (os == "linux") || (os == "win" && bits == 64) # linux: bug 1331616, win8: bug 1334752
skip-if = (os == "win" && bits == 64) # win8: bug 1334752
[browser_webrtc_hooks.js]
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var gTests = [
menulist.getItemAtIndex(2).doCommand();
ok(!document.getElementById("webRTC-all-windows-shared").hidden,
"the 'all windows will be shared' warning should now be visible");
yield promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden);
yield promiseWaitForCondition(() => !document.getElementById("webRTC-preview").hidden, 100);
ok(!document.getElementById("webRTC-preview").hidden,
"the preview area is visible");
ok(!document.getElementById("webRTC-previewWarning").hidden,
Expand Down Expand Up @@ -410,7 +410,7 @@ var gTests = [
yield check({video: true, audio: true});

info("Stop the camera, everything should stop.");
yield stopSharing("camera", false, true);
yield stopSharing("camera");

info("Now, share only the screen...");
indicator = promiseIndicatorWindow();
Expand All @@ -423,7 +423,7 @@ var gTests = [
yield check({video: true, audio: true, screen: "Screen"});

info("Stop the camera, this should stop everything.");
yield stopSharing("camera", false, true);
yield stopSharing("camera");
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var gTests = [
SitePermissions.remove(null, "microphone", gBrowser.selectedBrowser);

// After closing all streams, gUM(audio+camera) causes a prompt.
yield closeStream(false, 0, 2);
yield closeStream();
promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true);
yield promise;
Expand Down Expand Up @@ -169,7 +169,7 @@ var gTests = [
yield checkSharingUI({audio: false, video: true});

// close all streams
yield closeStream(false, 0, 2);
yield closeStream();
}
},

Expand Down Expand Up @@ -241,7 +241,7 @@ var gTests = [
yield checkSharingUI({audio: true, video: false});

// close all streams
yield closeStream(false, 0, 2);
yield closeStream();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var gTests = [
yield expectObserverCalled("recording-device-events");

// close the stream
yield closeStream(false, "frame1", 2);
yield closeStream(false, "frame1");
}
},

Expand Down Expand Up @@ -197,7 +197,7 @@ var gTests = [
yield expectObserverCalled("recording-window-ended");

// close the stream
yield closeStream(false);
yield closeStream();
SitePermissions.remove(null, "screen", gBrowser.selectedBrowser);
SitePermissions.remove(null, "camera", gBrowser.selectedBrowser);
SitePermissions.remove(null, "microphone", gBrowser.selectedBrowser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var gTests = [
yield Promise.all(promises);

promises = [promiseObserverCalled("recording-device-events"),
promiseObserverCalled("recording-device-events"),
promiseObserverCalled("recording-window-ended")];
yield BrowserTestUtils.closeWindow(win);
yield Promise.all(promises);
Expand Down
30 changes: 9 additions & 21 deletions browser/base/content/test/webrtc/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function waitForCondition(condition, nextTest, errorMsg, retryTimes) {
var moveOn = function() { clearInterval(interval); nextTest(); };
}

function promiseWaitForCondition(aConditionFn) {
function promiseWaitForCondition(aConditionFn, retryTimes) {
let deferred = Promise.defer();
waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.");
waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.", retryTimes);
return deferred.promise;
}

Expand Down Expand Up @@ -215,7 +215,7 @@ function expectObserverCalled(aTopic) {
});
}

function expectNoObserverCalled(aIgnoreDeviceEvents = false) {
function expectNoObserverCalled() {
return new Promise(resolve => {
let mm = _mm();
mm.addMessageListener("Test:ExpectNoObserverCalled:Reply",
Expand All @@ -225,15 +225,7 @@ function expectNoObserverCalled(aIgnoreDeviceEvents = false) {
if (!data[topic])
continue;

// If we are stopping tracks that were created from 2 different
// getUserMedia calls, the "recording-device-events" notification is
// fired twice on Windows and Mac, and intermittently twice on Linux.
if (topic == "recording-device-events" && aIgnoreDeviceEvents) {
todo(false, "Got " + data[topic] + " unexpected " + topic +
" notifications, see bug 1320994");
} else {
is(data[topic], 0, topic + " notification unexpected");
}
is(data[topic], 0, topic + " notification unexpected");
}
resolve();
});
Expand Down Expand Up @@ -354,8 +346,7 @@ function getMediaCaptureState() {
});
}

function* stopSharing(aType = "camera", aShouldKeepSharing = false,
aExpectDoubleRecordingEvent = false) {
function* stopSharing(aType = "camera", aShouldKeepSharing = false) {
let promiseRecordingEvent = promiseObserverCalled("recording-device-events");
gIdentityHandler._identityBox.click();
let permissions = document.getElementById("identity-popup-permission-list");
Expand All @@ -372,7 +363,7 @@ function* stopSharing(aType = "camera", aShouldKeepSharing = false,
if (!aShouldKeepSharing)
yield expectObserverCalled("recording-window-ended");

yield expectNoObserverCalled(aExpectDoubleRecordingEvent);
yield expectNoObserverCalled();

if (!aShouldKeepSharing)
yield* checkNotSharing();
Expand All @@ -391,16 +382,13 @@ function promiseRequestDevice(aRequestAudio, aRequestVideo, aFrameId, aType,
});
}

function* closeStream(aAlreadyClosed, aFrameId, aStreamCount = 1) {
function* closeStream(aAlreadyClosed, aFrameId) {
yield expectNoObserverCalled();

let promises;
if (!aAlreadyClosed) {
promises = [];
for (let i = 0; i < aStreamCount; i++) {
promises.push(promiseObserverCalled("recording-device-events"));
}
promises.push(promiseObserverCalled("recording-window-ended"));
promises = [promiseObserverCalled("recording-device-events"),
promiseObserverCalled("recording-window-ended")];
}

info("closing the stream");
Expand Down
Loading

0 comments on commit b223516

Please sign in to comment.