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
BavarianTomcat committed Mar 1, 2017
2 parents b890459 + 3b3f4c1 commit b43c07a
Show file tree
Hide file tree
Showing 366 changed files with 9,965 additions and 3,335 deletions.
3 changes: 3 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
^widget/android/GeneratedJNINatives.h
^widget/android/GeneratedJNIWrappers.cpp
^widget/android/GeneratedJNIWrappers.h
^widget/android/fennec/FennecJNINatives.h
^widget/android/fennec/FennecJNIWrappers.cpp
^widget/android/fennec/FennecJNIWrappers.h

# Generated from ./tools/rewriting/ThirdPartyPaths.txt
# awk '{print "^"$1".*"}' ./tools/rewriting/ThirdPartyPaths.txt
Expand Down
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ devtools/client/framework/**
devtools/client/inspector/markup/test/doc_markup_events_*.html
devtools/client/inspector/rules/test/doc_media_queries.html
devtools/client/memory/test/chrome/*.html
devtools/client/netmonitor/test/**
devtools/client/netmonitor/har/test/**
devtools/client/performance/components/test/test_jit_optimizations_01.html
devtools/client/projecteditor/**
devtools/client/responsive.html/test/browser/touch.html
Expand Down
50 changes: 49 additions & 1 deletion browser/base/content/test/webextensions/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,37 @@ function is_visible(element) {
return true;
}

/**
* Check the contents of an individual permission string.
* This function is fairly specific to the use here and probably not
* suitable for re-use elsewhere...
*
* @param {string} string
* The string value to check (i.e., pulled from the DOM)
* @param {string} key
* The key in browser.properties for the localized string to
* compare with.
* @param {string|null} param
* Optional string to substitute for %S in the localized string.
* @param {string} msg
* The message to be emitted as part of the actual test.
*/
function checkPermissionString(string, key, param, msg) {
let localizedString = param ?
gBrowserBundle.formatStringFromName(key, [param], 1) :
gBrowserBundle.GetStringFromName(key);

// If this is a parameterized string and the parameter isn't given,
// just do a simple comparison of the text before and after the %S
if (localizedString.includes("%S")) {
let i = localizedString.indexOf("%S");
ok(string.startsWith(localizedString.slice(0, i)), msg);
ok(string.endsWith(localizedString.slice(i + 2)), msg);
} else {
is(string, localizedString, msg);
}
}

