Merge m-c to b2g-inbound. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-08-14 17:29:21 -04:00
Родитель 4d35ee901d 6d7abde6f2
Коммит 93ae6ba543
170 изменённых файлов: 1839 добавлений и 4995 удалений

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

@ -425,7 +425,12 @@ this.ContentControl.prototype = {
let sentToChild = this.sendToChild(vc, {
name: 'AccessFu:AutoMove',
json: aOptions
json: {
moveMethod: aOptions.moveMethod,
moveToFocused: aOptions.moveToFocused,
noOpIfOnScreen: true,
forcePresent: true
}
});
if (!moved && !sentToChild) {

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

@ -279,7 +279,9 @@ this.EventManager.prototype = {
// Put vc where the focus is at
let acc = aEvent.accessible;
let doc = aEvent.accessibleDocument;
if (acc.role != Roles.DOCUMENT && doc.role != Roles.CHROME_WINDOW) {
if ([Roles.CHROME_WINDOW,
Roles.DOCUMENT,
Roles.APPLICATION].indexOf(acc.role) < 0) {
this.contentControl.autoMove(acc);
}
break;

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

@ -228,7 +228,7 @@ this.GestureTracker = { // jshint ignore:line
* @param {Number} aTimeStamp A new pointer event timeStamp.
*/
handle: function GestureTracker_handle(aDetail, aTimeStamp) {
Logger.debug(() => {
Logger.gesture(() => {
return ['Pointer event', aDetail.type, 'at:', aTimeStamp,
JSON.stringify(aDetail.points)];
});
@ -332,7 +332,7 @@ function compileDetail(aType, aPoints, keyMap = {x: 'startX', y: 'startY'}) {
*/
function Gesture(aTimeStamp, aPoints = {}, aLastEvent = undefined) {
this.startTime = Date.now();
Logger.debug('Creating', this.id, 'gesture.');
Logger.gesture('Creating', this.id, 'gesture.');
this.points = aPoints;
this.lastEvent = aLastEvent;
this._deferred = Promise.defer();
@ -509,7 +509,7 @@ Gesture.prototype = {
if (this.isComplete) {
return;
}
Logger.debug('Resolving', this.id, 'gesture.');
Logger.gesture('Resolving', this.id, 'gesture.');
this.isComplete = true;
let detail = this.compile();
if (detail) {
@ -533,7 +533,7 @@ Gesture.prototype = {
if (this.isComplete) {
return;
}
Logger.debug('Rejecting', this.id, 'gesture.');
Logger.gesture('Rejecting', this.id, 'gesture.');
this.isComplete = true;
return {
id: this.id,

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

@ -473,11 +473,12 @@ State.prototype = {
};
this.Logger = { // jshint ignore:line
GESTURE: -1,
DEBUG: 0,
INFO: 1,
WARNING: 2,
ERROR: 3,
_LEVEL_NAMES: ['DEBUG', 'INFO', 'WARNING', 'ERROR'],
_LEVEL_NAMES: ['GESTURE', 'DEBUG', 'INFO', 'WARNING', 'ERROR'],
logLevel: 1, // INFO;
@ -490,7 +491,7 @@ this.Logger = { // jshint ignore:line
let args = Array.prototype.slice.call(arguments, 1);
let message = (typeof(args[0]) === 'function' ? args[0]() : args).join(' ');
message = '[' + Utils.ScriptName + '] ' + this._LEVEL_NAMES[aLogLevel] +
message = '[' + Utils.ScriptName + '] ' + this._LEVEL_NAMES[aLogLevel + 1] +
' ' + message + '\n';
dump(message);
// Note: used for testing purposes. If |this.test| is true, also log to
@ -509,6 +510,11 @@ this.Logger = { // jshint ignore:line
this, [this.INFO].concat(Array.prototype.slice.call(arguments)));
},
gesture: function gesture() {
this.log.apply(
this, [this.GESTURE].concat(Array.prototype.slice.call(arguments)));
},
debug: function debug() {
this.log.apply(
this, [this.DEBUG].concat(Array.prototype.slice.call(arguments)));
@ -552,14 +558,16 @@ this.Logger = { // jshint ignore:line
},
accessibleToString: function accessibleToString(aAccessible) {
let str = '[ defunct ]';
try {
str = '[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
' | ' + aAccessible.name + ' ]';
} catch (x) {
if (!aAccessible) {
return '[ null ]';
}
return str;
try {
return'[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
' | ' + aAccessible.name + ' ]';
} catch (x) {
return '[ defunct ]';
}
},
eventToString: function eventToString(aEvent) {

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

@ -255,7 +255,7 @@ AccessFuContentTest.prototype = {
this.currentPair = this.queue.shift();
if (this.currentPair) {
if (this.currentPair[0] instanceof Function) {
if (typeof this.currentPair[0] === 'function') {
this.currentPair[0](this.mms[0]);
} else if (this.currentPair[0]) {
this.mms[0].sendAsyncMessage(this.currentPair[0].name,
@ -290,7 +290,11 @@ AccessFuContentTest.prototype = {
if (expected.speak) {
var checkFunc = SimpleTest[expected.speak_checkFunc] || isDeeply;
checkFunc.apply(SimpleTest, [speech, expected.speak,
'"' + JSON.stringify(speech) + '" spoken']);
'spoken: ' + JSON.stringify(speech) +
' expected: ' + JSON.stringify(expected.speak) +
' after: ' + (typeof this.currentPair[0] === 'function' ?
this.currentPair[0].toString() :
JSON.stringify(this.currentPair[0]))]);
}
if (expected.android) {

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

@ -136,8 +136,8 @@
speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}],
[ContentMessages.focusSelector('button#home', false), {
speak: ['Home button']
}]
speak: ['Home', {'string': 'pushbutton'}]
}],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
@ -152,13 +152,13 @@
speak: ['Phone status bar', 'Traversal Rule test document']
}],
[doc.defaultView.showAlert, {
speak: ['This is an alert! heading level 1 dialog']
speak: ['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}]
}],
[function() {
doc.defaultView.hideAlert()
}, {
speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
[doc.defaultView.hideAlert, {
speak: ["wow", {"string": "headingLevel","args": [1]}, "such app"],
}],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
@ -171,12 +171,14 @@
speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}],
[doc.defaultView.showAlert, {
speak: ['This is an alert! heading level 1 dialog']
speak: ['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}]
}],
// XXX: Place cursor back where it was.
[doc.defaultView.hideAlert, {
speak: ['many option not checked check button such app']
speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'],
}],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
@ -186,7 +188,9 @@
speak: ['Phone status bar', 'Traversal Rule test document']
}],
[doc.defaultView.showAlert, {
speak: ['This is an alert! heading level 1 dialog']
speak: ['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}]
}],
[function() {

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

@ -23,7 +23,7 @@ MOZ_SERVICES_METRICS=1
MOZ_CAPTIVEDETECT=1
MOZ_WEBSMS_BACKEND=1
MOZ_DISABLE_CRYPTOLEGACY=1
MOZ_NO_SMART_CARDS=1
MOZ_APP_STATIC_INI=1
NSS_NO_LIBPKIX=1
NSS_DISABLE_DBM=1

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

@ -24,6 +24,10 @@ const kUAID = "f47ac11b-58ca-4372-9567-0e02b2c3d479";
// Fake loop server
var loopServer;
// Ensure loop is always enabled for tests
Services.prefs.setBoolPref("loop.enabled", true);
function setupFakeLoopServer() {
loopServer = new HttpServer();
loopServer.start(-1);

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

@ -292,7 +292,7 @@ Toolbox.prototype = {
});
return deferred.promise;
});
}).then(null, console.error.bind(console));
},
/**

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

@ -155,7 +155,7 @@ var TextEditor = Class({
if (!this.editor.isAppended()) {
return true;
}
return this.editor.isClean();
return this.editor.getText() === this._savedResourceContents;
},
initialize: function(document, mode=Editor.modes.text) {
@ -212,6 +212,7 @@ var TextEditor = Class({
if (!this.editor) {
return;
}
this._savedResourceContents = resourceContents;
this.editor.setText(resourceContents);
this.editor.clearHistory();
this.editor.setClean();
@ -229,8 +230,9 @@ var TextEditor = Class({
* saved.
*/
save: function(resource) {
return resource.save(this.editor.getText()).then(() => {
this.editor.setClean();
let newText = this.editor.getText();
return resource.save(newText).then(() => {
this._savedResourceContents = newText;
this.emit("save", resource);
});
},

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

@ -31,7 +31,12 @@ var DirtyPlugin = Class({
},
onAnnotate: function(resource, editor, elt) {
if (editor && editor.editor && !editor.editor.isClean()) {
// Only run on a TextEditor
if (!editor || !editor.editor) {
return;
}
if (!editor.isClean()) {
elt.textContent = '*' + resource.displayName;
return true;
}

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

@ -20,6 +20,8 @@ const { ViewHelpers } = Cu.import("resource:///modules/devtools/ViewHelpers.jsm"
const { DOMHelpers } = Cu.import("resource:///modules/devtools/DOMHelpers.jsm");
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const ITCHPAD_URL = "chrome://browser/content/devtools/projecteditor.xul";
const { confirm } = require("projecteditor/helpers/prompts");
const { getLocalizedString } = require("projecteditor/helpers/l10n");
// Enabled Plugins
require("projecteditor/plugins/dirty/dirty");
@ -728,7 +730,37 @@ var ProjectEditor = Class({
get menuEnabled() {
return this._menuEnabled;
},
/**
* Are there any unsaved resources in the Project?
*/
get hasUnsavedResources() {
return this.project.allResources().some(resource=> {
let editor = this.editorFor(resource);
return editor && !editor.isClean();
});
},
/**
* Check with the user about navigating away with unsaved changes.
*
* @returns Boolean
* True if there are no unsaved changes
* Otherwise, ask the user to confirm and return the outcome.
*/
confirmUnsaved: function() {
if (this.hasUnsavedResources) {
return confirm(
getLocalizedString("projecteditor.confirmUnsavedTitle"),
getLocalizedString("projecteditor.confirmUnsavedLabel")
);
}
return true;
}
});

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

@ -7,6 +7,7 @@ support-files =
[browser_projecteditor_app_options.js]
skip-if = buildapp == 'mulet'
[browser_projecteditor_confirm_unsaved.js]
[browser_projecteditor_contextmenu_01.js]
[browser_projecteditor_contextmenu_02.js]
[browser_projecteditor_delete_file.js]

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

@ -0,0 +1,60 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
loadHelperScript("helper_edits.js");
// Test that a prompt shows up when requested if a file is unsaved.
let test = asyncTest(function*() {
let projecteditor = yield addProjectEditorTabForTempDirectory();
ok(true, "ProjectEditor has loaded");
let resources = projecteditor.project.allResources();
yield selectFile(projecteditor, resources[2]);
let editor = projecteditor.currentEditor;
let originalText = editor.editor.getText();
ok (!projecteditor.hasUnsavedResources, "There are no unsaved resources");
ok (projecteditor.confirmUnsaved(), "When there are no unsaved changes, confirmUnsaved() is true");
editor.editor.setText("bar");
editor.editor.setText(originalText);
ok (!projecteditor.hasUnsavedResources, "There are no unsaved resources");
ok (projecteditor.confirmUnsaved(), "When an editor has changed but is still the original text, confirmUnsaved() is true");
editor.editor.setText("bar");
checkConfirmYes(projecteditor);
checkConfirmNo(projecteditor);
});
function checkConfirmYes(projecteditor, container) {
function confirmYes(aSubject) {
info("confirm dialog observed as expected, going to click OK");
Services.obs.removeObserver(confirmYes, "common-dialog-loaded");
Services.obs.removeObserver(confirmYes, "tabmodal-dialog-loaded");
aSubject.Dialog.ui.button0.click();
}
Services.obs.addObserver(confirmYes, "common-dialog-loaded", false);
Services.obs.addObserver(confirmYes, "tabmodal-dialog-loaded", false);
ok (projecteditor.hasUnsavedResources, "There are unsaved resources");
ok (projecteditor.confirmUnsaved(), "When there are unsaved changes, clicking OK makes confirmUnsaved() true");
}
function checkConfirmNo(projecteditor, container) {
function confirmNo(aSubject) {
info("confirm dialog observed as expected, going to click cancel");
Services.obs.removeObserver(confirmNo, "common-dialog-loaded");
Services.obs.removeObserver(confirmNo, "tabmodal-dialog-loaded");
aSubject.Dialog.ui.button1.click();
}
Services.obs.addObserver(confirmNo, "common-dialog-loaded", false);
Services.obs.addObserver(confirmNo, "tabmodal-dialog-loaded", false);
ok (projecteditor.hasUnsavedResources, "There are unsaved resources");
ok (!projecteditor.confirmUnsaved(), "When there are unsaved changes, clicking cancel makes confirmUnsaved() false");
}

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

@ -81,9 +81,16 @@ let test = asyncTest(function*() {
yield selectFile(projecteditor, resource);
let editor = projecteditor.currentEditor;
let onChange = promise.defer();
projecteditor.on("onEditorChange", () => {
info ("onEditorChange has been detected");
onChange.resolve();
});
editor.editor.focus();
EventUtils.synthesizeKey("f", { }, projecteditor.window);
yield onChange;
yield openAndCloseMenu(fileMenu);
yield openAndCloseMenu(editMenu);

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

@ -100,6 +100,13 @@ let UI = {
window.removeEventListener("message", this.onMessage);
},
canWindowClose: function() {
if (this.projecteditor) {
return this.projecteditor.confirmUnsaved();
}
return true;
},
onfocus: function() {
// Because we can't track the activity in the folder project,
// we need to validate the project regularly. Let's assume that
@ -665,7 +672,9 @@ let UI = {
let Cmds = {
quit: function() {
if (UI.canWindowClose()) {
window.close();
}
},
/**

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

@ -14,7 +14,7 @@
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://webide/skin/webide.css"?>
<window id="webide"
<window id="webide" onclose="return UI.canWindowClose();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&windowTitle;"

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

@ -11,6 +11,16 @@
# A good criteria is the language in which you'd find the best
# documentation on web development on the web.
# LOCALIZATION NOTE (projecteditor.confirmUnsavedTitle):
# This string is displayed as as the title of the confirm prompt that checks
# to make sure if the project editor can be closed without saving changes
projecteditor.confirmUnsavedTitle=Unsaved Changes
# LOCALIZATION NOTE (projecteditor.confirmUnsavedLabel):
# This string is displayed as the message of the confirm prompt that checks
# to make sure if the project editor can be closed without saving changes
projecteditor.confirmUnsavedLabel=You have unsaved changes that will be lost if you exit. Are you sure you want to continue?
# LOCALIZATION NOTE (projecteditor.deleteLabel):
# This string is displayed as a context menu item for allowing the selected
# file / folder to be deleted.

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

@ -87,6 +87,19 @@ this.webrtcUI = {
let PopupNotifications = browserWindow.PopupNotifications;
let notif = PopupNotifications.getNotification("webRTC-sharing" + aType,
aActiveStream.browser);
#ifdef XP_MACOSX
if (!Services.focus.activeWindow) {
browserWindow.addEventListener("activate", function onActivate() {
browserWindow.removeEventListener("activate", onActivate);
Services.tm.mainThread.dispatch(function() {
notif.reshow();
}, Ci.nsIThread.DISPATCH_NORMAL);
});
Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport)
.activateApplication(true);
return;
}
#endif
notif.reshow();
},
@ -690,7 +703,7 @@ function updateIndicators() {
else if (window.value && !webrtcUI.showScreenSharingIndicator)
webrtcUI.showScreenSharingIndicator = "Window";
showBrowserSpecificIndicator(getBrowserForWindow(contentWindow));
updateBrowserSpecificIndicator(getBrowserForWindow(contentWindow));
}
let browserWindowEnum = Services.wm.getEnumerator("navigator:browser");
@ -724,7 +737,7 @@ function updateIndicators() {
}
}
function showBrowserSpecificIndicator(aBrowser) {
function updateBrowserSpecificIndicator(aBrowser) {
let camera = {}, microphone = {}, screen = {}, window = {};
MediaManagerService.mediaCaptureWindowState(aBrowser.contentWindow,
camera, microphone, screen, window);
@ -735,9 +748,6 @@ function showBrowserSpecificIndicator(aBrowser) {
captureState = "Camera";
} else if (microphone.value) {
captureState = "Microphone";
} else if (!screen.value && !window.value) {
Cu.reportError("showBrowserSpecificIndicator: got neither video nor audio access");
return;
}
let chromeWin = aBrowser.ownerDocument.defaultView;
@ -796,10 +806,15 @@ function showBrowserSpecificIndicator(aBrowser) {
chromeWin.PopupNotifications.show(aBrowser, "webRTC-sharingDevices", message,
anchorId, mainAction, secondaryActions, options);
}
else {
removeBrowserNotification(aBrowser,"webRTC-sharingDevices");
}
// Now handle the screen sharing indicator.
if (!screen.value && !window.value)
if (!screen.value && !window.value) {
removeBrowserNotification(aBrowser,"webRTC-sharingScreen");
return;
}
options = {
hideNotNow: true,
@ -820,15 +835,14 @@ function showBrowserSpecificIndicator(aBrowser) {
mainAction, secondaryActions, options);
}
function removeBrowserSpecificIndicator(aSubject, aTopic, aData) {
let browser = getBrowserForWindowId(aData);
let PopupNotifications = browser.ownerDocument.defaultView.PopupNotifications;
if (!PopupNotifications)
return;
for (let notifId of ["webRTC-sharingDevices", "webRTC-sharingScreen"]) {
let notification = PopupNotifications.getNotification(notifId, browser);
function removeBrowserNotification(aBrowser, aNotificationId) {
let win = aBrowser.ownerDocument.defaultView;
let notification =
win.PopupNotifications.getNotification(aNotificationId, aBrowser);
if (notification)
PopupNotifications.remove(notification);
}
win.PopupNotifications.remove(notification);
}
function removeBrowserSpecificIndicator(aSubject, aTopic, aData) {
updateBrowserSpecificIndicator(getBrowserForWindowId(aData));
}

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

@ -17,24 +17,24 @@ a {
.message {
display: flex;
flex: 0 0 main-size;
flex: none;
padding: 0 7px;
width: 100%;
box-sizing: border-box;
}
.message > .timestamp {
flex: 0 0 main-size;
flex: none;
color: GrayText;
margin: 4px 6px 0 0;
}
.message > .indent {
flex: 0 0 main-size;
flex: none;
}
.message > .icon {
flex: 0 0 main-size;
flex: none;
margin: 3px 6px 0 0;
padding: 0 4px;
height: 1em;
@ -66,7 +66,7 @@ a {
/* The red bubble that shows the number of times a message is repeated */
.message-repeats {
-moz-user-select: none;
flex: 0 0 main-size;
flex: none;
margin: 2px 6px;
padding: 0 6px;
height: 1.25em;
@ -84,7 +84,7 @@ a {
.message-location {
display: flex;
flex: 0 0 main-size;
flex: none;
align-self: flex-start;
justify-content: flex-end;
width: 10em;
@ -106,7 +106,7 @@ a {
}
.message-location > .line-number {
flex: 0 0 main-size;
flex: none;
}
.message-flex-body {
@ -236,7 +236,7 @@ a {
}
.message[category=network] .method {
flex: 0 0 main-size;
flex: none;
}
.message[category=network]:not(.navigation-marker) .url {
@ -250,7 +250,7 @@ a {
}
.message[category=network] .status {
flex: 0 0 main-size;
flex: none;
-moz-margin-start: 6px;
}

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

@ -180,7 +180,7 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH"
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH --disable-tools"
ICU_TARGET_OPT="--build=$build --host=$target"
else
# CROSS_COMPILE isn't set build and target are i386 and x86-64.

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

@ -1395,7 +1395,7 @@ sub readZipCRCs($) {
if ($$this{'magicInit'}) {
if (defined($$this{'magicErrno'})) {
if (defined($$this{'magicErrMsg'})) {
complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
}
$! = $$this{'magicErrno'};
@ -1409,7 +1409,7 @@ sub readZipCRCs($) {
if (!sysopen($fh, $$this{'path'}, O_RDONLY)) {
$$this{'magicErrno'} = $!;
$$this{'magicErrMsg'} = 'open "'.$$this{'path'}.'": '.$!;
complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
return undef;
}
@ -1419,7 +1419,7 @@ sub readZipCRCs($) {
if (!defined($bytes = sysread($fh, $magic, 4))) {
$$this{'magicErrno'} = $!;
$$this{'magicErrMsg'} = 'read "'.$$this{'path'}.'": '.$!;
complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
close($fh);
return undef;

2
config/external/nss/crmf/moz.build поставляемый
Просмотреть файл

@ -8,7 +8,7 @@ LIBRARY_NAME = 'crmf'
if CONFIG['MOZ_NATIVE_NSS']:
OS_LIBS += [l for l in CONFIG['NSS_LIBS'] if l.startswith('-L')]
OS_LIBS += '-lcrmf'
OS_LIBS += ['-lcrmf']
else:
USE_LIBS += [
# The dependency on nss is not real, but is required to force the

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

@ -1992,7 +1992,10 @@ ia64*-hpux*)
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
fi
;;
*-*linux*)
@ -2009,7 +2012,10 @@ ia64*-hpux*)
MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
esac
MOZ_PGO_OPTIMIZE_FLAGS="-O3"
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
fi
fi
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
@ -3779,7 +3785,7 @@ MOZ_WMF=
if test -n "$MOZ_FMP4"; then
MOZ_FMP4=1
else
MOZ_FMP4 =
MOZ_FMP4=
fi
MOZ_EME=1
MOZ_FFMPEG=
@ -3826,7 +3832,7 @@ MOZ_XUL=1
MOZ_ZIPWRITER=1
NS_PRINTING=1
MOZ_PDF_PRINTING=
MOZ_DISABLE_CRYPTOLEGACY=
MOZ_NO_SMART_CARDS=
NSS_DISABLE_DBM=
NECKO_COOKIES=1
NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
@ -6342,12 +6348,12 @@ fi
AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
dnl ========================================================
dnl = Disable DOMCrypto
dnl = Disable smartcard support
dnl ========================================================
if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
if test -n "$MOZ_NO_SMART_CARDS"; then
AC_DEFINE(MOZ_NO_SMART_CARDS)
fi
AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
AC_SUBST(MOZ_NO_SMART_CARDS)
dnl ========================================================
dnl = Disable EV certificate verification

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

@ -1,12 +0,0 @@
<html>
<head>
<title>CSP eval script tests</title>
<script type="application/javascript"
src="file_CSP_evalscript_main_allowed_getCRMFRequest.js"></script>
</head>
<body>
Foo.
</body>
</html>

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

@ -1,2 +0,0 @@
Cache-Control: no-cache
Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-eval'

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

@ -1,42 +0,0 @@
// some javascript for the CSP eval() tests
// all of these evals should succeed, as the document loading this script
// has script-src 'self' 'unsafe-eval'
function logResult(str, passed) {
var elt = document.createElement('div');
var color = passed ? "#cfc;" : "#fcc";
elt.setAttribute('style', 'background-color:' + color + '; width:100%; border:1px solid black; padding:3px; margin:4px;');
elt.innerHTML = str;
document.body.appendChild(elt);
}
// callback for when stuff is allowed by CSP
var onevalexecuted = (function(window) {
return function(shouldrun, what, data) {
window.parent.scriptRan(shouldrun, what, data);
logResult((shouldrun ? "PASS: " : "FAIL: ") + what + " : " + data, shouldrun);
};})(window);
// callback for when stuff is blocked
var onevalblocked = (function(window) {
return function(shouldrun, what, data) {
window.parent.scriptBlocked(shouldrun, what, data);
logResult((shouldrun ? "FAIL: " : "PASS: ") + what + " : " + data, !shouldrun);
};})(window);
// Defer until document is loaded so that we can write the pretty result boxes
// out.
addEventListener('load', function() {
// test that allows crypto.generateCRMFRequest eval to run
try {
var script =
'console.log("dynamic script passed to crypto.generateCRMFRequest should execute")';
crypto.generateCRMFRequest('CN=0', 0, 0, null, script, 384, null, 'rsa-dual-use');
onevalexecuted(true, "eval(script) inside crypto.generateCRMFRequest",
"eval executed during crypto.generateCRMFRequest");
} catch (e) {
onevalblocked(true, "eval(script) inside crypto.generateCRMFRequest",
"eval was blocked during crypto.generateCRMFRequest");
}
}, false);

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

@ -1,12 +0,0 @@
<html>
<head>
<title>CSP eval script tests</title>
<script type="application/javascript"
src="file_CSP_evalscript_main_getCRMFRequest.js"></script>
</head>
<body>
Foo.
</body>
</html>

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

@ -1,2 +0,0 @@
Cache-Control: no-cache
Content-Security-Policy: default-src 'self'

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

@ -1,48 +0,0 @@
// some javascript for the CSP eval() tests
function logResult(str, passed) {
var elt = document.createElement('div');
var color = passed ? "#cfc;" : "#fcc";
elt.setAttribute('style', 'background-color:' + color + '; width:100%; border:1px solid black; padding:3px; margin:4px;');
elt.innerHTML = str;
document.body.appendChild(elt);
}
window._testResults = {};
// callback for when stuff is allowed by CSP
var onevalexecuted = (function(window) {
return function(shouldrun, what, data) {
window._testResults[what] = "ran";
window.parent.scriptRan(shouldrun, what, data);
logResult((shouldrun ? "PASS: " : "FAIL: ") + what + " : " + data, shouldrun);
};})(window);
// callback for when stuff is blocked
var onevalblocked = (function(window) {
return function(shouldrun, what, data) {
window._testResults[what] = "blocked";
window.parent.scriptBlocked(shouldrun, what, data);
logResult((shouldrun ? "FAIL: " : "PASS: ") + what + " : " + data, !shouldrun);
};})(window);
// Defer until document is loaded so that we can write the pretty result boxes
// out.
addEventListener('load', function() {
// generateCRMFRequest test -- make sure we cannot eval the callback if CSP is in effect
try {
var script = 'console.log("dynamic script eval\'d in crypto.generateCRMFRequest should be disallowed")';
crypto.generateCRMFRequest('CN=0', 0, 0, null, script, 384, null, 'rsa-dual-use');
onevalexecuted(false, "crypto.generateCRMFRequest()",
"crypto.generateCRMFRequest() should not run!");
} catch (e) {
onevalblocked(false, "eval(script) inside crypto.generateCRMFRequest",
"eval was blocked during crypto.generateCRMFRequest");
}
}, false);

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

@ -1,12 +0,0 @@
<html>
<head>
<title>CSP eval script tests: no CSP specified</title>
<script type="application/javascript"
src="file_CSP_evalscript_no_CSP_at_all.js"></script>
</head>
<body>
Foo. See bug 824652
</body>
</html>

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

@ -1 +0,0 @@
Cache-Control: no-cache

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

@ -1,42 +0,0 @@
// some javascript for the CSP eval() tests
// all of these evals should succeed, as the document loading this script
// has script-src 'self' 'unsafe-eval'
function logResult(str, passed) {
var elt = document.createElement('div');
var color = passed ? "#cfc;" : "#fcc";
elt.setAttribute('style', 'background-color:' + color + '; width:100%; border:1px solid black; padding:3px; margin:4px;');
elt.innerHTML = str;
document.body.appendChild(elt);
}
// callback for when stuff is allowed by CSP
var onevalexecuted = (function(window) {
return function(shouldrun, what, data) {
window.parent.scriptRan(shouldrun, what, data);
logResult((shouldrun ? "PASS: " : "FAIL: ") + what + " : " + data, shouldrun);
};})(window);
// callback for when stuff is blocked
var onevalblocked = (function(window) {
return function(shouldrun, what, data) {
window.parent.scriptBlocked(shouldrun, what, data);
logResult((shouldrun ? "FAIL: " : "PASS: ") + what + " : " + data, !shouldrun);
};})(window);
// Defer until document is loaded so that we can write the pretty result boxes
// out.
addEventListener('load', function() {
// test that allows crypto.generateCRMFRequest eval to run when there is no CSP at all in place
try {
var script =
'console.log("dynamic script passed to crypto.generateCRMFRequest should execute")';
crypto.generateCRMFRequest('CN=0', 0, 0, null, script, 384, null, 'rsa-dual-use');
onevalexecuted(true, "eval(script) inside crypto.generateCRMFRequest: no CSP at all",
"eval executed during crypto.generateCRMFRequest where no CSP is set at all");
} catch (e) {
onevalblocked(true, "eval(script) inside crypto.generateCRMFRequest",
"eval was blocked during crypto.generateCRMFRequest");
}
}, false);

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

@ -20,19 +20,10 @@ support-files =
file_CSP_bug888172.sjs
file_CSP_evalscript_main.js
file_CSP_evalscript_main_allowed.js
file_CSP_evalscript_main_allowed_getCRMFRequest.js
file_CSP_evalscript_main_getCRMFRequest.js
file_CSP_evalscript_main.html
file_CSP_evalscript_main.html^headers^
file_CSP_evalscript_main_allowed.html
file_CSP_evalscript_main_allowed.html^headers^
file_CSP_evalscript_main_allowed_getCRMFRequest.html
file_CSP_evalscript_main_allowed_getCRMFRequest.html^headers^
file_CSP_evalscript_main_getCRMFRequest.html
file_CSP_evalscript_main_getCRMFRequest.html^headers^
file_CSP_evalscript_no_CSP_at_all.html
file_CSP_evalscript_no_CSP_at_all.html^headers^
file_CSP_evalscript_no_CSP_at_all.js
file_CSP_frameancestors_main.html
file_CSP_frameancestors_main.js
file_CSP_frameancestors.sjs
@ -112,8 +103,6 @@ support-files =
[test_CSP_bug885433.html]
[test_CSP_bug888172.html]
[test_CSP_evalscript.html]
[test_CSP_evalscript_getCRMFRequest.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # no (deprecated) window.crypto support in multiprocess (bug 824652)
[test_CSP_frameancestors.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # Times out, not sure why (bug 1008445)
[test_CSP_inlinescript.html]

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

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Content Security Policy "no eval" in crypto.getCRMFRequest()</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<iframe style="width:100%;height:300px;" id='cspframe'></iframe>
<iframe style="width:100%;height:300px;" id='cspframe2'></iframe>
<iframe style="width:100%;height:300px;" id='cspframe3'></iframe>
<script class="testbody" type="text/javascript">
var path = "/tests/content/base/test/csp/";
var evalScriptsThatRan = 0;
var evalScriptsBlocked = 0;
var evalScriptsTotal = 3;
// called by scripts that run
var scriptRan = function(shouldrun, testname, data) {
evalScriptsThatRan++;
ok(shouldrun, 'EVAL SCRIPT RAN: ' + testname + '(' + data + ')');
checkTestResults();
}
// called when a script is blocked
var scriptBlocked = function(shouldrun, testname, data) {
evalScriptsBlocked++;
ok(!shouldrun, 'EVAL SCRIPT BLOCKED: ' + testname + '(' + data + ')');
checkTestResults();
}
// Check to see if all the tests have run
var checkTestResults = function() {
// if any test is incomplete, keep waiting
if (evalScriptsTotal - evalScriptsBlocked - evalScriptsThatRan > 0)
return;
// ... otherwise, finish
SimpleTest.finish();
}
function loadElements() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
document.getElementById('cspframe').src = 'file_CSP_evalscript_main_getCRMFRequest.html';
document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed_getCRMFRequest.html';
document.getElementById('cspframe3').src = 'file_CSP_evalscript_no_CSP_at_all.html';
}
//////////////////////////////////////////////////////////////////////
// set up and go
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.unsafe_legacy_crypto.enabled", true]]},
loadElements);
</script>
</pre>
</body>
</html>

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

@ -17,6 +17,7 @@
#include "mozilla/Telemetry.h"
#include "soundtouch/SoundTouch.h"
#include "Latency.h"
#include "nsPrintfCString.h"
#ifdef XP_MACOSX
#include <sys/sysctl.h>
#endif
@ -254,6 +255,7 @@ AudioStream::AudioStream()
, mState(INITIALIZED)
, mNeedsStart(false)
, mShouldDropFrames(false)
, mPendingAudioInitTask(false)
{
// keep a ref in case we shut down later than nsLayoutStatics
mLatencyLog = AsyncLatencyLogger::Get(true);
@ -535,19 +537,24 @@ AudioStream::Init(int32_t aNumChannels, int32_t aRate,
// cause us to move from INITIALIZED to RUNNING. Until then, we
// can't access any cubeb functions.
// Use a RefPtr to avoid leaks if Dispatch fails
mPendingAudioInitTask = true;
RefPtr<AudioInitTask> init = new AudioInitTask(this, aLatencyRequest, params);
init->Dispatch();
return NS_OK;
nsresult rv = init->Dispatch();
if (NS_FAILED(rv)) {
mPendingAudioInitTask = false;
}
return rv;
}
// High latency - open synchronously
nsresult rv = OpenCubeb(params, aLatencyRequest);
NS_ENSURE_SUCCESS(rv, rv);
// See if we need to start() the stream, since we must do that from this
// thread for now (cubeb API issue)
{
MonitorAutoLock mon(mMonitor);
CheckForStart();
}
return rv;
return NS_OK;
}
// On certain MacBookPro, the microphone is located near the left speaker.
@ -627,15 +634,9 @@ nsresult
AudioStream::OpenCubeb(cubeb_stream_params &aParams,
LatencyRequest aLatencyRequest)
{
{
MonitorAutoLock mon(mMonitor);
if (mState == AudioStream::SHUTDOWN) {
return NS_ERROR_FAILURE;
}
}
cubeb* cubebContext = GetCubebContext();
if (!cubebContext) {
NS_WARNING("Can't get cubeb context!");
MonitorAutoLock mon(mMonitor);
mState = AudioStream::ERRORED;
return NS_ERROR_FAILURE;
@ -658,21 +659,15 @@ AudioStream::OpenCubeb(cubeb_stream_params &aParams,
if (cubeb_stream_init(cubebContext, &stream, "AudioStream", aParams,
latency, DataCallback_S, StateCallback_S, this) == CUBEB_OK) {
MonitorAutoLock mon(mMonitor);
MOZ_ASSERT(mState != SHUTDOWN);
mCubebStream.own(stream);
// Make sure we weren't shut down while in flight!
if (mState == SHUTDOWN) {
mCubebStream.reset();
LOG(("AudioStream::OpenCubeb() %p Shutdown while opening cubeb", this));
return NS_ERROR_FAILURE;
}
// We can't cubeb_stream_start() the thread from a transient thread due to
// cubeb API requirements (init can be called from another thread, but
// not start/stop/destroy/etc)
} else {
MonitorAutoLock mon(mMonitor);
mState = ERRORED;
LOG(("AudioStream::OpenCubeb() %p failed to init cubeb", this));
NS_WARNING(nsPrintfCString("AudioStream::OpenCubeb() %p failed to init cubeb", this).get());
return NS_ERROR_FAILURE;
}
}
@ -693,6 +688,14 @@ AudioStream::OpenCubeb(cubeb_stream_params &aParams,
return NS_OK;
}
void
AudioStream::AudioInitTaskFinished()
{
MonitorAutoLock mon(mMonitor);
mPendingAudioInitTask = false;
mon.NotifyAll();
}
void
AudioStream::CheckForStart()
{
@ -731,6 +734,7 @@ AudioInitTask::Run()
}
nsresult rv = mAudioStream->OpenCubeb(mParams, mLatencyRequest);
mAudioStream->AudioInitTaskFinished();
// and now kill this thread
NS_DispatchToMainThread(this);
@ -951,6 +955,10 @@ AudioStream::Shutdown()
MonitorAutoLock mon(mMonitor);
LOG(("AudioStream: Shutdown %p, state %d", this, mState));
while (mPendingAudioInitTask) {
mon.Wait();
}
if (mCubebStream) {
MonitorAutoUnlock mon(mMonitor);
// Force stop to put the cubeb stream in a stable state before deletion.

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

@ -299,6 +299,7 @@ private:
// So we can call it asynchronously from AudioInitTask
nsresult OpenCubeb(cubeb_stream_params &aParams,
LatencyRequest aLatencyRequest);
void AudioInitTaskFinished();
void CheckForStart();
@ -425,6 +426,9 @@ private:
// is not going to be called for a little while, simply drop incoming frames.
// This is only on OSX for now, because other systems handle this gracefully.
bool mShouldDropFrames;
// True if there is a pending AudioInitTask. Shutdown() will wait until the
// pending AudioInitTask is finished.
bool mPendingAudioInitTask;
// This mutex protects the static members below.
static StaticMutex sMutex;

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

@ -127,82 +127,6 @@ Crypto::Subtle()
return mSubtle;
}
#ifndef MOZ_DISABLE_CRYPTOLEGACY
// Stub out the legacy nsIDOMCrypto methods. The actual
// implementations are in security/manager/ssl/src/nsCrypto.{cpp,h}
NS_IMETHODIMP
Crypto::GetEnableSmartCardEvents(bool *aEnableSmartCardEvents)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
Crypto::SetEnableSmartCardEvents(bool aEnableSmartCardEvents)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
Crypto::EnableSmartCardEvents()
{
return false;
}
void
Crypto::SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::GetVersion(nsString& aVersion)
{
}
mozilla::dom::CRMFObject*
Crypto::GenerateCRMFRequest(JSContext* aContext,
const nsCString& aReqDN,
const nsCString& aRegToken,
const nsCString& aAuthenticator,
const nsCString& aEaCert,
const nsCString& aJsCallback,
const Sequence<JS::Value>& aArgs,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
void
Crypto::ImportUserCertificates(const nsAString& aNickname,
const nsAString& aCmmfResponse,
bool aDoForcedBackup,
nsAString& aReturn,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::SignText(JSContext* aContext,
const nsAString& aStringToSign,
const nsAString& aCaOption,
const Sequence<nsCString>& aArgs,
nsAString& aReturn)
{
aReturn.AssignLiteral("error:internalError");
}
void
Crypto::Logout(ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
#endif
/* static */ uint8_t*
Crypto::GetRandomValues(uint32_t aLength)
{

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

@ -4,17 +4,7 @@
#ifndef mozilla_dom_Crypto_h
#define mozilla_dom_Crypto_h
#ifdef MOZ_DISABLE_CRYPTOLEGACY
#include "nsIDOMCrypto.h"
#else
#include "nsIDOMCryptoLegacy.h"
namespace mozilla {
namespace dom {
class CRMFObject;
}
}
#endif
#include "mozilla/dom/SubtleCrypto.h"
#include "nsPIDOMWindow.h"
@ -51,38 +41,6 @@ public:
SubtleCrypto*
Subtle();
#ifndef MOZ_DISABLE_CRYPTOLEGACY
virtual bool EnableSmartCardEvents();
virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv);
virtual void GetVersion(nsString& aVersion);
virtual mozilla::dom::CRMFObject*
GenerateCRMFRequest(JSContext* aContext,
const nsCString& aReqDN,
const nsCString& aRegToken,
const nsCString& aAuthenticator,
const nsCString& aEaCert,
const nsCString& aJsCallback,
const Sequence<JS::Value>& aArgs,
ErrorResult& aRv);
virtual void ImportUserCertificates(const nsAString& aNickname,
const nsAString& aCmmfResponse,
bool aDoForcedBackup,
nsAString& aReturn,
ErrorResult& aRv);
virtual void SignText(JSContext* aContext,
const nsAString& aStringToSign,
const nsAString& aCaOption,
const Sequence<nsCString>& aArgs,
nsAString& aReturn);
virtual void Logout(ErrorResult& aRv);
#endif
// WebIDL
nsPIDOMWindow*

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

@ -83,9 +83,6 @@
#include "nsIDocCharset.h"
#include "nsIDocument.h"
#include "Crypto.h"
#ifndef MOZ_DISABLE_CRYPTOLEGACY
#include "nsIDOMCryptoLegacy.h"
#endif
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMEvent.h"
@ -2364,14 +2361,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsCOMPtr<nsIDocument> oldDoc = mDoc;
#ifndef MOZ_DISABLE_CRYPTOLEGACY
// clear smartcard events, our document has gone away.
if (mCrypto && XRE_GetProcessType() != GeckoProcessType_Content) {
nsresult rv = mCrypto->SetEnableSmartCardEvents(false);
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
AutoJSAPI jsapi;
jsapi.Init();
JSContext *cx = jsapi.cx();
@ -4459,20 +4448,7 @@ nsGlobalWindow::GetCrypto(ErrorResult& aError)
FORWARD_TO_INNER_OR_THROW(GetCrypto, (aError), aError, nullptr);
if (!mCrypto) {
#ifndef MOZ_DISABLE_CRYPTOLEGACY
if (XRE_GetProcessType() != GeckoProcessType_Content) {
nsresult rv;
mCrypto = do_CreateInstance(NS_CRYPTO_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return nullptr;
}
} else
#endif
{
mCrypto = new Crypto();
}
mCrypto->Init(this);
}
return mCrypto;

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

@ -251,14 +251,7 @@ DOMInterfaces = {
'headerFile': 'nsGeoPosition.h'
},
'CRMFObject': {
'headerFile': 'nsCrypto.h',
'nativeOwnership': 'owned',
'wrapperCache': False,
},
'Crypto' : {
'implicitJSContext': [ 'generateCRMFRequest', 'signText' ],
'headerFile': 'Crypto.h'
},

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

@ -371,10 +371,6 @@ const kEventConstructors = {
return e;
},
},
SmartCardEvent: { create: function (aName, aProps) {
return new SmartCardEvent(aName, aProps);
},
},
SpeechRecognitionEvent: { create: function (aName, aProps) {
return new SpeechRecognitionEvent(aName, aProps);
},

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

@ -748,29 +748,6 @@ is(e.requestingWindow, window);
is(e.popupWindowFeatures, "features");
is(e.popupWindowName, "name");
// SmartCardEvent
try {
e = new SmartCardEvent();
} catch(exp) {
ex = true;
}
ok(ex, "SmartCardEvent: First parameter is required!");
ex = false;
e = new SmartCardEvent("hello");
is(e.type, "hello", "SmartCardEvent: Wrong event type!");
ok(!e.isTrusted, "SmartCardEvent: Event shouldn't be trusted!");
ok(!e.bubbles, "SmartCardEvent: Event shouldn't bubble!");
ok(!e.cancelable, "SmartCardEvent: Event shouldn't be cancelable!");
is(e.tokenName, "");
document.dispatchEvent(e);
is(receivedEvent, e, "SmartCardEvent: Wrong event!");
e = new SmartCardEvent("hello", { tokenName: "foo" });
is(e.tokenName, "foo");
// WheelEvent
try {

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

@ -1707,7 +1707,9 @@ public:
NS_ASSERTION(database->IsClosed(),
"AbortCloseStoragesForWindow should have closed database");
if (ownerDoc) {
ownerDoc->DisallowBFCaching();
}
continue;
}

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

@ -16,6 +16,7 @@ XPIDL_SOURCES += [
'nsIDOMClientRect.idl',
'nsIDOMClientRectList.idl',
'nsIDOMConstructor.idl',
'nsIDOMCrypto.idl',
'nsIDOMGlobalObjectConstructor.idl',
'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMHistory.idl',
@ -37,15 +38,6 @@ XPIDL_SOURCES += [
'nsITabParent.idl',
]
if CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
XPIDL_SOURCES += [
'nsIDOMCrypto.idl',
]
else:
XPIDL_SOURCES += [
'nsIDOMCryptoLegacy.idl',
]
if CONFIG['MOZ_B2G']:
XPIDL_SOURCES += [
'nsIDOMWindowB2G.idl',

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

@ -1,15 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "domstubs.idl"
interface nsIDOMWindow;
[uuid(c25ecf08-3f46-4420-bee4-8505792fd63a)]
interface nsIDOMCrypto : nsISupports
{
[notxpcom] void init(in nsIDOMWindow window);
attribute boolean enableSmartCardEvents;
};

176
dom/ipc/ContentParent.cpp Normal file → Executable file
Просмотреть файл

@ -575,7 +575,7 @@ ContentParent::RunNuwaProcess()
// PreallocateAppProcess is called by the PreallocatedProcessManager.
// ContentParent then takes this process back within
// MaybeTakePreallocatedAppProcess.
// GetNewOrPreallocatedAppProcess.
/*static*/ already_AddRefed<ContentParent>
ContentParent::PreallocateAppProcess()
{
@ -590,21 +590,47 @@ ContentParent::PreallocateAppProcess()
}
/*static*/ already_AddRefed<ContentParent>
ContentParent::MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
ProcessPriority aInitialPriority)
ContentParent::GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
ProcessPriority aInitialPriority,
ContentParent* aOpener,
/*out*/ bool* aTookPreAllocated)
{
MOZ_ASSERT(aApp);
nsRefPtr<ContentParent> process = PreallocatedProcessManager::Take();
if (!process) {
return nullptr;
}
if (process) {
if (!process->SetPriorityAndCheckIsAlive(aInitialPriority)) {
// Kill the process just in case it's not actually dead; we don't want
// to "leak" this process!
process->KillHard();
}
else {
nsAutoString manifestURL;
if (NS_FAILED(aApp->GetManifestURL(manifestURL))) {
NS_ERROR("Failed to get manifest URL");
return nullptr;
}
process->TransformPreallocatedIntoApp(aAppManifestURL);
process->TransformPreallocatedIntoApp(manifestURL);
if (aTookPreAllocated) {
*aTookPreAllocated = true;
}
return process.forget();
}
}
// XXXkhuey Nuwa wants the frame loader to try again later, but the
// frame loader is really not set up to do that ...
NS_WARNING("Unable to use pre-allocated app process");
process = new ContentParent(aApp,
/* aOpener = */ aOpener,
/* isForBrowserElement = */ false,
/* isForPreallocated = */ false,
aInitialPriority);
process->Init();
if (aTookPreAllocated) {
*aTookPreAllocated = false;
}
return process.forget();
}
@ -693,7 +719,7 @@ ContentParent::JoinAllSubprocesses()
}
/*static*/ already_AddRefed<ContentParent>
ContentParent::GetNewOrUsed(bool aForBrowserElement,
ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
ProcessPriority aPriority,
ContentParent* aOpener)
{
@ -805,10 +831,31 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
return false;
}
#endif
nsRefPtr<ContentParent> cp;
MaybeInvalidTabContext tc(aContext);
if (!tc.IsValid()) {
NS_ERROR(nsPrintfCString("Received an invalid TabContext from "
"the child process. (%s)",
tc.GetInvalidReason()).get());
return false;
}
nsRefPtr<ContentParent> cp = GetNewOrUsed(/* isBrowserElement = */ true,
nsCOMPtr<mozIApplication> ownApp = tc.GetTabContext().GetOwnApp();
if (ownApp) {
cp = GetNewOrPreallocatedAppProcess(ownApp,
aPriority,
this);
}
else {
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
aPriority,
this);
}
if (!cp) {
return false;
}
*aId = cp->ChildID();
*aIsForApp = cp->IsForApp();
*aIsForBrowser = cp->IsForBrowser();
@ -849,36 +896,20 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
}
ProcessPriority initialPriority = GetInitialProcessPriority(aFrameElement);
bool isInContentProcess = (XRE_GetProcessType() != GeckoProcessType_Default);
if (aContext.IsBrowserElement() || !aContext.HasOwnApp()) {
nsRefPtr<TabParent> tp;
nsRefPtr<nsIContentParent> constructorSender;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (isInContentProcess) {
MOZ_ASSERT(aContext.IsBrowserElement());
ContentChild* child = ContentChild::GetSingleton();
uint64_t id;
bool isForApp;
bool isForBrowser;
if (!child->SendCreateChildProcess(aContext.AsIPCTabContext(),
initialPriority,
&id,
&isForApp,
&isForBrowser)) {
return nullptr;
}
if (!child->CallBridgeToChildProcess(id)) {
return nullptr;
}
ContentBridgeParent* parent = child->GetLastBridge();
parent->SetChildID(id);
parent->SetIsForApp(isForApp);
parent->SetIsForBrowser(isForBrowser);
constructorSender = parent;
constructorSender = CreateContentBridgeParent(aContext, initialPriority);
} else {
if (aOpenerContentParent) {
constructorSender = aOpenerContentParent;
} else {
constructorSender = GetNewOrUsed(aContext.IsBrowserElement(), initialPriority);
constructorSender = GetNewOrUsedBrowserProcess(aContext.IsBrowserElement(),
initialPriority);
}
}
if (constructorSender) {
@ -928,6 +959,15 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
// If we got here, we have an app and we're not a browser element. ownApp
// shouldn't be null, because we otherwise would have gone into the
// !HasOwnApp() branch above.
nsRefPtr<nsIContentParent> parent;
bool reused = false;
bool tookPreallocated = false;
nsAutoString manifestURL;
if (isInContentProcess) {
parent = CreateContentBridgeParent(aContext, initialPriority);
}
else {
nsCOMPtr<mozIApplication> ownApp = aContext.GetOwnApp();
if (!sAppContentParents) {
@ -937,7 +977,6 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
// Each app gets its own ContentParent instance unless it shares it with
// a parent app.
nsAutoString manifestURL;
if (NS_FAILED(ownApp->GetManifestURL(manifestURL))) {
NS_ERROR("Failed to get manifest URL");
return nullptr;
@ -987,46 +1026,48 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
}
}
bool reused = !!p;
bool tookPreallocated = false;
reused = !!p;
if (!p) {
p = MaybeTakePreallocatedAppProcess(manifestURL,
initialPriority);
tookPreallocated = !!p;
if (!tookPreallocated) {
// XXXkhuey Nuwa wants the frame loader to try again later, but the
// frame loader is really not set up to do that ...
NS_WARNING("Unable to use pre-allocated app process");
p = new ContentParent(ownApp,
/* aOpener = */ nullptr,
/* isForBrowserElement = */ false,
/* isForPreallocated = */ false,
initialPriority);
p->Init();
}
p = GetNewOrPreallocatedAppProcess(ownApp,
initialPriority,
nullptr,
&tookPreallocated);
MOZ_ASSERT(p);
sAppContentParents->Put(manifestURL, p);
}
parent = static_cast<nsIContentParent*>(p);
}
if (!parent) {
return nullptr;
}
uint32_t chromeFlags = 0;
nsRefPtr<TabParent> tp = new TabParent(p, aContext, chromeFlags);
nsRefPtr<TabParent> tp = new TabParent(parent, aContext, chromeFlags);
tp->SetOwnerElement(aFrameElement);
PBrowserParent* browser = p->SendPBrowserConstructor(
PBrowserParent* browser = parent->SendPBrowserConstructor(
// DeallocPBrowserParent() releases this ref.
nsRefPtr<TabParent>(tp).forget().take(),
aContext.AsIPCTabContext(),
chromeFlags,
p->ChildID(),
p->IsForApp(),
p->IsForBrowser());
parent->ChildID(),
parent->IsForApp(),
parent->IsForBrowser());
if (isInContentProcess) {
// Just return directly without the following check in content process.
return static_cast<TabParent*>(browser);
}
if (!browser) {
// We failed to actually start the PBrowser. This can happen if the
// other process has already died.
if (!reused) {
// Don't leave a broken ContentParent in the hashtable.
p->KillHard();
parent->AsContentParent()->KillHard();
sAppContentParents->Remove(manifestURL);
p = nullptr;
parent = nullptr;
}
// If we took the preallocated process and it was already dead, try
@ -1043,11 +1084,36 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
return nullptr;
}
p->MaybeTakeCPUWakeLock(aFrameElement);
parent->AsContentParent()->MaybeTakeCPUWakeLock(aFrameElement);
return static_cast<TabParent*>(browser);
}
/*static*/ ContentBridgeParent*
ContentParent::CreateContentBridgeParent(const TabContext& aContext,
const hal::ProcessPriority& aPriority)
{
ContentChild* child = ContentChild::GetSingleton();
uint64_t id;
bool isForApp;
bool isForBrowser;
if (!child->SendCreateChildProcess(aContext.AsIPCTabContext(),
aPriority,
&id,
&isForApp,
&isForBrowser)) {
return nullptr;
}
if (!child->CallBridgeToChildProcess(id)) {
return nullptr;
}
ContentBridgeParent* parent = child->GetLastBridge();
parent->SetChildID(id);
parent->SetIsForApp(isForApp);
parent->SetIsForBrowser(isForBrowser);
return parent;
}
void
ContentParent::GetAll(nsTArray<ContentParent*>& aArray)
{

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

@ -63,6 +63,7 @@ class ClonedMessageData;
class MemoryReport;
class TabContext;
class PFileDescriptorSetParent;
class ContentBridgeParent;
class ContentParent : public PContentParent
, public nsIContentParent
@ -96,8 +97,14 @@ public:
static bool PreallocatedProcessReady();
static void RunAfterPreallocatedProcessReady(nsIRunnable* aRequest);
/**
* Get or create a content process for:
* 1. browser iframe
* 2. remote xul <browser>
* 3. normal iframe
*/
static already_AddRefed<ContentParent>
GetNewOrUsed(bool aForBrowserElement = false,
GetNewOrUsedBrowserProcess(bool aForBrowserElement = false,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
ContentParent* aOpener = nullptr);
@ -286,13 +293,18 @@ private:
// Take the preallocated process and transform it into a "real" app process,
// for the specified manifest URL. If there is no preallocated process (or
// if it's dead), this returns false.
// if it's dead), create a new one and set aTookPreAllocated to false.
static already_AddRefed<ContentParent>
MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
hal::ProcessPriority aInitialPriority);
GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
hal::ProcessPriority aInitialPriority,
ContentParent* aOpener,
/*out*/ bool* aTookPreAllocated = nullptr);
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
static ContentBridgeParent* CreateContentBridgeParent(const TabContext& aContext,
const hal::ProcessPriority& aPriority);
// Hide the raw constructor methods since we don't want client code
// using them.
virtual PBrowserParent* SendPBrowserConstructor(

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

@ -23,8 +23,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=983504
* Run a test to verify that we can complete a start and stop media playback
* cycle for an screenshare LocalMediaStream on a video HTMLMediaElement.
*/
SimpleTest.expectAssertions(0, 3); // Bug 1047842
runTest(function () {
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
if (IsMacOSX10_6orOlder() || isWinXP) {

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

@ -23,8 +23,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=983504
* Run a test to verify that we can complete a start and stop media playback
* cycle for an screenshare LocalMediaStream on a video HTMLMediaElement.
*/
SimpleTest.expectAssertions(0, 3); // Bug 1047842
runTest(function () {
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
if (IsMacOSX10_6orOlder() || isWinXP) {

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

@ -17,8 +17,6 @@
title: "Basic screenshare-only peer connection"
});
SimpleTest.expectAssertions(0, 1); // Bug 1047842
var test;
runNetworkTest(function (options) {
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;

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

@ -17,8 +17,6 @@
title: "Basic windowshare-only peer connection"
});
SimpleTest.expectAssertions(0, 1); // Bug 1047842
var test;
runNetworkTest(function (options) {
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;

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

@ -1,2 +0,0 @@
[test_legacy.html]
skip-if = e10s

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

@ -2,4 +2,3 @@
skip-if = e10s
[test_getRandomValues.html]
[test_no_legacy.html]

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

@ -1,60 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test presence of legacy window.crypto features when
MOZ_DISABLE_CRYPTOLEGACY is NOT set and dom.unsafe_legacy_crypto.enabled is true</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
function test_unsafe_legacy_crypto_enabled() {
ok("crypto" in window, "crypto in window");
ok("version" in window.crypto, "version in window.crypto");
ok("enableSmartCardEvents" in window.crypto,
"enableSmartCardEvents in window.crypto");
ok("generateCRMFRequest" in window.crypto,
"generateCRMFRequest in window.crypto");
ok("importUserCertificates" in window.crypto,
"importUserCertificates in window.crypto");
ok("signText" in window.crypto, "signText in window.crypto");
function jsCallback () {
}
try {
window.crypto.generateCRMFRequest(null, null, null, null, jsCallback.toString());
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/Failure/) > -1,
"Expected error: ReqDN cannot be null");
}
try {
window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
null);
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/Failure/) > -1,
"Expected error: jsCallback cannot be null");
}
try {
window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
jsCallback.toString(), 1024);
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/TypeError/) > -1,
"Expected error: Not enough arguments");
}
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({"set": [["dom.unsafe_legacy_crypto.enabled", true]]},
test_unsafe_legacy_crypto_enabled);
SimpleTest.waitForExplicitFinish();
</script>
</body></html>

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

@ -1,23 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test lack of legacy window.crypto features when
MOZ_DISABLE_CRYPTOLEGACY is set or dom.unsafe_legacy_crypto.enabled is false</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
ok("crypto" in window, "crypto in window");
ok(!("version" in window.crypto), "version not in window.crypto");
ok(!("enableSmartCardEvents" in window.crypto),
"enableSmartCardEvents not in window.crypto");
ok(!("generateCRMFRequest" in window.crypto),
"generateCRMFRequest not in window.crypto");
ok(!("importUserCertificates" in window.crypto),
"importUserCertificates not in window.crypto");
ok(!("signText" in window.crypto), "signText not in window.crypto");
</script>
</body></html>

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

@ -857,8 +857,6 @@ var interfaceNamesInGlobalScope =
"SimpleGestureEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SimpleTest", xbl: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
"SmartCardEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SpeechSynthesisEvent", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!

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

@ -48,11 +48,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk2':
'mochitest/pointerlock/mochitest.ini',
]
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
MOCHITEST_MANIFESTS += [
'mochitest/crypto/mochitest-legacy.ini',
]
if CONFIG['MOZ_GAMEPAD']:
MOCHITEST_MANIFESTS += [
'mochitest/gamepad/mochitest.ini',

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

@ -1,10 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[NoInterfaceObject]
interface CRMFObject {
readonly attribute DOMString request;
};

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

@ -19,38 +19,3 @@ interface Crypto {
[Pref="dom.webcrypto.enabled"]
readonly attribute SubtleCrypto subtle;
};
#ifndef MOZ_DISABLE_CRYPTOLEGACY
[NoInterfaceObject]
interface CryptoLegacy {
[Pref="dom.unsafe_legacy_crypto.enabled"]
readonly attribute DOMString version;
[SetterThrows,Pref="dom.unsafe_legacy_crypto.enabled"]
attribute boolean enableSmartCardEvents;
[Throws,NewObject,Pref="dom.unsafe_legacy_crypto.enabled"]
CRMFObject? generateCRMFRequest(ByteString? reqDN,
ByteString? regToken,
ByteString? authenticator,
ByteString? eaCert,
ByteString? jsCallback,
any... args);
[Throws,Pref="dom.unsafe_legacy_crypto.enabled"]
DOMString importUserCertificates(DOMString nickname,
DOMString cmmfResponse,
boolean doForcedBackup);
[Pref="dom.unsafe_legacy_crypto.enabled"]
DOMString signText(DOMString stringToSign,
DOMString caOption,
ByteString... args);
[Throws,Pref="dom.unsafe_legacy_crypto.enabled"]
void logout();
};
Crypto implements CryptoLegacy;
#endif // !MOZ_DISABLE_CRYPTOLEGACY

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

@ -1,16 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[Constructor(DOMString type, optional SmartCardEventInit eventInitDict)]
interface SmartCardEvent : Event
{
readonly attribute DOMString? tokenName;
};
dictionary SmartCardEventInit : EventInit
{
DOMString tokenName = "";
};

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

@ -552,7 +552,6 @@ WEBIDL_FILES += [
'PopupBlockedEvent.webidl',
'ProgressEvent.webidl',
'RecordErrorEvent.webidl',
'SmartCardEvent.webidl',
'StyleRuleChangeEvent.webidl',
'StyleSheetApplicableStateChangeEvent.webidl',
'StyleSheetChangeEvent.webidl',
@ -627,11 +626,6 @@ if CONFIG['MOZ_B2G_FM']:
'FMRadio.webidl',
]
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
WEBIDL_FILES += [
'CRMFObject.webidl',
]
GENERATED_EVENTS_WEBIDL_FILES = [
'AutocompleteErrorEvent.webidl',
'BlobEvent.webidl',
@ -672,7 +666,6 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'RTCPeerConnectionIdentityErrorEvent.webidl',
'RTCPeerConnectionIdentityEvent.webidl',
'SelectionChangeEvent.webidl',
'SmartCardEvent.webidl',
'StyleRuleChangeEvent.webidl',
'StyleSheetApplicableStateChangeEvent.webidl',
'StyleSheetChangeEvent.webidl',

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

@ -17,6 +17,7 @@ USING_WORKERS_NAMESPACE
ServiceWorker::ServiceWorker(nsPIDOMWindow* aWindow,
SharedWorker* aSharedWorker)
: DOMEventTargetHelper(aWindow),
mState(ServiceWorkerState::Installing),
mSharedWorker(aSharedWorker)
{
AssertIsOnMainThread();

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

@ -13,6 +13,7 @@
#include "nsString.h"
#include "nsIDialogParamBlock.h"
#include "nsIMutableArray.h"
#include "mozilla/dom/ScriptSettings.h"
/****************************************************************
************************ nsCookiePromptService *****************
@ -71,6 +72,11 @@ nsCookiePromptService::CookieDialog(nsIDOMWindow *aParent,
parent = do_QueryInterface(privateParent);
}
// We're opening a chrome window and passing in a nsIDialogParamBlock. Setting
// the nsIDialogParamBlock as the .arguments property on the chrome window
// requires system principals on the stack, so we use an AutoNoJSAPI for that.
mozilla::dom::AutoNoJSAPI nojsapi;
// The cookie dialog will be modal for the root chrome window rather than the
// tab containing the permission-requesting page. This removes confusion
// about which monitor is displaying the dialog (see bug 470356), but also

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

@ -38,3 +38,4 @@ support-files =
[test_same_base_domain_5.html]
[test_same_base_domain_6.html]
[test_samedomain.html]
[test_bug1041808.html]

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

@ -0,0 +1,61 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1041808
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1041808</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1041808 **/
SimpleTest.waitForExplicitFinish();
var dialogsOpened = 0;
var dialogsClosed = 0;
function dismissDialog(aSubject, aTopic, aData)
{
if (aTopic == "domwindowopened") {
var win = SpecialPowers.wrap(aSubject);
win.addEventListener("pageshow", function() {
win.removeEventListener("pageshow", arguments.callee, false);
sendKey("RETURN", aSubject);
}, false);
++dialogsOpened;
} else if (aTopic == "domwindowclosed") {
++dialogsClosed;
}
}
function runTest()
{
SpecialPowers.Services.ww.registerNotification(dismissDialog);
document.cookie = "test1=testValue";
document.cookie = "test2=testValue";
document.cookie = "test3=testValue";
SpecialPowers.Services.ww.unregisterNotification(dismissDialog);
is(dialogsOpened, 3, "Setting a cookie should have asked for permission");
is(dialogsOpened - dialogsClosed, 0,
"Setting a cookie shouldn't have left any additional windows open");
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy", 1]]},
runTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1041808">Mozilla Bug 1041808</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

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

@ -123,6 +123,9 @@ ValidateGlobalVariable(JSContext *cx, const AsmJSModule &module, AsmJSModule::Gl
if (!GetDataProperty(cx, importVal, field, &v))
return false;
if (!v.isPrimitive())
return LinkFail(cx, "Imported values must be primitives");
switch (global.varInitCoercion()) {
case AsmJS_ToInt32:
if (!ToInt32(cx, v, (int32_t *)datum))
@ -181,6 +184,7 @@ ValidateMathBuiltinFunction(JSContext *cx, AsmJSModule::Global &global, HandleVa
RootedValue v(cx);
if (!GetDataProperty(cx, globalVal, cx->names().Math, &v))
return false;
RootedPropertyName field(cx, global.mathName());
if (!GetDataProperty(cx, v, field, &v))
return false;
@ -226,6 +230,7 @@ ValidateConstant(JSContext *cx, AsmJSModule::Global &global, HandleValue globalV
if (!GetDataProperty(cx, v, field, &v))
return false;
if (!v.isNumber())
return LinkFail(cx, "math / global constant value needs to be a number");

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

@ -38,29 +38,47 @@ extern const JSFunctionSpec Int32x4Methods[];
static const char *laneNames[] = {"lane 0", "lane 1", "lane 2", "lane3"};
template<typename V>
static bool
IsVectorObject(HandleValue v)
{
if (!v.isObject())
return false;
JSObject &obj = v.toObject();
if (!obj.is<TypedObject>())
return false;
TypeDescr &typeRepr = obj.as<TypedObject>().typeDescr();
if (typeRepr.kind() != type::X4)
return false;
return typeRepr.as<X4TypeDescr>().type() == V::type;
}
template<typename Elem>
static Elem
TypedObjectMemory(HandleValue v)
{
TypedObject &obj = v.toObject().as<TypedObject>();
MOZ_ASSERT(!obj.owner().isNeutered());
return reinterpret_cast<Elem>(obj.typedMem());
}
template<typename Type32x4, int lane>
static bool GetX4Lane(JSContext *cx, unsigned argc, Value *vp) {
static bool GetX4Lane(JSContext *cx, unsigned argc, Value *vp)
{
typedef typename Type32x4::Elem Elem;
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.thisv().isObject() || !args.thisv().toObject().is<TypedObject>()) {
if (!IsVectorObject<Type32x4>(args.thisv())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
X4TypeDescr::class_.name, laneNames[lane],
InformalValueTypeName(args.thisv()));
return false;
}
TypedObject &typedObj = args.thisv().toObject().as<TypedObject>();
TypeDescr &descr = typedObj.typeDescr();
if (descr.kind() != type::X4 || descr.as<X4TypeDescr>().type() != Type32x4::type) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
X4TypeDescr::class_.name, laneNames[lane],
InformalValueTypeName(args.thisv()));
return false;
}
MOZ_ASSERT(!typedObj.owner().isNeutered());
Elem *data = reinterpret_cast<Elem *>(typedObj.typedMem());
Elem *data = TypedObjectMemory<Elem *>(args.thisv());
Type32x4::setReturn(args, data[lane]);
return true;
}
@ -82,7 +100,8 @@ static bool type##Lane##lane(JSContext *cx, unsigned argc, Value *vp) { \
#undef LANE_ACCESSOR
template<typename Type32x4>
static bool SignMask(JSContext *cx, unsigned argc, Value *vp) {
static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
{
typedef typename Type32x4::Elem Elem;
CallArgs args = CallArgsFromVp(argc, vp);
@ -388,33 +407,6 @@ js_InitSIMDClass(JSContext *cx, HandleObject obj)
return SIMDObject::initClass(cx, global);
}
template<typename V>
static bool
IsVectorObject(HandleValue v)
{
if (!v.isObject())
return false;
JSObject &obj = v.toObject();
if (!obj.is<TypedObject>())
return false;
TypeDescr &typeRepr = obj.as<TypedObject>().typeDescr();
if (typeRepr.kind() != type::X4)
return false;
return typeRepr.as<X4TypeDescr>().type() == V::type;
}
template<typename Elem>
static Elem
TypedObjectMemory(HandleValue v)
{
TypedObject &obj = v.toObject().as<TypedObject>();
MOZ_ASSERT(!obj.owner().isNeutered());
return reinterpret_cast<Elem>(obj.typedMem());
}
template<typename V>
JSObject *
js::CreateSimd(JSContext *cx, typename V::Elem *data)
@ -437,30 +429,33 @@ template JSObject *js::CreateSimd<Float32x4>(JSContext *cx, Float32x4::Elem *dat
template JSObject *js::CreateSimd<Int32x4>(JSContext *cx, Int32x4::Elem *data);
namespace js {
// Unary SIMD operators
template<typename T>
struct Abs {
static inline T apply(T x, T zero) { return x < 0 ? -1 * x : x; }
static inline T apply(T x) { return x < 0 ? -1 * x : x; }
};
template<typename T>
struct Neg {
static inline T apply(T x, T zero) { return -1 * x; }
static inline T apply(T x) { return -1 * x; }
};
template<typename T>
struct Not {
static inline T apply(T x, T zero) { return ~x; }
static inline T apply(T x) { return ~x; }
};
template<typename T>
struct Rec {
static inline T apply(T x, T zero) { return 1 / x; }
static inline T apply(T x) { return 1 / x; }
};
template<typename T>
struct RecSqrt {
static inline T apply(T x, T zero) { return 1 / sqrt(x); }
static inline T apply(T x) { return 1 / sqrt(x); }
};
template<typename T>
struct Sqrt {
static inline T apply(T x, T zero) { return sqrt(x); }
static inline T apply(T x) { return sqrt(x); }
};
// Binary SIMD operators
template<typename T>
struct Add {
static inline T apply(T l, T r) { return l + r; }
@ -575,53 +570,71 @@ ErrorBadArgs(JSContext *cx)
return false;
}
template<typename Out>
static bool
StoreResult(JSContext *cx, CallArgs &args, typename Out::Elem *result)
{
RootedObject obj(cx, CreateSimd<Out>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
}
// Coerces the inputs of type In to the type Coercion, apply the operator Op
// and converts the result to the type Out.
template<typename In, typename Coercion, template<typename C> class Op, typename Out>
static bool
CoercedFunc(JSContext *cx, unsigned argc, Value *vp)
CoercedUnaryFunc(JSContext *cx, unsigned argc, Value *vp)
{
typedef typename Coercion::Elem CoercionElem;
typedef typename Out::Elem RetElem;
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 1 && args.length() != 2)
if (args.length() != 1 || !IsVectorObject<In>(args[0]))
return ErrorBadArgs(cx);
CoercionElem result[Coercion::lanes];
if (args.length() == 1) {
if (!IsVectorObject<In>(args[0]))
return ErrorBadArgs(cx);
CoercionElem *val = TypedObjectMemory<CoercionElem *>(args[0]);
for (unsigned i = 0; i < Coercion::lanes; i++)
result[i] = Op<CoercionElem>::apply(val[i], 0);
} else {
JS_ASSERT(args.length() == 2);
if (!IsVectorObject<In>(args[0]) || !IsVectorObject<In>(args[1]))
result[i] = Op<CoercionElem>::apply(val[i]);
return StoreResult<Out>(cx, args, (RetElem*) result);
}
// Coerces the inputs of type In to the type Coercion, apply the operator Op
// and converts the result to the type Out.
template<typename In, typename Coercion, template<typename C> class Op, typename Out>
static bool
CoercedBinaryFunc(JSContext *cx, unsigned argc, Value *vp)
{
typedef typename Coercion::Elem CoercionElem;
typedef typename Out::Elem RetElem;
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 2 || !IsVectorObject<In>(args[0]) || !IsVectorObject<In>(args[1]))
return ErrorBadArgs(cx);
CoercionElem result[Coercion::lanes];
CoercionElem *left = TypedObjectMemory<CoercionElem *>(args[0]);
CoercionElem *right = TypedObjectMemory<CoercionElem *>(args[1]);
for (unsigned i = 0; i < Coercion::lanes; i++)
result[i] = Op<CoercionElem>::apply(left[i], right[i]);
}
RetElem *coercedResult = reinterpret_cast<RetElem *>(result);
RootedObject obj(cx, CreateSimd<Out>(cx, coercedResult));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Out>(cx, args, (RetElem *) result);
}
// Same as above, with Coercion == Out
// Same as above, with no coercion, i.e. Coercion == In.
template<typename In, template<typename C> class Op, typename Out>
static bool
Func(JSContext *cx, unsigned argc, Value *vp)
UnaryFunc(JSContext *cx, unsigned argc, Value *vp)
{
return CoercedFunc<In, Out, Op, Out>(cx, argc, vp);
return CoercedUnaryFunc<In, Out, Op, Out>(cx, argc, vp);
}
template<typename In, template<typename C> class Op, typename Out>
static bool
BinaryFunc(JSContext *cx, unsigned argc, Value *vp)
{
return CoercedBinaryFunc<In, Out, Op, Out>(cx, argc, vp);
}
template<typename V, template<typename T> class OpWith>
@ -652,13 +665,7 @@ FuncWith(JSContext *cx, unsigned argc, Value *vp)
for (unsigned i = 0; i < V::lanes; i++)
result[i] = OpWith<Elem>::apply(i, withAsBool, val[i]);
}
RootedObject obj(cx, CreateSimd<V>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<V>(cx, args, result);
}
template<typename V>
@ -712,12 +719,7 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp)
result[i] = val2[(maskArg >> (i * SELECT_SHIFT)) & SELECT_MASK];
}
RootedObject obj(cx, CreateSimd<V>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<V>(cx, args, result);
}
template<typename Op>
@ -739,13 +741,7 @@ Int32x4BinaryScalar(JSContext *cx, unsigned argc, Value *vp)
for (unsigned i = 0; i < 4; i++)
result[i] = Op::apply(val[i], bits);
RootedObject obj(cx, CreateSimd<Int32x4>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Int32x4>(cx, args, result);
}
template<typename V, typename Vret>
@ -763,13 +759,7 @@ FuncConvert(JSContext *cx, unsigned argc, Value *vp)
RetElem result[Vret::lanes];
for (unsigned i = 0; i < Vret::lanes; i++)
result[i] = RetElem(val[i]);
RootedObject obj(cx, CreateSimd<Vret>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Vret>(cx, args, result);
}
template<typename V, typename Vret>
@ -782,13 +772,8 @@ FuncConvertBits(JSContext *cx, unsigned argc, Value *vp)
if (args.length() != 1 || !IsVectorObject<V>(args[0]))
return ErrorBadArgs(cx);
RetElem *val = TypedObjectMemory<RetElem *>(args[0]);
RootedObject obj(cx, CreateSimd<Vret>(cx, val));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
RetElem *result = TypedObjectMemory<RetElem *>(args[0]);
return StoreResult<Vret>(cx, args, result);
}
template<typename Vret>
@ -804,13 +789,7 @@ FuncZero(JSContext *cx, unsigned argc, Value *vp)
RetElem result[Vret::lanes];
for (unsigned i = 0; i < Vret::lanes; i++)
result[i] = RetElem(0);
RootedObject obj(cx, CreateSimd<Vret>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Vret>(cx, args, result);
}
template<typename Vret>
@ -830,13 +809,7 @@ FuncSplat(JSContext *cx, unsigned argc, Value *vp)
RetElem result[Vret::lanes];
for (unsigned i = 0; i < Vret::lanes; i++)
result[i] = arg;
RootedObject obj(cx, CreateSimd<Vret>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Vret>(cx, args, result);
}
static bool
@ -853,13 +826,7 @@ Int32x4Bool(JSContext *cx, unsigned argc, Value *vp)
int32_t result[Int32x4::lanes];
for (unsigned i = 0; i < Int32x4::lanes; i++)
result[i] = args[i].toBoolean() ? 0xFFFFFFFF : 0x0;
RootedObject obj(cx, CreateSimd<Int32x4>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Int32x4>(cx, args, result);
}
static bool
@ -882,12 +849,7 @@ Float32x4Clamp(JSContext *cx, unsigned argc, Value *vp)
result[i] = result[i] > upperLimit[i] ? upperLimit[i] : result[i];
}
RootedObject obj(cx, CreateSimd<Float32x4>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Float32x4>(cx, args, result);
}
static bool
@ -910,22 +872,17 @@ Int32x4Select(JSContext *cx, unsigned argc, Value *vp)
int32_t fr[Int32x4::lanes];
for (unsigned i = 0; i < Int32x4::lanes; i++)
fr[i] = And<int32_t>::apply(Not<int32_t>::apply(val[i], 0), fv[i]);
fr[i] = And<int32_t>::apply(Not<int32_t>::apply(val[i]), fv[i]);
int32_t orInt[Int32x4::lanes];
for (unsigned i = 0; i < Int32x4::lanes; i++)
orInt[i] = Or<int32_t>::apply(tr[i], fr[i]);
float *result = reinterpret_cast<float *>(orInt);
RootedObject obj(cx, CreateSimd<Float32x4>(cx, result));
if (!obj)
return false;
args.rval().setObject(*obj);
return true;
return StoreResult<Float32x4>(cx, args, result);
}
#define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
#define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags) \
bool \
js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
{ \
@ -934,7 +891,7 @@ js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
FLOAT32X4_FUNCTION_LIST(DEFINE_SIMD_FLOAT32X4_FUNCTION)
#undef DEFINE_SIMD_FLOAT32x4_FUNCTION
#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags) \
bool \
js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
{ \
@ -944,7 +901,7 @@ INT32X4_FUNCTION_LIST(DEFINE_SIMD_INT32X4_FUNCTION)
#undef DEFINE_SIMD_INT32X4_FUNCTION
const JSFunctionSpec js::Float32x4Methods[] = {
#define SIMD_FLOAT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags, MIRId) \
#define SIMD_FLOAT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags) \
JS_FN(#Name, js::simd_float32x4_##Name, Operands, Flags),
FLOAT32X4_FUNCTION_LIST(SIMD_FLOAT32X4_FUNCTION_ITEM)
#undef SIMD_FLOAT32x4_FUNCTION_ITEM
@ -952,7 +909,7 @@ const JSFunctionSpec js::Float32x4Methods[] = {
};
const JSFunctionSpec js::Int32x4Methods[] = {
#define SIMD_INT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags, MIRId) \
#define SIMD_INT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags) \
JS_FN(#Name, js::simd_int32x4_##Name, Operands, Flags),
INT32X4_FUNCTION_LIST(SIMD_INT32X4_FUNCTION_ITEM)
#undef SIMD_INT32X4_FUNCTION_ITEM

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

@ -19,45 +19,45 @@
*/
#define FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
V(zero, (FuncZero<Float32x4>), 0, 0, Zero)
V(zero, (FuncZero<Float32x4>), 0, 0)
#define FLOAT32X4_UNARY_FUNCTION_LIST(V) \
V(abs, (Func<Float32x4, Abs, Float32x4>), 1, 0, Abs) \
V(fromInt32x4Bits, (FuncConvertBits<Int32x4, Float32x4>), 1, 0, FromInt32x4Bits) \
V(neg, (Func<Float32x4, Neg, Float32x4>), 1, 0, Neg) \
V(not, (CoercedFunc<Float32x4, Int32x4, Not, Float32x4>), 1, 0, Not) \
V(reciprocal, (Func<Float32x4, Rec, Float32x4>), 1, 0, Reciprocal) \
V(reciprocalSqrt, (Func<Float32x4, RecSqrt, Float32x4>), 1, 0, ReciprocalSqrt) \
V(splat, (FuncSplat<Float32x4>), 1, 0, Splat) \
V(sqrt, (Func<Float32x4, Sqrt, Float32x4>), 1, 0, Sqrt) \
V(fromInt32x4, (FuncConvert<Int32x4, Float32x4> ), 1, 0, FromInt32x4)
V(abs, (UnaryFunc<Float32x4, Abs, Float32x4>), 1, 0) \
V(fromInt32x4Bits, (FuncConvertBits<Int32x4, Float32x4>), 1, 0) \
V(neg, (UnaryFunc<Float32x4, Neg, Float32x4>), 1, 0) \
V(not, (CoercedUnaryFunc<Float32x4, Int32x4, Not, Float32x4>), 1, 0) \
V(reciprocal, (UnaryFunc<Float32x4, Rec, Float32x4>), 1, 0) \
V(reciprocalSqrt, (UnaryFunc<Float32x4, RecSqrt, Float32x4>), 1, 0) \
V(splat, (FuncSplat<Float32x4>), 1, 0) \
V(sqrt, (UnaryFunc<Float32x4, Sqrt, Float32x4>), 1, 0) \
V(fromInt32x4, (FuncConvert<Int32x4, Float32x4> ), 1, 0)
#define FLOAT32X4_BINARY_FUNCTION_LIST(V) \
V(add, (Func<Float32x4, Add, Float32x4>), 2, 0, Add) \
V(and, (CoercedFunc<Float32x4, Int32x4, And, Float32x4>), 2, 0, And) \
V(div, (Func<Float32x4, Div, Float32x4>), 2, 0, Div) \
V(equal, (Func<Float32x4, Equal, Int32x4>), 2, 0, Equal) \
V(greaterThan, (Func<Float32x4, GreaterThan, Int32x4>), 2, 0, GreaterThan) \
V(greaterThanOrEqual, (Func<Float32x4, GreaterThanOrEqual, Int32x4>), 2, 0, GreaterThanOrEqual) \
V(lessThan, (Func<Float32x4, LessThan, Int32x4>), 2, 0, LessThan) \
V(lessThanOrEqual, (Func<Float32x4, LessThanOrEqual, Int32x4>), 2, 0, LessThanOrEqual) \
V(max, (Func<Float32x4, Maximum, Float32x4>), 2, 0, Max) \
V(min, (Func<Float32x4, Minimum, Float32x4>), 2, 0, Min) \
V(mul, (Func<Float32x4, Mul, Float32x4>), 2, 0, Mul) \
V(notEqual, (Func<Float32x4, NotEqual, Int32x4>), 2, 0, NotEqual) \
V(shuffle, FuncShuffle<Float32x4>, 2, 0, Shuffle) \
V(or, (CoercedFunc<Float32x4, Int32x4, Or, Float32x4>), 2, 0, Or) \
V(scale, (FuncWith<Float32x4, Scale>), 2, 0, Scale) \
V(sub, (Func<Float32x4, Sub, Float32x4>), 2, 0, Sub) \
V(withX, (FuncWith<Float32x4, WithX>), 2, 0, WithX) \
V(withY, (FuncWith<Float32x4, WithY>), 2, 0, WithY) \
V(withZ, (FuncWith<Float32x4, WithZ>), 2, 0, WithZ) \
V(withW, (FuncWith<Float32x4, WithW>), 2, 0, WithW) \
V(xor, (CoercedFunc<Float32x4, Int32x4, Xor, Float32x4>), 2, 0, Xor)
V(add, (BinaryFunc<Float32x4, Add, Float32x4>), 2, 0) \
V(and, (CoercedBinaryFunc<Float32x4, Int32x4, And, Float32x4>), 2, 0) \
V(div, (BinaryFunc<Float32x4, Div, Float32x4>), 2, 0) \
V(equal, (BinaryFunc<Float32x4, Equal, Int32x4>), 2, 0) \
V(greaterThan, (BinaryFunc<Float32x4, GreaterThan, Int32x4>), 2, 0) \
V(greaterThanOrEqual, (BinaryFunc<Float32x4, GreaterThanOrEqual, Int32x4>), 2, 0) \
V(lessThan, (BinaryFunc<Float32x4, LessThan, Int32x4>), 2, 0) \
V(lessThanOrEqual, (BinaryFunc<Float32x4, LessThanOrEqual, Int32x4>), 2, 0) \
V(max, (BinaryFunc<Float32x4, Maximum, Float32x4>), 2, 0) \
V(min, (BinaryFunc<Float32x4, Minimum, Float32x4>), 2, 0) \
V(mul, (BinaryFunc<Float32x4, Mul, Float32x4>), 2, 0) \
V(notEqual, (BinaryFunc<Float32x4, NotEqual, Int32x4>), 2, 0) \
V(shuffle, FuncShuffle<Float32x4>, 2, 0) \
V(or, (CoercedBinaryFunc<Float32x4, Int32x4, Or, Float32x4>), 2, 0) \
V(scale, (FuncWith<Float32x4, Scale>), 2, 0) \
V(sub, (BinaryFunc<Float32x4, Sub, Float32x4>), 2, 0) \
V(withX, (FuncWith<Float32x4, WithX>), 2, 0) \
V(withY, (FuncWith<Float32x4, WithY>), 2, 0) \
V(withZ, (FuncWith<Float32x4, WithZ>), 2, 0) \
V(withW, (FuncWith<Float32x4, WithW>), 2, 0) \
V(xor, (CoercedBinaryFunc<Float32x4, Int32x4, Xor, Float32x4>), 2, 0)
#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \
V(clamp, Float32x4Clamp, 3, 0, Clamp) \
V(shuffleMix, FuncShuffle<Float32x4>, 3, 0, ShuffleMix)
V(clamp, Float32x4Clamp, 3, 0) \
V(shuffleMix, FuncShuffle<Float32x4>, 3, 0)
#define FLOAT32X4_FUNCTION_LIST(V) \
FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
@ -66,44 +66,44 @@
FLOAT32X4_TERNARY_FUNCTION_LIST(V)
#define INT32X4_NULLARY_FUNCTION_LIST(V) \
V(zero, (FuncZero<Int32x4>), 0, 0, Zero)
V(zero, (FuncZero<Int32x4>), 0, 0)
#define INT32X4_UNARY_FUNCTION_LIST(V) \
V(fromFloat32x4Bits, (FuncConvertBits<Float32x4, Int32x4>), 1, 0, FromFloat32x4Bits) \
V(neg, (Func<Int32x4, Neg, Int32x4>), 1, 0, Neg) \
V(not, (Func<Int32x4, Not, Int32x4>), 1, 0, Not) \
V(splat, (FuncSplat<Int32x4>), 0, 0, Splat) \
V(fromFloat32x4, (FuncConvert<Float32x4, Int32x4>), 1, 0, FromFloat32x4)
V(fromFloat32x4Bits, (FuncConvertBits<Float32x4, Int32x4>), 1, 0) \
V(neg, (UnaryFunc<Int32x4, Neg, Int32x4>), 1, 0) \
V(not, (UnaryFunc<Int32x4, Not, Int32x4>), 1, 0) \
V(splat, (FuncSplat<Int32x4>), 0, 0) \
V(fromFloat32x4, (FuncConvert<Float32x4, Int32x4>), 1, 0)
#define INT32X4_BINARY_FUNCTION_LIST(V) \
V(add, (Func<Int32x4, Add, Int32x4>), 2, 0, Add) \
V(and, (Func<Int32x4, And, Int32x4>), 2, 0, And) \
V(equal, (Func<Int32x4, Equal, Int32x4>), 2, 0, Equal) \
V(greaterThan, (Func<Int32x4, GreaterThan, Int32x4>), 2, 0, GreaterThan) \
V(lessThan, (Func<Int32x4, LessThan, Int32x4>), 2, 0, LessThan) \
V(mul, (Func<Int32x4, Mul, Int32x4>), 2, 0, Mul) \
V(or, (Func<Int32x4, Or, Int32x4>), 2, 0, Or) \
V(sub, (Func<Int32x4, Sub, Int32x4>), 2, 0, Sub) \
V(shiftLeft, (Int32x4BinaryScalar<ShiftLeft>), 2, 0, ShiftLeft) \
V(shiftRight, (Int32x4BinaryScalar<ShiftRight>), 2, 0, ShiftRight) \
V(shiftRightLogical, (Int32x4BinaryScalar<ShiftRightLogical>), 2, 0, ShiftRightLogical) \
V(shuffle, FuncShuffle<Int32x4>, 2, 0, Shuffle) \
V(withFlagX, (FuncWith<Int32x4, WithFlagX>), 2, 0, WithFlagX) \
V(withFlagY, (FuncWith<Int32x4, WithFlagY>), 2, 0, WithFlagY) \
V(withFlagZ, (FuncWith<Int32x4, WithFlagZ>), 2, 0, WithFlagZ) \
V(withFlagW, (FuncWith<Int32x4, WithFlagW>), 2, 0, WithFlagW) \
V(withX, (FuncWith<Int32x4, WithX>), 2, 0, WithX) \
V(withY, (FuncWith<Int32x4, WithY>), 2, 0, WithY) \
V(withZ, (FuncWith<Int32x4, WithZ>), 2, 0, WithZ) \
V(withW, (FuncWith<Int32x4, WithW>), 2, 0, WithW) \
V(xor, (Func<Int32x4, Xor, Int32x4>), 2, 0, Xor)
V(add, (BinaryFunc<Int32x4, Add, Int32x4>), 2, 0) \
V(and, (BinaryFunc<Int32x4, And, Int32x4>), 2, 0) \
V(equal, (BinaryFunc<Int32x4, Equal, Int32x4>), 2, 0) \
V(greaterThan, (BinaryFunc<Int32x4, GreaterThan, Int32x4>), 2, 0) \
V(lessThan, (BinaryFunc<Int32x4, LessThan, Int32x4>), 2, 0) \
V(mul, (BinaryFunc<Int32x4, Mul, Int32x4>), 2, 0) \
V(or, (BinaryFunc<Int32x4, Or, Int32x4>), 2, 0) \
V(sub, (BinaryFunc<Int32x4, Sub, Int32x4>), 2, 0) \
V(shiftLeft, (Int32x4BinaryScalar<ShiftLeft>), 2, 0) \
V(shiftRight, (Int32x4BinaryScalar<ShiftRight>), 2, 0) \
V(shiftRightLogical, (Int32x4BinaryScalar<ShiftRightLogical>), 2, 0) \
V(shuffle, FuncShuffle<Int32x4>, 2, 0) \
V(withFlagX, (FuncWith<Int32x4, WithFlagX>), 2, 0) \
V(withFlagY, (FuncWith<Int32x4, WithFlagY>), 2, 0) \
V(withFlagZ, (FuncWith<Int32x4, WithFlagZ>), 2, 0) \
V(withFlagW, (FuncWith<Int32x4, WithFlagW>), 2, 0) \
V(withX, (FuncWith<Int32x4, WithX>), 2, 0) \
V(withY, (FuncWith<Int32x4, WithY>), 2, 0) \
V(withZ, (FuncWith<Int32x4, WithZ>), 2, 0) \
V(withW, (FuncWith<Int32x4, WithW>), 2, 0) \
V(xor, (BinaryFunc<Int32x4, Xor, Int32x4>), 2, 0)
#define INT32X4_TERNARY_FUNCTION_LIST(V) \
V(select, Int32x4Select, 3, 0, Select) \
V(shuffleMix, FuncShuffle<Int32x4>, 3, 0, ShuffleMix)
V(select, Int32x4Select, 3, 0) \
V(shuffleMix, FuncShuffle<Int32x4>, 3, 0)
#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \
V(bool, Int32x4Bool, 4, 0, Bool)
V(bool, Int32x4Bool, 4, 0)
#define INT32X4_FUNCTION_LIST(V) \
INT32X4_NULLARY_FUNCTION_LIST(V) \
@ -166,13 +166,13 @@ struct Int32x4 {
template<typename V>
JSObject *CreateSimd(JSContext *cx, typename V::Elem *data);
#define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
#define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags) \
extern bool \
simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
FLOAT32X4_FUNCTION_LIST(DECLARE_SIMD_FLOAT32X4_FUNCTION)
#undef DECLARE_SIMD_FLOAT32X4_FUNCTION
#define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
#define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags) \
extern bool \
simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION)

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

@ -1550,7 +1550,10 @@ ia64*-hpux*)
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
MOZ_OPTIMIZE_FLAGS="-O3 -fno-reorder-functions"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
@ -1569,7 +1572,10 @@ ia64*-hpux*)
MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
esac
MOZ_PGO_OPTIMIZE_FLAGS="-O3"
MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
MOZ_OPTIMIZE_FLAGS="-O3 $MOZ_OPTIMIZE_SIZE_TWEAK"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
fi
fi
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'

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

@ -1,4 +1,5 @@
load(libdir + "asm.js");
load(libdir + "asserts.js");
assertAsmTypeFail(USE_ASM + "var i; function f(){} return f");
assertAsmTypeFail(USE_ASM + "const i; function f(){} return f");
@ -117,6 +118,14 @@ assertEq(asmLink(asmCompile('global', 'imp', USE_ASM + "const i=+imp.i; function
assertEq(asmLink(asmCompile('global', 'imp', USE_ASM + "var i=+imp.i; function f() { return +i } return f")(this, {i:1.4})), 1.4);
assertEq(asmLink(asmCompile('global', 'imp', USE_ASM + "const i=+imp.i; function f() { return +i } return f")(this, {i:1.4})), 1.4);
assertEq(asmLink(asmCompile(USE_ASM + "var g=0; function f() { var i=42; while (1) { break; } g = i; return g|0 } return f"))(), 42);
assertAsmLinkFail(asmCompile('glob','foreign', USE_ASM + 'var i = +foreign.x; function f() {} return f'), null, {x:{valueOf:function() { return 42 }}});
assertAsmLinkFail(asmCompile('glob','foreign', USE_ASM + 'var i = foreign.x|0; function f() {} return f'), null, {x:{valueOf:function() { return 42 }}});
assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var i = foreign.x|0; function f() { return i|0} return f'), null, {x:"blah"})(), 0);
assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var i = +foreign.x; function f() { return +i} return f'), null, {x:"blah"})(), NaN);
assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var tof = glob.Math.fround; var i = tof(foreign.x); function f() { return +i} return f'), this, {x:"blah"})(), NaN);
assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = foreign.x|0; function f() { return i|0} return f')(null, {x:Symbol("blah")}), TypeError);
assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = +foreign.x; function f() { return +i} return f')(null, {x:Symbol("blah")}), TypeError);
assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var tof = glob.Math.fround; var i = tof(foreign.x); function f() { return +i} return f')(this, {x:Symbol("blah")}), TypeError);
var f1 = asmCompile('global', 'foreign', 'heap', USE_ASM + 'var i32 = new global.Int32Array(heap); function g() { return i32[4]|0 } return g');
var global = this;

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

@ -199,7 +199,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
const nsCSSValue* tokenStream = nullptr;
uint32_t totalCount = 0, importantCount = 0,
initialCount = 0, inheritCount = 0, unsetCount = 0,
matchingTokenStreamCount = 0;
matchingTokenStreamCount = 0, nonMatchingTokenStreamCount = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty) {
if (*p == eCSSProperty__x_system_font ||
nsCSSProps::PropHasFlags(*p, CSS_PROPERTY_DIRECTIONAL_SOURCE)) {
@ -224,10 +224,13 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
++initialCount;
} else if (val->GetUnit() == eCSSUnit_Unset) {
++unsetCount;
} else if (val->GetUnit() == eCSSUnit_TokenStream &&
val->GetTokenStreamValue()->mShorthandPropertyID == aProperty) {
} else if (val->GetUnit() == eCSSUnit_TokenStream) {
if (val->GetTokenStreamValue()->mShorthandPropertyID == aProperty) {
tokenStream = val;
++matchingTokenStreamCount;
} else {
++nonMatchingTokenStreamCount;
}
}
}
if (importantCount != 0 && importantCount != totalCount) {
@ -252,8 +255,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
nsCSSValue::eNormalized);
return;
}
if (initialCount != 0 || inheritCount != 0 || unsetCount != 0) {
// Case (2): partially initial, inherit or unset.
if (initialCount != 0 || inheritCount != 0 ||
unsetCount != 0 || nonMatchingTokenStreamCount != 0) {
// Case (2): partially initial, inherit, unset or token stream.
return;
}
if (tokenStream) {

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

@ -81,6 +81,9 @@ function xfail_compute(property, value)
return false;
}
// constructed to map longhands ==> list of containing shorthands
var gPropertyShorthands = {};
var gElement = document.getElementById("testnode");
var gDeclaration = gElement.style;
var gComputedStyle = window.getComputedStyle(gElement, "");
@ -105,6 +108,17 @@ function test_property(property)
is(gDeclaration.cssText, "", "non-empty serialization after removing all properties " + errstr);
}
function test_other_shorthands_empty(value, subprop) {
if (!(subprop in gPropertyShorthands)) return;
var shorthands = gPropertyShorthands[subprop];
for (idx in shorthands) {
var sh = shorthands[idx];
if (sh.replace("-moz-","") == property.replace("-moz-","")) continue;
is(gDeclaration.getPropertyValue(sh), "",
"setting '" + value + "' on '" + property + "' (for shorthand '" + sh + "')");
}
}
function test_value(value, resolved_value) {
var value_has_variable_reference = resolved_value != null;
@ -134,6 +148,7 @@ function test_property(property)
(!info.alias_for || info.type == CSS_TYPE_TRUE_SHORTHAND)) {
is(gDeclaration.getPropertyValue(subprop), "",
"setting '" + value + "' on '" + property + "' (for '" + subprop + "')");
test_other_shorthands_empty(value, subprop);
} else {
isnot(gDeclaration.getPropertyValue(subprop), "",
"setting '" + value + "' on '" + property + "' (for '" + subprop + "')");
@ -273,8 +288,19 @@ function runTest() {
// property at a time.
ok(SpecialPowers.getBoolPref("layout.css.variables.enabled"), "pref not set #1");
var props = [];
for (var prop in gCSSProperties)
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if ("subproperties" in info) {
for (var idx in info.subproperties) {
var subprop = info.subproperties[idx];
if (!(subprop in gPropertyShorthands)) {
gPropertyShorthands[subprop] = [];
}
gPropertyShorthands[subprop].push(prop);
}
}
props.push(prop);
}
props = props.reverse();
function do_one() {
if (props.length == 0) {

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

@ -438,12 +438,15 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
break;
}
if (mChange) {
// We're in the process of moving the thumb to the mouse,
// but the mouse just moved. Make sure to update our
// destination point.
// On Linux the destination point is determined by the initial click
// on the scrollbar track and doesn't change until the mouse button
// is released.
#ifndef MOZ_WIDGET_GTK
// On the other platforms we need to update the destination point now.
mDestinationPoint = eventPoint;
StopRepeat();
StartRepeat();
#endif
break;
}
@ -523,6 +526,12 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
DragThumb(true);
#ifdef MOZ_WIDGET_GTK
nsCOMPtr<nsIContent> thumb = thumbFrame->GetContent();
thumb->SetAttr(kNameSpaceID_None, nsGkAtoms::active, NS_LITERAL_STRING("true"), true);
#endif
if (aEvent->mClass == eTouchEventClass) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}
@ -534,6 +543,21 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
mDragStart = pos - mThumbStart;
}
#ifdef MOZ_WIDGET_GTK
else if (ShouldScrollForEvent(aEvent) &&
aEvent->mClass == eMouseEventClass &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eRightButton) {
// HandlePress and HandleRelease are usually called via
// nsFrame::HandleEvent, but only for the left mouse button.
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
HandlePress(aPresContext, aEvent, aEventStatus);
} else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
HandleRelease(aPresContext, aEvent, aEventStatus);
}
return NS_OK;
}
#endif
// XXX hack until handle release is actually called in nsframe.
// if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
@ -862,6 +886,11 @@ nsSliderFrame::StartDrag(nsIDOMEvent* aEvent)
return NS_OK;
}
#ifdef MOZ_WIDGET_GTK
nsCOMPtr<nsIContent> thumb = thumbFrame->GetContent();
thumb->SetAttr(kNameSpaceID_None, nsGkAtoms::active, NS_LITERAL_STRING("true"), true);
#endif
if (isHorizontal)
mThumbStart = thumbFrame->GetPosition().x;
else
@ -881,6 +910,15 @@ nsSliderFrame::StopDrag()
{
AddListener();
DragThumb(false);
#ifdef MOZ_WIDGET_GTK
nsIFrame* thumbFrame = mFrames.FirstChild();
if (thumbFrame) {
nsCOMPtr<nsIContent> thumb = thumbFrame->GetContent();
thumb->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, true);
}
#endif
if (mChange) {
StopRepeat();
mChange = 0;
@ -955,8 +993,14 @@ nsSliderFrame::ShouldScrollForEvent(WidgetGUIEvent* aEvent)
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP: {
uint16_t button = aEvent->AsMouseEvent()->button;
#ifdef MOZ_WIDGET_GTK
return (button == WidgetMouseEvent::eLeftButton) ||
(button == WidgetMouseEvent::eRightButton && GetScrollToClick()) ||
(button == WidgetMouseEvent::eMiddleButton && gMiddlePref && !GetScrollToClick());
#else
return (button == WidgetMouseEvent::eLeftButton) ||
(button == WidgetMouseEvent::eMiddleButton && gMiddlePref);
#endif
}
default:
return false;
@ -978,8 +1022,8 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
return false;
}
#ifdef XP_MACOSX
// On Mac, clicking the scrollbar thumb should never scroll to click.
#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
// On Mac and Linux, clicking the scrollbar thumb should never scroll to click.
if (IsEventOverThumb(aEvent)) {
return false;
}
@ -995,6 +1039,12 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
return GetScrollToClick() != invertPref;
}
#ifdef MOZ_WIDGET_GTK
if (mouseEvent->button == WidgetMouseEvent::eRightButton) {
return !GetScrollToClick();
}
#endif
return true;
}
@ -1054,7 +1104,25 @@ nsSliderFrame::HandlePress(nsPresContext* aPresContext,
mChange = change;
DragThumb(true);
// On Linux we want to keep scrolling in the direction indicated by |change|
// until the mouse is released. On the other platforms we want to stop
// scrolling as soon as the scrollbar thumb has reached the current mouse
// position.
#ifdef MOZ_WIDGET_GTK
nsRect clientRect;
GetClientRect(clientRect);
// Set the destination point to the very end of the scrollbar so that
// scrolling doesn't stop halfway through.
if (change > 0) {
mDestinationPoint = nsPoint(clientRect.width, clientRect.height);
}
else {
mDestinationPoint = nsPoint(0, 0);
}
#else
mDestinationPoint = eventPoint;
#endif
StartRepeat();
PageUpDown(change);
return NS_OK;

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

@ -1079,11 +1079,13 @@ public class BrowserApp extends GeckoApp
}
// Make sure the toolbar is fully hidden or fully shown when the user
// lifts their finger. If the page is shorter than the viewport, the
// toolbar is always shown.
// lifts their finger. If the page is shorter than the viewport or if
// the user has reached the end of the page, the toolbar is always
// shown.
ImmutableViewportMetrics metrics = mLayerView.getViewportMetrics();
if (metrics.getPageHeight() < metrics.getHeight()
|| metrics.marginTop >= mToolbarHeight / 2) {
|| metrics.marginTop >= mToolbarHeight / 2
|| metrics.pageRectBottom == metrics.viewportRectBottom) {
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
} else {
mDynamicToolbar.setVisible(false, VisibilityTransition.ANIMATE);
@ -2893,8 +2895,13 @@ public class BrowserApp extends GeckoApp
// BrowserSearch.OnSearchListener
@Override
public void onSearch(SearchEngine engine, String text) {
recordSearch(engine, "barsuggest");
// Don't store searches that happen in private tabs. This assumes the user can only
// perform a search inside the currently selected tab, which is true for searches
// that come from SearchEngineRow.
if (!Tabs.getInstance().getSelectedTab().isPrivate()) {
storeSearchQuery(text);
}
recordSearch(engine, "barsuggest");
openUrlAndStopEditing(text, engine.name);
}

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

@ -185,6 +185,6 @@ public class FxAccountUtils {
*/
public static String getAudienceForURL(String serverURI) throws URISyntaxException {
URI uri = new URI(serverURI);
return new URI(uri.getScheme(), uri.getHost(), null, null).toString();
return new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString();
}
}

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

@ -21,7 +21,7 @@ public class MockMyIDTokenFactory {
public static final BigInteger MOCKMYID_g = new BigInteger("c52a4a0ff3b7e61fdf1867ce84138369a6154f4afa92966e3c827e25cfa6cf508b90e5de419e1337e07a2e9e2a3cd5dea704d175f8ebf6af397d69e110b96afb17c7a03259329e4829b0d03bbc7896b15b4ade53e130858cc34d96269aa89041f409136c7242a38895c9d5bccad4f389af1d7a4bd1398bd072dffa896233397a", 16);
// Computed lazily by static <code>getMockMyIDPrivateKey</code>.
protected static SigningPrivateKey cachedMockMyIDPrivateKey;
protected static SigningPrivateKey cachedMockMyIDPrivateKey = null;
public static SigningPrivateKey getMockMyIDPrivateKey() throws NoSuchAlgorithmException, InvalidKeySpecException {
if (cachedMockMyIDPrivateKey == null) {

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

@ -14,7 +14,7 @@ public class FxAccountAuthenticatorService extends Service {
public static final String LOG_TAG = FxAccountAuthenticatorService.class.getSimpleName();
// Lazily initialized by <code>getAuthenticator</code>.
protected FxAccountAuthenticator accountAuthenticator;
protected FxAccountAuthenticator accountAuthenticator = null;
protected synchronized FxAccountAuthenticator getAuthenticator() {
if (accountAuthenticator == null) {

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

@ -7,6 +7,7 @@ package org.mozilla.gecko.fxa.receivers;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.fxa.FxAccountConstants;
import org.mozilla.gecko.sync.config.AccountPickler;
import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository;
import android.app.IntentService;
import android.content.Context;
@ -58,6 +59,10 @@ public class FxAccountDeletedService extends IntentService {
Logger.info(LOG_TAG, "Firefox account named " + accountName + " being removed; " +
"deleting saved pickle file '" + FxAccountConstants.ACCOUNT_PICKLE_FILENAME + "'.");
deletePickle(context);
// Delete client database and non-local tabs.
Logger.info(LOG_TAG, "Deleting the entire clients database and non-local tabs");
FennecTabsRepository.deleteNonLocalClientsAndTabs(context);
}
public static void deletePickle(final Context context) {

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

@ -74,7 +74,7 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
// Used to do cheap in-memory rate limiting. Don't sync again if we
// successfully synced within this duration.
private static final int MINIMUM_SYNC_DELAY_MILLIS = 15 * 1000; // 15 seconds.
private volatile long lastSyncRealtimeMillis;
private volatile long lastSyncRealtimeMillis = 0L;
protected final ExecutorService executor;
protected final FxAccountNotificationManager notificationManager;

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

@ -10,7 +10,7 @@ import android.os.IBinder;
public class FxAccountSyncService extends Service {
private static final Object syncAdapterLock = new Object();
private static FxAccountSyncAdapter syncAdapter;
private static FxAccountSyncAdapter syncAdapter = null;
@Override
public void onCreate() {

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

@ -23,7 +23,7 @@ public class FxAccountSyncStatusHelper implements SyncStatusObserver {
@SuppressWarnings("unused")
private static final String LOG_TAG = FxAccountSyncStatusHelper.class.getSimpleName();
protected static FxAccountSyncStatusHelper sInstance;
protected static FxAccountSyncStatusHelper sInstance = null;
public synchronized static FxAccountSyncStatusHelper getInstance() {
if (sInstance == null) {
@ -33,7 +33,7 @@ public class FxAccountSyncStatusHelper implements SyncStatusObserver {
}
// Used to unregister this as a listener.
protected Object handle;
protected Object handle = null;
// Maps delegates to whether their underlying Android account was syncing the
// last time we observed a status change.

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

@ -85,9 +85,9 @@ public abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerR
protected static class InnerRequestDelegate<T> implements RequestDelegate<T> {
protected final CountDownLatch latch;
public T response;
public Exception exception;
public FxAccountClientRemoteException failure;
public T response = null;
public Exception exception = null;
public FxAccountClientRemoteException failure = null;
protected InnerRequestDelegate(CountDownLatch latch) {
this.latch = latch;

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

@ -212,8 +212,8 @@
<!ENTITY fxaccount_account_type_label 'Firefox'>
<!-- Localization note: these are shown by the Android system itself,
when the user navigates to the Android > Accounts > [Firefox
Account] Screen. The link takes the user to the Firefox Account
when the user navigates to the Android > Accounts > {Firefox
Account} Screen. The link takes the user to the Firefox Account
status activity, which lets them manage their Firefox
Account. -->
<!ENTITY fxaccount_options_title '&syncBrand.shortName.label; Options'>

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

@ -408,8 +408,8 @@ gbjar.sources += [
'toolbar/ToolbarDisplayLayout.java',
'toolbar/ToolbarEditLayout.java',
'toolbar/ToolbarEditText.java',
'toolbar/ToolbarPrefs.java',
'toolbar/ToolbarProgressView.java',
'toolbar/ToolbarTitlePrefs.java',
'TouchEventInterceptor.java',
'updater/UpdateService.java',
'updater/UpdateServiceHelper.java',
@ -484,12 +484,18 @@ gbjar.extra_jars = [
'websockets.jar',
]
moz_native_devices_jars = [
CONFIG['ANDROID_APPCOMPAT_LIB'],
CONFIG['ANDROID_MEDIAROUTER_LIB'],
CONFIG['GOOGLE_PLAY_SERVICES_LIB'],
]
moz_native_devices_sources = [
'ChromeCast.java',
'MediaPlayerManager.java',
]
if CONFIG['MOZ_NATIVE_DEVICES']:
gbjar.extra_jars += [CONFIG['ANDROID_APPCOMPAT_LIB']]
gbjar.extra_jars += [CONFIG['ANDROID_MEDIAROUTER_LIB']]
gbjar.extra_jars += [CONFIG['GOOGLE_PLAY_SERVICES_LIB']]
gbjar.sources += ['ChromeCast.java']
gbjar.sources += ['MediaPlayerManager.java']
gbjar.extra_jars += moz_native_devices_jars
gbjar.sources += moz_native_devices_sources
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough']
@ -623,15 +629,23 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
generated_recursive_make_targets = ['.aapt.deps', '.locales.deps'] # Captures dependencies on Android manifest and all resources.
generated = add_android_eclipse_library_project('FennecResourcesGenerated')
generated.package_name = 'org.mozilla.fennec.resources.generated'
generated.package_name = 'org.mozilla.gecko.generated'
generated.res = OBJDIR + '/res'
generated.recursive_make_targets += generated_recursive_make_targets
branding = add_android_eclipse_library_project('FennecResourcesBranding')
branding.package_name = 'org.mozilla.fennec.resources.branding'
branding.package_name = 'org.mozilla.gecko.branding'
branding.res = TOPSRCDIR + '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res'
branding.recursive_make_targets += generated_recursive_make_targets
static = add_android_eclipse_library_project('FennecResourcesStatic')
# 'org.mozilla.gecko.static' is not a valid Java package name, so we use a different one.
static.package_name = 'org.mozilla.gecko.resources'
static.res = SRCDIR + '/resources'
static.recursive_make_targets += generated_recursive_make_targets
static.included_projects += ['../' + generated.name, '../' + branding.name]
static.referenced_projects += ['../' + generated.name, '../' + branding.name]
main = add_android_eclipse_project('Fennec', OBJDIR + '/AndroidManifest.xml')
main.package_name = 'org.mozilla.gecko'
@ -654,30 +668,84 @@ main.res = None
cpe = main.add_classpathentry('src', SRCDIR,
dstdir='src/org/mozilla/gecko',
exclude_patterns=['org/mozilla/gecko/tests/**',
exclude_patterns=[
'org/mozilla/gecko/tests/**',
'org/mozilla/gecko/resources/**'])
if not CONFIG['MOZ_CRASHREPORTER']:
cpe.exclude_patterns += ['org/mozilla/gecko/CrashReporter.java']
if not CONFIG['MOZ_NATIVE_DEVICES']:
cpe.exclude_patterns += ['org/mozilla/gecko/ChromeCast.java']
cpe.exclude_patterns += ['org/mozilla/gecko/MediaPlayerManager.java']
if CONFIG['MOZ_NATIVE_DEVICES']:
# This is rather hacky, but: we define three Eclipse projects for appcompat,
# mediarouter, and Google Play Services. mediarouter depends on appcompat;
# Google Play Services depends on both mediarouter and appcompat. The three
# projects are "resources only" because it is difficult to arrange for
# exactly one version of each shipped Java JAR file to end up in the final
# APK when including the JARs in the Eclipse projects. To work around this,
# we instead add all the JAR files to the main Fennec project.
appcompat = add_android_eclipse_library_project('appcompat')
appcompat.package_name = 'android.support.v7.appcompat'
appcompat.res = CONFIG['ANDROID_APPCOMPAT_RES']
mediarouter = add_android_eclipse_library_project('mediarouter')
mediarouter.package_name = 'android.support.v7.mediarouter'
mediarouter.res = CONFIG['ANDROID_MEDIAROUTER_RES']
mediarouter.included_projects += ['../' + appcompat.name]
mediarouter.referenced_projects += ['../' + appcompat.name]
gps = add_android_eclipse_library_project('google-play-services_lib')
gps.package_name = 'com.google.android.gms'
gps.res = CONFIG['GOOGLE_PLAY_SERVICES_RES']
gps.included_projects += ['../' + appcompat.name, '../' + mediarouter.name]
gps.referenced_projects += ['../' + appcompat.name, '../' + mediarouter.name]
main.included_projects += ['../' + gps.name, '../' + appcompat.name, '../' + mediarouter.name]
main.referenced_projects += ['../' + gps.name, '../' + appcompat.name, '../' + mediarouter.name]
main.extra_jars += moz_native_devices_jars
else:
cpe.exclude_patterns += moz_native_devices_sources
# The generated/ directory includes both files generated by aapt (R.java and
# Manifest.java for all packages) but also preprocessed files. In the past, the
# generated R.java files were used by the Eclipse build, but now Eclipse
# generates these files itself. Therefore, we exclude those generated sources.
main.add_classpathentry('generated', OBJDIR + '/generated',
dstdir='generated')
dstdir='generated',
exclude_patterns=[
'**/R.java',
'**/Manifest.java'])
main.add_classpathentry('thirdparty', TOPSRCDIR + '/mobile/android/thirdparty',
dstdir='thirdparty',
ignore_warnings=True)
# Eclipse generates org.mozilla.gecko.R for this project, which is referenced by
# all the Java code. The reason that this is not generated in the main Fennec
# project is that you cannot specify a custom package to the Eclipse Android
# builder; that is, the Eclipse Android builder always builds the
# org.mozilla.fennec_*.R class. This approach works because Eclipse shares
# resources and some code across projects implicitly, which lets us provide
# org.mozilla.gecko.R to the main Fennec project from the FennecResources
# project.
#
# Previously, the static resources were in the FennecResources project. To let
# the FennecResources Eclipse project produce org.mozilla.gecko.R, however, the
# project must depend on all the resource projects. But the crash reporter
# resources depend on some of the static resources, and that causes a cycle.
# This layer of indirection lets us break the cycle.
resources = add_android_eclipse_library_project('FennecResources')
resources.package_name = 'org.mozilla.fennec.resources'
resources.res = SRCDIR + '/resources'
resources.included_projects += ['../' + generated.name, '../' + branding.name]
resources.package_name = 'org.mozilla.gecko'
resources.res = None
resources.included_projects += ['../' + static.name, '../' + generated.name, '../' + branding.name]
resources.recursive_make_targets += generated_recursive_make_targets
# The resources are included in the Fennec APK.
main.included_projects += ['../' + resources.name]
omnijar = add_android_eclipse_library_project('FennecOmnijar')
omnijar.package_name = 'org.mozilla.fennec.omnijar'
omnijar.package_name = 'org.mozilla.gecko.omnijar'
# This is delicate. We write into OBJDIR, and write triggers a new build of the
# Fennec project, because the omni.ja timestamp is always updated. (The target
# is FORCE and the installer does not track dependencies.) However, Eclipse only
@ -693,20 +761,34 @@ main.included_projects += ['../' + omnijar.name]
if CONFIG['MOZ_CRASHREPORTER']:
crashreporter = add_android_eclipse_library_project('FennecResourcesCrashReporter')
crashreporter.package_name = 'org.mozilla.fennec.resources.crashreporter'
crashreporter.package_name = 'org.mozilla.gecko.crashreporter'
crashreporter.res = SRCDIR + '/crashreporter/res'
crashreporter.included_projects += ['../' + resources.name]
crashreporter.recursive_make_targets += generated_recursive_make_targets
main.included_projects += ['../' + crashreporter.name]
# layout/crash_reporter.xml references strings and other resources, and
# therefore depends on other resource projects.
crashreporter.included_projects += ['../' + static.name, '../' + generated.name]
crashreporter.referenced_projects += ['../' + static.name, '../' + generated.name]
resources.included_projects += ['../' + crashreporter.name]
resources.referenced_projects += ['../' + crashreporter.name]
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
main.included_projects += ['../FennecStumbler']
main.referenced_projects += ['../FennecStumbler']
if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
searchactivity = add_android_eclipse_library_project('FennecResourcesSearch')
searchactivity.package_name = 'org.mozilla.fennec.resources.search'
searchactivity.res = SRCDIR + '/../search/res'
searchactivity.included_projects += ['../' + resources.name]
searchres = add_android_eclipse_library_project('FennecResourcesSearch')
# Eclipse generates org.mozilla.search.R for this project, which is
# referenced by the search/**/*.java code.
searchres.package_name = 'org.mozilla.search'
searchres.res = SRCDIR + '/../search/res'
main.included_projects += ['../' + searchactivity.name]
searchres.included_projects += ['../' + static.name, '../' + generated.name, '../' + branding.name]
searchres.referenced_projects += ['../' + static.name, '../' + generated.name, '../' + branding.name]
resources.included_projects += ['../' + searchres.name]
resources.referenced_projects += ['../' + searchres.name]
# The Search Activity code is built as part of Fennec, so we follow suit in Eclipse.
main.add_classpathentry('search', TOPSRCDIR + '/mobile/android/search/java', dstdir='search')

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

@ -20,9 +20,7 @@
android:focusable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/doorhanger_text"
android:textColorLink="@color/doorhanger_link"/>
android:textAppearance="@style/TextAppearance.Widget.DoorHanger.Medium"/>
</LinearLayout>

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

@ -39,7 +39,6 @@
<dimen name="doorhanger_input_width">250dp</dimen>
<dimen name="doorhanger_spinner_textsize">9sp</dimen>
<dimen name="doorhanger_padding">15dp</dimen>
<dimen name="doorhanger_textsize_small">8sp</dimen>
<dimen name="flow_layout_spacing">6dp</dimen>
<dimen name="menu_item_icon">21dp</dimen>

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

@ -378,6 +378,16 @@
<item name="android:textColor">?android:attr/textColorHint</item>
</style>
<style name="TextAppearance.Widget.DoorHanger.Medium" parent="TextAppearance.Medium">
<item name="android:textColor">@color/doorhanger_text</item>
<item name="android:textColorLink">@color/doorhanger_link</item>
</style>
<style name="TextAppearance.Widget.DoorHanger.Small" parent="TextAppearance.Small">
<item name="android:textColor">@color/doorhanger_text</item>
<item name="android:textColorLink">@color/doorhanger_link</item>
</style>
<!-- BrowserToolbar -->
<style name="BrowserToolbar">
<item name="android:layout_width">match_parent</item>

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

@ -165,6 +165,7 @@ public class BrowserToolbar extends ThemedRelativeLayout
private static final int FORWARD_ANIMATION_DURATION = 450;
private final LightweightTheme theme;
private final ToolbarPrefs prefs;
public BrowserToolbar(Context context) {
this(context, null);
@ -280,6 +281,10 @@ public class BrowserToolbar extends ThemedRelativeLayout
updateTabCountAndAnimate(Tabs.getInstance().getDisplayCount());
}
};
prefs = new ToolbarPrefs();
urlDisplayLayout.setToolbarPrefs(prefs);
urlEditLayout.setToolbarPrefs(prefs);
}
public ArrayList<View> populateTabletViews() {
@ -314,6 +319,8 @@ public class BrowserToolbar extends ThemedRelativeLayout
public void onAttachedToWindow() {
super.onAttachedToWindow();
prefs.open();
setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
@ -464,6 +471,13 @@ public class BrowserToolbar extends ThemedRelativeLayout
}
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
prefs.close();
}
public void setProgressBar(ToolbarProgressView progressBar) {
this.progressBar = progressBar;
}

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

@ -97,7 +97,7 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
private ThemedTextView mTitle;
private int mTitlePadding;
private ToolbarTitlePrefs mTitlePrefs;
private ToolbarPrefs mPrefs;
private OnTitleChangeListener mTitleChangeListener;
private ImageButton mSiteSecurity;
@ -164,7 +164,6 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
@Override
public void onAttachedToWindow() {
mIsAttached = true;
mTitlePrefs = new ToolbarTitlePrefs();
Button.OnClickListener faviconListener = new Button.OnClickListener() {
@Override
@ -218,7 +217,6 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
@Override
public void onDetachedFromWindow() {
mIsAttached = false;
mTitlePrefs.close();
}
@Override
@ -257,6 +255,10 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
mPageActionLayout.setNextFocusDownId(nextId);
}
void setToolbarPrefs(final ToolbarPrefs prefs) {
mPrefs = prefs;
}
void updateFromTab(Tab tab, EnumSet<UpdateFlags> flags) {
// Several parts of ToolbarDisplayLayout's state depends
// on the views being attached to the view tree.
@ -321,13 +323,13 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
}
// If the pref to show the URL isn't set, just use the tab's display title.
if (!mTitlePrefs.shouldShowUrl() || url == null) {
if (!mPrefs.shouldShowUrl() || url == null) {
setTitle(tab.getDisplayTitle());
return;
}
CharSequence title = url;
if (mTitlePrefs.shouldTrimUrls()) {
if (mPrefs.shouldTrimUrls()) {
title = StringUtils.stripCommonSubdomains(StringUtils.stripScheme(url));
}

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

@ -70,6 +70,10 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
mEditText.setPrivateMode(isPrivate);
}
void setToolbarPrefs(final ToolbarPrefs prefs) {
mEditText.setToolbarPrefs(prefs);
}
private void showSoftInput() {
InputMethodManager imm =
(InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

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

@ -51,6 +51,8 @@ public class ToolbarEditText extends CustomEditText
private OnDismissListener mDismissListener;
private OnFilterListener mFilterListener;
private ToolbarPrefs mPrefs;
// The previous autocomplete result returned to us
private String mAutoCompleteResult = "";
// Length of the user-typed portion of the result
@ -116,6 +118,10 @@ public class ToolbarEditText extends CustomEditText
resetAutocompleteState();
}
void setToolbarPrefs(final ToolbarPrefs prefs) {
mPrefs = prefs;
}
/**
* Mark the start of autocomplete changes so our text change
* listener does not react to changes in autocomplete text
@ -462,7 +468,7 @@ public class ToolbarEditText extends CustomEditText
final String text = getNonAutocompleteText(editable);
final int textLength = text.length();
boolean doAutocomplete = true;
boolean doAutocomplete = mPrefs.shouldAutocomplete();
if (StringUtils.isSearchQuery(text, false)) {
doAutocomplete = false;

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

@ -0,0 +1,113 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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/. */
package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.util.ThreadUtils;
class ToolbarPrefs {
private static final String PREF_AUTOCOMPLETE_ENABLED = "browser.urlbar.autocomplete.enabled";
private static final String PREF_TITLEBAR_MODE = "browser.chrome.titlebarMode";
private static final String PREF_TRIM_URLS = "browser.urlbar.trimURLs";
private static final String[] PREFS = {
PREF_AUTOCOMPLETE_ENABLED,
PREF_TITLEBAR_MODE,
PREF_TRIM_URLS
};
private final TitlePrefsHandler HANDLER = new TitlePrefsHandler();
private volatile boolean enableAutocomplete;
private volatile boolean showUrl;
private volatile boolean trimUrls;
private Integer prefObserverId;
ToolbarPrefs() {
// Skip autocompletion while Gecko is loading.
// We will get the correct pref value once Gecko is loaded.
enableAutocomplete = false;
trimUrls = true;
}
boolean shouldAutocomplete() {
return enableAutocomplete;
}
boolean shouldShowUrl() {
return showUrl;
}
boolean shouldTrimUrls() {
return trimUrls;
}
void open() {
if (prefObserverId == null) {
prefObserverId = PrefsHelper.getPrefs(PREFS, HANDLER);
}
}
void close() {
if (prefObserverId != null) {
PrefsHelper.removeObserver(prefObserverId);
prefObserverId = null;
}
}
private void triggerTitleChangeListener() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
final Tabs tabs = Tabs.getInstance();
final Tab tab = tabs.getSelectedTab();
if (tab != null) {
tabs.notifyListeners(tab, Tabs.TabEvents.TITLE);
}
}
});
}
private class TitlePrefsHandler extends PrefsHelper.PrefHandlerBase {
@Override
public void prefValue(String pref, String str) {
if (PREF_TITLEBAR_MODE.equals(pref)) {
// Handles PREF_TITLEBAR_MODE, which is always a string.
int value = Integer.parseInt(str);
boolean shouldShowUrl = (value == 1);
if (shouldShowUrl != showUrl) {
showUrl = shouldShowUrl;
triggerTitleChangeListener();
}
}
}
@Override
public void prefValue(String pref, boolean value) {
if (PREF_AUTOCOMPLETE_ENABLED.equals(pref)) {
enableAutocomplete = value;
} else if (PREF_TRIM_URLS.equals(pref)) {
// Handles PREF_TRIM_URLS, which should usually be a boolean.
if (value != trimUrls) {
trimUrls = value;
triggerTitleChangeListener();
}
}
}
@Override
public boolean isObserver() {
// We want to be notified of changes to be able to switch mode
// without restarting.
return true;
}
}
}

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

@ -1,98 +0,0 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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/. */
package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.util.ThreadUtils;
class ToolbarTitlePrefs {
static final String PREF_TITLEBAR_MODE = "browser.chrome.titlebarMode";
static final String PREF_TRIM_URLS = "browser.urlbar.trimURLs";
interface OnChangeListener {
public void onChange();
}
final String[] prefs = {
PREF_TITLEBAR_MODE,
PREF_TRIM_URLS
};
private boolean mShowUrl;
private boolean mTrimUrls;
private Integer mPrefObserverId;
ToolbarTitlePrefs() {
mTrimUrls = true;
mPrefObserverId = PrefsHelper.getPrefs(prefs, new TitlePrefsHandler());
}
boolean shouldShowUrl() {
return mShowUrl;
}
boolean shouldTrimUrls() {
return mTrimUrls;
}
void close() {
if (mPrefObserverId != null) {
PrefsHelper.removeObserver(mPrefObserverId);
mPrefObserverId = null;
}
}
private class TitlePrefsHandler extends PrefsHelper.PrefHandlerBase {
@Override
public void prefValue(String pref, String str) {
// Handles PREF_TITLEBAR_MODE, which is always a string.
int value = Integer.parseInt(str);
boolean shouldShowUrl = (value == 1);
if (shouldShowUrl == mShowUrl) {
return;
}
mShowUrl = shouldShowUrl;
triggerChangeListener();
}
@Override
public void prefValue(String pref, boolean value) {
// Handles PREF_TRIM_URLS, which should usually be a boolean.
if (value == mTrimUrls) {
return;
}
mTrimUrls = value;
triggerChangeListener();
}
@Override
public boolean isObserver() {
// We want to be notified of changes to be able to switch mode
// without restarting.
return true;
}
private void triggerChangeListener() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
final Tabs tabs = Tabs.getInstance();
final Tab tab = tabs.getSelectedTab();
if (tab != null) {
tabs.notifyListeners(tab, Tabs.TabEvents.TITLE);
}
}
});
}
}
}

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

@ -208,7 +208,6 @@ public class UpdateService extends IntentService {
Log.i(LOGTAG, "update available, buildID = " + info.buildID);
int connectionType = netInfo.getType();
int autoDownloadPolicy = getAutoDownloadPolicy();
@ -217,12 +216,11 @@ public class UpdateService extends IntentService {
*
* - We have a FORCE_DOWNLOAD flag passed in
* - The preference is set to 'always'
* - The preference is set to 'wifi' and we are actually using wifi (or regular ethernet)
* - The preference is set to 'wifi' and we are using a non-metered network (i.e. the user is OK with large data transfers occuring)
*/
boolean shouldStartDownload = hasFlag(flags, UpdateServiceHelper.FLAG_FORCE_DOWNLOAD) ||
autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_ENABLED ||
(autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_WIFI &&
(connectionType == ConnectivityManager.TYPE_WIFI || connectionType == ConnectivityManager.TYPE_ETHERNET));
(autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_WIFI && !mConnectivityManager.isActiveNetworkMetered());
if (!shouldStartDownload) {
Log.i(LOGTAG, "not initiating automatic update download due to policy " + autoDownloadPolicy);

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

@ -128,7 +128,7 @@ public class DoorHanger extends LinearLayout {
// Set a dark background, and use a smaller text size for dark-themed DoorHangers.
setBackgroundColor(mResources.getColor(R.color.doorhanger_background_dark));
mTextView.setTextSize(mResources.getDimension(R.dimen.doorhanger_textsize_small));
mTextView.setTextAppearance(getContext(), R.style.TextAppearance_Widget_DoorHanger_Small);
}
}

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

@ -4,6 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
"resource://gre/modules/PageActions.jsm");
// Define service targets. We should consider moving these to their respective
// JSM files, but we left them here to allow for better lazy JSM loading.
var rokuTarget = {
@ -404,7 +407,7 @@ var CastingApps = {
// Remove any exising pageaction first, in case state changes or we don't have
// a castable video
if (this.pageAction.id) {
NativeWindow.pageactions.remove(this.pageAction.id);
PageActions.remove(this.pageAction.id);
delete this.pageAction.id;
}
@ -425,14 +428,14 @@ var CastingApps = {
// 2. The video is allowed to be cast and is currently playing
// Both states have the same action: Show the cast page action
if (aVideo.mozIsCasting) {
this.pageAction.id = NativeWindow.pageactions.add({
this.pageAction.id = PageActions.add({
title: Strings.browser.GetStringFromName("contextmenu.castToScreen"),
icon: "drawable://casting_active",
clickCallback: this.pageAction.click,
important: true
});
} else if (aVideo.mozAllowCasting) {
this.pageAction.id = NativeWindow.pageactions.add({
this.pageAction.id = PageActions.add({
title: Strings.browser.GetStringFromName("contextmenu.castToScreen"),
icon: "drawable://casting",
clickCallback: this.pageAction.click,

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

@ -1609,12 +1609,16 @@ var BrowserApp = {
// perform a keyword search on the selected tab.
this.selectedTab.userSearch = aData;
// Don't store queries in private browsing mode.
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.selectedTab.browser.contentWindow);
let query = isPrivate ? "" : aData;
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
sendMessageToJava({
type: "Search:Keyword",
identifier: engine.identifier,
name: engine.name,
query: aData
query: query
});
break;
@ -1839,8 +1843,6 @@ var BrowserApp = {
var NativeWindow = {
init: function() {
Services.obs.addObserver(this, "Menu:Clicked", false);
Services.obs.addObserver(this, "PageActions:Clicked", false);
Services.obs.addObserver(this, "PageActions:LongClicked", false);
Services.obs.addObserver(this, "Doorhanger:Reply", false);
Services.obs.addObserver(this, "Toast:Click", false);
Services.obs.addObserver(this, "Toast:Hidden", false);
@ -1849,8 +1851,6 @@ var NativeWindow = {
uninit: function() {
Services.obs.removeObserver(this, "Menu:Clicked");
Services.obs.removeObserver(this, "PageActions:Clicked");
Services.obs.removeObserver(this, "PageActions:LongClicked");
Services.obs.removeObserver(this, "Doorhanger:Reply");
Services.obs.removeObserver(this, "Toast:Click", false);
Services.obs.removeObserver(this, "Toast:Hidden", false);
@ -1904,32 +1904,6 @@ var NativeWindow = {
}
},
pageactions: {
_items: { },
add: function(aOptions) {
let id = uuidgen.generateUUID().toString();
sendMessageToJava({
type: "PageActions:Add",
id: id,
title: aOptions.title,
icon: resolveGeckoURI(aOptions.icon),
important: "important" in aOptions ? aOptions.important : false
});
this._items[id] = {
clickCallback: aOptions.clickCallback,
longClickCallback: aOptions.longClickCallback
};
return id;
},
remove: function(id) {
sendMessageToJava({
type: "PageActions:Remove",
id: id
});
delete this._items[id];
}
},
menu: {
_callbacks: [],
_menuId: 1,
@ -2031,12 +2005,6 @@ var NativeWindow = {
if (aTopic == "Menu:Clicked") {
if (this.menu._callbacks[aData])
this.menu._callbacks[aData]();
} else if (aTopic == "PageActions:Clicked") {
if (this.pageactions._items[aData].clickCallback)
this.pageactions._items[aData].clickCallback();
} else if (aTopic == "PageActions:LongClicked") {
if (this.pageactions._items[aData].longClickCallback)
this.pageactions._items[aData].longClickCallback();
} else if (aTopic == "Toast:Click") {
if (this.toast._callbacks[aData]) {
this.toast._callbacks[aData]();
@ -2744,6 +2712,25 @@ var NativeWindow = {
}
};
XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
"resource://gre/modules/PageActions.jsm");
// These alias to the old, deprecated NativeWindow interfaces
[
["pageactions", "resource://gre/modules/PageActions.jsm", "PageActions"]
].forEach(item => {
let [name, script, exprt] = item;
XPCOMUtils.defineLazyGetter(NativeWindow, name, () => {
var err = Strings.browser.formatStringFromName("nativeWindow.deprecated", ["NativeWindow." + name, script], 2);
Cu.reportError(err);
let sandbox = {};
Services.scriptloader.loadSubScript(script, sandbox);
return sandbox[exprt];
});
});
var LightWeightThemeWebInstaller = {
init: function sh_init() {
let temp = {};
@ -7401,12 +7388,12 @@ let Reader = {
updatePageAction: function(tab) {
if (this.pageAction.id) {
NativeWindow.pageactions.remove(this.pageAction.id);
PageActions.remove(this.pageAction.id);
delete this.pageAction.id;
}
if (tab.readerActive) {
this.pageAction.id = NativeWindow.pageactions.add({
this.pageAction.id = PageActions.add({
title: Strings.browser.GetStringFromName("readerMode.exit"),
icon: "drawable://reader_active",
clickCallback: this.pageAction.readerModeCallback,
@ -7423,7 +7410,7 @@ let Reader = {
UITelemetry.stopSession("reader.1", "", null);
if (tab.readerEnabled) {
this.pageAction.id = NativeWindow.pageactions.add({
this.pageAction.id = PageActions.add({
title: Strings.browser.GetStringFromName("readerMode.enter"),
icon: "drawable://reader",
clickCallback:this.pageAction.readerModeCallback,
@ -7993,7 +7980,7 @@ var ExternalApps = {
if (this._pageActionId != undefined)
return;
this._pageActionId = NativeWindow.pageactions.add({
this._pageActionId = PageActions.add({
title: Strings.browser.GetStringFromName("openInApp.pageAction"),
icon: "drawable://icon_openinapp",
@ -8025,7 +8012,7 @@ var ExternalApps = {
if(!this._pageActionId)
return;
NativeWindow.pageactions.remove(this._pageActionId);
PageActions.remove(this._pageActionId);
delete this._pageActionId;
},
};

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

@ -18,7 +18,7 @@ MOZ_ANDROID_MIN_SDK_VERSION=9
MOZ_SAFE_BROWSING=1
MOZ_DISABLE_CRYPTOLEGACY=1
MOZ_NO_SMART_CARDS=1
# Enable getUserMedia
MOZ_MEDIA_NAVIGATOR=1

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

@ -375,3 +375,9 @@ browser.menu.context.mailto = Mail
# "Subscribe to page" prompts created in FeedHandler.js
feedHandler.chooseFeed=Choose feed
feedHandler.subscribeWith=Subscribe with
# LOCALIZATION NOTE (nativeWindow.deprecated):
# This string is shown in the console when someone uses deprecated NativeWindow apis.
# %1$S=name of the api that's deprecated, %2$S=New API to use. This may be a url to
# a file they should import or the name of an api.
nativeWindow.deprecated=%S is deprecated. Please use %S instead

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше