Merge m-c to fx-team

This commit is contained in:
Wes Kocher 2014-03-12 21:23:37 -07:00
commit 93661497bd
130 changed files with 2628 additions and 909 deletions

View File

@ -409,6 +409,14 @@ XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
}
}
}
nsAutoString name;
Name(name);
if (name != mCachedName) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
mCachedName = name;
}
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -106,6 +106,7 @@ protected:
// XULTreeItemAccessibleBase
mutable AccessibleHashtable mAccessibleCache;
nsString mCachedName;
};

View File

@ -92,6 +92,7 @@
case kShowElm:
aNode.style.display = "block";
break;
default:
return INVOKER_ACTION_FAILED;

View File

@ -97,6 +97,26 @@
}
}
/**
* Check name changed a11y event for a row.
*/
function rowNameChangeChecker(aMsg, aRow)
{
this.type = EVENT_NAME_CHANGE;
function targetGetter()
{
var acc = getAccessible(gTree);
return acc.getChildAt(aRow + 1);
}
Object.defineProperty(this, "target", { get: targetGetter });
this.getID = function getID()
{
return aMsg + "name changed";
}
}
////////////////////////////////////////////////////////////////////////////
// Invokers
@ -221,9 +241,10 @@
this.eventSeq =
[
new nameChangeChecker("invalidateColumn: ", 1, 0),
new nameChangeChecker("invalidateColumn: ", 1, 1),
new treeInvalidatedChecker("invalidateColumn", 1, 1, null, null)
new nameChangeChecker("invalidateRow: ", 1, 0),
new nameChangeChecker("invalidateRow: ", 1, 1),
new rowNameChangeChecker("invalidateRow: ", 1),
new treeInvalidatedChecker("invalidateRow", 1, 1, null, null)
];
this.getID = function invalidateRow_getID()
@ -277,11 +298,16 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=308564"
title="No accessibility events when data in a tree row changes.">
Mozilla Bug 308564
</a>
</a><br/>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=739524"
title="replace TreeViewChanged DOM event on direct call from XUL tree.">
Mozilla Bug 739524
</a><br/>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=743568"
title="Thunderbird message list tree emitting incorrect focus signals after message deleted.">
Mozilla Bug 743568
</a>
<p id="display"></p>
<div id="content" style="display: none">

View File

@ -15,4 +15,5 @@ support-files =
[test_output.html]
[test_tables.html]
[test_touch_adapter.html]
skip-if = true # disabled for a number of intermitten failures: Bug 982326
[test_traversal.html]

View File