/**
* Test that install-time permission prompts work for a given
* installation method.
Expand Down Expand Up @@ -196,7 +227,24 @@ async function testInstallMethod(installFn) {

is(header.getAttribute("hidden"), "", "Permission list header is visible");
is(ul.childElementCount, 5, "Permissions list has 5 entries");
// Real checking of the contents here is deferred until bug 1316996 lands

checkPermissionString(ul.children[0].textContent,
"webextPerms.hostDescription.wildcard",
"wildcard.domain",
"First permission is domain permission");
checkPermissionString(ul.children[1].textContent,
"webextPerms.hostDescription.oneSite",
"singlehost.domain",
"Second permission is single host permission");
checkPermissionString(ul.children[2].textContent,
"webextPerms.description.nativeMessaging", null,
"Third permission is nativeMessaging");
checkPermissionString(ul.children[3].textContent,
"webextPerms.description.tabs", null,
"Fourth permission is tabs");
checkPermissionString(ul.children[4].textContent,
"webextPerms.description.history", null,
"Fifth permission is history");
} else if (filename == NO_PERMS_XPI) {
// This extension has no icon, it should have the default
ok(isDefaultIcon(icon), "Icon is the default extension icon");
Expand Down
11 changes: 8 additions & 3 deletions browser/components/preferences/in-content/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -1348,9 +1348,10 @@ var gApplicationsPane = {
while (menuPopup.hasChildNodes())
menuPopup.removeChild(menuPopup.lastChild);

let internalMenuItem;
// Add the "Preview in Firefox" option for optional internal handlers.
if (handlerInfo instanceof InternalHandlerInfoWrapper) {
let internalMenuItem = document.createElement("menuitem");
internalMenuItem = document.createElement("menuitem");
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
let label = this._prefsBundle.getFormattedString("previewInApp",
[this._brandShortName]);
Expand Down Expand Up @@ -1392,7 +1393,7 @@ var gApplicationsPane = {

// If this is the feed type, add a Live Bookmarks item.
if (isFeedType(handlerInfo.type)) {
let internalMenuItem = document.createElement("menuitem");
internalMenuItem = document.createElement("menuitem");
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
let label = this._prefsBundle.getFormattedString("addLiveBookmarksInApp",
[this._brandShortName]);
Expand Down Expand Up @@ -1504,7 +1505,11 @@ var gApplicationsPane = {
menu.selectedItem = askMenuItem;
else switch (handlerInfo.preferredAction) {
case Ci.nsIHandlerInfo.handleInternally:
menu.selectedItem = internalMenuItem;
if (internalMenuItem) {
menu.selectedItem = internalMenuItem;
} else {
Cu.reportError("No menu item defined to set!")
}
break;
case Ci.nsIHandlerInfo.useSystemDefault:
menu.selectedItem = defaultMenuItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ support-files =
privacypane_tests_perwindow.js
site_data_test.html

[browser_applications_selection.js]
[browser_advanced_siteData.js]
[browser_advanced_update.js]
skip-if = !updater
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
var win;
var feedItem;
var container;

SimpleTest.requestCompleteLog();

add_task(function* setup() {
yield openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true});
info("Preferences page opened on the applications pane.");

registerCleanupFunction(() => {
gBrowser.removeCurrentTab();
});
});

add_task(function* getFeedItem() {
win = gBrowser.selectedBrowser.contentWindow;

container = win.document.getElementById("handlersView");
feedItem = container.querySelector("richlistitem[type='application/vnd.mozilla.maybe.feed']");
Assert.ok(feedItem, "feedItem is present in handlersView.");
})

add_task(function* selectInternalOptionForFeed() {
// Select the item.
feedItem.scrollIntoView();
container.selectItem(feedItem);
Assert.ok(feedItem.selected, "Should be able to select our item.");

// Wait for the menu.
let list = yield waitForCondition(() =>
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
info("Got list after item was selected");

// Find the "Add Live bookmarks option".
let chooseItems = list.getElementsByAttribute("action", Ci.nsIHandlerInfo.handleInternally);
Assert.equal(chooseItems.length, 1, "Should only be one action to handle internally");

// Select the option.
let cmdEvent = win.document.createEvent("xulcommandevent");
cmdEvent.initCommandEvent("command", true, true, win, 0, false, false, false, false, null);
chooseItems[0].dispatchEvent(cmdEvent);

// Check that we display the correct result.
list = yield waitForCondition(() =>
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
info("Got list after item was selected");
Assert.ok(list.selectedItem, "Should have a selected item.");
Assert.equal(list.selectedItem.getAttribute("action"),
Ci.nsIHandlerInfo.handleInternally,
"Newly selected item should be the expected one.");
});

// This builds on the previous selectInternalOptionForFeed task.
add_task(function* reselectInternalOptionForFeed() {
// Now select a different option in the list - use the pdf item as that doesn't
// need to load any favicons.
let anotherItem = container.querySelector("richlistitem[type='application/pdf']");

container.selectItem(anotherItem);

// Wait for the menu so that we don't hit race conditions.
yield waitForCondition(() =>
win.document.getAnonymousElementByAttribute(anotherItem, "class", "actionsMenu"));
info("Got list after item was selected");

// Now select the feed item again, and check what it is displaying.
container.selectItem(feedItem);

let list = yield waitForCondition(() =>
win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
info("Got list after item was selected");

Assert.ok(list.selectedItem,
"Should have a selected item");
Assert.equal(list.selectedItem.getAttribute("action"),
Ci.nsIHandlerInfo.handleInternally,
"Selected item should still be the same as the previously selected item.");
});
7 changes: 7 additions & 0 deletions browser/locales/search/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
]
}
},
"be": {
"default": {
"visibleDefaultEngines": [
"yandex-by", "google", "ddg", "wikipedia-be", "wikipedia-be-tarask"
]
}
},
"bg": {
"default": {
"visibleDefaultEngines": [
Expand Down
19 changes: 19 additions & 0 deletions browser/locales/searchplugins/wikipedia-be-tarask.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Вікіпэдыя (be-tarask)</ShortName>
<Description>Вікіпэдыя, вольная энцыкляпэдыя</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">resource://search-plugins/images/wikipedia.ico</Image>
<Url type="application/x-suggestions+json" method="GET" template="https://be-tarask.wikipedia.org/w/api.php">
<Param name="action" value="opensearch"/>
<Param name="search" value="{searchTerms}"/>
</Url>
<Url type="text/html" method="GET" template="https://be-tarask.wikipedia.org/wiki/Спэцыяльныя:Пошук"
resultdomain="wikipedia.org" rel="searchform">
<Param name="search" value="{searchTerms}"/>
<Param name="sourceid" value="Mozilla-search"/>
</Url>
</SearchPlugin>
19 changes: 19 additions & 0 deletions browser/locales/searchplugins/wikipedia-be.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Вікіпедыя (be)</ShortName>
<Description>Вікіпедыя, свабодная энцыклапедыя</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">resource://search-plugins/images/wikipedia.ico</Image>
<Url type="application/x-suggestions+json" method="GET" template="https://be.wikipedia.org/w/api.php">
<Param name="action" value="opensearch"/>
<Param name="search" value="{searchTerms}"/>
</Url>
<Url type="text/html" method="GET" template="https://be.wikipedia.org/wiki/Адмысловае:Search"
resultdomain="wikipedia.org" rel="searchform">
<Param name="search" value="{searchTerms}"/>
<Param name="sourceid" value="Mozilla-search"/>
</Url>
</SearchPlugin>
22 changes: 22 additions & 0 deletions browser/locales/searchplugins/yandex-by.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Яндекс</ShortName>
<Description>Пошук з дапамогаю Яндекс</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAB50lEQVQ4T43SvWsacRgH8OcPCITSLRQ6BSRL1gxZTNZQsgYC3QKunVoMnTKFhBQSnDqIUa5gxNbBCgriC4pv50sJ1lIR5SROpRVbz+O4b5/flbvedekJH+557nvfH8chdbvdIFMYPAgBICdqt9uKpmnw8huNRuDnX8J5QKvVgmEYnqiqClmWwZ113kmger0OXdf/Wv6EIb0BTo+AgB94ceDKJ5MJuHPOMwlUqVSwWq1sevQaxqvn0O5l6HdvgaMdV75cLtFoNMC9Xd6JisWiedNiPNuB9l4yZ+1jEvBvuXJBURRwL8YzUT6fx2KxsGHrKdQPCXNW794Bvieu3CLegrsnlM1mMZ/PbfqeH6vToDkvb2+Bx49cuWU2m4G7bUqn0xiPx7ZpqYRf29v4cXyMxf4+tLU1V24ZDAbgbptSqRSGw6HL9OwM37n4bXPTvP6bC7lcDtw9oWQyiX6/b/vMH1XZ2MAoEMDXqytM+QBnLtRqNXAvxjNRPB5Hr9ez9Q8PMfD50OM/2P3FBb7wAc680+mIMri3yzuRJEloNpsmORTCJy7INzd/9stLc7dyIZPJgDvnPJNA0WgU1WrVkxJ/4FgsBu6s804CRSKRh0KhgHK5/F+JRAL8fJBnslA4HH7NHhg8CDnLwm8IYz560xw92AAAAABJRU5ErkJggg==</Image>
<Url type="application/x-suggestions+json" method="GET" template="https://suggest.yandex.net/suggest-ff.cgi">
<Param name="part" value="{searchTerms}"/>
</Url>
<Url type="text/html" method="GET" template="https://yandex.by/yandsearch" resultdomain="yandex.by">
<MozParam name="clid" condition="purpose" purpose="searchbar" value="2186618"/>
<MozParam name="clid" condition="purpose" purpose="keyword" value="2186621"/>
<MozParam name="clid" condition="purpose" purpose="contextmenu" value="2186623"/>
<MozParam name="clid" condition="purpose" purpose="homepage" value="2186617"/>
<MozParam name="clid" condition="purpose" purpose="newtab" value="2186620"/>
<Param name="text" value="{searchTerms}"/>
</Url>
<SearchForm>https://www.yandex.by/</SearchForm>
</SearchPlugin>
46 changes: 29 additions & 17 deletions browser/modules/ExtensionsUI.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,7 @@ this.ExtensionsUI = {

let perms = info.permissions || {hosts: [], permissions: []};

result.msgs = [];
for (let permission of perms.permissions) {
let key = `webextPerms.description.${permission}`;
if (permission == "nativeMessaging") {
let brandBundle = Services.strings.createBundle(BRAND_PROPERTIES);
let appName = brandBundle.GetStringFromName("brandShortName");
result.msgs.push(bundle.formatStringFromName(key, [appName], 1));
} else {
try {
result.msgs.push(bundle.GetStringFromName(key));
} catch (err) {
// We deliberately do not include all permissions in the prompt.
// So if we don't find one then just skip it.
}
}
}

// First classify our host permissions
let allUrls = false, wildcards = [], sites = [];
for (let permission of perms.hosts) {
if (permission == "<all_urls>") {
Expand All @@ -256,6 +240,10 @@ this.ExtensionsUI = {
}
}

// Format the host permissions. If we have a wildcard for all urls,
// a single string will suffice. Otherwise, show domain wildcards
// first, then individual host permissions.
result.msgs = [];
if (allUrls) {
result.msgs.push(bundle.GetStringFromName("webextPerms.hostDescription.allUrls"));
} else {
Expand Down Expand Up @@ -283,6 +271,30 @@ this.ExtensionsUI = {
"webextPerms.hostDescription.tooManySites");
}

let permissionKey = perm => `webextPerms.description.${perm}`;

// Next, show the native messaging permission if it is present.
const NATIVE_MSG_PERM = "nativeMessaging";
if (perms.permissions.includes(NATIVE_MSG_PERM)) {
let brandBundle = Services.strings.createBundle(BRAND_PROPERTIES);
let appName = brandBundle.GetStringFromName("brandShortName");
result.msgs.push(bundle.formatStringFromName(permissionKey(NATIVE_MSG_PERM), [appName], 1));
}

// Finally, show remaining permissions, in any order.
for (let permission of perms.permissions) {
// Handled above
if (permission == "nativeMessaging") {
continue;
}
try {
result.msgs.push(bundle.GetStringFromName(permissionKey(permission)));
} catch (err) {
// We deliberately do not include all permissions in the prompt.
// So if we don't find one then just skip it.
}
}

return result;
},

Expand Down
2 changes: 2 additions & 0 deletions browser/themes/shared/customizableui/panelUI.inc.css
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ toolbarpaletteitem[place="palette"] > toolbaritem > toolbarbutton {

#PanelUI-footer-addons > toolbarbutton {
background-color: #FFEFBF;
/* Force border to override `#PanelUI-footer-addons > toolbarbutton` selector below */
border-top: 1px solid hsl(45, 100%, 77%) !important;
display: flex;
flex: 1 1 0%;
width: calc(@menuPanelWidth@ + 30px);
Expand Down
1 change: 1 addition & 0 deletions devtools/client/inspector/rules/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ skip-if = os == "mac" # Bug 1245996 : click on scrollbar not working on OSX
[browser_rules_filtereditor-revert-on-ESC.js]
skip-if = (os == "win" && debug) # bug 963492: win.
[browser_rules_grid-highlighter-on-navigate.js]
[browser_rules_grid-highlighter-on-reload.js]
[browser_rules_grid-toggle_01.js]
[browser_rules_grid-toggle_01b.js]
[browser_rules_grid-toggle_02.js]
Expand Down
Loading

0 comments on commit b43c07a

Please sign in to comment.