mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c. a=merge
This commit is contained in:
commit
4892c12aa0
@ -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,8 +279,10 @@ 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) {
|
||||
this.contentControl.autoMove(acc);
|
||||
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
|
||||
|
@ -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
vendored
2
config/external/nss/crmf/moz.build
vendored
@ -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
|
||||
|
22
configure.in
22
configure.in
@ -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 = 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");
|
||||
ownerDoc->DisallowBFCaching();
|
||||
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;
|
||||
};
|
294
dom/ipc/ContentParent.cpp
Normal file → Executable file
294
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(manifestURL);
|
||||
if (aTookPreAllocated) {
|
||||
*aTookPreAllocated = true;
|
||||
}
|
||||
return process.forget();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
return nullptr;
|
||||
// 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;
|
||||
}
|
||||
process->TransformPreallocatedIntoApp(aAppManifestURL);
|
||||
|
||||
return process.forget();
|
||||
}
|
||||
@ -693,9 +719,9 @@ ContentParent::JoinAllSubprocesses()
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<ContentParent>
|
||||
ContentParent::GetNewOrUsed(bool aForBrowserElement,
|
||||
ProcessPriority aPriority,
|
||||
ContentParent* aOpener)
|
||||
ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||
ProcessPriority aPriority,
|
||||
ContentParent* aOpener)
|
||||
{
|
||||
if (!sNonAppContentParents)
|
||||
sNonAppContentParents = new nsTArray<ContentParent*>();
|
||||
@ -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;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIApplication> ownApp = tc.GetTabContext().GetOwnApp();
|
||||
if (ownApp) {
|
||||
cp = GetNewOrPreallocatedAppProcess(ownApp,
|
||||
aPriority,
|
||||
this);
|
||||
}
|
||||
else {
|
||||
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
|
||||
aPriority,
|
||||
this);
|
||||
}
|
||||
|
||||
if (!cp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRefPtr<ContentParent> cp = GetNewOrUsed(/* isBrowserElement = */ true,
|
||||
aPriority,
|
||||
this);
|
||||
*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,105 +959,115 @@ 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.
|
||||
nsCOMPtr<mozIApplication> ownApp = aContext.GetOwnApp();
|
||||
|
||||
if (!sAppContentParents) {
|
||||
sAppContentParents =
|
||||
new nsDataHashtable<nsStringHashKey, ContentParent*>();
|
||||
}
|
||||
|
||||
// Each app gets its own ContentParent instance unless it shares it with
|
||||
// a parent app.
|
||||
nsRefPtr<nsIContentParent> parent;
|
||||
bool reused = false;
|
||||
bool tookPreallocated = false;
|
||||
nsAutoString manifestURL;
|
||||
if (NS_FAILED(ownApp->GetManifestURL(manifestURL))) {
|
||||
NS_ERROR("Failed to get manifest URL");
|
||||
return nullptr;
|
||||
|
||||
if (isInContentProcess) {
|
||||
parent = CreateContentBridgeParent(aContext, initialPriority);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<mozIApplication> ownApp = aContext.GetOwnApp();
|
||||
|
||||
nsRefPtr<ContentParent> p = sAppContentParents->Get(manifestURL);
|
||||
if (!sAppContentParents) {
|
||||
sAppContentParents =
|
||||
new nsDataHashtable<nsStringHashKey, ContentParent*>();
|
||||
}
|
||||
|
||||
if (!p && Preferences::GetBool("dom.ipc.reuse_parent_app")) {
|
||||
nsAutoString parentAppManifestURL;
|
||||
aFrameElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::parentapp, parentAppManifestURL);
|
||||
nsAdoptingString systemAppManifestURL =
|
||||
Preferences::GetString("b2g.system_manifest_url");
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!parentAppManifestURL.IsEmpty() &&
|
||||
!parentAppManifestURL.Equals(systemAppManifestURL) &&
|
||||
appsService) {
|
||||
nsCOMPtr<mozIApplication> parentApp;
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
appsService->GetAppByManifestURL(parentAppManifestURL,
|
||||
getter_AddRefs(parentApp));
|
||||
appsService->GetAppByManifestURL(manifestURL,
|
||||
getter_AddRefs(app));
|
||||
// Each app gets its own ContentParent instance unless it shares it with
|
||||
// a parent app.
|
||||
if (NS_FAILED(ownApp->GetManifestURL(manifestURL))) {
|
||||
NS_ERROR("Failed to get manifest URL");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Only let certified apps re-use the same process.
|
||||
unsigned short parentAppStatus = 0;
|
||||
unsigned short appStatus = 0;
|
||||
if (app &&
|
||||
NS_SUCCEEDED(app->GetAppStatus(&appStatus)) &&
|
||||
appStatus == nsIPrincipal::APP_STATUS_CERTIFIED &&
|
||||
parentApp &&
|
||||
NS_SUCCEEDED(parentApp->GetAppStatus(&parentAppStatus)) &&
|
||||
parentAppStatus == nsIPrincipal::APP_STATUS_CERTIFIED) {
|
||||
// Check if we can re-use the process of the parent app.
|
||||
p = sAppContentParents->Get(parentAppManifestURL);
|
||||
nsRefPtr<ContentParent> p = sAppContentParents->Get(manifestURL);
|
||||
|
||||
if (!p && Preferences::GetBool("dom.ipc.reuse_parent_app")) {
|
||||
nsAutoString parentAppManifestURL;
|
||||
aFrameElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::parentapp, parentAppManifestURL);
|
||||
nsAdoptingString systemAppManifestURL =
|
||||
Preferences::GetString("b2g.system_manifest_url");
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!parentAppManifestURL.IsEmpty() &&
|
||||
!parentAppManifestURL.Equals(systemAppManifestURL) &&
|
||||
appsService) {
|
||||
nsCOMPtr<mozIApplication> parentApp;
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
appsService->GetAppByManifestURL(parentAppManifestURL,
|
||||
getter_AddRefs(parentApp));
|
||||
appsService->GetAppByManifestURL(manifestURL,
|
||||
getter_AddRefs(app));
|
||||
|
||||
// Only let certified apps re-use the same process.
|
||||
unsigned short parentAppStatus = 0;
|
||||
unsigned short appStatus = 0;
|
||||
if (app &&
|
||||
NS_SUCCEEDED(app->GetAppStatus(&appStatus)) &&
|
||||
appStatus == nsIPrincipal::APP_STATUS_CERTIFIED &&
|
||||
parentApp &&
|
||||
NS_SUCCEEDED(parentApp->GetAppStatus(&parentAppStatus)) &&
|
||||
parentAppStatus == nsIPrincipal::APP_STATUS_CERTIFIED) {
|
||||
// Check if we can re-use the process of the parent app.
|
||||
p = sAppContentParents->Get(parentAppManifestURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p) {
|
||||
// Check that the process is still alive and set its priority.
|
||||
// Hopefully the process won't die after this point, if this call
|
||||
// succeeds.
|
||||
if (!p->SetPriorityAndCheckIsAlive(initialPriority)) {
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
reused = !!p;
|
||||
if (!p) {
|
||||
p = GetNewOrPreallocatedAppProcess(ownApp,
|
||||
initialPriority,
|
||||
nullptr,
|
||||
&tookPreallocated);
|
||||
MOZ_ASSERT(p);
|
||||
sAppContentParents->Put(manifestURL, p);
|
||||
}
|
||||
parent = static_cast<nsIContentParent*>(p);
|
||||
}
|
||||
|
||||
if (p) {
|
||||
// Check that the process is still alive and set its priority.
|
||||
// Hopefully the process won't die after this point, if this call
|
||||
// succeeds.
|
||||
if (!p->SetPriorityAndCheckIsAlive(initialPriority)) {
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool reused = !!p;
|
||||
bool tookPreallocated = false;
|
||||
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();
|
||||
}
|
||||
sAppContentParents->Put(manifestURL, 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,11 +97,17 @@ 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,
|
||||
hal::ProcessPriority aPriority =
|
||||
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
|
||||
ContentParent* aOpener = nullptr);
|
||||
GetNewOrUsedBrowserProcess(bool aForBrowserElement = false,
|
||||
hal::ProcessPriority aPriority =
|
||||
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
|
||||
ContentParent* aOpener = nullptr);
|
||||
|
||||
/**
|
||||
* Create a subprocess suitable for use as a preallocated app process.
|
||||
@ -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]
|
||||
|
61
extensions/cookie/test/test_bug1041808.html
Normal file
61
extensions/cookie/test/test_bug1041808.html
Normal file
@ -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]))
|
||||
return ErrorBadArgs(cx);
|
||||
|
||||
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;
|
||||
CoercionElem *val = TypedObjectMemory<CoercionElem *>(args[0]);
|
||||
for (unsigned i = 0; i < Coercion::lanes; i++)
|
||||
result[i] = Op<CoercionElem>::apply(val[i]);
|
||||
return StoreResult<Out>(cx, args, (RetElem*) result);
|
||||
}
|
||||
|
||||
// Same as above, with Coercion == Out
|
||||
// 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]);
|
||||
return StoreResult<Out>(cx, args, (RetElem *) result);
|
||||
}
|
||||
|
||||
// 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,41 +872,36 @@ 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) \
|
||||
bool \
|
||||
js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
||||
{ \
|
||||
return Func(cx, argc, vp); \
|
||||
#define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags) \
|
||||
bool \
|
||||
js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
||||
{ \
|
||||
return Func(cx, argc, vp); \
|
||||
}
|
||||
FLOAT32X4_FUNCTION_LIST(DEFINE_SIMD_FLOAT32X4_FUNCTION)
|
||||
#undef DEFINE_SIMD_FLOAT32x4_FUNCTION
|
||||
|
||||
#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
|
||||
bool \
|
||||
js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
||||
{ \
|
||||
return Func(cx, argc, vp); \
|
||||
#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags) \
|
||||
bool \
|
||||
js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \
|
||||
{ \
|
||||
return Func(cx, argc, vp); \
|
||||
}
|
||||
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
|
||||
|
@ -18,98 +18,98 @@
|
||||
* https://github.com/johnmccutchan/ecmascript_simd/blob/master/src/ecmascript_simd.js
|
||||
*/
|
||||
|
||||
#define FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
V(zero, (FuncZero<Float32x4>), 0, 0, Zero)
|
||||
#define FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define FLOAT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define FLOAT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(clamp, Float32x4Clamp, 3, 0) \
|
||||
V(shuffleMix, FuncShuffle<Float32x4>, 3, 0)
|
||||
|
||||
#define FLOAT32X4_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
#define FLOAT32X4_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
FLOAT32X4_TERNARY_FUNCTION_LIST(V)
|
||||
|
||||
#define INT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
V(zero, (FuncZero<Int32x4>), 0, 0, Zero)
|
||||
#define INT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define INT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define INT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
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)
|
||||
#define INT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(select, Int32x4Select, 3, 0) \
|
||||
V(shuffleMix, FuncShuffle<Int32x4>, 3, 0)
|
||||
|
||||
#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \
|
||||
V(bool, Int32x4Bool, 4, 0, Bool)
|
||||
#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \
|
||||
V(bool, Int32x4Bool, 4, 0)
|
||||
|
||||
#define INT32X4_FUNCTION_LIST(V) \
|
||||
INT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
INT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
INT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
INT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
#define INT32X4_FUNCTION_LIST(V) \
|
||||
INT32X4_NULLARY_FUNCTION_LIST(V) \
|
||||
INT32X4_UNARY_FUNCTION_LIST(V) \
|
||||
INT32X4_BINARY_FUNCTION_LIST(V) \
|
||||
INT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
INT32X4_QUARTERNARY_FUNCTION_LIST(V)
|
||||
|
||||
namespace js {
|
||||
@ -166,14 +166,14 @@ struct Int32x4 {
|
||||
template<typename V>
|
||||
JSObject *CreateSimd(JSContext *cx, typename V::Elem *data);
|
||||
|
||||
#define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \
|
||||
extern bool \
|
||||
#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) \
|
||||
extern bool \
|
||||
#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)
|
||||
#undef 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) {
|
||||
tokenStream = val;
|
||||
++matchingTokenStreamCount;
|
||||
} 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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -574,16 +574,18 @@ pref("accessibility.browsewithcaret_shortcut.enabled", true);
|
||||
// unless accessibility.tabfocus is set by the user.
|
||||
pref("accessibility.tabfocus", 7);
|
||||
pref("accessibility.tabfocus_applies_to_xul", false);
|
||||
|
||||
// On OS X, we follow the "Click in the scrollbar to:" system preference
|
||||
// unless this preference was set manually
|
||||
pref("ui.scrollToClick", 0);
|
||||
|
||||
#else
|
||||
// Only on mac tabfocus is expected to handle UI widgets as well as web content
|
||||
pref("accessibility.tabfocus_applies_to_xul", true);
|
||||
#endif
|
||||
|
||||
// We follow the "Click in the scrollbar to:" system preference on OS X and
|
||||
// "gtk-primary-button-warps-slider" property with GTK (since 2.24 / 3.6),
|
||||
// unless this preference is explicitly set.
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GTK)
|
||||
pref("ui.scrollToClick", 0);
|
||||
#endif
|
||||
|
||||
// provide ability to turn on support for canvas focus rings
|
||||
pref("canvas.focusring.enabled", true);
|
||||
pref("canvas.customfocusring.enabled", false);
|
||||
|
@ -611,6 +611,12 @@ class CCacheStats(object):
|
||||
|
||||
return '\n'.join(lines)
|
||||
|
||||
def __nonzero__(self):
|
||||
relative_values = [v for k, v in self._values.items()
|
||||
if k not in self.ABSOLUTE_KEYS]
|
||||
return (all(v >= 0 for v in relative_values) and
|
||||
any(v > 0 for v in relative_values))
|
||||
|
||||
@staticmethod
|
||||
def _format_value(v):
|
||||
if v > CCacheStats.GiB:
|
||||
|
@ -397,8 +397,9 @@ class Build(MachCommandBase):
|
||||
|
||||
if ccache_start and ccache_end:
|
||||
ccache_diff = ccache_end - ccache_start
|
||||
self.log(logging.INFO, 'ccache',
|
||||
{'msg': ccache_diff.hit_rate_message()}, "{msg}")
|
||||
if ccache_diff:
|
||||
self.log(logging.INFO, 'ccache',
|
||||
{'msg': ccache_diff.hit_rate_message()}, "{msg}")
|
||||
|
||||
if monitor.elapsed > 300:
|
||||
# Display a notification when the build completes.
|
||||
|
@ -73,6 +73,21 @@ class TestCcacheStats(unittest.TestCase):
|
||||
stats_diff = stats2 - stats1
|
||||
self.assertEqual(stats_diff.hit_rates(), (0.9, 0.05, 0.05))
|
||||
|
||||
def test_stats_contains_data(self):
|
||||
stats0 = CCacheStats(self.STAT0)
|
||||
stats1 = CCacheStats(self.STAT1)
|
||||
stats2 = CCacheStats(self.STAT2)
|
||||
stats_diff_zero = stats1 - stats1
|
||||
stats_diff_negative1 = stats0 - stats1
|
||||
stats_diff_negative2 = stats1 - stats2
|
||||
|
||||
self.assertFalse(stats0)
|
||||
self.assertTrue(stats1)
|
||||
self.assertTrue(stats2)
|
||||
self.assertFalse(stats_diff_zero)
|
||||
self.assertFalse(stats_diff_negative1)
|
||||
self.assertFalse(stats_diff_negative2)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -370,6 +370,13 @@ class TestStrictOrderingOnAppendListWithFlagsFactory(unittest.TestCase):
|
||||
with self.assertRaises(AttributeError):
|
||||
l['b'].baz = False
|
||||
|
||||
l['b'].update(foo=False, bar=12)
|
||||
self.assertEqual(l['b'].foo, False)
|
||||
self.assertEqual(l['b'].bar, 12)
|
||||
|
||||
with self.assertRaises(AttributeError):
|
||||
l['b'].update(xyz=1)
|
||||
|
||||
|
||||
class TestHierarchicalStringListWithFlagsFactory(unittest.TestCase):
|
||||
def test_hierarchical_string_list_with_flags_factory(self):
|
||||
|
@ -375,6 +375,10 @@ def FlagsFactory(flags):
|
||||
__slots__ = flags.keys()
|
||||
_flags = flags
|
||||
|
||||
def update(self, **kwargs):
|
||||
for k, v in kwargs.iteritems():
|
||||
setattr(self, k, v)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name not in self.__slots__:
|
||||
raise AttributeError("'%s' object has no attribute '%s'" %
|
||||
|
@ -372,8 +372,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage,
|
||||
case certificateUsageVerifyCA:
|
||||
case certificateUsageStatusResponder: {
|
||||
// XXX This is a pretty useless way to verify a certificate. It is used
|
||||
// by the implementation of window.crypto.importCertificates and in the
|
||||
// certificate viewer UI. Because we don't know what trust bit is
|
||||
// by the certificate viewer UI. Because we don't know what trust bit is
|
||||
// interesting, we just try them all.
|
||||
mozilla::pkix::EndEntityOrCA endEntityOrCA;
|
||||
mozilla::pkix::KeyUsage keyUsage;
|
||||
|
@ -81,11 +81,6 @@
|
||||
<!ENTITY createCertInfo.msg1 "Key Generation in progress… This may take a few minutes….">
|
||||
<!ENTITY createCertInfo.msg2 "Please wait…">
|
||||
|
||||
<!-- Form Signing confirmation prompt -->
|
||||
<!ENTITY formSigning.title "Text Signing Request">
|
||||
<!ENTITY formSigning.cert "Signing Certificate">
|
||||
<!ENTITY formSigning.confirmPassword "To confirm you agree to sign this text message using your selected certificate, please confirm by entering the master password:">
|
||||
|
||||
<!-- Strings for protectedAuth dialog -->
|
||||
<!ENTITY protectedAuth.title "Protected Token Authentication">
|
||||
<!ENTITY protectedAuth.msg "Please authenticate to the token. Authentication method depends on the type of your token.">
|
||||
|
@ -133,9 +133,6 @@ importCACertsPrompt=Select File containing CA certificate(s) to import
|
||||
importServerCertPrompt=Select File containing Server certificate to import
|
||||
file_browse_Certificate_spec=Certificate Files
|
||||
|
||||
# Form Signing confirmation prompt
|
||||
formSigningIntro=The site '%S' has requested that you sign the following text message:
|
||||
|
||||
# Cert export
|
||||
SaveCertAs=Save Certificate To File
|
||||
CertFormatBase64=X.509 Certificate (PEM)
|
||||
|
@ -32,11 +32,22 @@ var emailTreeView;
|
||||
var userTreeView;
|
||||
var orphanTreeView;
|
||||
|
||||
var smartCardObserver = {
|
||||
observe: function() {
|
||||
onSmartCardChange();
|
||||
}
|
||||
};
|
||||
|
||||
function DeregisterSmartCardObservers()
|
||||
{
|
||||
Services.obs.removeObserver(smartCardObserver, "smartcard-insert");
|
||||
Services.obs.removeObserver(smartCardObserver, "smartcard-remove");
|
||||
}
|
||||
|
||||
function LoadCerts()
|
||||
{
|
||||
window.crypto.enableSmartCardEvents = true;
|
||||
document.addEventListener("smartcard-insert", onSmartCardChange, false);
|
||||
document.addEventListener("smartcard-remove", onSmartCardChange, false);
|
||||
Services.obs.addObserver(smartCardObserver, "smartcard-insert", false);
|
||||
Services.obs.addObserver(smartCardObserver, "smartcard-remove", false);
|
||||
|
||||
certdb = Components.classes[nsX509CertDB].getService(nsIX509CertDB);
|
||||
var certcache = Components.classes[nsNSSCertCache].createInstance(nsINSSCertCache);
|
||||
@ -613,4 +624,3 @@ function addException()
|
||||
orphanTreeView.loadCertsFromCache(certcache, nsIX509Cert.UNKNOWN_CERT);
|
||||
orphanTreeView.selection.clearSelection();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&certmgr.title;"
|
||||
onload="LoadCerts();"
|
||||
onunload="DeregisterSmartCardObservers();"
|
||||
buttons="accept"
|
||||
style="width: 48em; height: 32em;"
|
||||
persist="screenX screenY width height">
|
||||
|
@ -16,18 +16,31 @@ const nsDialogParamBlock = "@mozilla.org/embedcomp/dialogparam;1";
|
||||
const nsIPKCS11 = Components.interfaces.nsIPKCS11;
|
||||
const nsPKCS11ContractID = "@mozilla.org/security/pkcs11;1";
|
||||
|
||||
let { Services } = Components.utils.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
var bundle;
|
||||
var secmoddb;
|
||||
var skip_enable_buttons = false;
|
||||
|
||||
var smartCardObserver = {
|
||||
observe: function() {
|
||||
onSmartCardChange();
|
||||
}
|
||||
};
|
||||
|
||||
function DeregisterSmartCardObservers()
|
||||
{
|
||||
Services.obs.removeObserver(smartCardObserver, "smartcard-insert");
|
||||
Services.obs.removeObserver(smartCardObserver, "smartcard-remove");
|
||||
}
|
||||
|
||||
/* Do the initial load of all PKCS# modules and list them. */
|
||||
function LoadModules()
|
||||
{
|
||||
bundle = document.getElementById("pippki_bundle");
|
||||
secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
|
||||
window.crypto.enableSmartCardEvents = true;
|
||||
document.addEventListener("smartcard-insert", onSmartCardChange, false);
|
||||
document.addEventListener("smartcard-remove", onSmartCardChange, false);
|
||||
Services.obs.addObserver(smartCardObserver, "smartcard-insert", false);
|
||||
Services.obs.addObserver(smartCardObserver, "smartcard-remove", false);
|
||||
|
||||
RefreshDeviceList();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
style="&devmgr.style;"
|
||||
persist="screenX screenY width height"
|
||||
onload="LoadModules();"
|
||||
onunload="DeregisterSmartCardObservers();"
|
||||
buttons="accept">
|
||||
|
||||
<stringbundleset id="stringbundleset">
|
||||
|
@ -1,67 +0,0 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
|
||||
|
||||
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
|
||||
|
||||
var dialogParams;
|
||||
var itemCount = 0;
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
|
||||
|
||||
var hostname = dialogParams.GetString(0);
|
||||
var bundle = document.getElementById("pippki_bundle");
|
||||
var intro = bundle.getFormattedString("formSigningIntro", [hostname]);
|
||||
setText("sign.intro", intro);
|
||||
|
||||
document.getElementById("sign.text").value = dialogParams.GetString(1);
|
||||
|
||||
var selectElement = document.getElementById("nicknames");
|
||||
itemCount = dialogParams.GetInt(0);
|
||||
for (var index = 0; index < itemCount; ++index) {
|
||||
var menuItemNode = document.createElement("menuitem");
|
||||
var nick = dialogParams.GetString(2 + 2 * index);
|
||||
menuItemNode.setAttribute("value", index);
|
||||
menuItemNode.setAttribute("label", nick); // this is displayed
|
||||
selectElement.firstChild.appendChild(menuItemNode);
|
||||
if (index == 0) {
|
||||
selectElement.selectedItem = menuItemNode;
|
||||
}
|
||||
}
|
||||
setDetails();
|
||||
document.getElementById("pw").focus();
|
||||
}
|
||||
|
||||
function setDetails()
|
||||
{
|
||||
var index = parseInt(document.getElementById("nicknames").value);
|
||||
if (index == "NaN")
|
||||
return;
|
||||
|
||||
var details = dialogParams.GetString(2 + (2 * index + 1));
|
||||
document.getElementById("certdetails").value = details;
|
||||
}
|
||||
|
||||
function onCertSelected()
|
||||
{
|
||||
setDetails();
|
||||
}
|
||||
|
||||
function doOK()
|
||||
{
|
||||
dialogParams.SetInt(0, 1);
|
||||
var index = parseInt(document.getElementById("nicknames").value);
|
||||
dialogParams.SetInt(1, index);
|
||||
var password = document.getElementById("pw").value;
|
||||
dialogParams.SetString(0, password);
|
||||
return true;
|
||||
}
|
||||
|
||||
function doCancel()
|
||||
{
|
||||
dialogParams.SetInt(0, 0);
|
||||
return true;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % pippkiDTD SYSTEM "chrome://pippki/locale/pippki.dtd" >
|
||||
%pippkiDTD;
|
||||
]>
|
||||
|
||||
<dialog id="formsigning" title="&formSigning.title;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return doOK();"
|
||||
ondialogcancel="return doCancel();"
|
||||
onload="onLoad();">
|
||||
|
||||
<stringbundle id="pippki_bundle" src="chrome://pippki/locale/pippki.properties"/>
|
||||
|
||||
<script type="application/javascript" src="chrome://pippki/content/pippki.js"/>
|
||||
<script type="application/javascript" src="chrome://pippki/content/formsigning.js"/>
|
||||
|
||||
<description id="sign.intro" style="max-width: 50em;"/>
|
||||
<textbox readonly="true" id="sign.text" multiline="true"
|
||||
style="height: 10em;" wrap="off"/>
|
||||
<separator class="thin"/>
|
||||
<groupbox>
|
||||
<caption label="&formSigning.cert;"/>
|
||||
<broadcaster id="certSelected" oncommand="onCertSelected();"/>
|
||||
<menulist id="nicknames" observes="certSelected">
|
||||
<!-- The items in this menulist must never be sorted,
|
||||
but remain in the order filled by the application
|
||||
-->
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
<textbox readonly="true" id="certdetails" multiline="true"
|
||||
style="height: 10em;" wrap="off"/>
|
||||
<separator/>
|
||||
</groupbox>
|
||||
<separator class="thin"/>
|
||||
<description style="max-width: 30em;">&formSigning.confirmPassword;</description>
|
||||
<textbox id="pw" type="password"/>
|
||||
</dialog>
|
@ -47,5 +47,3 @@ pippki.jar:
|
||||
content/pippki/createCertInfo.js (content/createCertInfo.js)
|
||||
content/pippki/protectedAuth.xul (content/protectedAuth.xul)
|
||||
content/pippki/protectedAuth.js (content/protectedAuth.js)
|
||||
content/pippki/formsigning.xul (content/formsigning.xul)
|
||||
content/pippki/formsigning.js (content/formsigning.js)
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsASN1Tree.cpp',
|
||||
'nsFormSigningDialog.cpp',
|
||||
'nsNSSDialogHelper.cpp',
|
||||
'nsNSSDialogs.cpp',
|
||||
'nsPKIModule.cpp',
|
||||
|
@ -1,91 +0,0 @@
|
||||
/* 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 "nsFormSigningDialog.h"
|
||||
#include "nsNSSDialogHelper.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
nsFormSigningDialog::nsFormSigningDialog()
|
||||
{
|
||||
}
|
||||
|
||||
nsFormSigningDialog::~nsFormSigningDialog()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFormSigningDialog, nsIFormSigningDialog)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormSigningDialog::ConfirmSignText(nsIInterfaceRequestor *aContext,
|
||||
const nsAString &aHost,
|
||||
const nsAString &aSignText,
|
||||
const char16_t **aCertNickList,
|
||||
const char16_t **aCertDetailsList,
|
||||
uint32_t aCount, int32_t *aSelectedIndex,
|
||||
nsAString &aPassword, bool *aCanceled)
|
||||
{
|
||||
*aCanceled = true;
|
||||
|
||||
// Get the parent window for the dialog
|
||||
nsCOMPtr<nsIDOMWindow> parent = do_GetInterface(aContext);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDialogParamBlock> block =
|
||||
do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
block->SetNumberStrings(3 + aCount * 2);
|
||||
|
||||
rv = block->SetString(0, PromiseFlatString(aHost).get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = block->SetString(1, PromiseFlatString(aSignText).get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t i;
|
||||
for (i = 0; i < aCount; ++i) {
|
||||
rv = block->SetString(2 + 2 * i, aCertNickList[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = block->SetString(2 + (2 * i + 1), aCertDetailsList[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = block->SetInt(0, aCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsNSSDialogHelper::openDialog(parent,
|
||||
"chrome://pippki/content/formsigning.xul",
|
||||
block);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
int32_t status;
|
||||
rv = block->GetInt(0, &status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (status == 0) {
|
||||
*aCanceled = true;
|
||||
}
|
||||
else {
|
||||
*aCanceled = false;
|
||||
|
||||
rv = block->GetInt(1, aSelectedIndex);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString pw;
|
||||
rv = block->GetString(0, getter_Copies(pw));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aPassword = pw;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_NSFORMSIGNINGDIALOG_H__
|
||||
#define __NS_NSFORMSIGNINGDIALOG_H__
|
||||
|
||||
#include "nsIFormSigningDialog.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#define NS_FORMSIGNINGDIALOG_CID \
|
||||
{ 0xa4bd2161, 0x7892, 0x4389, \
|
||||
{ 0x8d, 0x5a, 0x31, 0x11, 0xa6, 0xd1, 0x7e, 0xc7 }}
|
||||
|
||||
class nsFormSigningDialog MOZ_FINAL : public nsIFormSigningDialog
|
||||
{
|
||||
private:
|
||||
~nsFormSigningDialog();
|
||||
public:
|
||||
nsFormSigningDialog();
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIFORMSIGNINGDIALOG
|
||||
};
|
||||
|
||||
#endif
|
@ -9,24 +9,20 @@
|
||||
#include "nsNSSDialogs.h"
|
||||
#include "nsPKIParamBlock.h"
|
||||
#include "nsASN1Tree.h"
|
||||
#include "nsFormSigningDialog.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNSSDialogs, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPKIParamBlock, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNSSASN1Tree)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormSigningDialog)
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_NSSDIALOGS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_NSSASN1OUTINER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PKIPARAMBLOCK_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FORMSIGNINGDIALOG_CID);
|
||||
|
||||
|
||||
static const mozilla::Module::CIDEntry kPKICIDs[] = {
|
||||
{ &kNS_NSSDIALOGS_CID, false, nullptr, nsNSSDialogsConstructor },
|
||||
{ &kNS_NSSASN1OUTINER_CID, false, nullptr, nsNSSASN1TreeConstructor },
|
||||
{ &kNS_PKIPARAMBLOCK_CID, false, nullptr, nsPKIParamBlockConstructor },
|
||||
{ &kNS_FORMSIGNINGDIALOG_CID, false, nullptr, nsFormSigningDialogConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
@ -40,7 +36,6 @@ static const mozilla::Module::ContractIDEntry kPKIContracts[] = {
|
||||
{ NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID },
|
||||
{ NS_ASN1TREE_CONTRACTID, &kNS_NSSASN1OUTINER_CID },
|
||||
{ NS_PKIPARAMBLOCK_CONTRACTID, &kNS_PKIPARAMBLOCK_CID },
|
||||
{ NS_FORMSIGNINGDIALOG_CONTRACTID, &kNS_FORMSIGNINGDIALOG_CID },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
<title>Testcase bug 327524 - Crash when using crypto.generateCRMFRequest(document.documentElement);</title>
|
||||
</head><body>
|
||||
This should not crash Mozilla
|
||||
<script>
|
||||
crypto.generateCRMFRequest(document.documentElement);
|
||||
</script>
|
||||
</body></html>
|
@ -1,2 +1 @@
|
||||
skip-if(browserIsRemote) asserts-if(browserIsRemote,0-1) load 327524-1.html # bug 582297, bug 918119
|
||||
asserts-if(browserIsRemote,1) load 398665-1.html # bug 582297
|
||||
|
@ -17,7 +17,6 @@ XPIDL_SOURCES += [
|
||||
'nsIClientAuthDialogs.idl',
|
||||
'nsIDataSignatureVerifier.idl',
|
||||
'nsIDOMCryptoDialogs.idl',
|
||||
'nsIFormSigningDialog.idl',
|
||||
'nsIGenKeypairInfoDlg.idl',
|
||||
'nsIIdentityInfo.idl',
|
||||
'nsIKeygenThread.idl',
|
||||
|
@ -1,39 +0,0 @@
|
||||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsIInterfaceRequestor;
|
||||
|
||||
/**
|
||||
* nsIFormSigningDialog
|
||||
* Provides UI for form signing.
|
||||
*/
|
||||
[scriptable, uuid(4fe04d6d-4b66-4023-a0bc-b43ce68b3e15)]
|
||||
interface nsIFormSigningDialog : nsISupports
|
||||
{
|
||||
/**
|
||||
* confirmSignText
|
||||
* UI shown when a web site calls crypto.signText,
|
||||
* asking the user to confirm the confirm the signing request.
|
||||
*
|
||||
* returns true if the user confirmed, false on cancel
|
||||
*/
|
||||
boolean confirmSignText(in nsIInterfaceRequestor ctxt,
|
||||
in AString host,
|
||||
in AString signText,
|
||||
[array, size_is(count)] in wstring certNickList,
|
||||
[array, size_is(count)] in wstring certDetailsList,
|
||||
in uint32_t count,
|
||||
out int32_t selectedIndex,
|
||||
out AString password);
|
||||
};
|
||||
|
||||
/**
|
||||
* NS_FORMSIGNINGDIALOG_CONTRACTID - contract id to obtain an instance
|
||||
* that implements nsIFormSigningDialog.
|
||||
*/
|
||||
%{C++
|
||||
#define NS_FORMSIGNINGDIALOG_CONTRACTID "@mozilla.org/nsFormSigningDialog;1"
|
||||
%}
|
@ -73,7 +73,7 @@ SOURCES += [
|
||||
'PSMContentListener.cpp',
|
||||
]
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
|
||||
if not CONFIG['MOZ_NO_SMART_CARDS']:
|
||||
SOURCES += [
|
||||
'nsSmartCardMonitor.cpp',
|
||||
]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,97 +6,6 @@
|
||||
#ifndef _nsCrypto_h_
|
||||
#define _nsCrypto_h_
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
||||
#include "Crypto.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMCryptoLegacy.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
#define NS_CRYPTO_CID \
|
||||
{0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
|
||||
#define PSM_VERSION_STRING "2.4"
|
||||
|
||||
class nsIPSMComponent;
|
||||
class nsIDOMScriptObjectFactory;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CRMFObject : public NonRefcountedDOMObject
|
||||
{
|
||||
public:
|
||||
CRMFObject();
|
||||
virtual ~CRMFObject();
|
||||
|
||||
nsresult SetCRMFRequest(char *inRequest);
|
||||
|
||||
JSObject* WrapObject(JSContext *aCx, bool* aTookOwnership);
|
||||
|
||||
void GetRequest(nsAString& aRequest);
|
||||
|
||||
private:
|
||||
nsString mBase64Request;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class nsCrypto: public mozilla::dom::Crypto
|
||||
{
|
||||
public:
|
||||
nsCrypto();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// If legacy DOM crypto is enabled this is the class that actually
|
||||
// implements the legacy methods.
|
||||
NS_DECL_NSIDOMCRYPTO
|
||||
|
||||
virtual bool EnableSmartCardEvents() MOZ_OVERRIDE;
|
||||
virtual void SetEnableSmartCardEvents(bool aEnable,
|
||||
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::dom::CRMFObject*
|
||||
GenerateCRMFRequest(JSContext* aContext,
|
||||
const nsCString& aReqDN,
|
||||
const nsCString& aRegToken,
|
||||
const nsCString& aAuthenticator,
|
||||
const nsCString& aEaCert,
|
||||
const nsCString& aJsCallback,
|
||||
const mozilla::dom::Sequence<JS::Value>& aArgs,
|
||||
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ImportUserCertificates(const nsAString& aNickname,
|
||||
const nsAString& aCmmfResponse,
|
||||
bool aDoForcedBackup,
|
||||
nsAString& aReturn,
|
||||
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
virtual void SignText(JSContext* aContext,
|
||||
const nsAString& aStringToSign,
|
||||
const nsAString& aCaOption,
|
||||
const mozilla::dom::Sequence<nsCString>& aArgs,
|
||||
nsAString& aReturn) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Logout(mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual ~nsCrypto();
|
||||
|
||||
private:
|
||||
static already_AddRefed<nsIPrincipal> GetScriptPrincipal(JSContext *cx);
|
||||
|
||||
bool mEnableSmartCardEvents;
|
||||
};
|
||||
#endif // MOZ_DISABLE_CRYPTOLEGACY
|
||||
|
||||
#include "nsIPKCS11.h"
|
||||
|
||||
#define NS_PKCS11_CID \
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "mozilla/PublicSSL.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
#include "nsSmartCardMonitor.h"
|
||||
#endif
|
||||
|
||||
@ -212,7 +212,7 @@ GetOCSPBehaviorFromPrefs(/*out*/ CertVerifier::ocsp_download_config* odc,
|
||||
nsNSSComponent::nsNSSComponent()
|
||||
:mutex("nsNSSComponent.mutex"),
|
||||
mNSSInitialized(false),
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
mThreadList(nullptr),
|
||||
#endif
|
||||
mCertVerificationThread(nullptr)
|
||||
@ -356,7 +356,7 @@ nsNSSComponent::GetNSSBundleString(const char* name, nsAString& outString)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
void
|
||||
nsNSSComponent::LaunchSmartCardThreads()
|
||||
{
|
||||
@ -412,7 +412,7 @@ nsNSSComponent::ShutdownSmartCardThreads()
|
||||
delete mThreadList;
|
||||
mThreadList = nullptr;
|
||||
}
|
||||
#endif // MOZ_DISABLE_CRYPTOLEGACY
|
||||
#endif // MOZ_NO_SMART_CARDS
|
||||
|
||||
void
|
||||
nsNSSComponent::LoadLoadableRoots()
|
||||
@ -1033,7 +1033,7 @@ nsNSSComponent::InitializeNSS()
|
||||
|
||||
mHttpForNSS.initTable();
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
LaunchSmartCardThreads();
|
||||
#endif
|
||||
|
||||
@ -1063,7 +1063,7 @@ nsNSSComponent::ShutdownNSS()
|
||||
PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("nsNSSComponent::ShutdownNSS cannot stop observing cipher suite change\n"));
|
||||
}
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
ShutdownSmartCardThreads();
|
||||
#endif
|
||||
SSL_ClearSessionCache();
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#endif
|
||||
#include "nsINSSErrorsService.h"
|
||||
#include "nsNSSCallbacks.h"
|
||||
#include "SharedCertVerifier.h"
|
||||
@ -87,7 +85,7 @@ class NS_NO_VTABLE nsINSSComponent : public nsISupports {
|
||||
|
||||
NS_IMETHOD LogoutAuthenticatedPK11() = 0;
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
NS_IMETHOD LaunchSmartCardThread(SECMODModule* module) = 0;
|
||||
|
||||
NS_IMETHOD ShutdownSmartCardThread(SECMODModule* module) = 0;
|
||||
@ -140,7 +138,7 @@ public:
|
||||
nsAString& outString);
|
||||
NS_IMETHOD LogoutAuthenticatedPK11();
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
NS_IMETHOD LaunchSmartCardThread(SECMODModule* module);
|
||||
NS_IMETHOD ShutdownSmartCardThread(SECMODModule* module);
|
||||
void LaunchSmartCardThreads();
|
||||
@ -187,7 +185,7 @@ private:
|
||||
bool mObserversRegistered;
|
||||
static int mInstanceCount;
|
||||
nsNSSShutDownList* mShutdownObjectList;
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
SmartCardThreadList* mThreadList;
|
||||
#endif
|
||||
bool mIsNetworkDown;
|
||||
|
@ -188,9 +188,6 @@ NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsNSSCertList)
|
||||
#ifdef MOZ_XUL
|
||||
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCertTree)
|
||||
#endif
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCrypto)
|
||||
#endif
|
||||
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPkcs11)
|
||||
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCertPicker)
|
||||
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nssEnsure, nsNTLMAuthModule, InitTest)
|
||||
@ -225,9 +222,6 @@ NS_DEFINE_NAMED_CID(NS_FORMPROCESSOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CERTTREE_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_PKCS11_CID);
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
NS_DEFINE_NAMED_CID(NS_CRYPTO_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_CRYPTO_HASH_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CRYPTO_HMAC_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CERT_PICKER_CID);
|
||||
@ -260,9 +254,6 @@ static const mozilla::Module::CIDEntry kNSSCIDs[] = {
|
||||
{ &kNS_CERTTREE_CID, false, nullptr, nsCertTreeConstructor },
|
||||
#endif
|
||||
{ &kNS_PKCS11_CID, false, nullptr, nsPkcs11Constructor },
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
{ &kNS_CRYPTO_CID, false, nullptr, nsCryptoConstructor },
|
||||
#endif
|
||||
{ &kNS_CRYPTO_HASH_CID, false, nullptr, nsCryptoHashConstructor },
|
||||
{ &kNS_CRYPTO_HMAC_CID, false, nullptr, nsCryptoHMACConstructor },
|
||||
{ &kNS_CERT_PICKER_CID, false, nullptr, nsCertPickerConstructor },
|
||||
@ -298,9 +289,6 @@ static const mozilla::Module::ContractIDEntry kNSSContracts[] = {
|
||||
{ NS_CERTTREE_CONTRACTID, &kNS_CERTTREE_CID },
|
||||
#endif
|
||||
{ NS_PKCS11_CONTRACTID, &kNS_PKCS11_CID },
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
{ NS_CRYPTO_CONTRACTID, &kNS_CRYPTO_CID },
|
||||
#endif
|
||||
{ NS_CRYPTO_HASH_CONTRACTID, &kNS_CRYPTO_HASH_CID },
|
||||
{ NS_CRYPTO_HMAC_CONTRACTID, &kNS_CRYPTO_HMAC_CID },
|
||||
{ NS_CERT_PICKER_CONTRACTID, &kNS_CERT_PICKER_CID },
|
||||
|
@ -3,22 +3,15 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nspr.h"
|
||||
|
||||
#include "mozilla/dom/SmartCardEvent.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsIDOMCryptoLegacy.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsSmartCardMonitor.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "pk11func.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//
|
||||
// The SmartCard monitoring thread should start up for each module we load
|
||||
@ -50,7 +43,6 @@ public:
|
||||
|
||||
private:
|
||||
virtual ~nsTokenEventRunnable() {}
|
||||
nsresult DispatchEventToWindow(nsIDOMWindow* domWin);
|
||||
|
||||
nsString mType;
|
||||
nsString mTokenName;
|
||||
@ -71,121 +63,8 @@ nsTokenEventRunnable::Run()
|
||||
// This conversion is safe because mType can only be "smartcard-insert"
|
||||
// or "smartcard-remove".
|
||||
NS_ConvertUTF16toUTF8 eventTypeUTF8(mType);
|
||||
nsresult rv = observerService->NotifyObservers(nullptr, eventTypeUTF8.get(),
|
||||
mTokenName.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// 'Dispatch' the event to all the windows. 'DispatchEventToWindow()' will
|
||||
// first check to see if a given window has requested crypto events.
|
||||
nsCOMPtr<nsIWindowWatcher> windowWatcher =
|
||||
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = windowWatcher->GetWindowEnumerator(getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
bool hasMoreWindows;
|
||||
rv = enumerator->HasMoreElements(&hasMoreWindows);
|
||||
if (NS_FAILED(rv) || !hasMoreWindows) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
enumerator->GetNext(getter_AddRefs(supports));
|
||||
nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(supports));
|
||||
if (domWin) {
|
||||
rv = DispatchEventToWindow(domWin);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTokenEventRunnable::DispatchEventToWindow(nsIDOMWindow* domWin)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(domWin);
|
||||
|
||||
// first walk the children and dispatch their events
|
||||
nsCOMPtr<nsIDOMWindowCollection> frames;
|
||||
nsresult rv = domWin->GetFrames(getter_AddRefs(frames));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint32_t length;
|
||||
rv = frames->GetLength(&length);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMWindow> childWin;
|
||||
rv = frames->Item(i, getter_AddRefs(childWin));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (domWin) {
|
||||
rv = DispatchEventToWindow(childWin);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if we've enabled smart card events on this window
|
||||
// NOTE: it's not an error to say that we aren't going to dispatch
|
||||
// the event.
|
||||
nsCOMPtr<nsIDOMCrypto> crypto;
|
||||
rv = domWin->GetCrypto(getter_AddRefs(crypto));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (!crypto) {
|
||||
return NS_OK; // nope, it doesn't have a crypto property
|
||||
}
|
||||
|
||||
bool boolrv;
|
||||
rv = crypto->GetEnableSmartCardEvents(&boolrv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (!boolrv) {
|
||||
return NS_OK; // nope, it's not enabled.
|
||||
}
|
||||
|
||||
// dispatch the event ...
|
||||
|
||||
// find the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
rv = domWin->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (!doc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<EventTarget> d = do_QueryInterface(doc);
|
||||
|
||||
SmartCardEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = true;
|
||||
init.mTokenName = mTokenName;
|
||||
|
||||
nsRefPtr<SmartCardEvent> event(SmartCardEvent::Constructor(d, mType, init));
|
||||
event->SetTrusted(true);
|
||||
|
||||
return d->DispatchEvent(event, &boolrv);
|
||||
return observerService->NotifyObservers(nullptr, eventTypeUTF8.get(),
|
||||
mTokenName.get());
|
||||
}
|
||||
|
||||
// self linking and removing double linked entry
|
||||
|
@ -1,2 +0,0 @@
|
||||
[test_generateCRMFRequest.html]
|
||||
skip-if = e10s
|
@ -5,10 +5,5 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
||||
# test_generateCRMFRequest.html tests crypto.generateCRMFRequest, which isn't
|
||||
# available if legacy crypto has been disabled.
|
||||
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
|
||||
MOCHITEST_MANIFESTS += ['mochitest-legacy.ini']
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
|
||||
|
||||
|
@ -1,146 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>crypto.generateCRMFRequest bugs</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="onWindowLoad()">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function onWindowLoad() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.unsafe_legacy_crypto.enabled", true]]},
|
||||
runTest);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
// Does it work at all?
|
||||
try {
|
||||
var crmfObject = crypto.generateCRMFRequest("CN=undefined", "regToken",
|
||||
"authenticator", null, "",
|
||||
512, null, " rsa-ex ",
|
||||
1024, null, "\r\n\t rsa-sign\t");
|
||||
ok(true, "no exception thrown in generateCRMFRequest");
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception: " + e);
|
||||
}
|
||||
|
||||
// bug 849553
|
||||
// This should fail because 8 is too small of a key size.
|
||||
try {
|
||||
var crmfObject = crypto.generateCRMFRequest("CN=undefined", "regToken",
|
||||
"authenticator", null, "",
|
||||
8, null, "rsa-ex",
|
||||
1024, null, "rsa-sign");
|
||||
ok(false, "execution should not reach this line");
|
||||
} catch (e) {
|
||||
is(e.toString(), "Error: error:could not generate the key for algorithm rsa-ex", "expected exception");
|
||||
}
|
||||
// This should fail because 65536 is too large of a key size.
|
||||
try {
|
||||
var crmfObject = crypto.generateCRMFRequest("CN=undefined", "regToken",
|
||||
"authenticator", null, "",
|
||||
65536, null, "rsa-ex",
|
||||
1024, null, "rsa-sign");
|
||||
ok(false, "execution should not reach this line");
|
||||
} catch (e) {
|
||||
is(e.toString(), "Error: error:could not generate the key for algorithm rsa-ex", "expected exception");
|
||||
}
|
||||
|
||||
// bug 882865
|
||||
var o200 = document.documentElement;
|
||||
var o1 = crypto;
|
||||
try {
|
||||
o1.generateCRMFRequest("undefined", o200, 'X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X', null, o1, 1404343237, Math.PI, []);
|
||||
ok(false, "execution should not reach this line");
|
||||
} catch (e) {
|
||||
// The 'key generation argument' in this case was an empty array,
|
||||
// which gets interpreted as an empty string.
|
||||
is(e.toString(), "Error: error:invalid key generation argument:", "expected exception");
|
||||
}
|
||||
|
||||
// Test that an rsa certificate isn't used to generate an ec key.
|
||||
try {
|
||||
var crmfObject = crypto.generateCRMFRequest("CN=a", "a", "a", null, "",
|
||||
1024, "popcert=MIIBjzCB+aADAgECAgUAnVC3BjANBgkqhkiG9w0BAQUFADAMMQowCAYDVQQDEwFhMB4XDTEzMTEwNjE3NDU1NFoXDTIzMTEwNjE3NDU1NFowDDEKMAgGA1UEAxMBYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA3G2mwjE8IGVwv6H1NGZFSKE3UrTsgez2DtNIYb5zdi0P0w9SbmL2GWfveu9DZhRebhVz7QSMPKLagI4aoIzoP5BxRl7a8wR5wbU0z8qXnAvy9p3Ex5oN5vX47TWB7cnItoWpi6A81GSn5X1CFFHhVCEwnQsHuWXrEvLD5hrfdmcCAwEAATANBgkqhkiG9w0BAQUFAAOBgQCNo+yLKfAd2NBI5DUpwgHSFBA+59pdNtHY7E2KZjyc9tXN6PHkPp8nScVCtk0g60j4aiiZQm8maPQPLo7Hipgpk83iYqquHRvcJVX4fWJpS/7vX+qTNT0hRiKRhVlI6S4Ttp2J2W6uxy2xxeqC6nBbU98QmDj3UQAY31LyejbecQ==", "ec-dual-use");
|
||||
ok(crmfObject, "generateCRMFRequest succeeded");
|
||||
var request = crmfObject.request;
|
||||
var bytes = atob(request.replace(/\r\n/g, ""));
|
||||
|
||||
// rsaEncryption oid encoded in the request (as ASN1)
|
||||
var badIdentifier = [ 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
|
||||
0x01, 0x01, 0x01 ];
|
||||
ok(!findIdentifierInString(badIdentifier, bytes),
|
||||
"didn't find bad identifier in request");
|
||||
|
||||
// secp256r1 encoded in the request (as ASN1) (this is the default for
|
||||
// a "1024-bit" ec key)
|
||||
var goodIdentifier = [ 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03,
|
||||
0x01, 0x07 ];
|
||||
ok(findIdentifierInString(goodIdentifier, bytes),
|
||||
"found good identifier in request");
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception: " + e);
|
||||
}
|
||||
|
||||
// Test that only the first of repeated keygen parameters are used.
|
||||
try {
|
||||
var curveCrmfObject = crypto.generateCRMFRequest("CN=a", "a", "a", null,
|
||||
"", 1024, "curve=secp521r1;curve=nistp384",
|
||||
"ec-dual-use");
|
||||
ok(curveCrmfObject, "generateCRMFRequest succeeded");
|
||||
var curveRequest = curveCrmfObject.request;
|
||||
var curveBytes = atob(curveRequest.replace(/\r\n/g, ""));
|
||||
|
||||
// nistp384 encoded in the request (as ASN1)
|
||||
var badIdentifier = [ 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22 ];
|
||||
ok(!findIdentifierInString(badIdentifier, curveBytes),
|
||||
"didn't find bad identifier in curve request");
|
||||
|
||||
// secp512r1 encoded in the request (as ASN1)
|
||||
var goodIdentifier = [ 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x23 ];
|
||||
ok(findIdentifierInString(goodIdentifier, curveBytes),
|
||||
"found good identifier in curve request");
|
||||
|
||||
// The popcert=MII... values are base-64 encodings of self-signed
|
||||
// certificates. The key of the first one is a secp521r1 key, whereas
|
||||
// the second is nistp384.
|
||||
var popcertCrmfObject = crypto.generateCRMFRequest("CN=a", "a", "a",
|
||||
null, "", 1024, "popcert=MIIBjjCB8aADAgECAgUAnVEmVTAJBgcqhkjOPQQBMAwxCjAIBgNVBAMTAWkwHhcNMTMxMTA2MjE1NDUxWhcNMTQwMjA2MjE1NDUxWjAMMQowCAYDVQQDEwFpMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQA5juM0J3Od2Ih4s0ZiTkzVkh96J4yO12/L71df3GWy/Ex3LaGcew/EucY5ZITEqNHn22+3pKf3pwL6GJ/zA/foJwBspiE42ITo2BHHXl2Uuf1QK70UH5gzaqf1Cc4lPv3ibOf3EAmHx0a8sdDxRlUN2+V38iYWnMmV1qf4jM15fsYEDMwCQYHKoZIzj0EAQOBjAAwgYgCQgDO34oQkVDNkwtto1OAEbFZgq1xP9aqc+Nt7vnOuEGTISdFXCjlhon7SysTejFhO8d8wG500NrlJEmaie9FJbmWpQJCARcVtnC0K+ilxz307GyuANTaLEd7vBJxTAho8l6xkibNoxY1D9+hcc6ECbK7PCtAaysZoAVx5XhJlsnFdJdDj3wG;popcert=MIIBRDCBy6ADAgECAgUAnVEotzAJBgcqhkjOPQQBMAwxCjAIBgNVBAMTAWkwHhcNMTMxMTA2MjIwMDExWhcNMTQwMjA2MjIwMDExWjAMMQowCAYDVQQDEwFpMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEXjFpZ9bodzikeN4C8p2mVj1Ia1t+8zIndSavQHmxaD3+kvhkt18+P20ZagfBOaVEQZdArZ6KxBeW9oYZqaNpqHLveGlKYi6u9z5FyozAx4MXzyLdfu+bzOLIsryKRnLFMAkGByqGSM49BAEDaQAwZgIxAJDawIJLQ5iZsJVC3vV1YEKsI2aNEicdZ3YTMp/zUy+64Z2/cjyyfa7d5m1xKLDBogIxANHOQoy/7DioCyWNDDzx5QK0M24dOURVWRXsxjAjrg4vDmV/fkVzwpUzIr5fMgXEyQ==", "ec-dual-use");
|
||||
ok(popcertCrmfObject, "generateCRMFRequest succeeded");
|
||||
var popcertRequest = popcertCrmfObject.request;
|
||||
var popcertBytes = atob(popcertRequest.replace(/\r\n/g, ""));
|
||||
ok(!findIdentifierInString(badIdentifier, popcertBytes),
|
||||
"didn't find bad identifier in popcert request");
|
||||
|
||||
ok(findIdentifierInString(goodIdentifier, popcertBytes),
|
||||
"found good identifier in popcert request");
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception: " + e);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function findIdentifierInString(identifier, str) {
|
||||
var matches = 0;
|
||||
for (var i = 0; i < str.length - identifier.length;
|
||||
i += (matches != 0 ? matches : 1)) {
|
||||
matches = 0;
|
||||
for (var j = 0; j < identifier.length; j++) {
|
||||
if (identifier[j] == str.charCodeAt(i + j)) {
|
||||
matches++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (matches == identifier.length) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -17,5 +17,5 @@ TEST_DIRS += [
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
|
||||
if not CONFIG['MOZ_NO_SMART_CARDS']:
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell-smartcards.ini']
|
||||
|
@ -6,5 +6,5 @@
|
||||
|
||||
DIRS += ['tlsserver']
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
|
||||
if not CONFIG['MOZ_NO_SMART_CARDS']:
|
||||
DIRS += ['pkcs11testmodule']
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user