@ -334,7 +334,7 @@ ContentPermissionPrompt.prototype = {
if (remember) {
Services.perms.addFromPrincipal(request.principal, type.access,
Ci.nsIPermissionManager.DENY_ACTION);
} else if (PERMISSION_NO_SESSION.indexOf(aPerm) < 0) {
} else if (PERMISSION_NO_SESSION.indexOf(type.access) < 0) {
Services.perms.addFromPrincipal(request.principal, type.access,
Ci.nsIPermissionManager.DENY_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION,

View File

@ -7,3 +7,4 @@ support-files =
[test_sandbox_permission.html]
[test_filepicker_path.html]
[test_permission_deny.html]

View File

@ -37,7 +37,7 @@ if (loadShell()) {
return;
}
sendAsyncMessage("permission-request", evt.detail.permissions);
sendAsyncMessage("permission-request", evt.detail);
};
content.addEventListener("mozChromeEvent", eventHandler);
@ -46,5 +46,11 @@ if (loadShell()) {
addMessageListener("teardown", function() {
content.removeEventListener("mozChromeEvent", eventHandler);
});
addMessageListener("permission-response", function(detail) {
let event = content.document.createEvent('CustomEvent');
event.initCustomEvent('mozContentEvent', true, true, detail);
content.dispatchEvent(event);
});
}

View File

@ -0,0 +1,83 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=981113
-->
<head>
<meta charset="utf-8">
<title>Permission Deny Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=981113">Test Permission Deny</a>
<script type="application/javascript;version=1.8">
'use strict';
SimpleTest.waitForExplicitFinish();
const PROMPT_ACTION = SpecialPowers.Ci.nsIPermissionManager.PROMPT_ACTION;
var gUrl = SimpleTest.getTestFileURL('permission_handler_chrome.js');
var gScript = SpecialPowers.loadChromeScript(gUrl);
var gTests = [
{
'video': true,
},
{
'audio': true,
'video': true,
},
{
'audio': true,
},
];
function runNext() {
if (gTests.length > 0) {
// Put the requested permission in query string
let requestedType = gTests.shift();
info('getUserMedia for ' + JSON.stringify(requestedType));
navigator.mozGetUserMedia(requestedType, function success() {
ok(false, 'unexpected success, permission request should be denied');
runNext();
}, function failure(err) {
is(err.toLowerCase(), 'permission denied', 'expected permission denied');
runNext();
});
} else {
info('test finished, teardown');
gScript.sendAsyncMessage('teardown', '');
gScript.destroy();
SimpleTest.finish();
}
}
gScript.addMessageListener('permission-request', function(detail) {
let response = {
id: detail.id,
type: 'permission-deny',
remember: false,
};
gScript.sendAsyncMessage('permission-response', response);
});
// Need to change camera permission from ALLOW to PROMPT, otherwise
// MediaManager will automatically allow video-only gUM request.
SpecialPowers.pushPermissions([
{type: 'video-capture', allow: PROMPT_ACTION, context: document},
{type: 'audio-capture', allow: PROMPT_ACTION, context: document},
{type: 'camera', allow: PROMPT_ACTION, context: document},
], function() {
SpecialPowers.pushPrefEnv({
'set': [
['media.navigator.permission.disabled', false],
]
}, runNext);
}
);
</script>
</pre>
</body>
</html>

View File

@ -66,7 +66,8 @@ function loadBrowser() {
});
}
gScript.addMessageListener("permission-request", function (permissions) {
gScript.addMessageListener("permission-request", function (detail) {
let permissions = detail.permissions;
let expectedValue = gResult.shift();
let permissionTypes = Object.keys(permissions);

View File

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

View File

@ -12,14 +12,14 @@
<!--original fetch url was https://git.mozilla.org/releases-->
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
<project name="platform_build" path="build" remote="b2g" revision="15d69a6789c638709911507f74d25c0425963636">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

View File

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

View File

@ -4,6 +4,6 @@
"branch": "",
"revision": ""
},
"revision": "1450b977cb8e074f2e9fe2a12049005204febf72",
"revision": "57aedcebe10cd4fef4dc111f1b7347ba1ea3286c",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -15,11 +15,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -19,11 +19,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->

View File

@ -12,14 +12,14 @@
<!--original fetch url was https://git.mozilla.org/releases-->
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
<project name="platform_build" path="build" remote="b2g" revision="15d69a6789c638709911507f74d25c0425963636">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>

View File

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ec28d9dcf57ca8da142f9f2fea33bc288b76ed59"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="b5151b89ff31e92dc44b466f15ad4909e73db248"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->

View File

@ -28,7 +28,9 @@ pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-metro", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused
pref("browser.search.param.yahoo-fr-ja", "");
pref("browser.search.param.yahoo-f-CN", "");
#ifdef MOZ_METRO
pref("browser.search.param.yahoo-fr-metro", "");
#endif

View File

@ -25,7 +25,9 @@ pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-metro", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused
pref("browser.search.param.yahoo-fr-ja", "");
pref("browser.search.param.yahoo-f-CN", "");
#ifdef MOZ_METRO
pref("browser.search.param.yahoo-fr-metro", "");
#endif

View File

@ -24,8 +24,10 @@ pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/notes")
pref("app.update.checkInstallTime.days", 63);
pref("browser.search.param.ms-pc", "MOZI");
pref("browser.search.param.ms-pc-metro", "MOZW");
pref("browser.search.param.yahoo-fr", "moz35");
pref("browser.search.param.yahoo-fr-metro", "mozilla_metro_search");
pref("browser.search.param.yahoo-fr-cjkt", "moz35"); // now unused
pref("browser.search.param.yahoo-fr-ja", "mozff");
#ifdef MOZ_METRO
pref("browser.search.param.ms-pc-metro", "MOZW");
pref("browser.search.param.yahoo-fr-metro", "mozilla_metro_search");
#endif

View File

@ -25,7 +25,9 @@ pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-metro", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused
pref("browser.search.param.yahoo-fr-ja", "");
pref("browser.search.param.yahoo-f-CN", "");
#ifdef MOZ_METRO
pref("browser.search.param.yahoo-fr-metro", "");
#endif

View File

@ -3,6 +3,8 @@ support-files = head.js
[browser_bug400731.js]
[browser_bug415846.js]
skip-if = os == "mac"
skip-if = true
# Disabled because it seems to now touch network resources
# skip-if = os == "mac"
# Disabled on Mac because of its bizarre special-and-unique
# snowflake of a help menu.

View File

@ -57,7 +57,7 @@ robocop_FILES := \
$(NULL)
robocop-deps := $(notdir $(robocop_FILES))
MOCHITEST_ROBOCOP_FILES := \
ROBOCOP_FILES := \
$(wildcard $(TESTPATH)/*.html) \
$(wildcard $(TESTPATH)/*.jpg) \
$(wildcard $(TESTPATH)/*.sjs) \
@ -67,6 +67,9 @@ MOCHITEST_ROBOCOP_FILES := \
$(wildcard $(TESTPATH)/*.swf) \
$(NULL)
ROBOCOP_DEST = $(DEPTH)/_tests/testing/mochitest/tests/robocop/
INSTALL_TARGETS += ROBOCOP
GARBAGE += \
AndroidManifest.xml \
$(robocop-deps) \

View File

@ -73,8 +73,14 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
_DEPRECATED_VARIABLES := \
ANDROID_RESFILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_A11Y_FILES \
MOCHITEST_BROWSER_FILES \
MOCHITEST_BROWSER_FILES_PARTS \
MOCHITEST_CHROME_FILES \
MOCHITEST_FILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_METRO_FILES \
MOCHITEST_ROBOCOP_FILES \
SHORT_LIBNAME \
$(NULL)

View File

@ -1,52 +0,0 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# 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 INCLUDED_TESTS_MOCHITEST_MK #{
# $1- test directory name
# $2- optional: if passed dot used to flatten directory hierarchy copy
# else- relativesrcdir
mochitestdir = \
$(strip \
$(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
))
ifdef MOCHITEST_FILES
MOCHITEST_DEST := $(call mochitestdir,tests)
INSTALL_TARGETS += MOCHITEST
endif
ifdef MOCHITEST_CHROME_FILES
MOCHITEST_CHROME_DEST := $(call mochitestdir,chrome)
INSTALL_TARGETS += MOCHITEST_CHROME
endif
ifdef MOCHITEST_BROWSER_FILES
MOCHITEST_BROWSER_DEST := $(call mochitestdir,browser)
INSTALL_TARGETS += MOCHITEST_BROWSER
endif
ifdef MOCHITEST_A11Y_FILES
MOCHITEST_A11Y_DEST := $(call mochitestdir,a11y)
INSTALL_TARGETS += MOCHITEST_A11Y
endif
ifdef MOCHITEST_METRO_FILES
MOCHITEST_METRO_DEST := $(call mochitestdir,metro)
INSTALL_TARGETS += MOCHITEST_METRO
endif
ifdef MOCHITEST_ROBOCOP_FILES
MOCHITEST_ROBOCOP_DEST := $(call mochitestdir,tests/robocop,flat_hierarchy)
INSTALL_TARGETS += MOCHITEST_ROBOCOP
endif
INCLUDED_TESTS_MOCHITEST_MK := 1
endif #} INCLUDED_TESTS_MOCHITEST_MK

View File

@ -99,10 +99,6 @@ ifdef ENABLE_TESTS
# locally against non-current test code.
DIRS += $(TEST_DIRS)
ifndef INCLUDED_TESTS_MOCHITEST_MK #{
include $(topsrcdir)/config/makefiles/mochitest.mk
endif #}
ifdef CPP_UNIT_TESTS
ifdef COMPILE_ENVIRONMENT
@ -1635,12 +1631,6 @@ FREEZE_VARIABLES = \
TIERS \
EXTRA_COMPONENTS \
EXTRA_PP_COMPONENTS \
MOCHITEST_FILES \
MOCHITEST_CHROME_FILES \
MOCHITEST_BROWSER_FILES \
MOCHITEST_A11Y_FILES \
MOCHITEST_METRO_FILES \
MOCHITEST_ROBOCOP_FILES \
$(NULL)
$(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))

View File

@ -1964,6 +1964,7 @@ GK_ATOM(genConInitializerProperty, "QuoteNodeProperty")
GK_ATOM(labelMouseDownPtProperty, "LabelMouseDownPtProperty")
GK_ATOM(baseURIProperty, "baseURIProperty")
GK_ATOM(lockedStyleStates, "lockedStyleStates")
GK_ATOM(apzCallbackTransform, "apzCallbackTransform")
// Languages for lang-specific transforms
GK_ATOM(Japanese, "ja")

View File

@ -241,6 +241,16 @@ public:
MOZ_ASSERT(aTarget);
}
nsSimplePluginEvent(nsIContent* aTarget,
nsIDocument* aDocument,
const nsAString& aEvent)
: mTarget(aTarget)
, mDocument(aDocument)
, mEvent(aEvent)
{
MOZ_ASSERT(aTarget && aDocument);
}
~nsSimplePluginEvent() {}
NS_IMETHOD Run();
@ -703,7 +713,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
nsIDocument* ownerDoc = thisContent->OwnerDoc();
ownerDoc->RemovePlugin(this);
if (mType == eType_Plugin && mInstanceOwner) {
if (mType == eType_Plugin && (mInstanceOwner || mInstantiating)) {
// we'll let the plugin continue to run at least until we get back to
// the event loop. If we get back to the event loop and the node
// has still not been added back to the document then we tear down the
@ -744,7 +754,7 @@ nsObjectLoadingContent::~nsObjectLoadingContent()
NS_NOTREACHED("Should not be tearing down frame loaders at this point");
mFrameLoader->Destroy();
}
if (mInstanceOwner) {
if (mInstanceOwner || mInstantiating) {
// This is especially bad as delayed stop will try to hold on to this
// object...
NS_NOTREACHED("Should not be tearing down a plugin at this point!");
@ -772,7 +782,7 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
nsIDocument* doc = thisContent->GetCurrentDoc();
nsCOMPtr<nsIDocument> doc = thisContent->GetCurrentDoc();
if (!doc || !InActiveDocument(thisContent)) {
NS_ERROR("Shouldn't be calling "
"InstantiatePluginInstance without an active document");
@ -894,8 +904,10 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
}
}
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(thisContent,
NS_LITERAL_STRING("PluginInstantiated"));
nsCOMPtr<nsIRunnable> ev = \
new nsSimplePluginEvent(thisContent,
doc,
NS_LITERAL_STRING("PluginInstantiated"));
NS_DispatchToCurrentThread(ev);
return NS_OK;
@ -909,7 +921,7 @@ nsObjectLoadingContent::NotifyOwnerDocumentActivityChanged()
// If we have a plugin we want to queue an event to stop it unless we are
// moved into an active document before returning to the event loop.
if (mInstanceOwner)
if (mInstanceOwner || mInstantiating)
QueueCheckPluginStopEvent();
}
@ -1073,8 +1085,10 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
// Lost our frame. If we aren't going to be getting a new frame, e.g. we've
// become display:none, we'll want to stop the plugin. Queue a
// CheckPluginStopEvent
if (mInstanceOwner) {
mInstanceOwner->SetFrame(nullptr);
if (mInstanceOwner || mInstantiating) {
if (mInstanceOwner) {
mInstanceOwner->SetFrame(nullptr);
}
QueueCheckPluginStopEvent();
}
return NS_OK;
@ -2826,6 +2840,10 @@ nsObjectLoadingContent::StopPluginInstance()
mPendingInstantiateEvent = nullptr;
mPendingCheckPluginStopEvent = nullptr;
// If we're currently instantiating, clearing this will cause
// InstantiatePluginInstance's re-entrance check to destroy the created plugin
mInstantiating = false;
if (!mInstanceOwner) {
return NS_OK;
}

View File

@ -1006,6 +1006,7 @@ nsScriptLoader::FillCompileOptionsForRequest(nsScriptLoadRequest *aRequest,
// aRequest ended up getting script data from, as the script filename.
nsContentUtils::GetWrapperSafeScriptFilename(mDocument, aRequest->mURI, aRequest->mURL);
aOptions->setIntroductionType("scriptElement");
aOptions->setFileAndLine(aRequest->mURL.get(), aRequest->mLineNo);
aOptions->setVersion(JSVersion(aRequest->mJSVersion));
aOptions->setCompileAndGo(JS_IsGlobalObject(aScopeChain));

View File

@ -1,2 +1,4 @@
[test_messagemanager_assertpermission.html]
skip-if = buildapp == 'b2g' #b2g(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE) b2g-debug(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE) b2g-desktop(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE)
[test_child_process_shutdown_message.html]
skip-if = buildapp == 'b2g' #b2g(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE) b2g-debug(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE) b2g-desktop(specialpowers.wrap issue, NS_ERROR_XPC_GS_RETURNED_FAILURE)

View File

@ -544,7 +544,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' #needs plugin support # b2g(
[test_classList.html]
# This test fails on the Mac for some reason
[test_copyimage.html]
skip-if = toolkit != 'gtk2' && toolkit != 'gtk3' && toolkit != 'windows'
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit != 'gtk2' && toolkit != 'gtk3' && toolkit != 'windows' #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
[test_copypaste.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 904183 # b2g(clipboard undefined) b2g-debug(clipboard undefined) b2g-desktop(clipboard undefined)
[test_copypaste.xhtml]

View File

@ -475,15 +475,15 @@ skip-if = buildapp == 'b2g'
skip-if = appname == "seamonkey" # See bug 598252
[test_buffered.html]
skip-if = toolkit == 'android' || os == "win" # See bug 832768 and 864682
skip-if = toolkit == 'android' || os == "win" || (toolkit == 'gonk' && !debug) # See bug 832768 and 864682, b2g(assertion failures)
[test_bug465498.html]
skip-if = os == "win" # See bug 832768 and 864682
skip-if = os == "win" || (toolkit == 'gonk' && !debug) # See bug 832768 and 864682
[test_bug493187.html]
skip-if = os == "win" || (buildapp=='b2g'&&debug) # See bug 707777, #b2g-emulator-debug - process crash
skip-if = os == "win" || (buildapp=='b2g'&&debug) || (toolkit == 'gonk' && !debug) # See bug 707777, #b2g-emulator-debug - process crash
[test_media_selection.html]
skip-if = os == "win" # See bug 897843
skip-if = os == "win" || (toolkit == 'gonk' && !debug) # See bug 897843, b2g(timed out)
[test_seek.html]
skip-if = toolkit == 'android' || os == "win" # See bug 832678, 795271, and 857424 # android(bug 845162) androidx86(bug 845162)
skip-if = toolkit == 'android' || os == "win" || (toolkit == 'gonk' && !debug) # See bug 832678, 795271, and 857424 # android(bug 845162) androidx86(bug 845162)
# The tests below contain backend-specific tests. Write backend independent
# tests rather than adding to this list.

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) #b2g-debug(bug 916135) b2g-desktop(bug 916135)
support-files =
audio-expected.wav
audio-mono-expected-2.wav

View File

@ -2643,7 +2643,8 @@ nsXULPrototypeScript::Compile(const char16_t* aText,
// Ok, compile it to create a prototype script object!
NS_ENSURE_TRUE(JSVersion(mLangVersion) != JSVERSION_UNKNOWN, NS_OK);
JS::CompileOptions options(cx);
options.setFileAndLine(urlspec.get(), aLineNo)
options.setIntroductionType("scriptElement")
.setFileAndLine(urlspec.get(), aLineNo)
.setVersion(JSVersion(mLangVersion));
// If the script was inline, tell the JS parser to save source for
// Function.prototype.toSource(). If it's out of line, we retrieve the

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = buildapp == 'b2g' #tests that use xul
[test_bug486990.xul]
skip-if = toolkit == 'android' #TIMED_OUT

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = toolkit=='gonk' #b2g(bug 972927, nearly perma-fail) b2g-debug(bug 972927, nearly perma-fail)
support-files =
file_app.sjs
file_app.template.html

View File

@ -216,7 +216,7 @@ BluetoothHfpManager::Notify(const hal::BatteryInformation& aBatteryInfo)
int level = ceil(aBatteryInfo.level() * 5.0);
if (level != sCINDItems[CINDType::BATTCHG].value) {
sCINDItems[CINDType::BATTCHG].value = level;
SendCommand("+CIEV:", CINDType::BATTCHG);
SendCommand("+CIEV: ", CINDType::BATTCHG);
}
}

View File

@ -3,7 +3,7 @@
# so we don't run that test on platforms which don't support OOP tests.
# OOP tests don't work on native-fennec (bug 774939).
# Bug 960345 - Disabled on OSX debug for frequent crashes.
skip-if = os == "android" || (toolkit == "cocoa" && debug)
skip-if = os == "android" || (toolkit == "cocoa" && debug) || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
support-files =
browserElement_OpenMixedProcess.js
file_browserElement_OpenMixedProcess.html
@ -11,15 +11,19 @@ support-files =
[test_browserElement_inproc_ErrorSecurity.html]
skip-if = toolkit=='gonk'
[test_browserElement_inproc_OpenMixedProcess.html]
skip-if = toolkit=='gonk'
skip-if = toolkit=='gonk' || (toolkit == 'gonk' && !debug)
[test_browserElement_oop_Alert.html]
[test_browserElement_oop_AlertInFrame.html]
[test_browserElement_oop_AppFramePermission.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_AppWindowNamespace.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_Auth.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_BackForward.html]
[test_browserElement_oop_BadScreenshot.html]
[test_browserElement_oop_BrowserWindowNamespace.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_BrowserWindowResize.html]
[test_browserElement_oop_Close.html]
[test_browserElement_oop_CookiesNotThirdParty.html]
@ -27,20 +31,28 @@ skip-if = toolkit=='gonk'
[test_browserElement_oop_DataURI.html]
[test_browserElement_oop_DocumentFirstPaint.html]
[test_browserElement_oop_ErrorSecurity.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_FirstPaint.html]
[test_browserElement_oop_ForwardName.html]
[test_browserElement_oop_FrameWrongURI.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_GetScreenshot.html]
[test_browserElement_oop_GetScreenshotDppx.html]
[test_browserElement_oop_Iconchange.html]
[test_browserElement_oop_LoadEvents.html]
[test_browserElement_oop_Metachange.html]
[test_browserElement_oop_OpenMixedProcess.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_OpenNamed.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_OpenWindow.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_OpenWindowDifferentOrigin.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_OpenWindowInFrame.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_OpenWindowRejected.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_Opensearch.html]
[test_browserElement_oop_PromptCheck.html]
[test_browserElement_oop_PromptConfirm.html]
@ -50,7 +62,7 @@ skip-if = toolkit=='gonk'
[test_browserElement_oop_RemoveBrowserElement.html]
[test_browserElement_oop_ScrollEvent.html]
[test_browserElement_oop_SecurityChange.html]
skip-if = toolkit == 'android' #TIMED_OUT, bug 766586
skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) #TIMED_OUT, bug 766586
[test_browserElement_oop_SendEvent.html]
[test_browserElement_oop_SetInputMethodActive.html]
[test_browserElement_oop_SetVisible.html]
@ -58,6 +70,7 @@ skip-if = toolkit == 'android' #TIMED_OUT, bug 766586
[test_browserElement_oop_SetVisibleFrames2.html]
[test_browserElement_oop_Stop.html]
[test_browserElement_oop_TargetBlank.html]
skip-if = (toolkit == 'gonk' && !debug)
[test_browserElement_oop_TargetTop.html]
[test_browserElement_oop_Titlechange.html]
[test_browserElement_oop_TopBarrier.html]

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
support-files =
../../../browser/base/content/test/general/audio.ogg
../../../content/media/test/short-video.ogv

View File

@ -1,6 +1,6 @@
[DEFAULT]
# Good luck running these tests on anything but desktop Linux.
skip-if = toolkit != "gtk2"
skip-if = toolkit != "gtk2" || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
# Note: ../browserElementTestHelpers.js makes all tests in this directory OOP,
# because testing the process-priority manager without OOP frames does not make

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = toolkit=='gonk' #b2g(bug 974270, frequent failures) b2g-debug(bug 974270, frequent failures)
support-files =
file_app_install.html
file_readonly.html

View File

@ -48,6 +48,7 @@
#include "nsIPermissionManager.h"
#include "nsIStringBundle.h"
#include "nsIDocument.h"
#include "nsPrintfCString.h"
#include <algorithm>
#include "private/pprio.h"
#include "nsContentPermissionHelper.h"
@ -194,7 +195,7 @@ public:
#endif
nsCOMPtr<nsIFile> apps;
nsCOMPtr<nsIFile> crashes;
nsCOMPtr<nsIFile> temp;
nsCOMPtr<nsIFile> overrideRootDir;
};
static StaticRefPtr<GlobalDirs> sDirs;
@ -589,6 +590,116 @@ DeviceStorageFile::Init()
MOZ_ASSERT(typeChecker);
}
// The OverrideRootDir is needed to facilitate testing of the
// device.storage.overrideRootDir preference. The preference is normally
// only read once during initialization, but since the test environment has
// no convenient way to restart, we use a pref watcher instead.
class OverrideRootDir MOZ_FINAL : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
static OverrideRootDir* GetSingleton();
~OverrideRootDir();
void Init();
private:
static mozilla::StaticRefPtr<OverrideRootDir> sSingleton;
};
NS_IMPL_ISUPPORTS1(OverrideRootDir, nsIObserver)
mozilla::StaticRefPtr<OverrideRootDir>
OverrideRootDir::sSingleton;
OverrideRootDir*
OverrideRootDir::GetSingleton()
{
if (sSingleton) {
return sSingleton;
}
// Preference changes are automatically forwarded from parent to child
// in ContentParent::Observe, so we'll see the change in both the parent
// and the child process.
sSingleton = new OverrideRootDir();
Preferences::AddStrongObserver(sSingleton, "device.storage.overrideRootDir");
ClearOnShutdown(&sSingleton);
return sSingleton;
}
OverrideRootDir::~OverrideRootDir()
{
Preferences::RemoveObserver(this, "device.storage.overrideRootDir");
}
NS_IMETHODIMP
OverrideRootDir::Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *aData)
{
MOZ_ASSERT(NS_IsMainThread());
if (sSingleton) {
sSingleton->Init();
}
return NS_OK;
}
void
OverrideRootDir::Init()
{
MOZ_ASSERT(NS_IsMainThread());
if (!sDirs) {
return;
}
if (mozilla::Preferences::GetBool("device.storage.testing", false)) {
nsCOMPtr<nsIProperties> dirService
= do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
MOZ_ASSERT(dirService);
dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(sDirs->overrideRootDir));
if (sDirs->overrideRootDir) {
sDirs->overrideRootDir->AppendRelativeNativePath(
NS_LITERAL_CSTRING("device-storage-testing"));
}
} else {
// For users running on desktop, it's convenient to be able to override
// all of the directories to point to a single tree, much like what happens
// on a real device.
const nsAdoptingString& overrideRootDir =
mozilla::Preferences::GetString("device.storage.overrideRootDir");
if (overrideRootDir && overrideRootDir.Length() > 0) {
NS_NewLocalFile(overrideRootDir, false,
getter_AddRefs(sDirs->overrideRootDir));
} else {
sDirs->overrideRootDir = nullptr;
}
}
if (sDirs->overrideRootDir) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// Only the parent process can create directories. In testing, because
// the preference is updated after startup, its entirely possible that
// the preference updated notification will be received by a child
// prior to the parent.
nsresult rv
= sDirs->overrideRootDir->Create(nsIFile::DIRECTORY_TYPE, 0777);
nsString path;
sDirs->overrideRootDir->GetPath(path);
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS) {
nsPrintfCString msg("DeviceStorage: Unable to create directory '%s'",
NS_LossyConvertUTF16toASCII(path).get());
NS_WARNING(msg.get());
}
}
sDirs->overrideRootDir->Normalize();
}
}
// Directories which don't depend on a volume should be calculated once
// here. Directories which depend on the root directory of a volume
// should be calculated in DeviceStorageFile::GetRootDirectoryForType.
@ -676,16 +787,7 @@ InitDirs()
#endif
}
if (mozilla::Preferences::GetBool("device.storage.testing", false)) {
dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(sDirs->temp));
if (sDirs->temp) {
sDirs->temp->AppendRelativeNativePath(
NS_LITERAL_CSTRING("device-storage-testing"));
sDirs->temp->Create(nsIFile::DIRECTORY_TYPE, 0777);
sDirs->temp->Normalize();
}
}
OverrideRootDir::GetSingleton()->Init();
}
void
@ -715,6 +817,7 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
{
nsCOMPtr<nsIFile> f;
*aFile = nullptr;
bool allowOverride = true;
InitDirs();
@ -761,6 +864,7 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
// Apps directory
else if (aStorageType.EqualsLiteral(DEVICESTORAGE_APPS)) {
f = sDirs->apps;
allowOverride = false;
}
// default SDCard
@ -775,17 +879,19 @@ DeviceStorageFile::GetRootDirectoryForType(const nsAString& aStorageType,
// crash reports directory.
else if (aStorageType.EqualsLiteral(DEVICESTORAGE_CRASHES)) {
f = sDirs->crashes;
allowOverride = false;
} else {
// Not a storage type that we recognize. Return null
return;
}
// In testing, we default all device storage types to a temp directory.
// sDirs->temp will only have been initialized (in InitDirs) if the
// preference device.storage.testing was set to true. We can't test the
// preference directly here, since we may not be on the main thread.
if (sDirs->temp) {
f = sDirs->temp;
// sDirs->overrideRootDir will only have been initialized (in InitDirs)
// if the preference device.storage.testing was set to true, or if
// device.storage.overrideRootDir is set. We can't test the preferences
// directly here, since we may not be on the main thread.
if (allowOverride && sDirs->overrideRootDir) {
f = sDirs->overrideRootDir;
}
if (f) {

View File

@ -8,6 +8,7 @@ support-files = devicestorage_common.js
[test_addCorrectType.html]
[test_available.html]
[test_basic.html]
[test_overrideDir.html]
# [test_diskSpace.html]
# Possible race between the time we write a file, and the
# time it takes to be reflected by statfs(). Bug # 791287

View File

@ -0,0 +1,163 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html> <!--
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
-->
<head>
<title>Test for the device storage API </title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="devicestorage_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
devicestorage_setup();
var gFileName = "devicestorage/" + randomFilename(12) + "/hi.png";
var gData = "My name is Doug Turner. My IRC nick is DougT. I like Maple cookies."
var gDataBlob = new Blob([gData], {type: 'image/png'});
var gFileReader = new FileReader();
function getAfterDeleteSuccess(e) {
ok(false, "file was deleted not successfully");
devicestorage_cleanup();
}
function getAfterDeleteError(e) {
ok(true, "file was deleted successfully");
devicestorage_cleanup();
}
function deleteSuccess(e) {
ok(e.target.result == gFileName, "File name should match");
dump(e.target.result + "\n")
// File was deleted using the sdcard stoage area. It should be gone
// from the pictures as well.
var storage = navigator.getDeviceStorage("pictures");
request = storage.get(e.target.result);
request.onsuccess = getAfterDeleteSuccess;
request.onerror = getAfterDeleteError;
}
function deleteError(e) {
ok(false, "deleteError was called : " + e.target.error.name);
devicestorage_cleanup();
}
function getSuccess(e) {
// We wrote the file out using pictures type. Since we've over-ridden the
// root directory, we should be able to read it back using the sdcard
// storage area.
var storage = navigator.getDeviceStorage("sdcard");
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
ok(e.target.result.name == gFileName, "File name should match");
ok(e.target.result.size > 0, "File size be greater than zero");
ok(e.target.result.type, "File should have a mime type");
ok(e.target.result.lastModifiedDate, "File should have a last modified date");
var name = e.target.result.name;
gFileReader.readAsArrayBuffer(gDataBlob);
gFileReader.onload = function(e) {
readerCallback(e);
request = storage.delete(name)
request.onsuccess = deleteSuccess;
request.onerror = deleteError;
}
}
function readerCallback(e) {
ab = e.target.result;
is(ab.byteLength, gData.length, "wrong arraybuffer byteLength");
var u8v = new Uint8Array(ab);
is(String.fromCharCode.apply(String, u8v), gData, "wrong values");
}
function getError(e) {
ok(false, "getError was called : " + e.target.error.name);
devicestorage_cleanup();
}
function addSuccess(e) {
var filename = e.target.result;
if (filename[0] == "/") {
// We got /storageName/prefix/filename
// Remove the storageName (this shows up on FirefoxOS)
filename = filename.substring(1); // Remove leading slash
var slashIndex = filename.indexOf("/");
if (slashIndex >= 0) {
filename = filename.substring(slashIndex + 1); // Remove storageName
}
}
ok(filename == gFileName, "File name should match");
// Update gFileName to be the fully qualified name so that
// further checks will pass.
gFileName = e.target.result;
var storage = navigator.getDeviceStorage("pictures");
request = storage.get(gFileName);
request.onsuccess = getSuccess;
request.onerror = getError;
ok(true, "addSuccess was called");
}
function addError(e) {
ok(false, "addError was called : " + e.target.error.name);
devicestorage_cleanup();
}
function startTest() {
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
var storage = navigator.getDeviceStorage("pictures");
ok(storage, "Should have gotten a storage");
request = storage.addNamed(gDataBlob, gFileName);
ok(request, "Should have a non-null request");
request.onsuccess = addSuccess;
request.onerror = addError;
}
try {
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
var f = directoryService.get("TmpD", Ci.nsIFile);
f.appendRelativePath("device-storage-sdcard");
try {
// The remove will fail if the directory doesn't exist, which is fine.
f.remove(true);
} catch (e) {}
SpecialPowers.pushPrefEnv({'set': [["device.storage.overrideRootDir", f.path],
["device.storage.testing", false]]},
function() {
startTest();
});
} catch(e) {}
</script>
</pre>
</body>
</html>

View File

@ -10,17 +10,19 @@ support-files =
[conformancetest/test_event.html]
[conformancetest/test_runtest.html]
skip-if = toolkit == 'android'
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #b2g(takes too long) b2g-debug(takes too long) b2g-desktop(takes too long)
[selecttest/test_Document-open.html]
[selecttest/test_addRange.html]
skip-if = toolkit == 'android' #bug 775227
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(bug 775227) b2g(oom?, bug 775227) b2g-debug(oom?, bug 775227) b2g-desktop(oom?, bug 775227)
[selecttest/test_collapse.html]
[selecttest/test_collapseToStartEnd.html]
[selecttest/test_deleteFromDocument.html]
[selecttest/test_extend.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure; time out)
[selecttest/test_getRangeAt.html]
[selecttest/test_getSelection.html]
[selecttest/test_interfaces.html]
[selecttest/test_isCollapsed.html]
[selecttest/test_removeAllRanges.html]
[selecttest/test_selectAllChildren.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)

View File

@ -57,211 +57,414 @@ support-files =
webgl/common.js
[dom/collections/test_HTMLCollection-empty-name.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/errors/test_DOMException-constants.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/errors/test_exceptions.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-constants.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-constructors.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-defaultPrevented.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-initEvent.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-propagation.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_Event-type.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_EventTarget-addEventListener.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_EventTarget-dispatchEvent.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_EventTarget-removeEventListener.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/events/test_ProgressEvent.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/lists/test_DOMTokenList-stringifier.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_CharacterData-appendData.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_CharacterData-deleteData.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_CharacterData-insertData.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_CharacterData-remove.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_CharacterData-replaceData.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Comment-constructor.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_DOMImplementation-createDocument.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_DOMImplementation-createDocumentType.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_DOMImplementation-createHTMLDocument.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_DOMImplementation-hasFeature.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-adoptNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createComment.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createElement-namespace.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createElement.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createElementNS.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createEvent.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction-literal-1.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction-literal-2.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createProcessingInstruction.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-createTreeWalker.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-getElementById.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-getElementsByTagName.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-getElementsByTagNameNS.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Document-importNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_DocumentType-remove.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Element-children.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Element-getElementsByClassName.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Element-remove.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Element-removeAttributeNS.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Element-tagName.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-appendChild.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-cloneNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-compareDocumentPosition.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-constants.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-contains.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-contains.xml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-insertBefore.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-isEqualNode.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-lookupPrefix.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-nodeName.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-nodeName.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-normalize.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-parentElement.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-parentNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-properties.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-removeChild.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_Node-replaceChild.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_attributes.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_case.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-01.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-02.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-03.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-04.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-05.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-06.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-07.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-08.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-09.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-10.xml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-11.xml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-12.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-13.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-14.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-15.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-16.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-17.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/nodes/test_getElementsByClassName-18.htm]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-attributes.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-cloneContents.html]
skip-if = buildapp == 'b2g'
[dom/ranges/test_Range-cloneRange.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-collapse.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-commonAncestorContainer-2.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-commonAncestorContainer.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-compareBoundaryPoints.html]
skip-if = buildapp == 'b2g' #b2g(times out, bug 862196) b2g-debug(times out, bug 862196) b2g-desktop(times out, bug 862196)
[dom/ranges/test_Range-comparePoint-2.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-comparePoint.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-deleteContents.html]
skip-if = buildapp == 'b2g'
[dom/ranges/test_Range-detach.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-extractContents.html]
skip-if = buildapp == 'b2g'
[dom/ranges/test_Range-insertNode.html]
skip-if = buildapp == 'b2g' #b2g(oom?, bug 775227) b2g-debug(oom?, bug 775227) b2g-desktop(oom?, bug 775227)
[dom/ranges/test_Range-intersectsNode-binding.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-intersectsNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-isPointInRange.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-mutations.html]
skip-if = buildapp == 'b2g' #Test timed out.
[dom/ranges/test_Range-selectNode.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/ranges/test_Range-set.html]
skip-if = buildapp == 'b2g'
[dom/ranges/test_Range-surroundContents.html]
skip-if = buildapp == 'b2g'
[dom/test_historical.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/test_interface-objects.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/test_interfaces.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[dom/traversal/test_NodeFilter-constants.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[domxpath/test_evaluator-constructor.html]
[html/browsers/browsing-the-web/read-media/test_pageload-image.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/browsing-the-web/read-media/test_pageload-video.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/the-window-object/named-access-on-the-window-object/test_window-null-names.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/the-window-object/test_window-indexed-properties-strict.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/the-window-object/test_window-indexed-properties.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/the-window-object/test_window-named-properties.html]
skip-if = true # bug 859075
skip-if = true || (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure) bug 859075
[html/browsers/the-window-object/test_window-properties.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/browsers/the-window-object/test_window-prototype-chain.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-case.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-case.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-newelements.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-newelements.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-null-undef.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-null-undef.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-param.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-param.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-same.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_Document.getElementsByClassName-null-undef.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_Element.getElementsByClassName-null-undef.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.body-getter.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.body-setter-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.embeds-document.plugins-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.getElementsByClassName-same.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.head-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.head-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.images.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-02.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-03.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-04.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-05.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-06.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_document.title-07.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-03.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-04.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-05.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/test_nameditem-06.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_classlist-nonstring.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset-delete.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset-enumeration.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset-get.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset-prototype.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset-set.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_dataset.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_document-dir.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_id-attribute.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/elements/global-attributes/test_id-name.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_document-color-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_document-color-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_document-color-03.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_document-color-04.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_heading-obsolete-attributes-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/obsolete/implreq/oeaaa/test_script-IDL-event-htmlfor.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/document-metadata/the-title-element/test_title.text-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/document-metadata/the-title-element/test_title.text-02.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/document-metadata/the-title-element/test_title.text-03.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/document-metadata/the-title-element/test_title.text-04.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-form-element/test_form-elements-interfaces-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-form-element/test_form-elements-matches.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-form-element/test_form-elements-nameditem-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-form-element/test_form-elements-nameditem-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-form-element/test_form-nameditem.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-option-element/test_option-text-backslash.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-option-element/test_option-text-recurse.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-option-element/test_option-text-spaces.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-select-element/test_select-named-getter.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/forms/the-select-element/test_select-remove.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-for-event.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-for-event.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-for-onload.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-language-type.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-languages-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-languages-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-noembed-noframes-iframe.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-onload-string.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-text.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/scripting-1/the-script-element/test_script-text.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_createTBody.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_insertRow-method-01.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_insertRow-method-02.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_tBodies.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_table-insertRow.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/tabular-data/the-table-element/test_table-rows.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/semantics/text-level-semantics/the-time-element/test_001.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/atob/test_base64.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/events/test_body-onload.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/events/test_event-handler-javascript.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/events/test_event-handler-spec-example.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/processing-model-2/test_window-onerror-parse-error.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/processing-model-2/test_window-onerror-runtime-error-throw.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/scripting/processing-model-2/test_window-onerror-runtime-error.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/webappapis/timers/test_evil-spec-example.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[js/builtins/test_Array.DefineOwnProperty.html]
[js/builtins/test_Array.prototype.join-order.html]
[js/builtins/test_Math.max.html]
@ -271,14 +474,14 @@ skip-if = true # bug 859075
[microdata/microdata-dom-api/test_001.html]
[typedarrays/test_constructors.html]
[webgl/test_bufferSubData.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)
[webgl/test_compressedTexImage2D.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)
[webgl/test_compressedTexSubImage2D.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)
[webgl/test_texImage2D.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)
[webgl/test_texSubImage2D.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)
[webgl/test_uniformMatrixNfv.html]
skip-if = toolkit == 'android' #WebGL
skip-if = (toolkit == 'android') || (buildapp == 'b2g') #android(WebGL)

View File

@ -47,7 +47,7 @@ using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CSSIntPoint from "Units.h";
using mozilla::CSSPoint from "Units.h";
using mozilla::CSSToScreenScale from "Units.h";
namespace mozilla {
@ -366,21 +366,21 @@ child:
* the scroll offset. This message is expected to round-trip back to
* ZoomToRect() with a rect indicating where we should zoom to.
*/
HandleDoubleTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
HandleDoubleTap(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Requests handling of a single tap. |point| is in CSS pixels, relative to
* the scroll offset. This message is expected to send a "mousedown" and
* "mouseup" series of events at this point.
*/
HandleSingleTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
HandleSingleTap(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Requests handling of a long tap. |point| is in CSS pixels, relative to
* the scroll offset. This message is expected to send a "contextmenu"
* events at this point.
*/
HandleLongTap(CSSIntPoint point, ScrollableLayerGuid aGuid);
HandleLongTap(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
@ -389,7 +389,7 @@ child:
* this message is expected to generate a "mousedown" and "mouseup"
* series of events
*/
HandleLongTapUp(CSSIntPoint point, ScrollableLayerGuid aGuid);
HandleLongTapUp(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Notifies the child that the parent has begun or finished transforming

View File

@ -661,7 +661,7 @@ TabChild::HandlePossibleViewportChange()
// Force a repaint with these metrics. This, among other things, sets the
// displayport, so we start with async painting.
ProcessUpdateFrame(metrics);
mLastRootMetrics = ProcessUpdateFrame(metrics);
if (viewportInfo.IsZoomAllowed() && scrollIdentifiersValid) {
// If the CSS viewport is narrower than the screen (i.e. width <= device-width)
@ -832,7 +832,7 @@ TabChild::SetChromeFlags(uint32_t aChromeFlags)
NS_IMETHODIMP
TabChild::DestroyBrowserWindow()
{
NS_NOTREACHED("TabChild::SetWebBrowser not supported in TabChild");
NS_NOTREACHED("TabChild::DestroyBrowserWindow not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1477,7 +1477,9 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
if (aFrameMetrics.mIsRoot) {
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
if (APZCCallbackHelper::HasValidPresShellId(utils, aFrameMetrics)) {
return ProcessUpdateFrame(aFrameMetrics);
mLastRootMetrics = ProcessUpdateFrame(aFrameMetrics);
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, mLastRootMetrics);
return true;
}
} else {
// aFrameMetrics.mIsRoot is false, so we are trying to update a subframe.
@ -1487,6 +1489,7 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
if (content) {
FrameMetrics newSubFrameMetrics(aFrameMetrics);
APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics);
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, newSubFrameMetrics);
return true;
}
}
@ -1494,7 +1497,8 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
// We've recieved a message that is out of date and we want to ignore.
// However we can't reply without painting so we reply by painting the
// exact same thing as we did before.
return ProcessUpdateFrame(mLastRootMetrics);
mLastRootMetrics = ProcessUpdateFrame(mLastRootMetrics);
return true;
}
bool
@ -1505,11 +1509,11 @@ TabChild::RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
return true;
}
bool
FrameMetrics
TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
{
if (!mGlobal || !mTabChildGlobal) {
return true;
return aFrameMetrics;
}
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
@ -1549,22 +1553,20 @@ TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
data.AppendLiteral(" }");
DispatchMessageManagerMessage(NS_LITERAL_STRING("Viewport:Change"), data);
mLastRootMetrics = newMetrics;
return true;
return newMetrics;
}
bool
TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
TabChild::RecvHandleDoubleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (!mGlobal || !mTabChildGlobal) {
return true;
}
CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
nsCString data;
data += nsPrintfCString("{ \"x\" : %d", aPoint.x);
data += nsPrintfCString(", \"y\" : %d", aPoint.y);
data += nsPrintfCString("{ \"x\" : %f", point.x);
data += nsPrintfCString(", \"y\" : %f", point.y);
data += nsPrintfCString(" }");
DispatchMessageManagerMessage(NS_LITERAL_STRING("Gesture:DoubleTap"), data);
@ -1573,13 +1575,13 @@ TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGu
}
bool
TabChild::RecvHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
TabChild::RecvHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (!mGlobal || !mTabChildGlobal) {
return true;
}
LayoutDevicePoint currentPoint = CSSPoint(aPoint) * mWidget->GetDefaultScale();;
LayoutDevicePoint currentPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid) * mWidget->GetDefaultScale();;
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
@ -1598,14 +1600,16 @@ TabChild::FireSingleTapEvent(LayoutDevicePoint aPoint)
}
bool
TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
TabChild::RecvHandleLongTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (!mGlobal || !mTabChildGlobal) {
return true;
}
mContextMenuHandled =
DispatchMouseEvent(NS_LITERAL_STRING("contextmenu"), aPoint, 2, 1, 0, false,
DispatchMouseEvent(NS_LITERAL_STRING("contextmenu"),
APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid),
2, 1, 0, false,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
SendContentReceivedTouch(aGuid, mContextMenuHandled);
@ -1614,7 +1618,7 @@ TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid
}
bool
TabChild::RecvHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
TabChild::RecvHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (mContextMenuHandled) {
mContextMenuHandled = false;
@ -1857,6 +1861,10 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid)
{
WidgetTouchEvent localEvent(aEvent);
for (size_t i = 0; i < localEvent.touches.Length(); i++) {
aEvent.touches[i]->mRefPoint = APZCCallbackHelper::ApplyCallbackTransform(aEvent.touches[i]->mRefPoint, aGuid, mWidget->GetDefaultScale());
}
nsEventStatus status = DispatchWidgetEvent(localEvent);
if (!IsAsyncPanZoomEnabled()) {

View File

@ -218,13 +218,13 @@ public:
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
virtual bool RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint,
virtual bool RecvHandleDoubleTap(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint,
virtual bool RecvHandleSingleTap(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint,
virtual bool RecvHandleLongTap(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvHandleLongTapUp(const CSSIntPoint& aPoint,
virtual bool RecvHandleLongTapUp(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId) MOZ_OVERRIDE;
@ -417,7 +417,7 @@ private:
bool InitRenderingState();
void DestroyWindow();
void SetProcessNameToAppName();
bool ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
FrameMetrics ProcessUpdateFrame(const FrameMetrics& aFrameMetrics);
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow();

View File

@ -516,7 +516,7 @@ TabParent::AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScr
}
}
void TabParent::HandleDoubleTap(const CSSIntPoint& aPoint,
void TabParent::HandleDoubleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid &aGuid)
{
@ -525,7 +525,7 @@ void TabParent::HandleDoubleTap(const CSSIntPoint& aPoint,
}
}
void TabParent::HandleSingleTap(const CSSIntPoint& aPoint,
void TabParent::HandleSingleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid &aGuid)
{
@ -535,7 +535,7 @@ void TabParent::HandleSingleTap(const CSSIntPoint& aPoint,
}
}
void TabParent::HandleLongTap(const CSSIntPoint& aPoint,
void TabParent::HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid &aGuid)
{
@ -544,7 +544,7 @@ void TabParent::HandleLongTap(const CSSIntPoint& aPoint,
}
}
void TabParent::HandleLongTapUp(const CSSIntPoint& aPoint,
void TabParent::HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid &aGuid)
{
@ -721,7 +721,7 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
return PBrowserParent::SendRealMouseEvent(event);
}
CSSIntPoint TabParent::AdjustTapToChildWidget(const CSSIntPoint& aPoint)
CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
@ -735,12 +735,12 @@ CSSIntPoint TabParent::AdjustTapToChildWidget(const CSSIntPoint& aPoint)
}
nsPresContext* presContext = doc->GetShell()->GetPresContext();
return CSSIntPoint(
aPoint.x + presContext->DevPixelsToIntCSSPixels(mChildProcessOffsetAtTouchStart.x),
aPoint.y + presContext->DevPixelsToIntCSSPixels(mChildProcessOffsetAtTouchStart.y));
return aPoint + CSSPoint(
presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.x),
presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.y));
}
bool TabParent::SendHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
bool TabParent::SendHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (mIsDestroyed) {
return false;
@ -749,7 +749,7 @@ bool TabParent::SendHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableL
return PBrowserParent::SendHandleSingleTap(AdjustTapToChildWidget(aPoint), aGuid);
}
bool TabParent::SendHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
bool TabParent::SendHandleLongTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (mIsDestroyed) {
return false;
@ -758,7 +758,7 @@ bool TabParent::SendHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLay
return PBrowserParent::SendHandleLongTap(AdjustTapToChildWidget(aPoint), aGuid);
}
bool TabParent::SendHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
bool TabParent::SendHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (mIsDestroyed) {
return false;
@ -767,7 +767,7 @@ bool TabParent::SendHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableL
return PBrowserParent::SendHandleLongTapUp(AdjustTapToChildWidget(aPoint), aGuid);
}
bool TabParent::SendHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid)
bool TabParent::SendHandleDoubleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
{
if (mIsDestroyed) {
return false;

View File

@ -198,16 +198,16 @@ public:
void UpdateDimensions(const nsRect& rect, const nsIntSize& size);
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration);
void HandleDoubleTap(const CSSIntPoint& aPoint,
void HandleDoubleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void HandleSingleTap(const CSSIntPoint& aPoint,
void HandleSingleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void HandleLongTap(const CSSIntPoint& aPoint,
void HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void HandleLongTapUp(const CSSIntPoint& aPoint,
void HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void NotifyTransformBegin(ViewID aViewId);
@ -229,10 +229,10 @@ public:
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& event);
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
bool SendRealTouchEvent(WidgetTouchEvent& event);
bool SendHandleSingleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleLongTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleLongTapUp(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleDoubleTap(const CSSIntPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleLongTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid);
bool SendHandleDoubleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid);
virtual PDocumentRendererParent*
AllocPDocumentRendererParent(const nsRect& documentRect,
@ -360,7 +360,7 @@ private:
nsRefPtr<ContentParent> mManager;
void TryCacheDPIAndScale();
CSSIntPoint AdjustTapToChildWidget(const CSSIntPoint& aPoint);
CSSPoint AdjustTapToChildWidget(const CSSPoint& aPoint);
// When true, we create a pan/zoom controller for our frame and
// notify it of input events targeting us.

View File

@ -21,4 +21,4 @@ disabled = disabled until bug 859593 is fixed
[test_keyboard.html]
skip-if = buildapp != 'b2g'
[test_wifi-manage.html]
skip-if = buildapp != 'b2g'
skip-if = (buildapp != 'b2g') || (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)

View File

@ -1566,13 +1566,7 @@ bool nsPluginHost::IsJavaMIMEType(const char* aType)
(0 == PL_strncasecmp(aType, "application/x-java-applet",
sizeof("application/x-java-applet") - 1)) ||
(0 == PL_strncasecmp(aType, "application/x-java-bean",
sizeof("application/x-java-bean") - 1))
#ifdef DEBUG
// Emulate java handling for the npjavatest plugin
|| (0 == PL_strncasecmp(aType, "application/x-java-test",
sizeof("application/x-java-test") - 1))
#endif
);
sizeof("application/x-java-bean") - 1)));
}
// Check whether or not a tag is a live, valid tag, and that it's loaded.

View File

@ -1682,7 +1682,8 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent)
return NS_OK;
}
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
bool aAllowPropagate)
{
#if !defined(XP_MACOSX)
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
@ -1699,7 +1700,9 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
nsEventStatus rv = ProcessEvent(*mouseEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
aMouseEvent->PreventDefault();
aMouseEvent->StopPropagation();
if (!aAllowPropagate) {
aMouseEvent->StopPropagation();
}
}
if (mouseEvent->message == NS_MOUSE_BUTTON_UP) {
mLastMouseDownButtonType = -1;
@ -1741,8 +1744,10 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
}
return DispatchMouseToPlugin(aEvent);
}
if (eventType.EqualsLiteral("mousemove") ||
eventType.EqualsLiteral("click") ||
if (eventType.EqualsLiteral("mousemove")) {
return DispatchMouseToPlugin(aEvent, true);
}
if (eventType.EqualsLiteral("click") ||
eventType.EqualsLiteral("dblclick") ||
eventType.EqualsLiteral("mouseover") ||
eventType.EqualsLiteral("mouseout")) {

View File

@ -365,7 +365,8 @@ private:
nsRefPtr<nsPluginDOMContextMenuListener> mCXMenuListener;
nsresult DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent);
nsresult DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent);
nsresult DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
bool aAllowPropagate = false);
nsresult DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent);
int mLastMouseDownButtonType;

