Merge m-c to b2ginbound a=merge

This commit is contained in:
Wes Kocher 2015-05-15 17:32:38 -07:00
Родитель 7bd38d1cfe 5e59586179
Коммит 961d54ee8e
21 изменённых файлов: 127 добавлений и 96 удалений

Просмотреть файл

@ -49,7 +49,7 @@ const gXPInstallObserver = {
};
try {
options.originHost = installInfo.originatingURI.host;
options.displayOrigin = installInfo.originatingURI.host;
} catch (e) {
// originatingURI might be missing or 'host' might throw for non-nsStandardURL nsIURIs.
}
@ -78,7 +78,7 @@ const gXPInstallObserver = {
action, null, options);
break; }
case "addon-install-blocked": {
if (!options.originHost) {
if (!options.displayOrigin) {
// Need to deal with missing originatingURI and with about:/data: URIs more gracefully,
// see bug 1063418 - but for now, bail:
return;
@ -138,7 +138,7 @@ const gXPInstallObserver = {
case "addon-install-failed": {
// TODO This isn't terribly ideal for the multiple failure case
for (let install of installInfo.installs) {
let host = options.originHost;
let host = options.displayOrigin;
if (!host)
host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
install.sourceURI.host;

Просмотреть файл

@ -2389,9 +2389,8 @@ function URLBarSetURI(aURI) {
// Replace initial page URIs with an empty string
// only if there's no opener (bug 370555).
// Bug 863515 - Make content.opener checks work in electrolysis.
if (gInitialPages.indexOf(uri.spec) != -1)
value = !gMultiProcessBrowser && content.opener ? uri.spec : "";
value = gBrowser.selectedBrowser.hasContentOpener ? uri.spec : "";
else
value = losslessDecodeURI(uri);
@ -4158,7 +4157,7 @@ var XULBrowserWindow = {
// Do not update urlbar if there was a subframe navigation
if (aWebProgress.isTopLevel) {
if ((location == "about:blank" && (gMultiProcessBrowser || !content.opener)) ||
if ((location == "about:blank" && !gBrowser.selectedBrowser.hasContentOpener) ||
location == "") { // Second condition is for new tabs, otherwise
// reload function is enabled until tab is refreshed.
this.reloadCommand.setAttribute("disabled", "true");
@ -6533,8 +6532,7 @@ function isTabEmpty(aTab) {
if (!isBlankPageURL(browser.currentURI.spec))
return false;
// Bug 863515 - Make content.opener checks work in electrolysis.
if (!gMultiProcessBrowser && browser.contentWindow.opener)
if (browser.hasContentOpener)
return false;
if (browser.canGoForward || browser.canGoBack)

Просмотреть файл

@ -205,7 +205,7 @@ function test_blocked_install() {
wait_for_notification("addon-install-blocked", function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.button.label, "Allow", "Should have seen the right button");
is(notification.getAttribute("originhost"), "example.com",
is(notification.getAttribute("origin"), "example.com",
"Should have seen the right origin host");
is(notification.getAttribute("label"),
gApp + " prevented this site from asking you to install software on your computer.",

Просмотреть файл

@ -2346,11 +2346,6 @@ ContentPermissionPrompt.prototype = {
*/
_showPrompt: function CPP_showPrompt(aRequest, aMessage, aPermission, aActions,
aNotificationId, aAnchorId, aOptions) {
function onFullScreen() {
popup.remove();
}
var browser = this._getBrowserForRequest(aRequest);
var chromeWin = browser.ownerDocument.defaultView;
var requestPrincipal = aRequest.principal;
@ -2397,43 +2392,15 @@ ContentPermissionPrompt.prototype = {
popupNotificationActions[0] : null;
var secondaryActions = popupNotificationActions.splice(1);
// Only allow exactly one permission rquest here.
// Only allow exactly one permission request here.
let types = aRequest.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
aRequest.cancel();
return;
}
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
if (perm.type == "pointerLock") {
// If there's no mainAction, this is the autoAllow warning prompt.
let autoAllow = !mainAction;
if (!aOptions)
aOptions = {};
aOptions.removeOnDismissal = autoAllow;
aOptions.eventCallback = type => {
if (type == "removed") {
browser.removeEventListener("mozfullscreenchange", onFullScreen, true);
if (autoAllow) {
aRequest.allow();
}
}
}
}
var popup = chromeWin.PopupNotifications.show(browser, aNotificationId, aMessage, aAnchorId,
mainAction, secondaryActions, aOptions);
if (perm.type == "pointerLock") {
// pointerLock is automatically allowed in fullscreen mode (and revoked
// upon exit), so if the page enters fullscreen mode after requesting
// pointerLock (but before the user has granted permission), we should
// remove the now-impotent notification.
browser.addEventListener("mozfullscreenchange", onFullScreen, true);
}
return chromeWin.PopupNotifications.show(browser, aNotificationId, aMessage, aAnchorId,
mainAction, secondaryActions, aOptions);
},
_promptPush : function(aRequest) {
@ -2488,12 +2455,16 @@ ContentPermissionPrompt.prototype = {
},
}];
let options = {
learnMoreURL: Services.urlFormatter.formatURLPref("browser.geolocation.warning.infoURL"),
};
if (requestingURI.schemeIs("file")) {
message = gBrowserBundle.formatStringFromName("geolocation.shareWithFile",
[requestingURI.path], 1);
options.displayOrigin = requestingURI.path;
message = gBrowserBundle.GetStringFromName("geolocation.shareWithFile2");
} else {
message = gBrowserBundle.formatStringFromName("geolocation.shareWithSite",
[requestingURI.host], 1);
options.displayOrigin = requestingURI.host;
message = gBrowserBundle.GetStringFromName("geolocation.shareWithSite2");
// Always share location action.
actions.push({
stringId: "geolocation.alwaysShareLocation",
@ -2515,10 +2486,6 @@ ContentPermissionPrompt.prototype = {
});
}
var options = {
learnMoreURL: Services.urlFormatter.formatURLPref("browser.geolocation.warning.infoURL"),
};
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST);
this._showPrompt(aRequest, message, "geo", actions, "geolocation",
@ -2591,12 +2558,34 @@ ContentPermissionPrompt.prototype = {
];
}
this._showPrompt(aRequest, message, "pointerLock", actions, "pointerLock",
"pointerLock-notification-icon", null);
function onFullScreen() {
notification.remove();
}
let options = {};
options.removeOnDismissal = autoAllow;
options.eventCallback = type => {
if (type == "removed") {
notification.browser.removeEventListener("mozfullscreenchange", onFullScreen, true);
if (autoAllow) {
aRequest.allow();
}
}
}
let notification =
this._showPrompt(aRequest, message, "pointerLock", actions, "pointerLock",
"pointerLock-notification-icon", options);
// pointerLock is automatically allowed in fullscreen mode (and revoked
// upon exit), so if the page enters fullscreen mode after requesting
// pointerLock (but before the user has granted permission), we should
// remove the now-impotent notification.
notification.browser.addEventListener("mozfullscreenchange", onFullScreen, true);
},
prompt: function CPP_prompt(request) {
// Only allow exactly one permission rquest here.
// Only allow exactly one permission request here.
let types = request.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
request.cancel();

Просмотреть файл

@ -201,6 +201,7 @@ Section "-InstallStartCleanup"
SetOutPath "$INSTDIR"
${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}"
StrCpy $R9 "true"
StrCpy $PreventRebootRequired "false"
${GetParameters} $R8
${GetOptions} "$R8" "/INI=" $R7

Просмотреть файл

@ -369,8 +369,8 @@ geolocation.alwaysShareLocation=Always Share Location
geolocation.alwaysShareLocation.accesskey=A
geolocation.neverShareLocation=Never Share Location
geolocation.neverShareLocation.accesskey=N
geolocation.shareWithSite=Would you like to share your location with %S?
geolocation.shareWithFile=Would you like to share your location with the file %S?
geolocation.shareWithSite2=Would you like to share your location with this site?
geolocation.shareWithFile2=Would you like to share your location with this file?
webNotifications.showForSession=Show for this session
webNotifications.showForSession.accesskey=s

Просмотреть файл

@ -1167,10 +1167,6 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
list-style-image: url(moz-icon://stock/gtk-dialog-question?size=16);
}
#pointerLock-cancel {
margin: 0px;
}
/* Translation infobar */
%include ../shared/translation/infobar.inc.css

Просмотреть файл

@ -2172,10 +2172,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
outline: 1px dotted -moz-DialogText;
}
#pointerLock-cancel {
margin: 0px;
}
/* Translation infobar */
%include ../shared/translation/infobar.inc.css

Просмотреть файл

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(b19038ba-0d75-40d2-be35-742e26d33bf9)]
[scriptable, uuid(4d4576eb-ecfe-47b9-93b8-4121518621ad)]
interface nsITabParent : nsISupports
{
void injectTouchEvent(in AString aType,
@ -26,4 +26,6 @@ interface nsITabParent : nsISupports
void setIsDocShellActive(in bool aIsActive);
readonly attribute uint64_t tabId;
readonly attribute boolean hasContentOpener;
};

Просмотреть файл

@ -284,6 +284,7 @@ TabParent::TabParent(nsIContentParent* aManager,
, mNeedLayerTreeReadyNotification(false)
, mCursor(nsCursor(-1))
, mTabSetsCursor(false)
, mHasContentOpener(false)
{
MOZ_ASSERT(aManager);
}
@ -609,6 +610,11 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
NS_ENSURE_SUCCESS(rv, false);
TabParent* newTab = TabParent::GetFrom(aNewTab);
MOZ_ASSERT(newTab);
// Content has requested that we open this new content window, so
// we must have an opener.
newTab->SetHasContentOpener(true);
nsCOMPtr<nsIContent> frame(do_QueryInterface(mFrameElement));
@ -2906,6 +2912,19 @@ TabParent::GetTabId(uint64_t* aId)
return NS_OK;
}
NS_IMETHODIMP
TabParent::GetHasContentOpener(bool* aResult)
{
*aResult = mHasContentOpener;
return NS_OK;
}
void
TabParent::SetHasContentOpener(bool aHasContentOpener)
{
mHasContentOpener = aHasContentOpener;
}
class LayerTreeUpdateRunnable final
: public nsRunnable
{

Просмотреть файл

@ -458,6 +458,8 @@ protected:
bool InitBrowserConfiguration(const nsCString& aURI,
BrowserConfiguration& aConfiguration);
void SetHasContentOpener(bool aHasContentOpener);
// IME
static TabParent *mIMETabParent;
nsString mIMECacheText;
@ -605,6 +607,7 @@ private:
nsRefPtr<nsIPresShell> mPresShellWithRefreshListener;
bool mHasContentOpener;
private:
// This is used when APZ needs to find the TabParent associated with a layer
// to dispatch events.

Просмотреть файл

@ -282,6 +282,13 @@ this.ReaderMode = {
dump("Reader: " + msg);
},
_blockedHosts: [
"twitter.com",
"mail.google.com",
"github.com",
"reddit.com",
],
_shouldCheckUri: function (uri) {
if (!(uri.schemeIs("http") || uri.schemeIs("https") || uri.schemeIs("file"))) {
this.log("Not parsing URI scheme: " + uri.scheme);
@ -294,6 +301,12 @@ this.ReaderMode = {
// If this doesn't work, presumably the URL is not well-formed or something
return false;
}
// Sadly, some high-profile pages have false positives, so bail early for those:
let asciiHost = uri.asciiHost;
if (this._blockedHosts.some(blockedHost => asciiHost.endsWith(blockedHost))) {
return false;
}
if (!uri.filePath || uri.filePath == "/") {
this.log("Not parsing home page: " + uri.spec);
return false;

Просмотреть файл

@ -328,7 +328,7 @@ let ViewSourceChrome = {
_loadViewSourceDeprecated() {
Deprecated.warning("The arguments you're passing to viewSource.xul " +
"are using an out-of-date API.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
// Parse the 'arguments' supplied with the dialog.
// arg[0] - URL string.
// arg[1] - Charset value in the form 'charset=xxx'.
@ -844,35 +844,35 @@ function ViewSourceSavePage()
this.__defineGetter__("gLastLineFound", function () {
Deprecated.warning("gLastLineFound is deprecated - please use " +
"ViewSourceChrome.lastLineFound instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
return ViewSourceChrome.lastLineFound;
});
function onLoadViewSource() {
Deprecated.warning("onLoadViewSource() is deprecated - please use " +
"ViewSourceChrome.onXULLoaded() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.onXULLoaded();
}
function isHistoryEnabled() {
Deprecated.warning("isHistoryEnabled() is deprecated - please use " +
"ViewSourceChrome.historyEnabled instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
return ViewSourceChrome.historyEnabled;
}
function ViewSourceClose() {
Deprecated.warning("ViewSourceClose() is deprecated - please use " +
"ViewSourceChrome.close() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.close();
}
function ViewSourceReload() {
Deprecated.warning("ViewSourceReload() is deprecated - please use " +
"ViewSourceChrome.reload() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.reload();
}
@ -880,7 +880,7 @@ function getWebNavigation()
{
Deprecated.warning("getWebNavigation() is deprecated - please use " +
"ViewSourceChrome.webNav instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
// The original implementation returned null if anything threw during
// the getting of the webNavigation.
try {
@ -893,7 +893,7 @@ function getWebNavigation()
function viewSource(url) {
Deprecated.warning("viewSource() is deprecated - please use " +
"ViewSourceChrome.loadURL() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.loadURL(url);
}
@ -901,7 +901,7 @@ function ViewSourceGoToLine()
{
Deprecated.warning("ViewSourceGoToLine() is deprecated - please use " +
"ViewSourceChrome.promptAndGoToLine() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.promptAndGoToLine();
}
@ -909,27 +909,27 @@ function goToLine(line)
{
Deprecated.warning("goToLine() is deprecated - please use " +
"ViewSourceChrome.goToLine() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.goToLine(line);
}
function BrowserForward(aEvent) {
Deprecated.warning("BrowserForward() is deprecated - please use " +
"ViewSourceChrome.goForward() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.goForward();
}
function BrowserBack(aEvent) {
Deprecated.warning("BrowserBack() is deprecated - please use " +
"ViewSourceChrome.goBack() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.goBack();
}
function UpdateBackForwardCommands() {
Deprecated.warning("UpdateBackForwardCommands() is deprecated - please use " +
"ViewSourceChrome.updateCommands() instead.",
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/ViewSource");
"https://developer.mozilla.org/en-US/Add-ons/Code_snippets/View_Source_for_XUL_Applications");
ViewSourceChrome.updateCommands();
}

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* To keep the global namespace safe, don't define global variables and
* To keep the global namespace safe, don't define global variables and
* functions in this file.
*
* This file silently depends on contentAreaUtils.js for
@ -205,7 +205,7 @@ var gViewSourceUtils = {
internalViewerFallback: function(result, data)
{
if (!result) {
this.openInInternalViewer(data.url, data.pageDescriptor, data.doc, data.lineNumber);
this._openInInternalViewer(data.url, data.pageDescriptor, data.doc, data.lineNumber);
}
},

Просмотреть файл

@ -503,6 +503,12 @@
]]></getter>
</property>
<property name="hasContentOpener">
<getter><![CDATA[
return !!this.contentWindow.opener;
]]></getter>
</property>
<field name="mPrefs" readonly="true">
Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);

Просмотреть файл

@ -478,9 +478,9 @@
<xul:vbox>
<xul:hbox align="start">
<xul:vbox flex="1">
<xul:label class="popup-notification-originHost header"
xbl:inherits="value=originhost"
crop="end"/>
<xul:label class="popup-notification-origin header"
xbl:inherits="value=origin,tooltiptext=origin"
crop="center"/>
<xul:description class="popup-notification-description"
xbl:inherits="xbl:text=label,popupid"/>
</xul:vbox>

Просмотреть файл

@ -198,6 +198,13 @@
]]></getter>
</property>
<property name="hasContentOpener">
<getter><![CDATA[
let {frameLoader} = this.QueryInterface(Ci.nsIFrameLoaderOwner);
return frameLoader.tabParent.hasContentOpener;
]]></getter>
</property>
<field name="_outerWindowID">null</field>
<property name="outerWindowID"
onget="return this._outerWindowID"

Просмотреть файл

@ -270,8 +270,9 @@ PopupNotifications.prototype = {
* A string URL. Setting this property will make the
* prompt display a "Learn More" link that, when clicked,
* opens the URL in a new tab.
* originHost: The host name of the page the notification came from.
* If present, this will be displayed above the message.
* displayOrigin:
* The host name or file path of the page the notification came
* from. If present, this will be displayed above the message.
* @returns the Notification object corresponding to the added notification.
*/
show: function PopupNotifications_show(browser, id, message, anchorID,
@ -567,10 +568,10 @@ PopupNotifications.prototype = {
else
popupnotification.removeAttribute("learnmoreurl");
if (n.options.originHost)
popupnotification.setAttribute("originhost", n.options.originHost);
if (n.options.displayOrigin)
popupnotification.setAttribute("origin", n.options.displayOrigin);
else
popupnotification.removeAttribute("originhost");
popupnotification.removeAttribute("origin");
popupnotification.notification = n;

Просмотреть файл

@ -67,12 +67,12 @@ notification[type="critical"] {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
}

Просмотреть файл

@ -105,12 +105,12 @@ notification[type="info"]:not([value="translation"]) .close-icon:not(:hover) {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
-moz-margin-start: 0 !important; /* override default label margin to match description margin */
}

Просмотреть файл

@ -62,12 +62,12 @@ notification[type="critical"] {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
}