Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' 'ef553488251730120c975…
Browse files Browse the repository at this point in the history
…577b9f3eedbe18db87c' into embedlite
  • Loading branch information
tmeshkova committed Feb 26, 2014
2 parents 0c435c5 + ef55348 commit 59be9f0
Show file tree
Hide file tree
Showing 832 changed files with 21,166 additions and 7,735 deletions.
4 changes: 1 addition & 3 deletions CLOBBER
Expand Up @@ -22,6 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

CLOBBER to test mozfile changes which previously broke mozbuild's ability to clobber (bug 949600).

Safe to ignore - last clobber was 'Skia update from Bug 910754 needs a CLOBBER build' at Feb 18 15:19:59 2014 PST
Update CLOBBER for bug 939672 moves file location and requires clobber build.
22 changes: 21 additions & 1 deletion accessible/src/generic/Accessible.cpp
Expand Up @@ -919,7 +919,27 @@ void
Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
{
nsIFrame* frame = GetFrame();
if (frame) {
if (frame && mContent) {
nsRect* hitRegionRect = static_cast<nsRect*>(mContent->GetProperty(nsGkAtoms::hitregion));

if (hitRegionRect) {
// This is for canvas fallback content
// Find a canvas frame the found hit region is relative to.
nsIFrame* canvasFrame = frame->GetParent();
while (canvasFrame && (canvasFrame->GetType() != nsGkAtoms::HTMLCanvasFrame))
canvasFrame = canvasFrame->GetParent();

// make the canvas the bounding frame
if (canvasFrame) {
*aBoundingFrame = canvasFrame;

nsPresContext* presContext = mDoc->PresContext();
aTotalBounds = *hitRegionRect;

return;
}
}

*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
aTotalBounds = nsLayoutUtils::
GetAllInFlowRectsUnion(frame, *aBoundingFrame,
Expand Down
12 changes: 8 additions & 4 deletions accessible/src/jsat/OutputGenerator.jsm
Expand Up @@ -14,6 +14,7 @@ const INCLUDE_NAME = 0x02;
const INCLUDE_VALUE = 0x04;
const INCLUDE_CUSTOM = 0x08;
const NAME_FROM_SUBTREE_RULE = 0x10;
const IGNORE_EXPLICIT_NAME = 0x20;

const OUTPUT_DESC_FIRST = 0;
const OUTPUT_DESC_LAST = 1;
Expand Down Expand Up @@ -67,7 +68,8 @@ this.OutputGenerator = {
// NAME_FROM_SUBTREE_RULE.
return (((nameRule & INCLUDE_VALUE) && aAccessible.value) ||
((nameRule & NAME_FROM_SUBTREE_RULE) &&
Utils.getAttributes(aAccessible)['explicit-name'] === 'true'));
(Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
!(nameRule & IGNORE_EXPLICIT_NAME))));
};

let contextStart = this._getContextStart(aContext);
Expand Down Expand Up @@ -157,8 +159,8 @@ this.OutputGenerator = {

_addName: function _addName(aOutput, aAccessible, aFlags) {
let name;
if (Utils.getAttributes(aAccessible)['explicit-name'] === 'true' ||
(aFlags & INCLUDE_NAME)) {
if ((Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
!(aFlags & IGNORE_EXPLICIT_NAME)) || (aFlags & INCLUDE_NAME)) {
name = aAccessible.name;
}

Expand Down Expand Up @@ -319,7 +321,9 @@ this.OutputGenerator = {
'option': INCLUDE_DESC,
'listbox': INCLUDE_DESC,
'definitionlist': INCLUDE_DESC | INCLUDE_NAME,
'dialog': INCLUDE_DESC | INCLUDE_NAME },
'dialog': INCLUDE_DESC | INCLUDE_NAME,
'chrome window': IGNORE_EXPLICIT_NAME,
'app root': IGNORE_EXPLICIT_NAME },

objectOutputFunctions: {
_generateBaseOutput: function _generateBaseOutput(aAccessible, aRoleStr, aState, aFlags) {
Expand Down
1 change: 1 addition & 0 deletions accessible/tests/mochitest/elm/a11y.ini
Expand Up @@ -5,3 +5,4 @@
[test_listbox.xul]
[test_nsApplicationAcc.html]
[test_plugin.html]
[test_canvas.html]
55 changes: 55 additions & 0 deletions accessible/tests/mochitest/elm/test_canvas.html
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>Accessible boundaries for hit regions</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />

<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>

<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../layout.js"></script>

<script type="application/javascript">
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);

function doTest()
{
var canv = document.getElementById("c");
var context = canv.getContext('2d');
var element = document.getElementById("showA");
context.beginPath();
context.rect(10, 10, 150, 100);
context.addHitRegion({control: element});
var input = getAccessible("showA");
var input = getAccessible("showA");
var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv);
var [accX, accY, accWidth, accHeight] = getBounds(input);
is(accX, cnvX + 10, "accX should be 10 and not " + accX);
is(accY, cnvY + 10, "accY should be 10 and not " + accY);
is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
is(accHeight, 100, "accHeight should be 100 and not " + accHeight);

SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>

<canvas id="c">
<input id="showA" type="checkbox"><label for="showA"> Show As </label>
</canvas>

</body>
</html>
19 changes: 16 additions & 3 deletions accessible/tests/mochitest/jsat/output.js
Expand Up @@ -18,13 +18,26 @@ Cu.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this);
* scoped to the "root" element in markup.
*/
function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator) {
aOldAccOrElmOrID = aOldAccOrElmOrID || "root";
var accessible = getAccessible(aAccOrElmOrID);
var oldAccessible = getAccessible(aOldAccOrElmOrID);
var oldAccessible = aOldAccOrElmOrID !== null ?
getAccessible(aOldAccOrElmOrID || 'root') : null;
var context = new PivotContext(accessible, oldAccessible);
var output = aGenerator.genForContext(context).output;

isDeeply(output, expected,
// Create a version of the output that has null members where we have
// null members in the expected output. Those are indexes that are not testable
// because of the changing nature of the test (different window names), or strings
// that are inaccessible to us, like the title of parent documents.
var masked_output = [];
for (var i=0; i < output.length; i++) {
if (expected[i] === null) {
masked_output.push(null);
} else {
masked_output[i] = output[i];
}
}

isDeeply(masked_output, expected,
"Context output is correct for " + aAccOrElmOrID +
" (output: " + output.join(", ") + ") ==" +
" (expected: " + expected.join(", ") + ")");
Expand Down
5 changes: 5 additions & 0 deletions accessible/tests/mochitest/jsat/test_explicit_names.html
Expand Up @@ -35,6 +35,11 @@
}, {
accOrElmOrID: "heading1",
expected: ["heading level 1", "Test heading", "This is the heading."]
}, {
accOrElmOrID: "heading1",
oldAccOrElmOrID: null,
expected: [null /* parent doc title */, document.title,
"heading level 1", "Test heading", "This is the heading."]
}, {
accOrElmOrID: "heading2",
expected: ["heading level 1", "This is the heading."]
Expand Down
2 changes: 1 addition & 1 deletion addon-sdk/source/test/test-content-script.js
Expand Up @@ -590,7 +590,7 @@ exports["test XMLHttpRequest"] = createProxyTest("", function (helper) {
'new ' + function ContentScriptScope() {
// XMLHttpRequest doesn't support XMLHttpRequest.apply,
// that may break our proxy code
assert(window.XMLHttpRequest(), "we are able to instantiate XMLHttpRequest object");
assert(new window.XMLHttpRequest(), "we are able to instantiate XMLHttpRequest object");
done();
}
);
Expand Down
6 changes: 0 additions & 6 deletions b2g/app/Makefile.in
Expand Up @@ -47,12 +47,6 @@ endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,version)
endif

ifdef _MSC_VER
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
endif
endif #LIBXUL_SDK

UA_UPDATE_FILE = ua-update.json
Expand Down
4 changes: 4 additions & 0 deletions b2g/app/b2g.js
Expand Up @@ -872,6 +872,10 @@ pref("identity.fxaccounts.auth.uri", "https://api-accounts.dev.lcip.org/v1");
pref("apz.asyncscroll.throttle", 40);
pref("apz.pan_repaint_interval", 40);

// Maximum fling velocity in px/ms. Slower devices may need to reduce this
// to avoid checkerboarding. Note, float value must be set as a string.
pref("apz.max_velocity_pixels_per_ms", "6.0");

// This preference allows FirefoxOS apps (and content, I think) to force
// the use of software (instead of hardware accelerated) 2D canvases by
// creating a context like this:
Expand Down
4 changes: 4 additions & 0 deletions b2g/app/moz.build
Expand Up @@ -12,6 +12,10 @@ if not CONFIG['LIBXUL_SDK']:
SOURCES += [
'nsBrowserApp.cpp',
]
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']

if CONFIG['ENABLE_MARIONETTE']:
DEFINES['ENABLE_MARIONETTE'] = 1
Expand Down
17 changes: 13 additions & 4 deletions b2g/components/ContentPermissionPrompt.js
Expand Up @@ -222,11 +222,20 @@ ContentPermissionPrompt.prototype = {
permission: perm.type,
access: (perm.access && perm.access !== "unused") ?
perm.type + "-" + perm.access : perm.type,
options: [],
deny: true,
action: Ci.nsIPermissionManager.UNKNOWN_ACTION
};

// Append available options, if any.
let options = perm.options.QueryInterface(Ci.nsIArray);
for (let i = 0; i < options.length; i++) {
let option = options.queryElementAt(i, Ci.nsISupportsString).data;
tmp.options.push(option);
}
typesInfo.push(tmp);
}

if (typesInfo.length == 0) {
request.cancel();
return;
Expand Down Expand Up @@ -309,13 +318,13 @@ ContentPermissionPrompt.prototype = {
delegatePrompt: function(request, requestId, typesInfo, callback) {

this.sendToBrowserWindow("permission-prompt", request, requestId, typesInfo,
function(type, remember) {
function(type, remember, choices) {
if (type == "permission-allow") {
rememberPermission(typesInfo, request.principal, !remember);
if (callback) {
callback();
}
request.allow();
request.allow(choices);
return;
}

Expand Down Expand Up @@ -354,7 +363,7 @@ ContentPermissionPrompt.prototype = {
return;
evt.target.removeEventListener(evt.type, contentEvent);

callback(detail.type, detail.remember);
callback(detail.type, detail.remember, detail.choices);
})
}

Expand All @@ -367,7 +376,7 @@ ContentPermissionPrompt.prototype = {
let permissions = {};
for (let i in typesInfo) {
debug("prompt " + typesInfo[i].permission);
permissions[typesInfo[i].permission] = [];
permissions[typesInfo[i].permission] = typesInfo[i].options;
}

let details = {
Expand Down
10 changes: 5 additions & 5 deletions b2g/components/FxAccountsMgmtService.jsm
Expand Up @@ -39,7 +39,7 @@ this.FxAccountsMgmtService = {
this._shell.sendCustomEvent(aEventName, aMsg);
},

_onFullfill: function(aMsgId, aData) {
_onFulfill: function(aMsgId, aData) {
this._sendChromeEvent("mozFxAccountsChromeEvent", {
id: aMsgId,
data: aData ? aData : null
Expand Down Expand Up @@ -100,7 +100,7 @@ this.FxAccountsMgmtService = {
FxAccountsManager.getAccount().then(
account => {
// We only expose the email and verification status so far.
self._onFullfill(msg.id, account);
self._onFulfill(msg.id, account);
},
reason => {
self._onReject(msg.id, reason);
Expand All @@ -110,7 +110,7 @@ this.FxAccountsMgmtService = {
case "logout":
FxAccountsManager.signOut().then(
() => {
self._onFullfill(msg.id);
self._onFulfill(msg.id);
},
reason => {
self._onReject(msg.id, reason);
Expand All @@ -120,7 +120,7 @@ this.FxAccountsMgmtService = {
case "queryAccount":
FxAccountsManager.queryAccount(data.accountId).then(
result => {
self._onFullfill(msg.id, result);
self._onFulfill(msg.id, result);
},
reason => {
self._onReject(msg.id, reason);
Expand All @@ -132,7 +132,7 @@ this.FxAccountsMgmtService = {
case "refreshAuthentication":
FxAccountsManager[data.method](data.accountId, data.password).then(
user => {
self._onFullfill(msg.id, user);
self._onFulfill(msg.id, user);
},
reason => {
self._onReject(msg.id, reason);
Expand Down
55 changes: 48 additions & 7 deletions b2g/components/test/mochitest/SandboxPromptTest.html
Expand Up @@ -2,14 +2,55 @@
<body>
<script>

// invoke audio-capture permission prompt
navigator.mozGetUserMedia({audio: true}, function () {}, function () {});
var actions = [
{
permissions: ["video-capture"],
action: function() {
// invoke video-capture permission prompt
navigator.mozGetUserMedia({video: true}, function () {}, function () {});
}
},
{
permissions: ["audio-capture", "video-capture"],
action: function() {
// invoke audio-capture + video-capture permission prompt
navigator.mozGetUserMedia({audio: true, video: true}, function () {}, function () {});
}
},
{
permissions: ["audio-capture"],
action: function() {
// invoke audio-capture permission prompt
navigator.mozGetUserMedia({audio: true}, function () {}, function () {});
}
},
{
permissions: ["geolocation"],
action: function() {
// invoke geolocation permission prompt
navigator.geolocation.getCurrentPosition(function (pos) {});
}
},
{
permissions: ["desktop-notification"],
action: function() {
// invoke desktop-notification prompt
Notification.requestPermission(function (perm) {});
}
},
];

// invoke geolocation permission prompt
navigator.geolocation.getCurrentPosition(function (pos) {});

// invoke desktop-notification prompt
Notification.requestPermission(function (perm) {});
// The requested permissions are specified in query string.
var permissions = JSON.parse(decodeURIComponent(window.location.search.substring(1)));
for (var i = 0; i < actions.length; i++) {
if(permissions.length === actions[i].permissions.length &&
permissions.every(function(permission) {
return actions[i].permissions.indexOf(permission) >= 0;
})) {
actions[i].action();
break;
}
}

</script>
</body>
Expand Down

0 comments on commit 59be9f0

Please sign in to comment.