View File

@ -169,8 +169,9 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
#if defined(MOZ_X11) || defined(OS_MACOSX)
nsPluginInfo info = nsPluginInfo();
if (NS_FAILED(pluginFile.GetPluginInfo(info, &mLibrary)))
if (NS_FAILED(pluginFile.GetPluginInfo(info, &mLibrary))) {
return false;
}
#if defined(MOZ_X11)
NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
@ -181,6 +182,8 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
mozilla::plugins::PluginUtilsOSX::SetProcessName(info.fName);
#endif
pluginFile.FreePluginInfo(info);
if (!mLibrary)
#endif
{

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(tests that use plugins)
support-files =
307-xo-redirect.sjs
crashing_subpage.html

View File

@ -1,11 +1,11 @@
/* ***** BEGIN LICENSE BLOCK *****
*
*
* Copyright (c) 2008, Mozilla Corporation
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
@ -14,7 +14,7 @@
* * Neither the name of the Mozilla Corporation nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@ -25,11 +25,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
* Dave Townsend <dtownsend@oxymoronical.com>
* Josh Aas <josh@mozilla.com>
*
*
* ***** END LICENSE BLOCK ***** */
#include "nptest.h"
@ -389,7 +389,7 @@ static void initializeIdentifiers()
NPN_GetStringIdentifiers(sPluginPropertyIdentifierNames,
ARRAY_LENGTH(sPluginPropertyIdentifierNames), sPluginPropertyIdentifiers);
sIdentifiersInitialized = true;
sIdentifiersInitialized = true;
// Check whether nullptr is handled in NPN_GetStringIdentifiers
NPIdentifier IDList[2];
@ -431,7 +431,7 @@ static void sendBufferToFrame(NPP instance)
if (!instanceData->npnNewStream) outbuf = "data:text/html,";
const char* buf = reinterpret_cast<char *>(instanceData->streamBuf);
int32_t bufsize = instanceData->streamBufSize;
if (instanceData->streamMode == NP_ASFILE ||
if (instanceData->streamMode == NP_ASFILE ||
instanceData->streamMode == NP_ASFILEONLY) {
buf = reinterpret_cast<char *>(instanceData->fileBuf);
bufsize = instanceData->fileBufSize;
@ -445,24 +445,24 @@ static void sendBufferToFrame(NPP instance)
else {
outbuf.append("Error: no data in buffer");
}
if (instanceData->npnNewStream &&
instanceData->err.str().length() == 0) {
char typeHTML[] = "text/html";
NPStream* stream;
printf("calling NPN_NewStream...");
NPError err = NPN_NewStream(instance, typeHTML,
NPError err = NPN_NewStream(instance, typeHTML,
instanceData->frame.c_str(), &stream);
printf("return value %d\n", err);
if (err != NPERR_NO_ERROR) {
instanceData->err << "NPN_NewStream returned " << err;
return;
}
int32_t bytesToWrite = outbuf.length();
int32_t bytesWritten = 0;
while ((bytesToWrite - bytesWritten) > 0) {
int32_t numBytes = (bytesToWrite - bytesWritten) <
int32_t numBytes = (bytesToWrite - bytesWritten) <
instanceData->streamChunkSize ?
bytesToWrite - bytesWritten : instanceData->streamChunkSize;
int32_t written = NPN_Write(instance, stream,
@ -503,7 +503,7 @@ static void sendBufferToFrame(NPP instance)
}
}
NPError err = NPN_GetURL(instance, outbuf.c_str(),
NPError err = NPN_GetURL(instance, outbuf.c_str(),
instanceData->frame.c_str());
if (err != NPERR_NO_ERROR) {
instanceData->err << "NPN_GetURL returned " << err;
@ -523,7 +523,7 @@ static void XPSleep(unsigned int seconds)
TestFunction
getFuncFromString(const char* funcname)
{
FunctionTable funcTable[] =
FunctionTable funcTable[] =
{
{ FUNCTION_NPP_NEWSTREAM, "npp_newstream" },
{ FUNCTION_NPP_WRITEREADY, "npp_writeready" },
@ -856,7 +856,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
for (int i = 0; i < argc; i++) {
if (strcmp(argn[i], "drawmode") == 0) {
if (strcmp(argv[i], "solid") == 0)
scriptableObject->drawMode = DM_SOLID_COLOR;
scriptableObject->drawMode = DM_SOLID_COLOR;
}
else if (strcmp(argn[i], "color") == 0) {
scriptableObject->drawColor = parseHexColor(argv[i], strlen(argv[i]));
@ -1034,7 +1034,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
NPN_ReleaseObject(o);
o = nullptr;
}
// Set a property on NPNVWindowNPObject
err = NPN_GetValue(instance, NPNVWindowNPObject, &o);
if (err == NPERR_NO_ERROR) {
@ -1053,7 +1053,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
}
}
else if (instanceData->testFunction == FUNCTION_NPP_GETURLNOTIFY) {
NPError err = NPN_GetURLNotify(instance, instanceData->testUrl.c_str(),
NPError err = NPN_GetURLNotify(instance, instanceData->testUrl.c_str(),
nullptr, static_cast<void*>(&kNotifyData));
if (err != NPERR_NO_ERROR) {
instanceData->err << "NPN_GetURLNotify returned " << err;
@ -1178,7 +1178,7 @@ NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable,
{
printf("NPP_NewStream\n");
InstanceData* instanceData = (InstanceData*)(instance->pdata);
if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM &&
instanceData->failureCode) {
instanceData->err << SUCCESS_STRING;
@ -1257,20 +1257,20 @@ NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
return NPERR_GENERIC_ERROR;
}
if (strcmp(reinterpret_cast<char *>(instanceData->fileBuf),
if (strcmp(reinterpret_cast<char *>(instanceData->fileBuf),
reinterpret_cast<char *>(instanceData->streamBuf))) {
instanceData->err <<
"Error: data passed to NPP_Write and NPP_StreamAsFile differed";
}
}
if (instanceData->frame.length() > 0 &&
if (instanceData->frame.length() > 0 &&
instanceData->testFunction != FUNCTION_NPP_GETURLNOTIFY &&
instanceData->testFunction != FUNCTION_NPP_POSTURL) {
sendBufferToFrame(instance);
}
if (instanceData->testFunction == FUNCTION_NPP_POSTURL) {
NPError err = NPN_PostURL(instance, instanceData->testUrl.c_str(),
instanceData->postMode == POSTMODE_FRAME ? instanceData->frame.c_str() : nullptr,
NPError err = NPN_PostURL(instance, instanceData->testUrl.c_str(),
instanceData->postMode == POSTMODE_FRAME ? instanceData->frame.c_str() : nullptr,
instanceData->streamBufSize,
reinterpret_cast<char *>(instanceData->streamBuf), false);
if (err != NPERR_NO_ERROR)
@ -1288,7 +1288,7 @@ NPP_WriteReady(NPP instance, NPStream* stream)
if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM) {
instanceData->err << "NPP_WriteReady called";
}
// temporarily disabled per bug 519870
//if (instanceData->writeReadyCount == 1) {
// return 0;
@ -1318,7 +1318,7 @@ NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf
return len;
}
if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM) {
instanceData->err << "NPP_Write called";
}
@ -1354,7 +1354,7 @@ NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf
NPN_DestroyStream(instance, stream, NPRES_USER_BREAK);
}
else if (instanceData->streamMode == NP_SEEK &&
stream->end != 0 &&
stream->end != 0 &&
stream->end == ((uint32_t)instanceData->streamBufSize + len)) {
// If the complete stream has been written, and we're doing a seek test,
// then call NPN_RequestRead.
@ -1373,7 +1373,7 @@ NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf
char* streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
if (offset + len <= instanceData->streamBufSize) {
if (memcmp(buffer, streamBuf + offset, len)) {
instanceData->err <<
instanceData->err <<
"Error: data written from NPN_RequestRead doesn't match";
}
else {
@ -1402,8 +1402,8 @@ NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf
streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
}
else {
instanceData->streamBuf =
realloc(reinterpret_cast<char *>(instanceData->streamBuf),
instanceData->streamBuf =
realloc(reinterpret_cast<char *>(instanceData->streamBuf),
instanceData->streamBufSize + len + 1);
streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
}
@ -1813,14 +1813,14 @@ NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
}
NPError
NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32_t len,
NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32_t len,
const char* buf, NPBool file, void* notifyData)
{
return sBrowserFuncs->posturlnotify(instance, url, target, len, buf, file, notifyData);
}
NPError
NPError
NPN_PostURL(NPP instance, const char *url,
const char *target, uint32_t len,
const char *buf, NPBool file)
@ -1835,8 +1835,8 @@ NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
}
NPError
NPN_NewStream(NPP instance,
NPMIMEType type,
NPN_NewStream(NPP instance,
NPMIMEType type,
const char* target,
NPStream** stream)
{
@ -1858,7 +1858,7 @@ NPN_Enumerate(NPP instance,
NPIdentifier **identifiers,
uint32_t *identifierCount)
{
return sBrowserFuncs->enumerate(instance, npobj, identifiers,
return sBrowserFuncs->enumerate(instance, npobj, identifiers,
identifierCount);
}
@ -1999,7 +1999,7 @@ scriptableInvoke(NPObject* npobj, NPIdentifier name, const NPVariant* args, uint
}
return false;
}
for (int i = 0; i < int(ARRAY_LENGTH(sPluginMethodIdentifiers)); i++) {
if (name == sPluginMethodIdentifiers[i])
return sPluginMethodFunctions[i](npobj, args, argCount, result);
@ -2048,7 +2048,9 @@ scriptableInvokeDefault(NPObject* npobj, const NPVariant* args, uint32_t argCoun
value << ";other";
}
}
STRINGZ_TO_NPVARIANT(NPN_StrDup(value.str().c_str()), *result);
char *outval = NPN_StrDup(value.str().c_str());
STRINGZ_TO_NPVARIANT(outval, *result);
return true;
}
@ -2056,16 +2058,21 @@ bool
scriptableHasProperty(NPObject* npobj, NPIdentifier name)
{
if (NPN_IdentifierIsString(name)) {
if (NPN_GetStringIdentifier(NPN_UTF8FromIdentifier(name)) != name)
NPUTF8 *asUTF8 = NPN_UTF8FromIdentifier(name);
if (NPN_GetStringIdentifier(asUTF8) != name) {
Crash();
}
NPN_MemFree(asUTF8);
}
else {
if (NPN_GetIntIdentifier(NPN_IntFromIdentifier(name)) != name)
if (NPN_GetIntIdentifier(NPN_IntFromIdentifier(name)) != name) {
Crash();
}
}
for (int i = 0; i < int(ARRAY_LENGTH(sPluginPropertyIdentifiers)); i++) {
if (name == sPluginPropertyIdentifiers[i])
if (name == sPluginPropertyIdentifiers[i]) {
return true;
}
}
return false;
}
@ -2141,7 +2148,7 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
" expected " << var2->type;
return false;
}
switch (var1->type) {
case NPVariantType_Int32: {
int32_t result = NPVARIANT_TO_INT32(*var1);
@ -2184,8 +2191,8 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
const NPString* expected = &NPVARIANT_TO_STRING(*var2);
if (strcmp(result->UTF8Characters, expected->UTF8Characters) ||
strlen(result->UTF8Characters) != strlen(expected->UTF8Characters)) {
id->err << "Variant values don't match; got " <<
result->UTF8Characters << " expected " <<
id->err << "Variant values don't match; got " <<
result->UTF8Characters << " expected " <<
expected->UTF8Characters;
success = false;
}
@ -2221,7 +2228,7 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
success = false;
}
else {
success = compareVariants(instance, &resultVariant,
success = compareVariants(instance, &resultVariant,
&expectedVariant);
NPN_ReleaseVariantValue(&expectedVariant);
}
@ -2235,7 +2242,7 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
id->err << "Unknown variant type";
success = false;
}
return success;
}
@ -2246,7 +2253,7 @@ throwExceptionNextInvoke(NPObject* npobj, const NPVariant* args, uint32_t argCou
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
id->throwOnNextInvoke = true;
BOOLEAN_TO_NPVARIANT(true, *result);
return true;
return true;
}
static bool
@ -2254,7 +2261,7 @@ npnInvokeDefaultTest(NPObject* npobj, const NPVariant* args, uint32_t argCount,
{
bool success = false;
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
NPObject* windowObject;
NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
if (!windowObject)
@ -2271,7 +2278,7 @@ npnInvokeDefaultTest(NPObject* npobj, const NPVariant* args, uint32_t argCount,
NPObject* selfObject = NPVARIANT_TO_OBJECT(objectVariant);
if (selfObject != nullptr) {
NPVariant resultVariant;
if (NPN_InvokeDefault(npp, selfObject, argCount > 1 ? &args[1] : nullptr,
if (NPN_InvokeDefault(npp, selfObject, argCount > 1 ? &args[1] : nullptr,
argCount - 1, &resultVariant)) {
*result = resultVariant;
success = true;
@ -2297,18 +2304,18 @@ npnInvokeTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria
NPIdentifier function = variantToIdentifier(args[0]);
if (!function)
return false;
NPObject* windowObject;
NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
if (!windowObject)
return false;
NPVariant invokeResult;
bool invokeReturn = NPN_Invoke(npp, windowObject, function,
argCount > 2 ? &args[2] : nullptr, argCount - 2, &invokeResult);
bool compareResult = compareVariants(npp, &invokeResult, &args[1]);
NPN_ReleaseObject(windowObject);
NPN_ReleaseVariantValue(&invokeResult);
BOOLEAN_TO_NPVARIANT(invokeReturn && compareResult, *result);
@ -2320,10 +2327,10 @@ npnEvaluateTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVar
{
bool success = false;
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
if (argCount != 1)
return false;
if (!NPVARIANT_IS_STRING(args[0]))
return false;
@ -2331,9 +2338,9 @@ npnEvaluateTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVar
NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
if (!windowObject)
return false;
success = NPN_Evaluate(npp, windowObject, (NPString*)&NPVARIANT_TO_STRING(args[0]), result);
NPN_ReleaseObject(windowObject);
return success;
}
@ -2580,10 +2587,13 @@ getError(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* r
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
if (id->err.str().length() == 0)
STRINGZ_TO_NPVARIANT(NPN_StrDup(SUCCESS_STRING), *result);
else
STRINGZ_TO_NPVARIANT(NPN_StrDup(id->err.str().c_str()), *result);
if (id->err.str().length() == 0) {
char *outval = NPN_StrDup(SUCCESS_STRING);
STRINGZ_TO_NPVARIANT(outval, *result);
} else {
char *outval = NPN_StrDup(id->err.str().c_str());
STRINGZ_TO_NPVARIANT(outval, *result);
}
return true;
}
@ -2663,7 +2673,7 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria
double resultX, resultY;
NPN_ConvertPoint(npp, sourceX, sourceY, (NPCoordinateSpace)sourceSpace, &resultX, &resultY, (NPCoordinateSpace)destSpace);
DOUBLE_TO_NPVARIANT(resultY, *result);
return true;
}
@ -2906,7 +2916,9 @@ static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t arg
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
STRINGZ_TO_NPVARIANT(NPN_StrDup(id->javaCodebase.c_str()), *result);
char *outval = NPN_StrDup(id->javaCodebase.c_str());
STRINGZ_TO_NPVARIANT(outval, *result);
return true;
}
@ -2954,12 +2966,12 @@ static bool enableFPExceptions(NPObject* npobj, const NPVariant* args, uint32_t
// caller is responsible for freeing return buffer
static char* URLForInstanceWindow(NPP instance) {
char *outString = nullptr;
NPObject* windowObject = nullptr;
NPError err = NPN_GetValue(instance, NPNVWindowNPObject, &windowObject);
if (err != NPERR_NO_ERROR || !windowObject)
return nullptr;
NPIdentifier locationIdentifier = NPN_GetStringIdentifier("location");
NPVariant locationVariant;
if (NPN_GetProperty(instance, windowObject, locationIdentifier, &locationVariant)) {
@ -2977,13 +2989,13 @@ static char* URLForInstanceWindow(NPP instance) {
}
}
NPN_ReleaseVariantValue(&hrefVariant);
}
}
}
NPN_ReleaseVariantValue(&locationVariant);
}
NPN_ReleaseObject(windowObject);
return outString;
}
@ -2995,15 +3007,15 @@ setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
if (!NPVARIANT_IS_STRING(args[0]))
return false;
const NPString* cookie = &NPVARIANT_TO_STRING(args[0]);
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
char* url = URLForInstanceWindow(npp);
if (!url)
return false;
NPError err = NPN_SetValueForURL(npp, NPNURLVCookie, url, cookie->UTF8Characters, cookie->UTF8Length);
free(url);
return (err == NPERR_NO_ERROR);
}
@ -3012,9 +3024,9 @@ getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
{
if (argCount != 0)
return false;
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
char* url = URLForInstanceWindow(npp);
if (!url)
return false;
@ -3024,7 +3036,7 @@ getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
free(url);
if (err != NPERR_NO_ERROR || !cookie)
return false;
STRINGZ_TO_NPVARIANT(cookie, *result);
return true;
}
@ -3051,18 +3063,18 @@ getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant
char* username = nullptr;
char* password = nullptr;
uint32_t ulen = 0, plen = 0;
NPError err = NPN_GetAuthenticationInfo(npp,
protocol->UTF8Characters,
host->UTF8Characters,
port,
scheme->UTF8Characters,
NPError err = NPN_GetAuthenticationInfo(npp,
protocol->UTF8Characters,
host->UTF8Characters,
port,
scheme->UTF8Characters,
realm->UTF8Characters,
&username,
&ulen,
&password,
&username,
&ulen,
&password,
&plen);
if (err != NPERR_NO_ERROR) {
return false;
}
@ -3077,7 +3089,7 @@ getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant
NPN_MemFree(username);
NPN_MemFree(password);
return true;
}
@ -3105,7 +3117,7 @@ static void timerCallback(NPP npp, uint32_t timerID)
}
NPN_ReleaseObject(windowObject);
if (event.timerIdSchedule > -1) {
id->timerID[event.timerIdSchedule] = NPN_ScheduleTimer(npp, event.timerInterval, event.timerRepeat, timerCallback);
}
@ -3128,9 +3140,9 @@ timerTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
id->timerTestResult = true;
timerEvent event = timerEvents[currentTimerEventCount];
id->timerID[event.timerIdSchedule] = NPN_ScheduleTimer(npp, event.timerInterval, event.timerRepeat, timerCallback);
return id->timerID[event.timerIdSchedule] != 0;
}
@ -3171,7 +3183,7 @@ asyncCallback(void* cookie)
id->asyncCallbackResult = false;
#endif
break;
// async callback triggered from different thread
default:
NPObject* windowObject;
@ -3197,11 +3209,11 @@ asyncCallbackTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPV
return false;
const NPString* argstr = &NPVARIANT_TO_STRING(args[0]);
id->asyncTestScriptCallback = argstr->UTF8Characters;
id->asyncTestPhase = 0;
id->asyncCallbackResult = true;
NPN_PluginThreadAsyncCall(npp, asyncCallback, (void*)npobj);
return true;
}
@ -3287,7 +3299,7 @@ checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount,
return false;
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
NPObject* localFunc =
NPN_CreateObject(npp, const_cast<NPClass*>(&kGCRaceClass));
@ -3310,7 +3322,7 @@ hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount,
busyHang = NPVARIANT_TO_BOOLEAN(args[0]);
}
if (busyHang) {
if (busyHang) {
const time_t start = std::time(nullptr);
while ((std::time(nullptr) - start) < 100000) {
volatile int dummy = 0;
@ -3660,7 +3672,7 @@ bool constructObject(NPObject* npobj, const NPVariant* args, uint32_t argCount,
return false;
NPObject* ctor = NPVARIANT_TO_OBJECT(args[0]);
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
return NPN_Construct(npp, ctor, args + 1, argCount - 1, result);
@ -3693,12 +3705,12 @@ bool setSitesWithData(NPObject* npobj, const NPVariant* args, uint32_t argCount,
const char* flagsEnd = strchr(siteEnd + 1, ':');
*((char*) flagsEnd) = '\0';
*((char*) next) = '\0';
siteData data;
data.site = string(iterator);
data.flags = atoi(siteEnd + 1);
data.age = atoi(flagsEnd + 1);
sSitesWithData->push_back(data);
if (next == end)
@ -3728,7 +3740,9 @@ bool getLastKeyText(NPObject* npobj, const NPVariant* args, uint32_t argCount,
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
STRINGZ_TO_NPVARIANT(NPN_StrDup(id->lastKeyText.c_str()), *result);
char *outval = NPN_StrDup(id->lastKeyText.c_str());
STRINGZ_TO_NPVARIANT(outval, *result);
return true;
}
@ -3756,7 +3770,7 @@ bool getMouseUpEventCount(NPObject* npobj, const NPVariant* args, uint32_t argCo
if (argCount != 0) {
return false;
}
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
INT32_TO_NPVARIANT(id->mouseUpEventCount, *result);

View File

@ -185,11 +185,10 @@ public:
NS_IMPL_CYCLE_COLLECTION_CLASS(Promise)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Promise)
tmp->MaybeReportRejected();
tmp->MaybeReportRejectedOnce();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolveCallbacks);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRejectCallbacks);
tmp->mResult = JS::UndefinedValue();
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -229,8 +228,7 @@ Promise::Promise(nsIGlobalObject* aGlobal)
Promise::~Promise()
{
MaybeReportRejected();
mResult = JS::UndefinedValue();
MaybeReportRejectedOnce();
mozilla::DropJSObjects(this);
}
@ -822,6 +820,9 @@ Promise::AppendCallbacks(PromiseCallback* aResolveCallback,
if (aRejectCallback) {
mHadRejectCallback = true;
mRejectCallbacks.AppendElement(aRejectCallback);
// Now that there is a callback, we don't need to report anymore.
RemoveFeature();
}
// If promise's state is resolved, queue a task to process our resolve
@ -1058,9 +1059,47 @@ Promise::RunResolveTask(JS::Handle<JS::Value> aValue,
SetResult(aValue);
SetState(aState);
// If the Promise was rejected, and there is no reject handler already setup,
// watch for thread shutdown.
if (aState == PromiseState::Rejected &&
!mHadRejectCallback &&
!NS_IsMainThread()) {
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
mFeature = new PromiseReportRejectFeature(this);
if (NS_WARN_IF(!worker->AddFeature(worker->GetJSContext(), mFeature))) {
// Worker is shutting down, report rejection immediately since it is
// unlikely that reject callbacks will be added after this point.
MaybeReportRejected();
}
}
RunTask();
}
void
Promise::RemoveFeature()
{
if (mFeature) {
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->RemoveFeature(worker->GetJSContext(), mFeature);
mFeature = nullptr;
}
}
bool
PromiseReportRejectFeature::Notify(JSContext* aCx, workers::Status aStatus)
{
MOZ_ASSERT(aStatus > workers::Running);
mPromise->MaybeReportRejectedOnce();
// After this point, `this` has been deleted by RemoveFeature!
return true;
}
bool
Promise::ArgumentToJSValue(const nsAString& aArgument,
JSContext* aCx,

View File

@ -18,6 +18,8 @@
#include "nsAutoPtr.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/workers/bindings/WorkerFeature.h"
class nsIGlobalObject;
namespace mozilla {
@ -28,6 +30,23 @@ class PromiseCallback;
class PromiseInit;
class PromiseNativeHandler;
class Promise;
class PromiseReportRejectFeature : public workers::WorkerFeature
{
// The Promise that owns this feature.
Promise* mPromise;
public:
PromiseReportRejectFeature(Promise* aPromise)
: mPromise(aPromise)
{
MOZ_ASSERT(mPromise);
}
virtual bool
Notify(JSContext* aCx, workers::Status aStatus) MOZ_OVERRIDE;
};
class Promise MOZ_FINAL : public nsISupports,
public nsWrapperCache
{
@ -35,6 +54,7 @@ class Promise MOZ_FINAL : public nsISupports,
friend class PromiseResolverMixin;
friend class PromiseResolverTask;
friend class PromiseTask;
friend class PromiseReportRejectFeature;
friend class RejectPromiseCallback;
friend class ResolvePromiseCallback;
friend class WorkerPromiseResolverTask;
@ -157,8 +177,15 @@ private:
// If we have been rejected and our mResult is a JS exception,
// report it to the error console.
// Use MaybeReportRejectedOnce() for actual calls.
void MaybeReportRejected();
void MaybeReportRejectedOnce() {
MaybeReportRejected();
RemoveFeature();
mResult = JS::UndefinedValue();
}
void MaybeResolveInternal(JSContext* aCx,
JS::Handle<JS::Value> aValue,
PromiseTaskSync aSync = AsyncTask);
@ -271,6 +298,8 @@ private:
void HandleException(JSContext* aCx);
void RemoveFeature();
nsRefPtr<nsIGlobalObject> mGlobal;
nsTArray<nsRefPtr<PromiseCallback> > mResolveCallbacks;
@ -282,6 +311,12 @@ private:
bool mHadRejectCallback;
bool mResolvePending;
// If a rejected promise on a worker has no reject callbacks attached, it
// needs to know when the worker is shutting down, to report the error on the
// console before the worker's context is deleted. This feature is used for
// that purpose.
nsAutoPtr<PromiseReportRejectFeature> mFeature;
};
} // namespace dom

View File

@ -573,7 +573,7 @@ Nfc.prototype = {
}
// Update the current sessionId before sending to the worker
message.sessionId = this._currentSessionId;
message.json.sessionId = this._currentSessionId;
switch (message.name) {
case "NFC:GetDetailsNDEF":

View File

@ -310,15 +310,17 @@ gfxMemorySharedReadLock::GetReadCount()
gfxShmSharedReadLock::gfxShmSharedReadLock(ISurfaceAllocator* aAllocator)
: mAllocator(aAllocator)
, mAllocSuccess(false)
{
MOZ_COUNT_CTOR(gfxShmSharedReadLock);
MOZ_ASSERT(mAllocator);
if (mAllocator) {
#define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3)
if (mAllocator->AllocUnsafeShmem(MOZ_ALIGN_WORD(sizeof(ShmReadLockInfo)),
mozilla::ipc::SharedMemory::TYPE_BASIC, &mShmem)) {
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
info->readCount = 1;
mAllocSuccess = true;
}
}
}
@ -331,13 +333,18 @@ gfxShmSharedReadLock::~gfxShmSharedReadLock()
int32_t
gfxShmSharedReadLock::ReadLock() {
NS_ASSERT_OWNINGTHREAD(gfxShmSharedReadLock);
if (!mAllocSuccess) {
return 0;
}
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
return PR_ATOMIC_INCREMENT(&info->readCount);
}
int32_t
gfxShmSharedReadLock::ReadUnlock() {
if (!mAllocSuccess) {
return 0;
}
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
int32_t readCount = PR_ATOMIC_DECREMENT(&info->readCount);
NS_ASSERTION(readCount >= 0, "ReadUnlock called without a ReadLock.");
@ -350,7 +357,9 @@ gfxShmSharedReadLock::ReadUnlock() {
int32_t
gfxShmSharedReadLock::GetReadCount() {
NS_ASSERT_OWNINGTHREAD(gfxShmSharedReadLock);
if (!mAllocSuccess) {
return 0;
}
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
return info->readCount;
}
@ -514,6 +523,9 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion, TextureClientPool *aP
} else {
mBackLock = new gfxShmSharedReadLock(mManager->AsShadowForwarder());
}
MOZ_ASSERT(mBackLock->IsValid());
*aCreatedTextureClient = true;
mInvalidBack = nsIntRect(0, 0, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
}

View File

@ -55,6 +55,7 @@ public:
virtual int32_t ReadLock() = 0;
virtual int32_t ReadUnlock() = 0;
virtual int32_t GetReadCount() = 0;
virtual bool IsValid() const = 0;
enum gfxSharedReadLockType {
TYPE_MEMORY,
@ -80,6 +81,8 @@ public:
virtual gfxSharedReadLockType GetType() MOZ_OVERRIDE { return TYPE_MEMORY; }
virtual bool IsValid() const MOZ_OVERRIDE { return true; };
private:
int32_t mReadCount;
};
@ -101,6 +104,8 @@ public:
virtual int32_t GetReadCount() MOZ_OVERRIDE;
virtual bool IsValid() const MOZ_OVERRIDE { return mAllocSuccess; };
virtual gfxSharedReadLockType GetType() MOZ_OVERRIDE { return TYPE_SHMEM; }
mozilla::ipc::Shmem& GetShmem() { return mShmem; }
@ -116,6 +121,7 @@ private:
gfxShmSharedReadLock(ISurfaceAllocator* aAllocator, const mozilla::ipc::Shmem& aShmem)
: mAllocator(aAllocator)
, mShmem(aShmem)
, mAllocSuccess(true)
{
MOZ_COUNT_CTOR(gfxShmSharedReadLock);
}
@ -128,6 +134,7 @@ private:
RefPtr<ISurfaceAllocator> mAllocator;
mozilla::ipc::Shmem mShmem;
bool mAllocSuccess;
};
/**
@ -170,14 +177,18 @@ struct TileClient
void ReadUnlock()
{
NS_ASSERTION(mFrontLock != nullptr, "ReadUnlock with no gfxSharedReadLock");
mFrontLock->ReadUnlock();
MOZ_ASSERT(mFrontLock, "ReadLock with no gfxSharedReadLock");
if (mFrontLock) {
mFrontLock->ReadUnlock();
}
}
void ReadLock()
{
NS_ASSERTION(mFrontLock != nullptr, "ReadLock with no gfxSharedReadLock");
mFrontLock->ReadLock();
MOZ_ASSERT(mFrontLock, "ReadLock with no gfxSharedReadLock");
if (mFrontLock) {
mFrontLock->ReadLock();
}
}
void Release()

View File

@ -904,7 +904,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
}
bool
AsyncPanZoomController::ConvertToGecko(const ScreenPoint& aPoint, CSSIntPoint* aOut)
AsyncPanZoomController::ConvertToGecko(const ScreenPoint& aPoint, CSSPoint* aOut)
{
APZCTreeManager* treeManagerLocal = mTreeManager;
if (treeManagerLocal) {
@ -917,8 +917,7 @@ AsyncPanZoomController::ConvertToGecko(const ScreenPoint& aPoint, CSSIntPoint* a
LayoutDevicePoint layoutPoint = LayoutDevicePoint(result.x, result.y);
{ // scoped lock to access mFrameMetrics
ReentrantMonitorAutoEnter lock(mMonitor);
CSSPoint cssPoint = layoutPoint / mFrameMetrics.mDevPixelsPerCSSPixel;
*aOut = gfx::RoundedToInt(cssPoint);
*aOut = layoutPoint / mFrameMetrics.mDevPixelsPerCSSPixel;
}
return true;
}
@ -930,7 +929,7 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
SetState(WAITING_CONTENT_RESPONSE);
SetContentResponseTimer();
@ -946,7 +945,7 @@ nsEventStatus AsyncPanZoomController::OnLongPressUp(const TapGestureInput& aEven
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleLongTapUp(geckoScreenPoint, modifiers, GetGuid());
return nsEventStatus_eConsumeNoDefault;
@ -962,7 +961,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
// sending event to content
if (controller && !mZoomConstraints.mAllowDoubleTapZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
// Because this may be being running as part of APZCTreeManager::ReceiveInputEvent,
// calling controller->HandleSingleTap directly might mean that content receives
@ -984,7 +983,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
// See comment in OnSingleTapUp as to why we do this in PostDelayedTask.
controller->PostDelayedTask(
@ -1003,7 +1002,7 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
if (controller) {
if (mZoomConstraints.mAllowDoubleTapZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleDoubleTap(geckoScreenPoint, modifiers, GetGuid());
}
@ -1685,7 +1684,8 @@ gfx3DMatrix AsyncPanZoomController::GetNontransientAsyncTransform() {
gfx3DMatrix AsyncPanZoomController::GetTransformToLastDispatchedPaint() {
ReentrantMonitorAutoEnter lock(mMonitor);
CSSPoint scrollChange = mLastContentPaintMetrics.mScrollOffset - mLastDispatchedPaintMetrics.mScrollOffset;
LayerPoint scrollChange = (mLastContentPaintMetrics.mScrollOffset - mLastDispatchedPaintMetrics.mScrollOffset)
* mLastContentPaintMetrics.LayersPixelsPerCSSPixel();
float zoomChange = mLastContentPaintMetrics.mZoom.scale / mLastDispatchedPaintMetrics.mZoom.scale;
return gfx3DMatrix::Translation(scrollChange.x, scrollChange.y, 0) *
gfx3DMatrix::ScalingMatrix(zoomChange, zoomChange, 1);

View File

@ -601,12 +601,12 @@ private:
void SetState(PanZoomState aState);
/**
* Convert ScreenPoint relative to this APZC to CSSIntPoint relative
* Convert ScreenPoint relative to this APZC to CSSPoint relative
* to the parent document. This excludes the transient compositor transform.
* NOTE: This must be converted to CSSIntPoint relative to the child
* NOTE: This must be converted to CSSPoint relative to the child
* document before sending over IPC.
*/
bool ConvertToGecko(const ScreenPoint& aPoint, CSSIntPoint* aOut);
bool ConvertToGecko(const ScreenPoint& aPoint, CSSPoint* aOut);
/**
* Internal helpers for checking general state of this apzc.

View File

@ -8,7 +8,7 @@
#define mozilla_layers_GeckoContentController_h
#include "FrameMetrics.h" // for FrameMetrics, etc
#include "Units.h" // for CSSIntPoint, CSSRect, etc
#include "Units.h" // for CSSPoint, CSSRect, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsISupportsImpl.h"
@ -42,7 +42,7 @@ public:
* AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
* to.
*/
virtual void HandleDoubleTap(const CSSIntPoint& aPoint,
virtual void HandleDoubleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) = 0;
@ -51,7 +51,7 @@ public:
* current scroll offset. This should simulate and send to content a mouse
* button down, then mouse button up at |aPoint|.
*/
virtual void HandleSingleTap(const CSSIntPoint& aPoint,
virtual void HandleSingleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) = 0;
@ -59,7 +59,7 @@ public:
* Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
* current scroll offset.
*/
virtual void HandleLongTap(const CSSIntPoint& aPoint,
virtual void HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) = 0;
@ -68,7 +68,7 @@ public:
* relative to the current scroll offset. HandleLongTapUp will always be
* preceeded by HandleLongTap
*/
virtual void HandleLongTapUp(const CSSIntPoint& aPoint,
virtual void HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) = 0;

View File

@ -10,7 +10,7 @@
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "base/task.h" // for CancelableTask, etc
#include "mozilla/Preferences.h" // for Preferences
#include "gfxPrefs.h" // for gfxPrefs
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/mozalloc.h" // for operator new
#include "nsDebug.h" // for NS_WARN_IF_FALSE
@ -85,7 +85,7 @@ nsEventStatus GestureEventListener::HandleInputEvent(const MultiTouchInput& aEve
mAsyncPanZoomController->PostDelayedTask(
mLongTapTimeoutTask,
Preferences::GetInt("ui.click_hold_context_menus.delay", 500));
gfxPrefs::UiClickHoldContextMenusDelay());
}
} else if (length == 2) {
// Another finger has been added; it can't be a tap anymore.

View File

@ -137,72 +137,6 @@ DrawQuads(GLContext *aGLContext,
aGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
}
#ifdef MOZ_WIDGET_GONK
CompositorOGLGonkBackendSpecificData::CompositorOGLGonkBackendSpecificData(CompositorOGL* aCompositor)
: mCompositor(aCompositor)
{
}
CompositorOGLGonkBackendSpecificData::~CompositorOGLGonkBackendSpecificData()
{
// Delete all textures by calling EndFrame twice
gl()->MakeCurrent();
EndFrame();
EndFrame();
}
GLContext*
CompositorOGLGonkBackendSpecificData::gl() const
{
return mCompositor->gl();
}
GLuint
CompositorOGLGonkBackendSpecificData::GetTexture()
{
GLuint texture = 0;
if (!mUnusedTextures.IsEmpty()) {
// Try to reuse one from the unused pile first
texture = mUnusedTextures[0];
mUnusedTextures.RemoveElementAt(0);
} else if (gl()->MakeCurrent()) {
// There isn't one to reuse, create one.
gl()->fGenTextures(1, &texture);
}
if (texture) {
mCreatedTextures.AppendElement(texture);
}
return texture;
}
void
CompositorOGLGonkBackendSpecificData::EndFrame()
{
gl()->MakeCurrent();
// Some platforms have issues unlocking Gralloc buffers even when they're
// rebound.
if (gfxPrefs::OverzealousGrallocUnlocking()) {
mUnusedTextures.AppendElements(mCreatedTextures);
mCreatedTextures.Clear();
}
// Delete unused textures
for (size_t i = 0; i < mUnusedTextures.Length(); i++) {
GLuint texture = mUnusedTextures[i];
gl()->fDeleteTextures(1, &texture);
}
mUnusedTextures.Clear();
// Move all created textures into the unused pile
mUnusedTextures.AppendElements(mCreatedTextures);
mCreatedTextures.Clear();
}
#endif
CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
int aSurfaceHeight, bool aUseExternalSurfaceSize)
: mWidget(aWidget)
@ -246,38 +180,18 @@ CompositorOGL::CreateContext()
return context.forget();
}
GLuint
CompositorOGL::GetTemporaryTexture(GLenum aTextureUnit)
{
size_t index = aTextureUnit - LOCAL_GL_TEXTURE0;
// lazily grow the array of temporary textures
if (mTextures.Length() <= index) {
size_t prevLength = mTextures.Length();
mTextures.SetLength(index + 1);
for(unsigned int i = prevLength; i <= index; ++i) {
mTextures[i] = 0;
}
}
// lazily initialize the temporary textures
if (!mTextures[index]) {
if (!gl()->MakeCurrent()) {
return 0;
}
gl()->fGenTextures(1, &mTextures[index]);
}
return mTextures[index];
}
void
CompositorOGL::Destroy()
{
if (gl() && gl()->MakeCurrent()) {
if (mTextures.Length() > 0) {
gl()->fDeleteTextures(mTextures.Length(), &mTextures[0]);
}
mVBOs.Flush(gl());
}
mTextures.SetLength(0);
if (mTexturePool) {
mTexturePool->Clear();
mTexturePool = nullptr;
}
if (!mDestroyed) {
mDestroyed = true;
CleanupResources();
@ -1366,11 +1280,9 @@ CompositorOGL::EndFrame()
mCurrentRenderTarget = nullptr;
#ifdef MOZ_WIDGET_GONK
if (mCompositorBackendSpecificData) {
static_cast<CompositorOGLGonkBackendSpecificData*>(mCompositorBackendSpecificData.get())->EndFrame();
if (mTexturePool) {
mTexturePool->EndFrame();
}
#endif
mGLContext->SwapBuffers();
mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
@ -1480,17 +1392,6 @@ CompositorOGL::Resume()
return true;
}
#ifdef MOZ_WIDGET_GONK
CompositorBackendSpecificData*
CompositorOGL::GetCompositorBackendSpecificData()
{
if (!mCompositorBackendSpecificData) {
mCompositorBackendSpecificData = new CompositorOGLGonkBackendSpecificData(this);
}
return mCompositorBackendSpecificData;
}
#endif
TemporaryRef<DataTextureSource>
CompositorOGL::CreateDataTextureSource(TextureFlags aFlags)
{
@ -1593,5 +1494,120 @@ CompositorOGL::BindAndDrawQuad(ShaderProgramOGL *aProg,
aFlipped, aDrawMode);
}
GLuint
CompositorOGL::GetTemporaryTexture(GLenum aUnit)
{
if (!mTexturePool) {
#ifdef MOZ_WIDGET_GONK
mTexturePool = new PerFrameTexturePoolOGL(gl());
#else
mTexturePool = new PerUnitTexturePoolOGL(gl());
#endif
}
return mTexturePool->GetTexture(aUnit);
}
GLuint
PerUnitTexturePoolOGL::GetTexture(GLenum aTextureUnit)
{
size_t index = aTextureUnit - LOCAL_GL_TEXTURE0;
// lazily grow the array of temporary textures
if (mTextures.Length() <= index) {
size_t prevLength = mTextures.Length();
mTextures.SetLength(index + 1);
for(unsigned int i = prevLength; i <= index; ++i) {
mTextures[i] = 0;
}
}
// lazily initialize the temporary textures
if (!mTextures[index]) {
if (!mGL->MakeCurrent()) {
return 0;
}
mGL->fGenTextures(1, &mTextures[index]);
}
return mTextures[index];
}
void
PerUnitTexturePoolOGL::DestroyTextures()
{
if (mGL && mGL->MakeCurrent()) {
if (mTextures.Length() > 0) {
mGL->fDeleteTextures(mTextures.Length(), &mTextures[0]);
}
}
mTextures.SetLength(0);
}
void
PerFrameTexturePoolOGL::DestroyTextures()
{
if (!mGL->MakeCurrent()) {
return;
}
if (mUnusedTextures.Length() > 0) {
mGL->fDeleteTextures(mUnusedTextures.Length(), &mUnusedTextures[0]);
mUnusedTextures.Clear();
}
if (mCreatedTextures.Length() > 0) {
mGL->fDeleteTextures(mCreatedTextures.Length(), &mCreatedTextures[0]);
mCreatedTextures.Clear();
}
}
GLuint
PerFrameTexturePoolOGL::GetTexture(GLenum)
{
GLuint texture = 0;
if (!mUnusedTextures.IsEmpty()) {
// Try to reuse one from the unused pile first
texture = mUnusedTextures[0];
mUnusedTextures.RemoveElementAt(0);
} else if (mGL->MakeCurrent()) {
// There isn't one to reuse, create one.
mGL->fGenTextures(1, &texture);
}
if (texture) {
mCreatedTextures.AppendElement(texture);
}
return texture;
}
void
PerFrameTexturePoolOGL::EndFrame()
{
if (!mGL->MakeCurrent()) {
// this means the context got destroyed underneith us somehow, and the driver
// already has destroyed the textures.
mCreatedTextures.Clear();
mUnusedTextures.Clear();
return;
}
// Some platforms have issues unlocking Gralloc buffers even when they're
// rebound.
if (gfxPrefs::OverzealousGrallocUnlocking()) {
mUnusedTextures.AppendElements(mCreatedTextures);
mCreatedTextures.Clear();
}
// Delete unused textures
for (size_t i = 0; i < mUnusedTextures.Length(); i++) {
GLuint texture = mUnusedTextures[i];
mGL->fDeleteTextures(1, &texture);
}
mUnusedTextures.Clear();
// Move all created textures into the unused pile
mUnusedTextures.AppendElements(mCreatedTextures);
mCreatedTextures.Clear();
}
} /* layers */
} /* mozilla */

View File

@ -55,6 +55,99 @@ class TextureSource;
struct Effect;
struct EffectChain;
/**
* Interface for pools of temporary gl textures for the compositor.
* The textures are fully owned by the pool, so the latter is responsible
* calling fDeleteTextures accordingly.
* Users of GetTexture receive a texture that is only valid for the duration
* of the current frame.
* This is primarily intended for direct texturing APIs that need to attach
* shared objects (such as an EGLImage) to a gl texture.
*/
class CompositorTexturePoolOGL : public RefCounted<CompositorTexturePoolOGL>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorTexturePoolOGL)
virtual ~CompositorTexturePoolOGL() {}
virtual void Clear() = 0;
virtual GLuint GetTexture(GLenum aUnit) = 0;
virtual void EndFrame() = 0;
};
/**
* Agressively reuses textures. One gl texture per texture unit in total.
* So far this hasn't shown the best results on b2g.
*/
class PerUnitTexturePoolOGL : public CompositorTexturePoolOGL
{
public:
PerUnitTexturePoolOGL(gl::GLContext* aGL)
: mGL(aGL)
{}
virtual ~PerUnitTexturePoolOGL()
{
DestroyTextures();
}
virtual void Clear() MOZ_OVERRIDE
{
DestroyTextures();
}
virtual GLuint GetTexture(GLenum aUnit) MOZ_OVERRIDE;
virtual void EndFrame() MOZ_OVERRIDE {}
protected:
void DestroyTextures();
nsTArray<GLuint> mTextures;
RefPtr<gl::GLContext> mGL;
};
/**
* Reuse gl textures from a pool of textures that haven't yet been
* used during the current frame.
* All the textures that are not used at the end of a frame are
* deleted.
* This strategy seems to work well with gralloc textures because destroying
* unused textures which are bound to gralloc buffers let drivers know that it
* can unlock the gralloc buffers.
*/
class PerFrameTexturePoolOGL : public CompositorTexturePoolOGL
{
public:
PerFrameTexturePoolOGL(gl::GLContext* aGL)
: mGL(aGL)
{}
virtual ~PerFrameTexturePoolOGL()
{
DestroyTextures();
}
virtual void Clear() MOZ_OVERRIDE
{
DestroyTextures();
}
virtual GLuint GetTexture(GLenum aUnit) MOZ_OVERRIDE;
virtual void EndFrame() MOZ_OVERRIDE;
protected:
void DestroyTextures();
RefPtr<gl::GLContext> mGL;
nsTArray<GLuint> mCreatedTextures;
nsTArray<GLuint> mUnusedTextures;
};
class CompositorOGL : public Compositor
{
typedef mozilla::gl::GLContext GLContext;
@ -162,10 +255,6 @@ public:
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
#ifdef MOZ_WIDGET_GONK
virtual CompositorBackendSpecificData* GetCompositorBackendSpecificData() MOZ_OVERRIDE;
#endif
GLContext* gl() const { return mGLContext; }
gfx::SurfaceFormat GetFBOFormat() const {
return gfx::SurfaceFormat::R8G8B8A8;
@ -309,43 +398,17 @@ private:
*/
GLint FlipY(GLint y) const { return mHeight - y; }
bool mDestroyed;
RefPtr<CompositorTexturePoolOGL> mTexturePool;
// Textures used for direct texturing of buffers like gralloc.
// The index of the texture in this array must correspond to the texture unit.
nsTArray<GLuint> mTextures;
bool mDestroyed;
/**
* Height of the OpenGL context's primary framebuffer in pixels. Used by
* FlipY for the y-flipping calculation.
*/
GLint mHeight;
#ifdef MOZ_WIDGET_GONK
RefPtr<CompositorBackendSpecificData> mCompositorBackendSpecificData;
#endif
};
#ifdef MOZ_WIDGET_GONK
class CompositorOGLGonkBackendSpecificData : public CompositorBackendSpecificData
{
public:
CompositorOGLGonkBackendSpecificData(CompositorOGL* aCompositor);
virtual ~CompositorOGLGonkBackendSpecificData();
GLuint GetTexture();
void EndFrame();
private:
gl::GLContext* gl() const;
RefPtr<CompositorOGL> mCompositor;
nsTArray<GLuint> mCreatedTextures;
nsTArray<GLuint> mUnusedTextures;
};
#endif
}
}

View File

@ -93,7 +93,6 @@ GrallocTextureSourceOGL::GrallocTextureSourceOGL(CompositorOGL* aCompositor,
, mGraphicBuffer(aGraphicBuffer)
, mEGLImage(0)
, mFormat(aFormat)
, mNeedsReset(true)
{
MOZ_ASSERT(mGraphicBuffer.get());
}
@ -107,14 +106,6 @@ GrallocTextureSourceOGL::~GrallocTextureSourceOGL()
void
GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
{
/*
* The job of this function is to ensure that the texture is tied to the
* android::GraphicBuffer, so that texturing will source the GraphicBuffer.
*
* To this effect we create an EGLImage wrapping this GraphicBuffer,
* using EGLImageCreateFromNativeBuffer, and then we tie this EGLImage to our
* texture using fEGLImageTargetTexture2D.
*/
MOZ_ASSERT(gl());
if (!IsValid()) {
return;
@ -127,29 +118,22 @@ GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(textureTarget, tex);
if (mCompositableBackendData) {
// There are two paths for locking/unlocking - if mCompositableBackendData is
// set, we use the texture on there, otherwise we use
// CompositorBackendSpecificData from the compositor and bind the EGLImage
// only in Lock().
if (!mEGLImage) {
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
}
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
}
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
}
void GrallocTextureSourceOGL::Lock()
{
if (mCompositableBackendData) return;
/*
* The job of this function is to ensure that the texture is tied to the
* android::GraphicBuffer, so that texturing will source the GraphicBuffer.
*
* To this effect we create an EGLImage wrapping this GraphicBuffer,
* using EGLImageCreateFromNativeBuffer, and then we tie this EGLImage to our
* texture using fEGLImageTargetTexture2D.
*/
MOZ_ASSERT(IsValid());
CompositorOGLGonkBackendSpecificData* backendData =
static_cast<CompositorOGLGonkBackendSpecificData*>(mCompositor->GetCompositorBackendSpecificData());
mTexture = backendData->GetTexture();
mTexture = mCompositor->GetTemporaryTexture(LOCAL_GL_TEXTURE0);
GLuint textureTarget = GetTextureTarget();
@ -165,7 +149,7 @@ void GrallocTextureSourceOGL::Lock()
bool
GrallocTextureSourceOGL::IsValid() const
{
return !!gl() && !!mGraphicBuffer.get() && (!!mCompositor || !!mCompositableBackendData);
return !!gl() && !!mGraphicBuffer.get();
}
gl::GLContext*
@ -205,51 +189,6 @@ GrallocTextureSourceOGL::GetFormat() const {
return mFormat;
}
void
GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
if (!aBackendData) {
mCompositableBackendData = nullptr;
DeallocateDeviceData();
return;
}
if (mCompositableBackendData != aBackendData) {
mNeedsReset = true;
}
if (!mNeedsReset) {
// Update binding to the EGLImage
gl()->MakeCurrent();
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(textureTarget, tex);
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
return;
}
mCompositableBackendData = aBackendData;
if (!mCompositor) {
return;
}
// delete old EGLImage
DeallocateDeviceData();
gl()->MakeCurrent();
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(textureTarget, tex);
// create new EGLImage
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
mNeedsReset = false;
}
gfx::IntSize
GrallocTextureSourceOGL::GetSize() const
{
@ -418,11 +357,6 @@ GrallocTextureSourceOGL::GetAsSurface() {
GLuint
GrallocTextureSourceOGL::GetGLTexture()
{
if (mCompositableBackendData) {
mCompositableBackendData->SetCompositor(mCompositor);
return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
}
return mTexture;
}

View File

@ -45,8 +45,6 @@ public:
return LOCAL_GL_CLAMP_TO_EDGE;
}
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
void DeallocateDeviceData();
gl::GLContext* gl() const;
@ -70,7 +68,6 @@ protected:
EGLImage mEGLImage;
GLuint mTexture;
gfx::SurfaceFormat mFormat;
bool mNeedsReset;
};
class GrallocTextureHostOGL : public TextureHost

View File

@ -155,12 +155,10 @@ WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
}
CompositableDataGonkOGL::CompositableDataGonkOGL()
: mTexture(0)
{
}
CompositableDataGonkOGL::~CompositableDataGonkOGL()
{
DeleteTextureIfPresent();
}
gl::GLContext*
@ -177,28 +175,6 @@ void CompositableDataGonkOGL::SetCompositor(Compositor* aCompositor)
void CompositableDataGonkOGL::ClearData()
{
CompositableBackendSpecificData::ClearData();
DeleteTextureIfPresent();
}
GLuint CompositableDataGonkOGL::GetTexture()
{
if (!mTexture) {
if (gl()->MakeCurrent()) {
gl()->fGenTextures(1, &mTexture);
}
}
return mTexture;
}
void
CompositableDataGonkOGL::DeleteTextureIfPresent()
{
if (mTexture) {
if (gl()->MakeCurrent()) {
gl()->fDeleteTextures(1, &mTexture);
}
mTexture = 0;
}
}
#if MOZ_WIDGET_GONK && ANDROID_VERSION >= 17
@ -731,19 +707,6 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
return;
}
#ifdef MOZ_WIDGET_GONK
if (mCompositableBackendData) {
// on gonk, this class is used as a fallback from gralloc buffer.
// There is a case this class is used with GrallocDeprecatedTextureHostOGL
// under same CompositableHost. if it happens, a gralloc buffer of
// GrallocDeprecatedTextureHostOGL needs to be unbounded from a texture,
// when the gralloc buffer is not rendered.
// Establish the unbound by deleting the texture.
// See Bug 916264.
static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->DeleteTextureIfPresent();
}
#endif
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
gfx::IntSize size = surf.Size();
TextureImage::ImageFormat format = surf.ImageFormat();
@ -1196,7 +1159,7 @@ GLuint
GrallocDeprecatedTextureHostOGL::GetGLTexture()
{
mCompositableBackendData->SetCompositor(mCompositor);
return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
return mCompositor->GetTemporaryTexture(LOCAL_GL_TEXTURE0);
}
#endif // MOZ_WIDGET_GONK

View File

@ -72,12 +72,9 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual void ClearData() MOZ_OVERRIDE;
GLuint GetTexture();
void DeleteTextureIfPresent();
gl::GLContext* gl() const;
protected:
RefPtr<CompositorOGL> mCompositor;
GLuint mTexture;
};
/*

View File

@ -54,10 +54,10 @@ class MockContentController : public GeckoContentController {
public:
MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration));
MOCK_METHOD3(HandleDoubleTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleSingleTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleLongTap, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleLongTapUp, void(const CSSIntPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleLongTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(HandleLongTapUp, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
MOCK_METHOD3(SendAsyncScrollDOMEvent, void(bool aIsRoot, const CSSRect &aContentRect, const CSSSize &aScrollableSize));
MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs));
};
@ -686,7 +686,7 @@ TEST_F(AsyncPanZoomControllerTester, OverScrollPanning) {
EXPECT_EQ(pointOut, ScreenPoint(0, 90));
}
TEST(AsyncPanZoomController, ShortPress) {
TEST_F(AsyncPanZoomControllerTester, ShortPress) {
nsRefPtr<MockContentControllerDelayed> mcc = new NiceMock<MockContentControllerDelayed>();
nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(
@ -704,13 +704,13 @@ TEST(AsyncPanZoomController, ShortPress) {
// touchdown is fully processed. The ordering here is important.
mcc->CheckHasDelayedTask();
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
mcc->RunDelayedTask();
apzc->Destroy();
}
TEST(AsyncPanZoomController, MediumPress) {
TEST_F(AsyncPanZoomControllerTester, MediumPress) {
nsRefPtr<MockContentControllerDelayed> mcc = new NiceMock<MockContentControllerDelayed>();
nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(
@ -728,7 +728,7 @@ TEST(AsyncPanZoomController, MediumPress) {
// touchdown is fully processed. The ordering here is important.
mcc->CheckHasDelayedTask();
EXPECT_CALL(*mcc, HandleSingleTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
mcc->RunDelayedTask();
apzc->Destroy();
@ -761,11 +761,11 @@ DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
InSequence s;
EXPECT_CALL(check, Call("preHandleLongTap"));
EXPECT_CALL(*mcc, HandleLongTap(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(*mcc, HandleLongTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(check, Call("postHandleLongTap"));
EXPECT_CALL(check, Call("preHandleLongTapUp"));
EXPECT_CALL(*mcc, HandleLongTapUp(CSSIntPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(*mcc, HandleLongTapUp(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(check, Call("postHandleLongTapUp"));
}
@ -791,7 +791,7 @@ DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
apzc->Destroy();
}
TEST(AsyncPanZoomController, LongPressPreventDefault) {
TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
// We have to initialize both an integer time and TimeStamp time because
// TimeStamp doesn't have any ToXXX() functions for converting back to
// primitives.
@ -824,7 +824,7 @@ TEST(AsyncPanZoomController, LongPressPreventDefault) {
InSequence s;
EXPECT_CALL(check, Call("preHandleLongTap"));
EXPECT_CALL(*mcc, HandleLongTap(CSSIntPoint(touchX, touchStartY), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(*mcc, HandleLongTap(CSSPoint(touchX, touchStartY), 0, apzc->GetGuid())).Times(1);
EXPECT_CALL(check, Call("postHandleLongTap"));
}
@ -866,11 +866,11 @@ TEST(AsyncPanZoomController, LongPressPreventDefault) {
apzc->Destroy();
}
TEST(AsyncPanZoomController, LongPress) {
TEST_F(AsyncPanZoomControllerTester, LongPress) {
DoLongPressTest(false, mozilla::layers::AllowedTouchBehavior::NONE);
}
TEST(AsyncPanZoomController, LongPressPanAndZoom) {
TEST_F(AsyncPanZoomControllerTester, LongPressPanAndZoom) {
DoLongPressTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
| mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
| mozilla::layers::AllowedTouchBehavior::ZOOM);

View File

@ -178,6 +178,8 @@ private:
DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
DECL_GFX_PREF(Once, "webgl.force-layers-readback", WebGLForceLayersReadback, bool, false);
public:

View File

@ -0,0 +1,39 @@
function testReduce() {
function sum(a, b) {
var r = a + b;
}
var array = build(8 * 0X0aaec , function() { return 1; });
var parResult = array.reducePar(sum);
}
for (var ix = 0; ix < 3; ++ix) {
testReduce();
}
function build(n, f) {
var result = [];
for (var i = 0; i < n; i++)
result.push(f(i));
return result;
}
function seq_scan(array, f) {
for (var i = 1; i < array.length; i++) {
}
}
function assertAlmostEq(v1, v2) {
if (e1 instanceof Array && e2 instanceof Array) {
for (prop in e1) {
if (e1.hasOwnProperty(prop)) { }
}
}
}
function assertEqArray(a, b) {
for (var i = 0, l = a.length; i < l; i++) {
try { } catch (e) { }
}
}
function assertParallelExecWillRecover(opFunction) {
assertParallelExecSucceeds(
function(m) {},
function(r) {}
);
}

View File

@ -506,8 +506,9 @@ jit::FinishOffThreadBuilder(IonBuilder *builder)
{
ExecutionMode executionMode = builder->info().executionMode();
// Clear the recompiling flag if it would have failed.
if (builder->script()->hasIonScript())
// Clear the recompiling flag of the old ionScript, since we continue to
// use the old ionScript if recompiling fails.
if (executionMode == SequentialExecution && builder->script()->hasIonScript())
builder->script()->ionScript()->clearRecompiling();
// Clean up if compilation did not succeed.

View File

@ -539,7 +539,7 @@ public:
}
}
virtual void HandleDoubleTap(const CSSIntPoint& aPoint,
virtual void HandleDoubleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
{
@ -558,7 +558,7 @@ public:
}
}
virtual void HandleSingleTap(const CSSIntPoint& aPoint,
virtual void HandleSingleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
{
@ -577,7 +577,7 @@ public:
}
}
virtual void HandleLongTap(const CSSIntPoint& aPoint,
virtual void HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
{
@ -596,7 +596,7 @@ public:
}
}
virtual void HandleLongTapUp(const CSSIntPoint& aPoint,
virtual void HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE
{

View File

@ -20,6 +20,8 @@ css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_
./host_ListCSSProperties$(HOST_BIN_SUFFIX) > $@
cat $(srcdir)/css_properties_like_longhand.js >> $@
GARBAGE += css_properties.jsm
MOCHITEST_FILES += css_properties.js
GARBAGE += css_properties.js
TEST_FILES := css_properties.js
TEST_DEST = $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
INSTALL_TARGETS += TEST
endif

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = buildapp == 'b2g'
[test_bug386386.html]
[test_bug394800.xhtml]

View File

@ -827,17 +827,15 @@ pref("browser.snippets.syncPromo.enabled", true);
#ifdef MOZ_ANDROID_SYNTHAPKS
// The URL of the APK factory from which we obtain APKs for webapps.
// This currently points to the development server.
pref("browser.webapps.apkFactoryUrl", "http://dapk.net/application.apk");
pref("browser.webapps.apkFactoryUrl", "https://controller.apk.firefox.com/application.apk");
// How frequently to check for webapp updates, in seconds (86400 is daily).
pref("browser.webapps.updateInterval", 86400);
// The URL of the service that checks for updates.
// This currently points to the development server.
// To test updates, set this to http://apk-update-checker.paas.allizom.org,
// which is a test server that always reports all apps as having updates.
pref("browser.webapps.updateCheckUrl", "http://dapk.net/app_updates");
pref("browser.webapps.updateCheckUrl", "https://controller.apk.firefox.com/app_updates");
#endif

View File

@ -70,8 +70,6 @@ skip-if = processor == "x86"
[testPasswordProvider]
# [testPermissions] # see bug 757475
[testPictureLinkContextMenu]
# disabled on Android 2.3; bug 979612
skip-if = android_version == "10"
[testPrefsObserver]
[testPrivateBrowsing]
[testPromptGridInput]

View File

@ -20,8 +20,8 @@ public class testPictureLinkContextMenu extends ContentContextMenuTest {
PICTURE_PAGE_URL=getAbsoluteUrl("/robocop/robocop_picture_link.html");
BLANK_PAGE_URL=getAbsoluteUrl("/robocop/robocop_blank_02.html");
inputAndLoadUrl(PICTURE_PAGE_URL);
waitForText(PICTURE_PAGE_TITLE);
loadAndPaint(PICTURE_PAGE_URL);
verifyPageTitle(PICTURE_PAGE_TITLE);
verifyContextMenuItems(photoMenuItems);
verifyCopyOption(photoMenuItems[0], "Firefox.jpg"); // Test the "Copy Image Location" option

View File

@ -112,7 +112,7 @@ public class EventListener implements GeckoEventListener {
JSONObject obj = new JSONObject();
obj.put("profile", preInstallWebapp(name, manifestURL, origin).toString());
EventDispatcher.sendResponse(message, obj);
} else if (event.equals("WebApps:GetApkVersions")) {
} else if (event.equals("Webapps:GetApkVersions")) {
JSONObject obj = new JSONObject();
obj.put("versions", getApkVersions(GeckoAppShell.getGeckoInterface().getActivity(),
message.getJSONArray("packageNames")).toString());

View File

@ -23,6 +23,7 @@ Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Notifications", "resource://gre/modules/Notifications.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava", "resource://gre/modules/Messaging.jsm");
XPCOMUtils.defineLazyGetter(this, "Strings", function() {
return Services.strings.createBundle("chrome://browser/locale/webapp.properties");
@ -34,15 +35,11 @@ function debug(aMessage) {
// append a newline character to the end of the message because *dump* spills
// into the Android native logging system, which strips newlines from messages
// and breaks messages into lines automatically at display time (i.e. logcat).
#ifdef MOZ_DEBUG
#ifdef DEBUG
dump(aMessage);
#endif
}
function sendMessageToJava(aMessage) {
return Services.androidBridge.handleGeckoMessage(JSON.stringify(aMessage));
}
this.WebappManager = {
__proto__: DOMRequestIpcHelper.prototype,

View File

@ -272,7 +272,8 @@ CertVerifier::InsanityVerifyCert(
case certificateUsageSSLClient: {
// XXX: We don't really have a trust bit for SSL client authentication so
// just use trustEmail as it is the closest alternative.
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, pinArg);
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(trustDomain, cert, time, MustBeEndEntity,
KU_DIGITAL_SIGNATURE,
SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH,
@ -296,7 +297,7 @@ CertVerifier::InsanityVerifyCert(
ocspFetching == NSSCertDBTrustDomain::NeverFetchOCSP
? NSSCertDBTrustDomain::LocalOnlyOCSPForEV
: NSSCertDBTrustDomain::FetchOCSPForEV,
pinArg);
mOCSPCache, pinArg);
rv = BuildCertChainForOneKeyUsage(trustDomain, cert, time,
KU_DIGITAL_SIGNATURE, // ECDHE/DHE
KU_KEY_ENCIPHERMENT, // RSA
@ -321,7 +322,8 @@ CertVerifier::InsanityVerifyCert(
}
// Now try non-EV.
NSSCertDBTrustDomain trustDomain(trustSSL, ocspFetching, pinArg);
NSSCertDBTrustDomain trustDomain(trustSSL, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChainForOneKeyUsage(trustDomain, cert, time,
KU_DIGITAL_SIGNATURE, // ECDHE/DHE
KU_KEY_ENCIPHERMENT, // RSA
@ -333,7 +335,8 @@ CertVerifier::InsanityVerifyCert(
}
case certificateUsageSSLCA: {
NSSCertDBTrustDomain trustDomain(trustSSL, ocspFetching, pinArg);
NSSCertDBTrustDomain trustDomain(trustSSL, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(trustDomain, cert, time, MustBeCA,
KU_KEY_CERT_SIGN,
SEC_OID_EXT_KEY_USAGE_SERVER_AUTH,
@ -343,7 +346,8 @@ CertVerifier::InsanityVerifyCert(
}
case certificateUsageEmailSigner: {
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, pinArg);
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(trustDomain, cert, time, MustBeEndEntity,
KU_DIGITAL_SIGNATURE,
SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT,
@ -356,7 +360,8 @@ CertVerifier::InsanityVerifyCert(
// TODO: The higher level S/MIME processing should pass in which key
// usage it is trying to verify for, and base its algorithm choices
// based on the result of the verification(s).
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, pinArg);
NSSCertDBTrustDomain trustDomain(trustEmail, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChainForOneKeyUsage(trustDomain, cert, time,
KU_KEY_ENCIPHERMENT, // RSA
KU_KEY_AGREEMENT, // ECDH/DH
@ -369,7 +374,7 @@ CertVerifier::InsanityVerifyCert(
case certificateUsageObjectSigner: {
NSSCertDBTrustDomain trustDomain(trustObjectSigning, ocspFetching,
pinArg);
mOCSPCache, pinArg);
rv = BuildCertChain(trustDomain, cert, time, MustBeEndEntity,
KU_DIGITAL_SIGNATURE,
SEC_OID_EXT_KEY_USAGE_CODE_SIGN,
@ -397,18 +402,21 @@ CertVerifier::InsanityVerifyCert(
eku = SEC_OID_OCSP_RESPONDER;
}
NSSCertDBTrustDomain sslTrust(trustSSL, ocspFetching, pinArg);
NSSCertDBTrustDomain sslTrust(trustSSL, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(sslTrust, cert, time, endEntityOrCA,
keyUsage, eku, SEC_OID_X509_ANY_POLICY,
stapledOCSPResponse, builtChain);
if (rv == SECFailure && PR_GetError() == SEC_ERROR_UNKNOWN_ISSUER) {
NSSCertDBTrustDomain emailTrust(trustEmail, ocspFetching, pinArg);
NSSCertDBTrustDomain emailTrust(trustEmail, ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(emailTrust, cert, time, endEntityOrCA, keyUsage,
eku, SEC_OID_X509_ANY_POLICY,
stapledOCSPResponse, builtChain);
if (rv == SECFailure && SEC_ERROR_UNKNOWN_ISSUER) {
NSSCertDBTrustDomain objectSigningTrust(trustObjectSigning,
ocspFetching, pinArg);
ocspFetching, mOCSPCache,
pinArg);
rv = BuildCertChain(objectSigningTrust, cert, time, endEntityOrCA,
keyUsage, eku, SEC_OID_X509_ANY_POLICY,
stapledOCSPResponse, builtChain);

View File

@ -8,6 +8,7 @@
#define mozilla_psm__CertVerifier_h
#include "insanity/pkixtypes.h"
#include "OCSPCache.h"
namespace mozilla { namespace psm {
@ -67,6 +68,8 @@ public:
ocsp_get_config ogc);
~CertVerifier();
void ClearOCSPCache() { mOCSPCache.Clear(); }
const implementation_config mImplementation;
#ifndef NSS_NO_LIBPKIX
const bool mMissingCertDownloadEnabled;
@ -85,6 +88,8 @@ private:
/*optional*/ const SECItem* stapledOCSPResponse,
/*optional out*/ insanity::pkix::ScopedCERTCertList* validationChain,
/*optional out*/ SECOidTag* evOidPolicy);
OCSPCache mOCSPCache;
};
void InitCertVerifierLog();

View File

@ -9,8 +9,8 @@
#include <stdint.h>
#include "ExtendedValidation.h"
#include "insanity/pkix.h"
#include "certdb.h"
#include "insanity/pkix.h"
#include "nss.h"
#include "ocsp.h"
#include "pk11pub.h"
@ -30,9 +30,9 @@ namespace mozilla { namespace psm {
const char BUILTIN_ROOTS_MODULE_DEFAULT_NAME[] = "Builtin Roots Module";
namespace {
void PORT_Free_string(char* str) { PORT_Free(str); }
inline void PORT_Free_string(char* str) { PORT_Free(str); }
namespace {
typedef ScopedPtr<SECMODModule, SECMOD_DestroyModule> ScopedSECMODModule;
@ -40,9 +40,11 @@ typedef ScopedPtr<SECMODModule, SECMOD_DestroyModule> ScopedSECMODModule;
NSSCertDBTrustDomain::NSSCertDBTrustDomain(SECTrustType certDBTrustType,
OCSPFetching ocspFetching,
OCSPCache& ocspCache,
void* pinArg)
: mCertDBTrustType(certDBTrustType)
, mOCSPFetching(ocspFetching)
, mOCSPCache(ocspCache)
, mPinArg(pinArg)
{
}
@ -161,17 +163,62 @@ NSSCertDBTrustDomain::CheckRevocation(
// are known to serve expired responses due to bugs.
if (stapledOCSPResponse) {
PR_ASSERT(endEntityOrCA == MustBeEndEntity);
SECStatus rv = VerifyEncodedOCSPResponse(*this, cert, issuerCert, time,
stapledOCSPResponse);
SECStatus rv = VerifyAndMaybeCacheEncodedOCSPResponse(cert, issuerCert,
time,
stapledOCSPResponse);
if (rv == SECSuccess) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: stapled OCSP response: good"));
return rv;
}
if (PR_GetError() != SEC_ERROR_OCSP_OLD_RESPONSE) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: stapled OCSP response: failure"));
return rv;
}
} else {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: no stapled OCSP response"));
}
// TODO(bug 915932): Need to change this when we add the OCSP cache.
PRErrorCode cachedResponseErrorCode = 0;
PRTime cachedResponseValidThrough = 0;
bool cachedResponsePresent = mOCSPCache.Get(cert, issuerCert,
cachedResponseErrorCode,
cachedResponseValidThrough);
if (cachedResponsePresent) {
if (cachedResponseErrorCode == 0 && cachedResponseValidThrough >= time) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: cached OCSP response: good"));
return SECSuccess;
}
// If we have a cached revoked response, use it.
if (cachedResponseErrorCode == SEC_ERROR_REVOKED_CERTIFICATE) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: cached OCSP response: revoked"));
PR_SetError(SEC_ERROR_REVOKED_CERTIFICATE, 0);
return SECFailure;
}
// The cached response may indicate an unknown certificate or it may be
// expired. Don't return with either of these statuses yet - we may be
// able to fetch a more recent one.
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: cached OCSP response: error %ld valid "
"until %lld", cachedResponseErrorCode, cachedResponseValidThrough));
// When a good cached response has expired, it is more convenient
// to convert that to an error code and just deal with
// cachedResponseErrorCode from here on out.
if (cachedResponseErrorCode == 0 && cachedResponseValidThrough < time) {
cachedResponseErrorCode = SEC_ERROR_OCSP_OLD_RESPONSE;
}
} else {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: no cached OCSP response"));
}
// At this point, if and only if cachedErrorResponseCode is 0, there was no
// cached response.
PR_ASSERT((!cachedResponsePresent && cachedResponseErrorCode == 0) ||
(cachedResponsePresent && cachedResponseErrorCode != 0));
// TODO: We still need to handle the fallback for expired responses. But,
// if/when we disable OCSP fetching by default, it would be ambiguous whether
@ -181,11 +228,26 @@ NSSCertDBTrustDomain::CheckRevocation(
if ((mOCSPFetching == NeverFetchOCSP) ||
(endEntityOrCA == MustBeCA && (mOCSPFetching == FetchOCSPForDVHardFail ||
mOCSPFetching == FetchOCSPForDVSoftFail))) {
// We're not going to be doing any fetching, so if there was a cached
// "unknown" response, say so.
if (cachedResponseErrorCode == SEC_ERROR_OCSP_UNKNOWN_CERT) {
PR_SetError(SEC_ERROR_OCSP_UNKNOWN_CERT, 0);
return SECFailure;
}
// If we're doing hard-fail, we want to know if we have a cached response
// that has expired.
if (mOCSPFetching == FetchOCSPForDVHardFail &&
cachedResponseErrorCode == SEC_ERROR_OCSP_OLD_RESPONSE) {
PR_SetError(SEC_ERROR_OCSP_OLD_RESPONSE, 0);
return SECFailure;
}
return SECSuccess;
}
if (mOCSPFetching == LocalOnlyOCSPForEV) {
PR_SetError(SEC_ERROR_OCSP_UNKNOWN_CERT, 0);
PR_SetError(cachedResponseErrorCode != 0 ? cachedResponseErrorCode
: SEC_ERROR_OCSP_UNKNOWN_CERT, 0);
return SECFailure;
}
@ -193,12 +255,14 @@ NSSCertDBTrustDomain::CheckRevocation(
url(CERT_GetOCSPAuthorityInfoAccessLocation(cert));
if (!url) {
if (stapledOCSPResponse) {
PR_SetError(SEC_ERROR_OCSP_OLD_RESPONSE, 0);
if (mOCSPFetching == FetchOCSPForEV ||
cachedResponseErrorCode == SEC_ERROR_OCSP_UNKNOWN_CERT) {
PR_SetError(SEC_ERROR_OCSP_UNKNOWN_CERT, 0);
return SECFailure;
}
if (mOCSPFetching == FetchOCSPForEV) {
PR_SetError(SEC_ERROR_OCSP_UNKNOWN_CERT, 0);
if (stapledOCSPResponse ||
cachedResponseErrorCode == SEC_ERROR_OCSP_OLD_RESPONSE) {
PR_SetError(SEC_ERROR_OCSP_OLD_RESPONSE, 0);
return SECFailure;
}
@ -229,6 +293,13 @@ NSSCertDBTrustDomain::CheckRevocation(
"CERT_PostOCSPRequest failure"));
return SECFailure;
}
if (cachedResponseErrorCode == SEC_ERROR_OCSP_UNKNOWN_CERT) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: returning SECFailure from cached "
"response after CERT_PostOCSPRequest failure"));
PR_SetError(cachedResponseErrorCode, 0);
return SECFailure;
}
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: returning SECSuccess after "
@ -236,8 +307,8 @@ NSSCertDBTrustDomain::CheckRevocation(
return SECSuccess; // Soft fail -> success :(
}
SECStatus rv = VerifyEncodedOCSPResponse(*this, cert, issuerCert, time,
response);
SECStatus rv = VerifyAndMaybeCacheEncodedOCSPResponse(cert, issuerCert, time,
response);
if (rv == SECSuccess || mOCSPFetching != FetchOCSPForDVSoftFail) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: returning after VerifyEncodedOCSPResponse"));
@ -256,6 +327,31 @@ NSSCertDBTrustDomain::CheckRevocation(
return SECSuccess;
}
SECStatus
NSSCertDBTrustDomain::VerifyAndMaybeCacheEncodedOCSPResponse(
const CERTCertificate* cert, CERTCertificate* issuerCert, PRTime time,
const SECItem* encodedResponse)
{
PRTime thisUpdate = 0;
PRTime validThrough = 0;
SECStatus rv = VerifyEncodedOCSPResponse(*this, cert, issuerCert, time,
encodedResponse, &thisUpdate,
&validThrough);
PRErrorCode error = (rv == SECSuccess ? 0 : PR_GetError());
if (rv == SECSuccess || error == SEC_ERROR_REVOKED_CERTIFICATE ||
error == SEC_ERROR_OCSP_UNKNOWN_CERT) {
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG,
("NSSCertDBTrustDomain: caching OCSP response"));
if (mOCSPCache.Put(cert, issuerCert, error, thisUpdate, validThrough)
!= SECSuccess) {
return SECFailure;
}
// The call to Put may have un-set the error. Re-set it.
PR_SetError(error, 0);
}
return rv;
}
namespace {
static char*

View File

@ -19,6 +19,8 @@ void DisableMD5();
extern const char BUILTIN_ROOTS_MODULE_DEFAULT_NAME[];
void PORT_Free_string(char* str);
// The dir parameter is the path to the directory containing the NSS builtin
// roots module. Usually this is the same as the path to the other NSS shared
// libraries. If it is null then the (library) path will be searched.
@ -55,7 +57,7 @@ public:
LocalOnlyOCSPForEV = 4,
};
NSSCertDBTrustDomain(SECTrustType certDBTrustType, OCSPFetching ocspFetching,
void* pinArg);
OCSPCache& ocspCache, void* pinArg);
virtual SECStatus FindPotentialIssuers(
const SECItem* encodedIssuerName,
@ -77,8 +79,13 @@ public:
/*optional*/ const SECItem* stapledOCSPResponse);
private:
SECStatus VerifyAndMaybeCacheEncodedOCSPResponse(
const CERTCertificate* cert, CERTCertificate* issuerCert, PRTime time,
const SECItem* encodedResponse);
const SECTrustType mCertDBTrustType;
const OCSPFetching mOCSPFetching;
OCSPCache& mOCSPCache; // non-owning!
void* mPinArg; // non-owning!
};

View File

@ -0,0 +1,289 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "OCSPCache.h"
#include "NSSCertDBTrustDomain.h"
#include "pk11pub.h"
#include "secerr.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo* gCertVerifierLog;
#endif
namespace mozilla { namespace psm {
void
Insanity_PK11_DestroyContext_true(PK11Context* context)
{
PK11_DestroyContext(context, true);
}
typedef insanity::pkix::ScopedPtr<PK11Context,
Insanity_PK11_DestroyContext_true>
ScopedPK11Context;
// Let derIssuer be the DER encoding of the issuer of aCert.
// Let derPublicKey be the DER encoding of the public key of aIssuerCert.
// Let serialNumber be the bytes of the serial number of aCert.
// The value calculated is SHA384(derIssuer || derPublicKey || serialNumber).
// Because the DER encodings include the length of the data encoded,
// there do not exist A(derIssuerA, derPublicKeyA, serialNumberA) and
// B(derIssuerB, derPublicKeyB, serialNumberB) such that the concatenation of
// each triplet results in the same string of bytes but where each part in A is
// not equal to its counterpart in B. This is important because as a result it
// is computationally infeasible to find collisions that would subvert this
// cache (given that SHA384 is a cryptographically-secure hash function).
static SECStatus
CertIDHash(SHA384Buffer& buf, const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert)
{
ScopedPK11Context context(PK11_CreateDigestContext(SEC_OID_SHA384));
if (!context) {
return SECFailure;
}
SECStatus rv = PK11_DigestBegin(context.get());
if (rv != SECSuccess) {
return rv;
}
rv = PK11_DigestOp(context.get(), aCert->derIssuer.data,
aCert->derIssuer.len);
if (rv != SECSuccess) {
return rv;
}
rv = PK11_DigestOp(context.get(), aIssuerCert->derPublicKey.data,
aIssuerCert->derPublicKey.len);
if (rv != SECSuccess) {
return rv;
}
rv = PK11_DigestOp(context.get(), aCert->serialNumber.data,
aCert->serialNumber.len);
if (rv != SECSuccess) {
return rv;
}
uint32_t outLen = 0;
rv = PK11_DigestFinal(context.get(), buf, &outLen, SHA384_LENGTH);
if (outLen != SHA384_LENGTH) {
return SECFailure;
}
return rv;
}
SECStatus
OCSPCache::Entry::Init(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
PRErrorCode aErrorCode,
PRTime aThisUpdate,
PRTime aValidThrough)
{
mErrorCode = aErrorCode;
mThisUpdate = aThisUpdate;
mValidThrough = aValidThrough;
return CertIDHash(mIDHash, aCert, aIssuerCert);
}
OCSPCache::OCSPCache()
: mMutex("OCSPCache-mutex")
{
}
OCSPCache::~OCSPCache()
{
Clear();
}
// Returns -1 if no entry is found for the given (cert, issuer) pair.
int32_t
OCSPCache::FindInternal(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
const MutexAutoLock& /* aProofOfLock */)
{
if (mEntries.length() == 0) {
return -1;
}
SHA384Buffer idHash;
SECStatus rv = CertIDHash(idHash, aCert, aIssuerCert);
if (rv != SECSuccess) {
return -1;
}
// mEntries is sorted with the most-recently-used entry at the end.
// Thus, searching from the end will often be fastest.
for (int32_t i = mEntries.length() - 1; i >= 0; i--) {
if (memcmp(mEntries[i]->mIDHash, idHash, SHA384_LENGTH) == 0) {
return i;
}
}
return -1;
}
void
OCSPCache::LogWithCerts(const char* aMessage, const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert)
{
#ifdef PR_LOGGING
if (PR_LOG_TEST(gCertVerifierLog, PR_LOG_DEBUG)) {
insanity::pkix::ScopedPtr<char, mozilla::psm::PORT_Free_string>
cn(CERT_GetCommonName(&aCert->subject));
insanity::pkix::ScopedPtr<char, mozilla::psm::PORT_Free_string>
cnIssuer(CERT_GetCommonName(&aIssuerCert->subject));
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, (aMessage, cn.get(), cnIssuer.get()));
}
#endif
}
void
OCSPCache::MakeMostRecentlyUsed(size_t aIndex,
const MutexAutoLock& /* aProofOfLock */)
{
Entry* entry = mEntries[aIndex];
// Since mEntries is sorted with the most-recently-used entry at the end,
// aIndex is likely to be near the end, so this is likely to be fast.
mEntries.erase(mEntries.begin() + aIndex);
mEntries.append(entry);
}
bool
OCSPCache::Get(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
PRErrorCode& aErrorCode,
PRTime& aValidThrough)
{
PR_ASSERT(aCert);
PR_ASSERT(aIssuerCert);
MutexAutoLock lock(mMutex);
int32_t index = FindInternal(aCert, aIssuerCert, lock);
if (index < 0) {
LogWithCerts("OCSPCache::Get(%s, %s) not in cache", aCert, aIssuerCert);
return false;
}
LogWithCerts("OCSPCache::Get(%s, %s) in cache", aCert, aIssuerCert);
aErrorCode = mEntries[index]->mErrorCode;
aValidThrough = mEntries[index]->mValidThrough;
MakeMostRecentlyUsed(index, lock);
return true;
}
SECStatus
OCSPCache::Put(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
PRErrorCode aErrorCode,
PRTime aThisUpdate,
PRTime aValidThrough)
{
PR_ASSERT(aCert);
PR_ASSERT(aIssuerCert);
MutexAutoLock lock(mMutex);
int32_t index = FindInternal(aCert, aIssuerCert, lock);
if (index >= 0) {
// Never replace an entry indicating a revoked certificate.
if (mEntries[index]->mErrorCode == SEC_ERROR_REVOKED_CERTIFICATE) {
LogWithCerts("OCSPCache::Put(%s, %s) already in cache as revoked - "
"not replacing", aCert, aIssuerCert);
MakeMostRecentlyUsed(index, lock);
return SECSuccess;
}
// Never replace a newer entry with an older one unless the older entry
// indicates a revoked certificate, which we want to remember.
if (mEntries[index]->mThisUpdate > aThisUpdate &&
aErrorCode != SEC_ERROR_REVOKED_CERTIFICATE) {
LogWithCerts("OCSPCache::Put(%s, %s) already in cache with more recent "
"validity - not replacing", aCert, aIssuerCert);
MakeMostRecentlyUsed(index, lock);
return SECSuccess;
}
LogWithCerts("OCSPCache::Put(%s, %s) already in cache - replacing",
aCert, aIssuerCert);
mEntries[index]->mErrorCode = aErrorCode;
mEntries[index]->mThisUpdate = aThisUpdate;
mEntries[index]->mValidThrough = aValidThrough;
MakeMostRecentlyUsed(index, lock);
return SECSuccess;
}
if (mEntries.length() == MaxEntries) {
LogWithCerts("OCSPCache::Put(%s, %s) too full - evicting an entry", aCert,
aIssuerCert);
for (Entry** toEvict = mEntries.begin(); toEvict != mEntries.end();
toEvict++) {
// Never evict an entry that indicates a revoked or unknokwn certificate,
// because revoked responses are more security-critical to remember.
if ((*toEvict)->mErrorCode != SEC_ERROR_REVOKED_CERTIFICATE &&
(*toEvict)->mErrorCode != SEC_ERROR_OCSP_UNKNOWN_CERT) {
delete *toEvict;
mEntries.erase(toEvict);
break;
}
}
// Well, we tried, but apparently everything is revoked or unknown.
// We don't want to remove a cached revoked or unknown response. If we're
// trying to insert a good response, we can just return "successfully"
// without doing so. This means we'll lose some speed, but it's not a
// security issue. If we're trying to insert a revoked or unknown response,
// we can't. We should return with an error that causes the current
// verification to fail.
if (mEntries.length() == MaxEntries) {
if (aErrorCode != 0) {
PR_SetError(aErrorCode, 0);
return SECFailure;
}
return SECSuccess;
}
}
Entry* newEntry = new Entry();
// Normally we don't have to do this in Gecko, because OOM is fatal.
// However, if we want to embed this in another project, OOM might not
// be fatal, so handle this case.
if (!newEntry) {
PR_SetError(SEC_ERROR_NO_MEMORY, 0);
return SECFailure;
}
SECStatus rv = newEntry->Init(aCert, aIssuerCert, aErrorCode, aThisUpdate,
aValidThrough);
if (rv != SECSuccess) {
return rv;
}
mEntries.append(newEntry);
LogWithCerts("OCSPCache::Put(%s, %s) added to cache", aCert, aIssuerCert);
return SECSuccess;
}
void
OCSPCache::Clear()
{
MutexAutoLock lock(mMutex);
PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, ("OCSPCache::Clear: clearing cache"));
// First go through and delete the memory being pointed to by the pointers
// in the vector.
for (Entry** entry = mEntries.begin(); entry < mEntries.end();
entry++) {
delete *entry;
}
// Then remove the pointers themselves.
mEntries.clearAndFree();
}
} } // namespace mozilla::psm

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef mozilla_psm_OCSPCache_h
#define mozilla_psm_OCSPCache_h
#include "certt.h"
#include "hasht.h"
#include "insanity/pkixtypes.h"
#include "mozilla/Mutex.h"
#include "mozilla/Vector.h"
#include "prerror.h"
namespace mozilla { namespace psm {
// make SHA384Buffer be of type "array of uint8_t of length SHA384_LENGTH"
typedef uint8_t SHA384Buffer[SHA384_LENGTH];
// OCSPCache can store and retrieve OCSP response verification results. Each
// result is keyed on the certificate that purportedly corresponds to it (where
// certificates are distinguished based on serial number, issuer, and
// issuer public key, much like in an encoded OCSP response itself). A maximum
// of 1024 distinct entries can be stored.
// OCSPCache is thread-safe.
class OCSPCache
{
public:
OCSPCache();
~OCSPCache();
// Returns true if the status of the given certificate (issued by the given
// issuer) is in the cache, and false otherwise.
// If it is in the cache, returns by reference the error code of the cached
// status and the time through which the status is considered trustworthy.
bool Get(const CERTCertificate* aCert, const CERTCertificate* aIssuerCert,
/* out */ PRErrorCode& aErrorCode, /* out */ PRTime& aValidThrough);
// Caches the status of the given certificate (issued by the given issuer).
// The status is considered trustworthy through the given time.
// A status with an error code of SEC_ERROR_REVOKED_CERTIFICATE will not
// be replaced or evicted.
// A status with an error code of SEC_ERROR_OCSP_UNKNOWN_CERT will not
// be evicted when the cache is full.
// A status with a more recent thisUpdate will not be replaced with a
// status with a less recent thisUpdate unless the less recent status
// indicates the certificate is revoked.
SECStatus Put(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
PRErrorCode aErrorCode,
PRTime aThisUpdate,
PRTime aValidThrough);
// Removes everything from the cache.
void Clear();
private:
class Entry
{
public:
SECStatus Init(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
PRErrorCode aErrorCode, PRTime aThisUpdate,
PRTime aValidThrough);
PRErrorCode mErrorCode;
PRTime mThisUpdate;
PRTime mValidThrough;
// The SHA-384 hash of the concatenation of the DER encodings of the
// issuer name and issuer key, followed by the serial number.
// See the documentation for CertIDHash in OCSPCache.cpp.
SHA384Buffer mIDHash;
};
int32_t FindInternal(const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert,
const MutexAutoLock& aProofOfLock);
void MakeMostRecentlyUsed(size_t aIndex, const MutexAutoLock& aProofOfLock);
void LogWithCerts(const char* aMessage, const CERTCertificate* aCert,
const CERTCertificate* aIssuerCert);
Mutex mMutex;
static const size_t MaxEntries = 1024;
// Sorted with the most-recently-used entry at the end.
// Using 256 here reserves as much possible inline storage as the vector
// implementation will give us. 1024 bytes is the maximum it allows,
// which results in 256 Entry pointers or 128 Entry pointers, depending
// on the size of a pointer.
Vector<Entry*, 256> mEntries;
};
} } // namespace mozilla::psm
#endif // mozilla_psm_OCSPCache_h

View File

@ -5,13 +5,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
UNIFIED_SOURCES += [
'../insanity/lib/pkixbuild.cpp',
'../insanity/lib/pkixcheck.cpp',
'../insanity/lib/pkixder.cpp',
'../insanity/lib/pkixkey.cpp',
'../insanity/lib/pkixocsp.cpp',
'CertVerifier.cpp',
'NSSCertDBTrustDomain.cpp',
'OCSPCache.cpp',
]
if not CONFIG['NSS_NO_EV_CERTS']:
@ -24,7 +20,7 @@ LOCAL_INCLUDES += [
]
DIRS += [
'../insanity/test/lib',
'../insanity',
]
FAIL_ON_WARNINGS = True

View File

@ -103,11 +103,20 @@ SECItem* CreateEncodedOCSPRequest(PLArenaPool* arena,
const CERTCertificate* cert,
const CERTCertificate* issuerCert);
// The optional parameter thisUpdate will be the thisUpdate value of
// the encoded response if it is considered trustworthy. Only
// good, unknown, or revoked responses that verify correctly are considered
// trustworthy. If the response is not trustworthy, thisUpdate will be 0.
// Similarly, the optional parameter validThrough will be the time through
// which the encoded response is considered trustworthy (that is, if a response had a
// thisUpdate time of validThrough, it would be considered trustworthy).
SECStatus VerifyEncodedOCSPResponse(TrustDomain& trustDomain,
const CERTCertificate* cert,
CERTCertificate* issuerCert,
PRTime time,
const SECItem* encodedResponse);
const SECItem* encodedResponse,
/* optional out */ PRTime* thisUpdate,
/* optional out */ PRTime* validThrough);
} } // namespace insanity::pkix

View File

@ -55,13 +55,23 @@ public:
Context(TrustDomain& trustDomain,
const CERTCertificate& cert,
CERTCertificate& issuerCert,
PRTime time)
PRTime time,
PRTime* thisUpdate,
PRTime* validThrough)
: trustDomain(trustDomain)
, cert(cert)
, issuerCert(issuerCert)
, time(time)
, certStatus(CertStatus::Unknown)
, thisUpdate(thisUpdate)
, validThrough(validThrough)
{
if (thisUpdate) {
*thisUpdate = 0;
}
if (validThrough) {
*validThrough = 0;
}
}
TrustDomain& trustDomain;
@ -69,6 +79,8 @@ public:
CERTCertificate& issuerCert;
const PRTime time;
CertStatus certStatus;
PRTime* thisUpdate;
PRTime* validThrough;
private:
Context(const Context&); // delete
@ -303,7 +315,9 @@ SECStatus
VerifyEncodedOCSPResponse(TrustDomain& trustDomain,
const CERTCertificate* cert,
CERTCertificate* issuerCert, PRTime time,
const SECItem* encodedResponse)
const SECItem* encodedResponse,
PRTime* thisUpdate,
PRTime* validThrough)
{
PR_ASSERT(cert);
PR_ASSERT(issuerCert);
@ -319,7 +333,8 @@ VerifyEncodedOCSPResponse(TrustDomain& trustDomain,
return SECFailure;
}
Context context(trustDomain, *cert, *issuerCert, time);
Context context(trustDomain, *cert, *issuerCert, time, thisUpdate,
validThrough);
if (der::Nested(input, der::SEQUENCE,
bind(OCSPResponse, _1, ref(context))) != der::Success) {
@ -684,6 +699,13 @@ SingleResponse(der::Input& input, Context& context)
}
}
if (context.thisUpdate) {
*context.thisUpdate = thisUpdate;
}
if (context.validThrough) {
*context.validThrough = notAfter;
}
return der::Success;
}

View File

@ -0,0 +1,27 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
UNIFIED_SOURCES += [
'lib/pkixbuild.cpp',
'lib/pkixcheck.cpp',
'lib/pkixder.cpp',
'lib/pkixkey.cpp',
'lib/pkixocsp.cpp',
]
LOCAL_INCLUDES += [
'include',
]
DIRS += [
'test/lib',
]
FAIL_ON_WARNINGS = True
LIBRARY_NAME = 'insanitypkix'
FINAL_LIBRARY = 'xul'

View File

@ -21,7 +21,7 @@ interface nsIX509CertList;
typedef uint32_t AppTrustedRoot;
[scriptable, function, uuid(e12aec59-7153-4e84-9376-2e851311b7a3)]
[scriptable, function, uuid(0927baea-622d-4e41-a76d-255af426e7fb)]
interface nsIOpenSignedAppFileCallback : nsISupports
{
void openSignedAppFileFinished(in nsresult rv,
@ -358,4 +358,7 @@ interface nsIX509CertDB : nsISupports {
out nsIX509CertList verifiedChain,
out bool aHasEVPolicy);
// Clears the OCSP cache for the current certificate verification
// implementation.
void clearOCSPCache();
};

Some files were not shown because too many files have changed in this diff Show More