зеркало из https://github.com/mozilla/gecko-dev.git
Merge latest green birch changeset and mozilla-central
This commit is contained in:
Коммит
82e422b825
|
@ -1739,10 +1739,33 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
|
|||
if (child) {
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
} else {
|
||||
TreeWalker walker(aContainer, aChildNode, true);
|
||||
if (aIsInsert) {
|
||||
TreeWalker walker(aContainer, aChildNode, true);
|
||||
|
||||
while ((child = walker.NextChild()))
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
while ((child = walker.NextChild()))
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent);
|
||||
} else {
|
||||
// aChildNode may not coorespond to a particular accessible, to handle
|
||||
// this we go through all the children of aContainer. Then if a child
|
||||
// has aChildNode as an ancestor, or does not have the node for
|
||||
// aContainer as an ancestor remove that child of aContainer. Note that
|
||||
// when we are called aChildNode may already have been removed
|
||||
// from the DOM so we can't expect it to have a parent or what was it's
|
||||
// parent to have it as a child.
|
||||
nsINode* containerNode = aContainer->GetNode();
|
||||
for (uint32_t idx = 0; idx < aContainer->ContentChildCount();) {
|
||||
Accessible* child = aContainer->ContentChildAt(idx);
|
||||
nsINode* childNode = child->GetContent();
|
||||
while (childNode != aChildNode && childNode != containerNode &&
|
||||
(childNode = childNode->GetParentNode()));
|
||||
|
||||
if (childNode != containerNode) {
|
||||
updateFlags |= UpdateTreeInternal(child, false, reorderEvent);
|
||||
} else {
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Content insertion/removal is not cause of accessible tree change.
|
||||
|
|
|
@ -30,6 +30,7 @@ MOCHITEST_A11Y_FILES =\
|
|||
test_optgroup.html \
|
||||
test_recreation.html \
|
||||
test_select.html \
|
||||
test_bug852150.xhtml \
|
||||
test_textleaf.html \
|
||||
test_visibility.html \
|
||||
test_whitespace.html \
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Canvas subdom mutation</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="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
var the_displayNone = getNode("the_displaynone");
|
||||
var the_table = getNode("the_table");
|
||||
var the_row = getNode("the_row");
|
||||
ok(isAccessible(the_table), "table should be accessible");
|
||||
the_displayNone.appendChild(the_table);
|
||||
ok(!isAccessible(the_table), "table in display none tree shouldn't be accessible");
|
||||
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(the_row);
|
||||
// make sure no accessibles have stuck around.
|
||||
ok(!isAccessible(the_row), "row shouldn't be accessible");
|
||||
ok(!isAccessible(the_table), "table shouldn't be accessible");
|
||||
ok(!isAccessible(the_displayNone), "display none things shouldn't be accessible");
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="test accessible removal when reframe root isn't accessible"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=852150">
|
||||
Mozilla Bug 852150
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="the_displaynone" style="display: none;"></div>
|
||||
<table id="the_table"></table>
|
||||
<tr id="the_row"></tr>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"repo": "http://hg.mozilla.org/integration/gaia-central/",
|
||||
"revision": "8c7dcb64cafd"
|
||||
"repo_path": "/integration/gaia-central",
|
||||
"revision": "3f5bb84585fc"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1369693795000">
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1370548649000">
|
||||
<emItems>
|
||||
<emItem blockID="i350" id="sqlmoz@facebook.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
|
@ -49,6 +49,10 @@
|
|||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
|
||||
<versionRange minVersion=" " maxVersion="8.5">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i236" id="{EEE6C361-6118-11DC-9C72-001320C79847}">
|
||||
<versionRange minVersion="0" maxVersion="1.7.999" severity="1">
|
||||
</versionRange>
|
||||
|
@ -103,6 +107,10 @@
|
|||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i360" id="ytd@mybrowserbar.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i5" id="support@daemon-tools.cc">
|
||||
<versionRange minVersion=" " maxVersion="1.0.0.5">
|
||||
</versionRange>
|
||||
|
@ -374,8 +382,8 @@
|
|||
<versionRange minVersion="1.5.7.5" maxVersion="1.5.7.5" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
|
||||
<versionRange minVersion=" " maxVersion="8.5">
|
||||
<emItem blockID="i362" id="addon@defaulttab.com">
|
||||
<versionRange minVersion="0" maxVersion="1.4.4" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i12" id="masterfiler@gmail.com">
|
||||
|
@ -722,35 +730,35 @@
|
|||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p180">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 7 Update 0" maxVersion="Java 7 Update 11" severity="0" vulnerabilitystatus="2">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 7 Update 0" maxVersion="Java 7 Update 11" severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p182">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 7 U([0-9]|(1[0-1]))(\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 7 U([0-9]|(1[0-1]))(\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p184">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.7\.0(_0?([0-9]|(1[0-1]))?)?([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.7\.0(_0?([0-9]|(1[0-1]))?)?([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p186">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 6 U3[1-8](\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 6 U3[1-8](\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p188">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 6 Update 0" maxVersion="Java 6 Update 38" severity="0" vulnerabilitystatus="2">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 6 Update 0" maxVersion="Java 6 Update 38" severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
|
@ -839,42 +847,42 @@
|
|||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p292">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 7 Update 12" maxVersion="Java 7 Update 15" severity="0" vulnerabilitystatus="2">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 7 Update 12" maxVersion="Java 7 Update 15" severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p294">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 7 U1[2-5](\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 7 U1[2-5](\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p296">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.7\.0_1[2-5]([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.7\.0_1[2-5]([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p298">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 6 Update 39" maxVersion="Java 6 Update 41" severity="0" vulnerabilitystatus="2">
|
||||
<match name="filename" exp="JavaAppletPlugin\.plugin" /> <versionRange minVersion="Java 6 Update 39" maxVersion="Java 6 Update 41" severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p300">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 6 U(39|40|41)(\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Platform SE 6 U(39|40|41)(\s[^\d\._U]|$)" /> <match name="filename" exp="npjp2\.dll" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p302">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.6\.0_(39|40|41)([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="2">
|
||||
<match name="name" exp="Java\(TM\) Plug-in 1\.6\.0_(39|40|41)([^\d\._]|$)" /> <match name="filename" exp="libnpjp2\.so" /> <versionRange severity="0" vulnerabilitystatus="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="17.0" maxVersion="*" />
|
||||
</targetApplication>
|
||||
|
|
|
@ -30,7 +30,6 @@ function test() {
|
|||
}
|
||||
}
|
||||
|
||||
registerCleanupFunction(finalize);
|
||||
Services.obs.addObserver(observer, "browser-search-engine-modified", false);
|
||||
ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine_mozsearch.xml",
|
||||
Ci.nsISearchEngine.DATA_XML, "data:image/x-icon,%00",
|
||||
|
@ -41,7 +40,10 @@ function test() {
|
|||
ok(contextMenu, "Got context menu XUL");
|
||||
|
||||
doOnloadOnce(testContextMenu);
|
||||
gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
|
||||
registerCleanupFunction(function () {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
}
|
||||
|
||||
function testContextMenu() {
|
||||
|
@ -69,7 +71,9 @@ function test() {
|
|||
is(event.originalTarget.URL,
|
||||
"http://mochi.test:8888/browser/browser/components/search/test/?test=test+search&ie=utf-8&client=app&channel=contextsearch",
|
||||
"Checking context menu search URL");
|
||||
finalize();
|
||||
// Remove the tab opened by the search
|
||||
gBrowser.removeCurrentTab();
|
||||
ss.removeEngine(ss.currentEngine);
|
||||
}
|
||||
|
||||
var selectionListener = {
|
||||
|
@ -93,14 +97,4 @@ function test() {
|
|||
goDoCommand('cmd_selectAll');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
while (gBrowser.tabs.length != 1) {
|
||||
gBrowser.removeTab(gBrowser.tabs[0]);
|
||||
}
|
||||
content.location.href = "about:blank";
|
||||
var engine = ss.getEngineByName(ENGINE_NAME);
|
||||
if (engine)
|
||||
ss.removeEngine(engine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -529,12 +529,10 @@
|
|||
@BINPATH@/components/PeerConnection.manifest
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MARIONETTE
|
||||
@BINPATH@/chrome/marionette@JAREXT@
|
||||
@BINPATH@/chrome/marionette.manifest
|
||||
@BINPATH@/components/MarionetteComponents.manifest
|
||||
@BINPATH@/components/marionettecomponent.js
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
@BINPATH@/components/dom_webspeechsynth.xpt
|
||||
|
|
|
@ -12,18 +12,27 @@ function test() {
|
|||
runTests();
|
||||
}
|
||||
|
||||
function scrollToEnd() {
|
||||
let startBox = document.getElementById("start-scrollbox");
|
||||
let [, scrollInterface] = ScrollUtils.getScrollboxFromElement(startBox);
|
||||
|
||||
scrollInterface.scrollBy(50000, 0);
|
||||
}
|
||||
|
||||
function setup() {
|
||||
PanelUI.hide();
|
||||
HistoryTestHelper.setup();
|
||||
|
||||
if (StartUI.isStartPageVisible)
|
||||
return;
|
||||
if (!StartUI.isStartPageVisible) {
|
||||
yield addTab("about:start");
|
||||
|
||||
yield addTab("about:start");
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
yield hideContextUI();
|
||||
}
|
||||
|
||||
yield hideContextUI();
|
||||
// Scroll to make sure all tiles are visible.
|
||||
scrollToEnd();
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
@ -166,6 +175,7 @@ gTests.push({
|
|||
let item2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
@ -269,6 +279,7 @@ gTests.push({
|
|||
let initialLocation2 = gStartView._set.getIndexOfItem(item2);
|
||||
let initialLocation3 = gStartView._set.getIndexOfItem(item3);
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
@ -313,6 +324,7 @@ gTests.push({
|
|||
let item2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
@ -391,6 +403,7 @@ gTests.push({
|
|||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
@ -444,6 +457,7 @@ gTests.push({
|
|||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
@ -521,6 +535,7 @@ gTests.push({
|
|||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
|
|
|
@ -3842,23 +3842,40 @@ toolbar[mode="icons"] > *|* > .toolbarbutton-badge[badge]:not([badge=""]):-moz-l
|
|||
min-width: 300px;
|
||||
}
|
||||
|
||||
.social-share-frame {
|
||||
border-top-left-radius: none;
|
||||
border-bottom-left-radius: none;
|
||||
.social-share-frame:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-panel > .social-share-toolbar {
|
||||
.social-share-frame:-moz-locale-dir(rtl) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
#social-share-panel > .social-share-toolbar:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons {
|
||||
#social-share-panel > .social-share-toolbar:-moz-locale-dir(rtl) {
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons:-moz-locale-dir(rtl) {
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
/* === end of social toolbar provider menu === */
|
||||
|
||||
%include ../shared/social/chat.inc.css
|
||||
|
|
|
@ -1795,24 +1795,44 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
background: linear-gradient(to bottom, #f0f4f7, #fafbfc);
|
||||
width: 330px;
|
||||
height: 150px;
|
||||
border-top-left-radius: none;
|
||||
border-bottom-left-radius: none;
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
/* we resize our panels dynamically, make it look nice */
|
||||
transition: height 100ms ease-out, width 100ms ease-out;
|
||||
}
|
||||
|
||||
#social-share-panel > .social-share-toolbar {
|
||||
.social-share-frame:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
.social-share-frame:-moz-locale-dir(rtl) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
#social-share-panel > .social-share-toolbar:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons {
|
||||
#social-share-panel > .social-share-toolbar:-moz-locale-dir(rtl) {
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons:-moz-locale-dir(ltr) {
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
}
|
||||
|
||||
#social-share-provider-buttons:-moz-locale-dir(rtl) {
|
||||
border-top-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
/* social recommending panel */
|
||||
|
||||
#social-mark-button {
|
||||
|
|
|
@ -78,10 +78,6 @@ GDBINIT_FILES := $(topsrcdir)/.gdbinit
|
|||
GDBINIT_DEST = $(FINAL_TARGET)
|
||||
INSTALL_TARGETS += GDBINIT
|
||||
|
||||
PYTHON_UNIT_TESTS := \
|
||||
tests/test.py \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# we install to _leaktest/
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,11 +0,0 @@
|
|||
# illustrate test filters based on various categories
|
||||
|
||||
[windowstest]
|
||||
run-if = os == 'win'
|
||||
|
||||
[fleem]
|
||||
skip-if = os == 'mac'
|
||||
|
||||
[linuxtest]
|
||||
skip-if = (os == 'mac') || (os == 'win')
|
||||
fail-if = toolkit == 'cocoa'
|
|
@ -1 +0,0 @@
|
|||
# dummy spot for "fleem" test
|
|
@ -1,11 +0,0 @@
|
|||
[DEFAULT]
|
||||
foo = bar
|
||||
|
||||
[include:include/bar.ini]
|
||||
|
||||
[fleem]
|
||||
|
||||
[include:include/foo.ini]
|
||||
red = roses
|
||||
blue = violets
|
||||
yellow = daffodils
|
|
@ -1,4 +0,0 @@
|
|||
[DEFAULT]
|
||||
foo = fleem
|
||||
|
||||
[crash-handling]
|
|
@ -1 +0,0 @@
|
|||
# dummy spot for "crash-handling" test
|
|
@ -1 +0,0 @@
|
|||
# dummy spot for "flowers" test
|
|
@ -1,5 +0,0 @@
|
|||
[DEFAULT]
|
||||
blue = ocean
|
||||
|
||||
[flowers]
|
||||
yellow = submarine
|
|
@ -1,80 +0,0 @@
|
|||
[testAddons/testDisableEnablePlugin.js]
|
||||
[testAddons/testGetAddons.js]
|
||||
[testAddons/testSearchAddons.js]
|
||||
[testAwesomeBar/testAccessLocationBar.js]
|
||||
[testAwesomeBar/testCheckItemHighlight.js]
|
||||
[testAwesomeBar/testEscapeAutocomplete.js]
|
||||
[testAwesomeBar/testFaviconInAutocomplete.js]
|
||||
[testAwesomeBar/testGoButton.js]
|
||||
[testAwesomeBar/testLocationBarSearches.js]
|
||||
[testAwesomeBar/testPasteLocationBar.js]
|
||||
[testAwesomeBar/testSuggestHistoryBookmarks.js]
|
||||
[testAwesomeBar/testVisibleItemsMax.js]
|
||||
[testBookmarks/testAddBookmarkToMenu.js]
|
||||
[testCookies/testDisableCookies.js]
|
||||
[testCookies/testEnableCookies.js]
|
||||
[testCookies/testRemoveAllCookies.js]
|
||||
[testCookies/testRemoveCookie.js]
|
||||
[testDownloading/testCloseDownloadManager.js]
|
||||
[testDownloading/testDownloadStates.js]
|
||||
[testDownloading/testOpenDownloadManager.js]
|
||||
[testFindInPage/testFindInPage.js]
|
||||
[testFormManager/testAutoCompleteOff.js]
|
||||
[testFormManager/testBasicFormCompletion.js]
|
||||
[testFormManager/testClearFormHistory.js]
|
||||
[testFormManager/testDisableFormManager.js]
|
||||
[testGeneral/testGoogleSuggestions.js]
|
||||
[testGeneral/testStopReloadButtons.js]
|
||||
[testInstallation/testBreakpadInstalled.js]
|
||||
[testLayout/testNavigateFTP.js]
|
||||
[testPasswordManager/testPasswordNotSaved.js]
|
||||
[testPasswordManager/testPasswordSavedAndDeleted.js]
|
||||
[testPopups/testPopupsAllowed.js]
|
||||
[testPopups/testPopupsBlocked.js]
|
||||
[testPreferences/testPaneRetention.js]
|
||||
[testPreferences/testPreferredLanguage.js]
|
||||
[testPreferences/testRestoreHomepageToDefault.js]
|
||||
[testPreferences/testSetToCurrentPage.js]
|
||||
[testPreferences/testSwitchPanes.js]
|
||||
[testPrivateBrowsing/testAboutPrivateBrowsing.js]
|
||||
[testPrivateBrowsing/testCloseWindow.js]
|
||||
[testPrivateBrowsing/testDisabledElements.js]
|
||||
[testPrivateBrowsing/testDisabledPermissions.js]
|
||||
[testPrivateBrowsing/testDownloadManagerClosed.js]
|
||||
[testPrivateBrowsing/testGeolocation.js]
|
||||
[testPrivateBrowsing/testStartStopPBMode.js]
|
||||
[testPrivateBrowsing/testTabRestoration.js]
|
||||
[testPrivateBrowsing/testTabsDismissedOnStop.js]
|
||||
[testSearch/testAddMozSearchProvider.js]
|
||||
[testSearch/testFocusAndSearch.js]
|
||||
[testSearch/testGetMoreSearchEngines.js]
|
||||
[testSearch/testOpenSearchAutodiscovery.js]
|
||||
[testSearch/testRemoveSearchEngine.js]
|
||||
[testSearch/testReorderSearchEngines.js]
|
||||
[testSearch/testRestoreDefaults.js]
|
||||
[testSearch/testSearchSelection.js]
|
||||
[testSearch/testSearchSuggestions.js]
|
||||
[testSecurity/testBlueLarry.js]
|
||||
[testSecurity/testDefaultPhishingEnabled.js]
|
||||
[testSecurity/testDefaultSecurityPrefs.js]
|
||||
[testSecurity/testEncryptedPageWarning.js]
|
||||
[testSecurity/testGreenLarry.js]
|
||||
[testSecurity/testGreyLarry.js]
|
||||
[testSecurity/testIdentityPopupOpenClose.js]
|
||||
[testSecurity/testSSLDisabledErrorPage.js]
|
||||
[testSecurity/testSafeBrowsingNotificationBar.js]
|
||||
[testSecurity/testSafeBrowsingWarningPages.js]
|
||||
[testSecurity/testSecurityInfoViaMoreInformation.js]
|
||||
[testSecurity/testSecurityNotification.js]
|
||||
[testSecurity/testSubmitUnencryptedInfoWarning.js]
|
||||
[testSecurity/testUnknownIssuer.js]
|
||||
[testSecurity/testUntrustedConnectionErrorPage.js]
|
||||
[testSessionStore/testUndoTabFromContextMenu.js]
|
||||
[testTabbedBrowsing/testBackgroundTabScrolling.js]
|
||||
[testTabbedBrowsing/testCloseTab.js]
|
||||
[testTabbedBrowsing/testNewTab.js]
|
||||
[testTabbedBrowsing/testNewWindow.js]
|
||||
[testTabbedBrowsing/testOpenInBackground.js]
|
||||
[testTabbedBrowsing/testOpenInForeground.js]
|
||||
[testTechnicalTools/testAccessPageInfoDialog.js]
|
||||
[testToolbar/testBackForwardButtons.js]
|
|
@ -1,26 +0,0 @@
|
|||
[DEFAULT]
|
||||
type = restart
|
||||
|
||||
[restartTests/testExtensionInstallUninstall/test2.js]
|
||||
foo = bar
|
||||
|
||||
[restartTests/testExtensionInstallUninstall/test1.js]
|
||||
foo = baz
|
||||
|
||||
[restartTests/testExtensionInstallUninstall/test3.js]
|
||||
[restartTests/testSoftwareUpdateAutoProxy/test2.js]
|
||||
[restartTests/testSoftwareUpdateAutoProxy/test1.js]
|
||||
[restartTests/testMasterPassword/test1.js]
|
||||
[restartTests/testExtensionInstallGetAddons/test2.js]
|
||||
[restartTests/testExtensionInstallGetAddons/test1.js]
|
||||
[restartTests/testMultipleExtensionInstallation/test2.js]
|
||||
[restartTests/testMultipleExtensionInstallation/test1.js]
|
||||
[restartTests/testThemeInstallUninstall/test2.js]
|
||||
[restartTests/testThemeInstallUninstall/test1.js]
|
||||
[restartTests/testThemeInstallUninstall/test3.js]
|
||||
[restartTests/testDefaultBookmarks/test1.js]
|
||||
[softwareUpdate/testFallbackUpdate/test2.js]
|
||||
[softwareUpdate/testFallbackUpdate/test1.js]
|
||||
[softwareUpdate/testFallbackUpdate/test3.js]
|
||||
[softwareUpdate/testDirectUpdate/test2.js]
|
||||
[softwareUpdate/testDirectUpdate/test1.js]
|
|
@ -1,2 +0,0 @@
|
|||
[foo]
|
||||
path = fleem
|
|
@ -1,81 +0,0 @@
|
|||
#!/usr/bin/env 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/.
|
||||
|
||||
"""tests for ManifestDestiny"""
|
||||
|
||||
import doctest
|
||||
import os
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
def run_tests(raise_on_error=False, report_first=False):
|
||||
|
||||
# add results here
|
||||
results = {}
|
||||
|
||||
# doctest arguments
|
||||
directory = os.path.dirname(os.path.abspath(__file__))
|
||||
extraglobs = {}
|
||||
doctest_args = dict(extraglobs=extraglobs,
|
||||
module_relative=False,
|
||||
raise_on_error=raise_on_error)
|
||||
if report_first:
|
||||
doctest_args['optionflags'] = doctest.REPORT_ONLY_FIRST_FAILURE
|
||||
|
||||
# gather tests
|
||||
directory = os.path.dirname(os.path.abspath(__file__))
|
||||
tests = [ test for test in os.listdir(directory)
|
||||
if test.endswith('.txt') and test.startswith('test_')]
|
||||
os.chdir(directory)
|
||||
|
||||
# run the tests
|
||||
for test in tests:
|
||||
try:
|
||||
results[test] = doctest.testfile(test, **doctest_args)
|
||||
except doctest.DocTestFailure, failure:
|
||||
raise
|
||||
except doctest.UnexpectedException, failure:
|
||||
raise failure.exc_info[0], failure.exc_info[1], failure.exc_info[2]
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def main(args=sys.argv[1:]):
|
||||
|
||||
# parse command line options
|
||||
parser = OptionParser(description=__doc__)
|
||||
parser.add_option('--raise', dest='raise_on_error',
|
||||
default=False, action='store_true',
|
||||
help="raise on first error")
|
||||
parser.add_option('--report-first', dest='report_first',
|
||||
default=False, action='store_true',
|
||||
help="report the first error only (all tests will still run)")
|
||||
parser.add_option('-q', '--quiet', dest='quiet',
|
||||
default=False, action='store_true',
|
||||
help="minimize output")
|
||||
options, args = parser.parse_args(args)
|
||||
quiet = options.__dict__.pop('quiet')
|
||||
|
||||
# run the tests
|
||||
results = run_tests(**options.__dict__)
|
||||
|
||||
# check for failure
|
||||
failed = False
|
||||
for result in results.values():
|
||||
if result[0]: # failure count; http://docs.python.org/library/doctest.html#basic-api
|
||||
failed = True
|
||||
break
|
||||
if failed:
|
||||
sys.exit(1) # error
|
||||
if not quiet:
|
||||
# print results
|
||||
print "manifestparser.py: All tests pass!"
|
||||
for test in sorted(results.keys()):
|
||||
result = results[test]
|
||||
print "%s: failed=%s, attempted=%s" % (test, result[0], result[1])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,120 +0,0 @@
|
|||
Test Expressionparser
|
||||
=====================
|
||||
|
||||
Test the conditional expression parser.
|
||||
|
||||
Boilerplate::
|
||||
|
||||
>>> from manifestparser import parse
|
||||
|
||||
Test basic values::
|
||||
|
||||
>>> parse("1")
|
||||
1
|
||||
>>> parse("100")
|
||||
100
|
||||
>>> parse("true")
|
||||
True
|
||||
>>> parse("false")
|
||||
False
|
||||
>>> '' == parse('""')
|
||||
True
|
||||
>>> parse('"foo bar"')
|
||||
'foo bar'
|
||||
>>> parse("'foo bar'")
|
||||
'foo bar'
|
||||
>>> parse("foo", foo=1)
|
||||
1
|
||||
>>> parse("bar", bar=True)
|
||||
True
|
||||
>>> parse("abc123", abc123="xyz")
|
||||
'xyz'
|
||||
|
||||
Test equality::
|
||||
|
||||
>>> parse("true == true")
|
||||
True
|
||||
>>> parse("false == false")
|
||||
True
|
||||
>>> parse("false == false")
|
||||
True
|
||||
>>> parse("1 == 1")
|
||||
True
|
||||
>>> parse("100 == 100")
|
||||
True
|
||||
>>> parse('"some text" == "some text"')
|
||||
True
|
||||
>>> parse("true != false")
|
||||
True
|
||||
>>> parse("1 != 2")
|
||||
True
|
||||
>>> parse('"text" != "other text"')
|
||||
True
|
||||
>>> parse("foo == true", foo=True)
|
||||
True
|
||||
>>> parse("foo == 1", foo=1)
|
||||
True
|
||||
>>> parse('foo == "bar"', foo='bar')
|
||||
True
|
||||
>>> parse("foo == bar", foo=True, bar=True)
|
||||
True
|
||||
>>> parse("true == foo", foo=True)
|
||||
True
|
||||
>>> parse("foo != true", foo=False)
|
||||
True
|
||||
>>> parse("foo != 2", foo=1)
|
||||
True
|
||||
>>> parse('foo != "bar"', foo='abc')
|
||||
True
|
||||
>>> parse("foo != bar", foo=True, bar=False)
|
||||
True
|
||||
>>> parse("true != foo", foo=False)
|
||||
True
|
||||
>>> parse("!false")
|
||||
True
|
||||
|
||||
Test conjunctions::
|
||||
|
||||
>>> parse("true && true")
|
||||
True
|
||||
>>> parse("true || false")
|
||||
True
|
||||
>>> parse("false || false")
|
||||
False
|
||||
>>> parse("true && false")
|
||||
False
|
||||
>>> parse("true || false && false")
|
||||
True
|
||||
|
||||
Test parentheses::
|
||||
|
||||
>>> parse("(true)")
|
||||
True
|
||||
>>> parse("(10)")
|
||||
10
|
||||
>>> parse('("foo")')
|
||||
'foo'
|
||||
>>> parse("(foo)", foo=1)
|
||||
1
|
||||
>>> parse("(true == true)")
|
||||
True
|
||||
>>> parse("(true != false)")
|
||||
True
|
||||
>>> parse("(true && true)")
|
||||
True
|
||||
>>> parse("(true || false)")
|
||||
True
|
||||
>>> parse("(true && true || false)")
|
||||
True
|
||||
>>> parse("(true || false) && false")
|
||||
False
|
||||
>>> parse("(true || false) && true")
|
||||
True
|
||||
>>> parse("true && (true || false)")
|
||||
True
|
||||
>>> parse("true && (true || false)")
|
||||
True
|
||||
>>> parse("(true && false) || (true && (true || false))")
|
||||
True
|
||||
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
Test the manifest parser
|
||||
========================
|
||||
|
||||
You must have ManifestDestiny installed before running these tests.
|
||||
Run ``python manifestparser.py setup develop`` with setuptools installed.
|
||||
|
||||
Ensure basic parser is sane::
|
||||
|
||||
>>> from manifestparser import ManifestParser
|
||||
>>> parser = ManifestParser()
|
||||
>>> parser.read('mozmill-example.ini')
|
||||
>>> tests = parser.tests
|
||||
>>> len(tests) == len(file('mozmill-example.ini').read().strip().splitlines())
|
||||
True
|
||||
|
||||
Ensure that capitalization and order aren't an issue:
|
||||
|
||||
>>> lines = ['[%s]' % test['name'] for test in tests]
|
||||
>>> lines == file('mozmill-example.ini').read().strip().splitlines()
|
||||
True
|
||||
|
||||
Show how you select subsets of tests:
|
||||
|
||||
>>> parser.read('mozmill-restart-example.ini')
|
||||
>>> restart_tests = parser.get(type='restart')
|
||||
>>> len(restart_tests) < len(parser.tests)
|
||||
True
|
||||
>>> import os
|
||||
>>> len(restart_tests) == len(parser.get(manifest=os.path.abspath('mozmill-restart-example.ini')))
|
||||
True
|
||||
>>> assert not [test for test in restart_tests if test['manifest'] != os.path.abspath('mozmill-restart-example.ini')]
|
||||
>>> parser.get('name', tags=['foo'])
|
||||
['restartTests/testExtensionInstallUninstall/test2.js', 'restartTests/testExtensionInstallUninstall/test1.js']
|
||||
>>> parser.get('name', foo='bar')
|
||||
['restartTests/testExtensionInstallUninstall/test2.js']
|
||||
|
||||
Illustrate how include works::
|
||||
|
||||
>>> parser = ManifestParser(manifests=('include-example.ini',))
|
||||
|
||||
All of the tests should be included, in order::
|
||||
|
||||
>>> parser.get('name')
|
||||
['crash-handling', 'fleem', 'flowers']
|
||||
>>> [(test['name'], os.path.basename(test['manifest'])) for test in parser.tests]
|
||||
[('crash-handling', 'bar.ini'), ('fleem', 'include-example.ini'), ('flowers', 'foo.ini')]
|
||||
|
||||
The manifests should be there too::
|
||||
|
||||
>>> len(parser.manifests())
|
||||
3
|
||||
|
||||
We're already in the root directory::
|
||||
|
||||
>>> os.getcwd() == parser.rootdir
|
||||
True
|
||||
|
||||
DEFAULT values should persist across includes, unless they're
|
||||
overwritten. In this example, include-example.ini sets foo=bar, but
|
||||
its overridden to fleem in bar.ini::
|
||||
|
||||
>>> parser.get('name', foo='bar')
|
||||
['fleem', 'flowers']
|
||||
>>> parser.get('name', foo='fleem')
|
||||
['crash-handling']
|
||||
|
||||
Passing parameters in the include section allows defining variables in
|
||||
the submodule scope:
|
||||
|
||||
>>> parser.get('name', tags=['red'])
|
||||
['flowers']
|
||||
|
||||
However, this should be overridable from the DEFAULT section in the
|
||||
included file and that overridable via the key directly connected to
|
||||
the test::
|
||||
|
||||
>>> parser.get(name='flowers')[0]['blue']
|
||||
'ocean'
|
||||
>>> parser.get(name='flowers')[0]['yellow']
|
||||
'submarine'
|
||||
|
||||
You can query multiple times if you need to::
|
||||
|
||||
>>> flowers = parser.get(foo='bar')
|
||||
>>> len(flowers)
|
||||
2
|
||||
>>> roses = parser.get(tests=flowers, red='roses')
|
||||
|
||||
Using the inverse flag should invert the set of tests returned::
|
||||
|
||||
>>> parser.get('name', inverse=True, tags=['red'])
|
||||
['crash-handling', 'fleem']
|
||||
|
||||
All of the included tests actually exist::
|
||||
|
||||
>>> [i['name'] for i in parser.missing()]
|
||||
[]
|
||||
|
||||
Write the output to a manifest:
|
||||
|
||||
>>> from StringIO import StringIO
|
||||
>>> buffer = StringIO()
|
||||
>>> parser.write(fp=buffer, global_kwargs={'foo': 'bar'})
|
||||
>>> buffer.getvalue().strip()
|
||||
'[DEFAULT]\nfoo = bar\n\n[fleem]\n\n[include/flowers]\nblue = ocean\nred = roses\nyellow = submarine'
|
||||
|
||||
Test our ability to convert a static directory structure to a
|
||||
manifest. First, stub out a directory with files in it::
|
||||
|
||||
>>> import shutil, tempfile
|
||||
>>> def create_stub():
|
||||
... directory = tempfile.mkdtemp()
|
||||
... for i in 'foo', 'bar', 'fleem':
|
||||
... file(os.path.join(directory, i), 'w').write(i)
|
||||
... subdir = os.path.join(directory, 'subdir')
|
||||
... os.mkdir(subdir)
|
||||
... file(os.path.join(subdir, 'subfile'), 'w').write('baz')
|
||||
... return directory
|
||||
>>> stub = create_stub()
|
||||
>>> os.path.exists(stub) and os.path.isdir(stub)
|
||||
True
|
||||
|
||||
Make a manifest for it::
|
||||
|
||||
>>> from manifestparser import convert
|
||||
>>> print convert([stub])
|
||||
[bar]
|
||||
[fleem]
|
||||
[foo]
|
||||
[subdir/subfile]
|
||||
>>> shutil.rmtree(stub)
|
||||
|
||||
Now do the same thing but keep the manifests in place::
|
||||
|
||||
>>> stub = create_stub()
|
||||
>>> convert([stub], write='manifest.ini')
|
||||
>>> sorted(os.listdir(stub))
|
||||
['bar', 'fleem', 'foo', 'manifest.ini', 'subdir']
|
||||
>>> parser = ManifestParser()
|
||||
>>> parser.read(os.path.join(stub, 'manifest.ini'))
|
||||
>>> [i['name'] for i in parser.tests]
|
||||
['subfile', 'bar', 'fleem', 'foo']
|
||||
>>> parser = ManifestParser()
|
||||
>>> parser.read(os.path.join(stub, 'subdir', 'manifest.ini'))
|
||||
>>> len(parser.tests)
|
||||
1
|
||||
>>> parser.tests[0]['name']
|
||||
'subfile'
|
||||
>>> shutil.rmtree(stub)
|
||||
|
||||
Test our ability to copy a set of manifests::
|
||||
|
||||
>>> tempdir = tempfile.mkdtemp()
|
||||
>>> manifest = ManifestParser(manifests=('include-example.ini',))
|
||||
>>> manifest.copy(tempdir)
|
||||
>>> sorted(os.listdir(tempdir))
|
||||
['fleem', 'include', 'include-example.ini']
|
||||
>>> sorted(os.listdir(os.path.join(tempdir, 'include')))
|
||||
['bar.ini', 'crash-handling', 'flowers', 'foo.ini']
|
||||
>>> from_manifest = ManifestParser(manifests=('include-example.ini',))
|
||||
>>> to_manifest = os.path.join(tempdir, 'include-example.ini')
|
||||
>>> to_manifest = ManifestParser(manifests=(to_manifest,))
|
||||
>>> to_manifest.get('name') == from_manifest.get('name')
|
||||
True
|
||||
>>> shutil.rmtree(tempdir)
|
||||
|
||||
Test our ability to update tests from a manifest and a directory of
|
||||
files::
|
||||
|
||||
>>> tempdir = tempfile.mkdtemp()
|
||||
>>> for i in range(10):
|
||||
... file(os.path.join(tempdir, str(i)), 'w').write(str(i))
|
||||
|
||||
First, make a manifest::
|
||||
|
||||
>>> manifest = convert([tempdir])
|
||||
>>> newtempdir = tempfile.mkdtemp()
|
||||
>>> manifest_file = os.path.join(newtempdir, 'manifest.ini')
|
||||
>>> file(manifest_file,'w').write(manifest)
|
||||
>>> manifest = ManifestParser(manifests=(manifest_file,))
|
||||
>>> manifest.get('name') == [str(i) for i in range(10)]
|
||||
True
|
||||
|
||||
All of the tests are initially missing::
|
||||
|
||||
>>> [i['name'] for i in manifest.missing()] == [str(i) for i in range(10)]
|
||||
True
|
||||
|
||||
But then we copy one over::
|
||||
|
||||
>>> manifest.get('name', name='1')
|
||||
['1']
|
||||
>>> manifest.update(tempdir, name='1')
|
||||
>>> sorted(os.listdir(newtempdir))
|
||||
['1', 'manifest.ini']
|
||||
|
||||
Update that one file and copy all the "tests"::
|
||||
|
||||
>>> file(os.path.join(tempdir, '1'), 'w').write('secret door')
|
||||
>>> manifest.update(tempdir)
|
||||
>>> sorted(os.listdir(newtempdir))
|
||||
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'manifest.ini']
|
||||
>>> file(os.path.join(newtempdir, '1')).read().strip()
|
||||
'secret door'
|
||||
|
||||
Clean up::
|
||||
|
||||
>>> shutil.rmtree(tempdir)
|
||||
>>> shutil.rmtree(newtempdir)
|
||||
|
||||
You can override the path in the section too. This shows that you can
|
||||
use a relative path::
|
||||
|
||||
>>> manifest = ManifestParser(manifests=('path-example.ini',))
|
||||
>>> manifest.tests[0]['path'] == os.path.abspath('fleem')
|
||||
True
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
Test the Test Manifest
|
||||
======================
|
||||
|
||||
Boilerplate::
|
||||
|
||||
>>> import os
|
||||
|
||||
Test filtering based on platform::
|
||||
|
||||
>>> from manifestparser import TestManifest
|
||||
>>> manifest = TestManifest(manifests=('filter-example.ini',))
|
||||
>>> [i['name'] for i in manifest.active_tests(os='win', disabled=False, exists=False)]
|
||||
['windowstest', 'fleem']
|
||||
>>> [i['name'] for i in manifest.active_tests(os='linux', disabled=False, exists=False)]
|
||||
['fleem', 'linuxtest']
|
||||
|
||||
Look for existing tests. There is only one::
|
||||
|
||||
>>> [i['name'] for i in manifest.active_tests()]
|
||||
['fleem']
|
||||
|
||||
You should be able to expect failures::
|
||||
|
||||
>>> last_test = manifest.active_tests(exists=False, toolkit='gtk2')[-1]
|
||||
>>> last_test['name']
|
||||
'linuxtest'
|
||||
>>> last_test['expected']
|
||||
'pass'
|
||||
>>> last_test = manifest.active_tests(exists=False, toolkit='cocoa')[-1]
|
||||
>>> last_test['expected']
|
||||
'fail'
|
||||
|
|
@ -9132,8 +9132,8 @@ if test -n "$ARM_ARCH"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Don't try to compile sse4.1 code if toolchain doesn't support
|
||||
if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
|
||||
# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
|
||||
if test -z "$HAVE_TOOLCHAIN_SUPPORT_SSSE3" || test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
|
||||
EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
|
||||
fi
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@ enum {
|
|||
|
||||
#undef ELEMENT_FLAG_BIT
|
||||
|
||||
// Make sure we have space for our bits
|
||||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
|
|
@ -632,17 +632,6 @@ public:
|
|||
*/
|
||||
virtual bool IsLink(nsIURI** aURI) const = 0;
|
||||
|
||||
/**
|
||||
* Get the cached state of the link. If the state is unknown,
|
||||
* return eLinkState_Unknown.
|
||||
*
|
||||
* @return The cached link state of the link.
|
||||
*/
|
||||
virtual nsLinkState GetLinkState() const
|
||||
{
|
||||
return eLinkState_NotLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the full href URI (fully resolved and canonicalized,
|
||||
* since it's an nsIURI object) for link elements.
|
||||
|
|
|
@ -71,7 +71,7 @@ class Value;
|
|||
template<typename T> class Handle;
|
||||
}
|
||||
|
||||
#define NODE_FLAG_BIT(n_) (1U << (n_))
|
||||
#define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_)))
|
||||
|
||||
enum {
|
||||
// This bit will be set if the node has a listener manager.
|
||||
|
@ -155,29 +155,27 @@ enum {
|
|||
// Set if the node has the accesskey attribute set.
|
||||
NODE_HAS_ACCESSKEY = NODE_FLAG_BIT(17),
|
||||
|
||||
// Set if the node is handling a click.
|
||||
NODE_HANDLING_CLICK = NODE_FLAG_BIT(18),
|
||||
|
||||
// Set if the node has had :hover selectors matched against it
|
||||
NODE_HAS_RELEVANT_HOVER_RULES = NODE_FLAG_BIT(19),
|
||||
|
||||
// Set if the node has right-to-left directionality
|
||||
NODE_HAS_DIRECTION_RTL = NODE_FLAG_BIT(20),
|
||||
NODE_HAS_DIRECTION_RTL = NODE_FLAG_BIT(18),
|
||||
|
||||
// Set if the node has left-to-right directionality
|
||||
NODE_HAS_DIRECTION_LTR = NODE_FLAG_BIT(21),
|
||||
NODE_HAS_DIRECTION_LTR = NODE_FLAG_BIT(19),
|
||||
|
||||
NODE_ALL_DIRECTION_FLAGS = NODE_HAS_DIRECTION_LTR |
|
||||
NODE_HAS_DIRECTION_RTL,
|
||||
|
||||
NODE_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(22),
|
||||
NODE_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(20),
|
||||
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(23),
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(21),
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 24
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 22
|
||||
};
|
||||
|
||||
// Make sure we have space for our bits
|
||||
#define ASSERT_NODE_FLAGS_SPACE(n) PR_STATIC_ASSERT(WRAPPER_CACHE_FLAGS_BITS_USED + (n) <= 32)
|
||||
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET);
|
||||
|
||||
/**
|
||||
* Class used to detect unexpected mutations. To use the class create an
|
||||
* nsMutationGuard on the stack before unexpected mutations could occur.
|
||||
|
@ -319,7 +317,6 @@ public:
|
|||
nsINode(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: mNodeInfo(aNodeInfo),
|
||||
mParent(nullptr),
|
||||
mFlags(0),
|
||||
mBoolFlags(0),
|
||||
mNextSibling(nullptr),
|
||||
mPreviousSibling(nullptr),
|
||||
|
@ -931,16 +928,6 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
bool HasFlag(uintptr_t aFlag) const
|
||||
{
|
||||
return !!(GetFlags() & aFlag);
|
||||
}
|
||||
|
||||
uint32_t GetFlags() const
|
||||
{
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
void SetFlags(uint32_t aFlagsToSet)
|
||||
{
|
||||
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS |
|
||||
|
@ -952,7 +939,7 @@ public:
|
|||
NODE_CHROME_ONLY_ACCESS)) ||
|
||||
IsNodeOfType(eCONTENT),
|
||||
"Flag only permitted on nsIContent nodes");
|
||||
mFlags |= aFlagsToSet;
|
||||
nsWrapperCache::SetFlags(aFlagsToSet);
|
||||
}
|
||||
|
||||
void UnsetFlags(uint32_t aFlagsToUnset)
|
||||
|
@ -962,7 +949,7 @@ public:
|
|||
NODE_IS_IN_ANONYMOUS_SUBTREE |
|
||||
NODE_IS_NATIVE_ANONYMOUS_ROOT)),
|
||||
"Trying to unset write-only flags");
|
||||
mFlags &= ~aFlagsToUnset;
|
||||
nsWrapperCache::UnsetFlags(aFlagsToUnset);
|
||||
}
|
||||
|
||||
void SetEditableFlag(bool aEditable)
|
||||
|
@ -1337,6 +1324,10 @@ private:
|
|||
ElementIsInStyleScope,
|
||||
// Set if the element is a scoped style sheet root
|
||||
ElementIsScopedStyleRoot,
|
||||
// Set if the node is handling a click.
|
||||
NodeHandlingClick,
|
||||
// Set if the node has had :hover selectors matched against it
|
||||
NodeHasRelevantHoverRules,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
|
@ -1471,6 +1462,8 @@ public:
|
|||
void SetIsScopedStyleRoot() { SetBoolFlag(ElementIsScopedStyleRoot); }
|
||||
void ClearIsScopedStyleRoot() { ClearBoolFlag(ElementIsScopedStyleRoot); }
|
||||
bool IsScopedStyleRoot() { return GetBoolFlag(ElementIsScopedStyleRoot); }
|
||||
bool HasRelevantHoverRules() const { return GetBoolFlag(NodeHasRelevantHoverRules); }
|
||||
void SetHasRelevantHoverRules() { SetBoolFlag(NodeHasRelevantHoverRules); }
|
||||
protected:
|
||||
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
|
||||
void SetInDocument() { SetBoolFlag(IsInDocument); }
|
||||
|
@ -1490,6 +1483,9 @@ protected:
|
|||
void ClearHasLockedStyleStates() { ClearBoolFlag(ElementHasLockedStyleStates); }
|
||||
bool HasLockedStyleStates() const
|
||||
{ return GetBoolFlag(ElementHasLockedStyleStates); }
|
||||
bool HandlingClick() const { return GetBoolFlag(NodeHandlingClick); }
|
||||
void SetHandlingClick() { SetBoolFlag(NodeHandlingClick); }
|
||||
void ClearHandlingClick() { ClearBoolFlag(NodeHandlingClick); }
|
||||
|
||||
void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
|
||||
{
|
||||
|
@ -1738,8 +1734,6 @@ protected:
|
|||
|
||||
nsINode* mParent;
|
||||
|
||||
uint32_t mFlags;
|
||||
|
||||
private:
|
||||
// Boolean flags.
|
||||
uint32_t mBoolFlags;
|
||||
|
|
|
@ -43,14 +43,6 @@ Link::ElementHasHref() const
|
|||
|| (!mElement->IsHTML() && mElement->HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)));
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
Link::GetLinkState() const
|
||||
{
|
||||
NS_ASSERTION(mRegistered,
|
||||
"Getting the link state of an unregistered Link!");
|
||||
return nsLinkState(mLinkState);
|
||||
}
|
||||
|
||||
void
|
||||
Link::SetLinkState(nsLinkState aState)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
* aElement is the element pointer corresponding to this link.
|
||||
*/
|
||||
Link(Element* aElement);
|
||||
nsLinkState GetLinkState() const;
|
||||
virtual void SetLinkState(nsLinkState aState);
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,10 @@ MarkUserDataHandler(void* aNode, nsIAtom* aKey, void* aValue, void* aData)
|
|||
static void
|
||||
MarkMessageManagers()
|
||||
{
|
||||
// The global message manager only exists in the root process.
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
if (!strongGlobalMM) {
|
||||
|
|
|
@ -676,7 +676,7 @@ nsContentList::NamedItem(JSContext* cx, const nsAString& name,
|
|||
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, item, nullptr, v.address())) {
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, item, nullptr, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "nsCPrefetchService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDOMCID.h"
|
||||
|
@ -4325,27 +4326,22 @@ void
|
|||
nsContentUtils::HoldJSObjects(void* aScriptObjectHolder,
|
||||
nsScriptObjectTracer* aTracer)
|
||||
{
|
||||
MOZ_ASSERT(sXPConnect, "Tried to HoldJSObjects when there was no XPConnect");
|
||||
if (sXPConnect) {
|
||||
sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
}
|
||||
cyclecollector::AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::DropJSObjects(void* aScriptObjectHolder)
|
||||
{
|
||||
if (sXPConnect) {
|
||||
sXPConnect->RemoveJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
cyclecollector::RemoveJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::AreJSObjectsHeld(void* aScriptHolder)
|
||||
nsContentUtils::AreJSObjectsHeld(void* aScriptObjectHolder)
|
||||
{
|
||||
return sXPConnect->TestJSHolder(aScriptHolder);
|
||||
return cyclecollector::TestJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ enum {
|
|||
};
|
||||
|
||||
// Make sure we have enough space for those bits
|
||||
PR_STATIC_ASSERT(NODE_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
|
||||
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
||||
|
||||
#undef DATA_NODE_FLAG_BIT
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
class gfxContext;
|
||||
class gfxASurface;
|
||||
class nsIPropertyBag;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -110,9 +109,7 @@ public:
|
|||
// Redraw the dirty rectangle of this canvas.
|
||||
NS_IMETHOD Redraw(const gfxRect &dirty) = 0;
|
||||
|
||||
// Passes a generic nsIPropertyBag options argument, along with the
|
||||
// previous one, if any. Optional.
|
||||
NS_IMETHOD SetContextOptions(nsIPropertyBag *aNewOptions) { return NS_OK; }
|
||||
NS_IMETHOD SetContextOptions(JSContext* aCx, JS::Handle<JS::Value> aOptions) { return NS_OK; }
|
||||
|
||||
//
|
||||
// shmem support
|
||||
|
|
|
@ -122,10 +122,6 @@ namespace mgfx = mozilla::gfx;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
static float kDefaultFontSize = 10.0;
|
||||
static NS_NAMED_LITERAL_STRING(kDefaultFontName, "sans-serif");
|
||||
static NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||
|
||||
// Cap sigma to avoid overly large temp surfaces.
|
||||
const Float SIGMA_MAX = 100;
|
||||
|
||||
|
@ -1307,7 +1303,7 @@ WrapStyle(JSContext* cx, JSObject* objArg,
|
|||
case CanvasRenderingContext2D::CMG_STYLE_GRADIENT:
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, objArg);
|
||||
ok = dom::WrapObject(cx, obj, supports, v.address());
|
||||
ok = dom::WrapObject(cx, obj, supports, &v);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -2696,12 +2692,14 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
|||
// use lazy initilization for the font group since it's rather expensive
|
||||
if (!CurrentState().fontGroup) {
|
||||
ErrorResult err;
|
||||
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||
static float kDefaultFontSize = 10.0;
|
||||
SetFont(kDefaultFontStyle, err);
|
||||
if (err.Failed()) {
|
||||
gfxFontStyle style;
|
||||
style.size = kDefaultFontSize;
|
||||
CurrentState().fontGroup =
|
||||
gfxPlatform::GetPlatform()->CreateFontGroup(kDefaultFontName,
|
||||
gfxPlatform::GetPlatform()->CreateFontGroup(NS_LITERAL_STRING("sans-serif"),
|
||||
&style,
|
||||
nullptr);
|
||||
if (CurrentState().fontGroup) {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsIGfxInfo.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
#include "nsIPropertyBag.h"
|
||||
#include "nsIVariant.h"
|
||||
|
||||
#include "imgIEncoder.h"
|
||||
|
@ -308,38 +307,22 @@ WebGLContext::Invalidate()
|
|||
// nsICanvasRenderingContextInternal
|
||||
//
|
||||
|
||||
static bool
|
||||
GetBoolFromPropertyBag(nsIPropertyBag *bag, const char *propName, bool *boolResult)
|
||||
{
|
||||
nsCOMPtr<nsIVariant> vv;
|
||||
bool bv;
|
||||
|
||||
nsresult rv = bag->GetProperty(NS_ConvertASCIItoUTF16(propName), getter_AddRefs(vv));
|
||||
if (NS_FAILED(rv) || !vv)
|
||||
return false;
|
||||
|
||||
rv = vv->GetAsBool(&bv);
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
*boolResult = bv ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::SetContextOptions(nsIPropertyBag *aOptions)
|
||||
WebGLContext::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value> aOptions)
|
||||
{
|
||||
if (!aOptions)
|
||||
return NS_OK;
|
||||
WebGLContextAttributes attributes;
|
||||
attributes.Init(aCx, aOptions);
|
||||
|
||||
WebGLContextOptions newOpts;
|
||||
|
||||
GetBoolFromPropertyBag(aOptions, "stencil", &newOpts.stencil);
|
||||
GetBoolFromPropertyBag(aOptions, "depth", &newOpts.depth);
|
||||
GetBoolFromPropertyBag(aOptions, "premultipliedAlpha", &newOpts.premultipliedAlpha);
|
||||
GetBoolFromPropertyBag(aOptions, "antialias", &newOpts.antialias);
|
||||
GetBoolFromPropertyBag(aOptions, "preserveDrawingBuffer", &newOpts.preserveDrawingBuffer);
|
||||
GetBoolFromPropertyBag(aOptions, "alpha", &newOpts.alpha);
|
||||
newOpts.stencil = attributes.mStencil;
|
||||
newOpts.depth = attributes.mDepth;
|
||||
newOpts.premultipliedAlpha = attributes.mPremultipliedAlpha;
|
||||
newOpts.antialias = attributes.mAntialias;
|
||||
newOpts.preserveDrawingBuffer = attributes.mPreserveDrawingBuffer;
|
||||
if (attributes.mAlpha.WasPassed()) {
|
||||
newOpts.alpha = attributes.mAlpha.Value();
|
||||
}
|
||||
|
||||
// enforce that if stencil is specified, we also give back depth
|
||||
newOpts.depth |= newOpts.stencil;
|
||||
|
@ -925,7 +908,7 @@ WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributesInitializ
|
|||
|
||||
const PixelBufferFormat& format = gl->GetPixelFormat();
|
||||
|
||||
result.mAlpha = format.alpha > 0;
|
||||
result.mAlpha.Construct(format.alpha > 0);
|
||||
result.mDepth = format.depth > 0;
|
||||
result.mStencil = format.stencil > 0;
|
||||
result.mAntialias = format.samples > 1;
|
||||
|
|
|
@ -69,8 +69,6 @@
|
|||
#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024 // Different from the spec, which sets it to 1 on page 164
|
||||
#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Page 164
|
||||
|
||||
class nsIPropertyBag;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebGLMemoryPressureObserver;
|
||||
|
@ -219,7 +217,8 @@ public:
|
|||
{ return nullptr; }
|
||||
|
||||
NS_IMETHOD SetIsOpaque(bool b) MOZ_OVERRIDE { return NS_OK; };
|
||||
NS_IMETHOD SetContextOptions(nsIPropertyBag *aOptions) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetContextOptions(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aOptions) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD SetIsIPC(bool b) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD Redraw(const gfxRect&) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
|
|
@ -23,7 +23,7 @@ WebGLContext::WebGLObjectAsJSValue(JSContext *cx, const WebGLObjectType *object,
|
|||
JS::Rooted<JS::Value> v(cx);
|
||||
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
if (!dom::WrapNewBindingObject(cx, wrapper, const_cast<WebGLObjectType*>(object), v.address())) {
|
||||
if (!dom::WrapNewBindingObject(cx, wrapper, const_cast<WebGLObjectType*>(object), &v)) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
|
|
@ -45,13 +45,6 @@ TextComposition::MatchesNativeContext(nsIWidget* aWidget) const
|
|||
return mNativeContext == aWidget->GetInputContext().mNativeIMEContext;
|
||||
}
|
||||
|
||||
bool
|
||||
TextComposition::MatchesEventTarget(nsPresContext* aPresContext,
|
||||
nsINode* aNode) const
|
||||
{
|
||||
return mPresContext == aPresContext && mNode == aNode;
|
||||
}
|
||||
|
||||
void
|
||||
TextComposition::DispatchEvent(nsGUIEvent* aEvent,
|
||||
nsEventStatus* aStatus,
|
||||
|
@ -198,13 +191,6 @@ TextCompositionArray::GetCompositionFor(nsIWidget* aWidget)
|
|||
return i != NoIndex ? &ElementAt(i) : nullptr;
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
TextCompositionArray::GetCompositionFor(nsPresContext* aPresContext)
|
||||
{
|
||||
index_type i = IndexOf(aPresContext);
|
||||
return i != NoIndex ? &ElementAt(i) : nullptr;
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
TextCompositionArray::GetCompositionFor(nsPresContext* aPresContext,
|
||||
nsINode* aNode)
|
||||
|
|
|
@ -53,8 +53,6 @@ public:
|
|||
bool IsSynthesizedForTests() const { return mIsSynthesizedForTests; }
|
||||
|
||||
bool MatchesNativeContext(nsIWidget* aWidget) const;
|
||||
bool MatchesEventTarget(nsPresContext* aPresContext,
|
||||
nsINode* aNode) const;
|
||||
|
||||
/**
|
||||
* SynthesizeCommit() dispatches compositionupdate, text and compositionend
|
||||
|
@ -158,7 +156,6 @@ public:
|
|||
index_type IndexOf(nsPresContext* aPresContext, nsINode* aNode);
|
||||
|
||||
TextComposition* GetCompositionFor(nsIWidget* aWidget);
|
||||
TextComposition* GetCompositionFor(nsPresContext* aPresContext);
|
||||
TextComposition* GetCompositionFor(nsPresContext* aPresContext,
|
||||
nsINode* aNode);
|
||||
TextComposition* GetCompositionInContent(nsPresContext* aPresContext,
|
||||
|
|
|
@ -177,29 +177,6 @@ nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
|||
}
|
||||
|
||||
// ---- nsDOMNSUIEvent implementation -------------------
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetPagePoint()
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mPagePoint;
|
||||
}
|
||||
|
||||
nsIntPoint pagePoint = GetClientPoint();
|
||||
|
||||
// If there is some scrolling, add scroll info to client point.
|
||||
if (mPresContext && mPresContext->GetPresShell()) {
|
||||
nsIPresShell* shell = mPresContext->GetPresShell();
|
||||
nsIScrollableFrame* scrollframe = shell->GetRootScrollFrameAsScrollable();
|
||||
if (scrollframe) {
|
||||
nsPoint pt = scrollframe->GetScrollPosition();
|
||||
pagePoint += nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(pt.y));
|
||||
}
|
||||
}
|
||||
|
||||
return pagePoint;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
|
|
|
@ -144,7 +144,6 @@ protected:
|
|||
nsIntPoint GetClientPoint();
|
||||
nsIntPoint GetMovementPoint();
|
||||
nsIntPoint GetLayerPoint() const;
|
||||
nsIntPoint GetPagePoint();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> mView;
|
||||
int32_t mDetail;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
class nsICanvasRenderingContextInternal;
|
||||
class nsIDOMFile;
|
||||
class nsITimerCallback;
|
||||
class nsIPropertyBag;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -90,16 +89,8 @@ public:
|
|||
}
|
||||
already_AddRefed<nsISupports>
|
||||
GetContext(JSContext* aCx, const nsAString& aContextId,
|
||||
const Optional<JS::Handle<JS::Value> >& aContextOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
JS::Value contextOptions = aContextOptions.WasPassed()
|
||||
? aContextOptions.Value()
|
||||
: JS::UndefinedValue();
|
||||
nsCOMPtr<nsISupports> context;
|
||||
aRv = GetContext(aContextId, contextOptions, aCx, getter_AddRefs(context));
|
||||
return context.forget();
|
||||
}
|
||||
JS::Handle<JS::Value> aContextOptions,
|
||||
ErrorResult& aRv);
|
||||
void ToDataURL(JSContext* aCx, const nsAString& aType,
|
||||
const Optional<JS::Handle<JS::Value> >& aParams,
|
||||
nsAString& aDataURL, ErrorResult& aRv)
|
||||
|
@ -235,7 +226,7 @@ protected:
|
|||
|
||||
nsIntSize GetWidthHeight();
|
||||
|
||||
nsresult UpdateContext(nsIPropertyBag *aNewContextOptions = nullptr);
|
||||
nsresult UpdateContext(JSContext* aCx, JS::Handle<JS::Value> options);
|
||||
nsresult ExtractData(const nsAString& aType,
|
||||
const nsAString& aOptions,
|
||||
nsIInputStream** aStream,
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINK_IID)
|
||||
|
||||
/**
|
||||
* GetLinkState/SetLinkState/GetHrefURI were moved to nsIContent.
|
||||
* SetLinkState/GetHrefURI were moved to nsIContent.
|
||||
* @see nsIContent
|
||||
*/
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ enum {
|
|||
HTML_ANCHOR_DNS_PREFETCH_DEFERRED = ANCHOR_ELEMENT_FLAG_BIT(1)
|
||||
};
|
||||
|
||||
// Make sure we have enough space for those bits
|
||||
PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
|
||||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
||||
|
||||
#undef ANCHOR_ELEMENT_FLAG_BIT
|
||||
|
||||
|
@ -330,12 +329,6 @@ HTMLAnchorElement::SetPing(const nsAString& aValue)
|
|||
return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
HTMLAnchorElement::GetLinkState() const
|
||||
{
|
||||
return Link::GetLinkState();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
HTMLAnchorElement::GetHrefURI() const
|
||||
{
|
||||
|
|
|
@ -70,7 +70,6 @@ public:
|
|||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
||||
virtual nsLinkState GetLinkState() const MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
|
|
|
@ -219,12 +219,6 @@ HTMLAreaElement::SetPing(const nsAString& aValue)
|
|||
return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
HTMLAreaElement::GetLinkState() const
|
||||
{
|
||||
return Link::GetLinkState();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
HTMLAreaElement::GetHrefURI() const
|
||||
{
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
||||
virtual nsLinkState GetLinkState() const MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
|
|
|
@ -210,7 +210,7 @@ HTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
if (NS_SUCCEEDED(rv) && mCurrentContext &&
|
||||
(aName == nsGkAtoms::width || aName == nsGkAtoms::height || aName == nsGkAtoms::moz_opaque))
|
||||
{
|
||||
rv = UpdateContext();
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -724,24 +724,21 @@ nsresult
|
|||
HTMLCanvasElement::GetContext(const nsAString& aContextId,
|
||||
nsISupports** aContext)
|
||||
{
|
||||
return GetContext(aContextId, JS::UndefinedHandleValue, nullptr, aContext);
|
||||
ErrorResult rv;
|
||||
*aContext = GetContext(nullptr, aContextId, JS::NullHandleValue, rv).get();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLCanvasElement::GetContext(const nsAString& aContextId,
|
||||
const JS::Value& aContextOptions,
|
||||
JSContext* aCx,
|
||||
nsISupports **aContext)
|
||||
already_AddRefed<nsISupports>
|
||||
HTMLCanvasElement::GetContext(JSContext* aCx,
|
||||
const nsAString& aContextId,
|
||||
JS::Handle<JS::Value> aContextOptions,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
MOZ_ASSERT_IF(!aCx, aContextOptions.isUndefined());
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mCurrentContextId.IsEmpty()) {
|
||||
rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!mCurrentContext) {
|
||||
return NS_OK;
|
||||
if (rv.Failed() || !mCurrentContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Ensure that the context participates in CC. Note that returning a
|
||||
|
@ -750,70 +747,24 @@ HTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||
CallQueryInterface(mCurrentContext, &cp);
|
||||
if (!cp) {
|
||||
mCurrentContext = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// note: if any contexts end up supporting something other
|
||||
// than objects, e.g. plain strings, then we'll need to expand
|
||||
// this to know how to create nsISupportsStrings etc.
|
||||
|
||||
nsCOMPtr<nsIWritablePropertyBag2> contextProps;
|
||||
if (aContextOptions.isObject()) {
|
||||
MOZ_ASSERT(aCx);
|
||||
contextProps = do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
||||
|
||||
JS::Rooted<JSObject*> opts(aCx, &aContextOptions.toObject());
|
||||
JS::AutoIdArray props(aCx, JS_Enumerate(aCx, opts));
|
||||
for (size_t i = 0; !!props && i < props.length(); ++i) {
|
||||
jsid propid = props[i];
|
||||
JS::Rooted<JS::Value> propname(aCx), propval(aCx);
|
||||
if (!JS_IdToValue(aCx, propid, propname.address()) ||
|
||||
!JS_GetPropertyById(aCx, opts, propid, propval.address())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSString *propnameString = JS_ValueToString(aCx, propname);
|
||||
nsDependentJSString pstr;
|
||||
if (!propnameString || !pstr.init(aCx, propnameString)) {
|
||||
mCurrentContext = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_BOOLEAN(propval)) {
|
||||
contextProps->SetPropertyAsBool(pstr, JSVAL_TO_BOOLEAN(propval));
|
||||
} else if (JSVAL_IS_INT(propval)) {
|
||||
contextProps->SetPropertyAsInt32(pstr, JSVAL_TO_INT(propval));
|
||||
} else if (JSVAL_IS_DOUBLE(propval)) {
|
||||
contextProps->SetPropertyAsDouble(pstr, JSVAL_TO_DOUBLE(propval));
|
||||
} else if (JSVAL_IS_STRING(propval)) {
|
||||
JSString *propvalString = JS_ValueToString(aCx, propval);
|
||||
nsDependentJSString vstr;
|
||||
if (!propvalString || !vstr.init(aCx, propvalString)) {
|
||||
mCurrentContext = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
contextProps->SetPropertyAsAString(pstr, vstr);
|
||||
}
|
||||
|
||||
}
|
||||
rv = UpdateContext(aCx, aContextOptions);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rv = UpdateContext(contextProps);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mCurrentContextId.Assign(aContextId);
|
||||
}
|
||||
|
||||
if (!mCurrentContextId.Equals(aContextId)) {
|
||||
//XXX eventually allow for more than one active context on a given canvas
|
||||
return NS_OK;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_ADDREF (*aContext = mCurrentContext);
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext;
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -838,7 +789,7 @@ HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
|
|||
|
||||
mCurrentContext->SetIsIPC(true);
|
||||
|
||||
rv = UpdateContext();
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mCurrentContextId.Assign(aContextId);
|
||||
|
@ -852,7 +803,7 @@ HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
|
|||
}
|
||||
|
||||
nsresult
|
||||
HTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
|
||||
HTMLCanvasElement::UpdateContext(JSContext* aCx, JS::Handle<JS::Value> aNewContextOptions)
|
||||
{
|
||||
if (!mCurrentContext)
|
||||
return NS_OK;
|
||||
|
@ -866,7 +817,7 @@ HTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = mCurrentContext->SetContextOptions(aNewContextOptions);
|
||||
rv = mCurrentContext->SetContextOptions(aCx, aNewContextOptions);
|
||||
if (NS_FAILED(rv)) {
|
||||
mCurrentContext = nullptr;
|
||||
mCurrentContextId.Truncate();
|
||||
|
|
|
@ -318,12 +318,6 @@ HTMLLinkElement::GetLinkTarget(nsAString& aTarget)
|
|||
}
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
HTMLLinkElement::GetLinkState() const
|
||||
{
|
||||
return Link::GetLinkState();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
HTMLLinkElement::GetHrefURI() const
|
||||
{
|
||||
|
|
|
@ -79,7 +79,6 @@ public:
|
|||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual nsLinkState GetLinkState() const MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
|
||||
// Element
|
||||
|
|
|
@ -291,8 +291,7 @@ HTMLOptionsCollection::NamedItem(JSContext* cx, const nsAString& name,
|
|||
JS::Rooted<JSObject*> wrapper(cx, nsWrapperCache::GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, item, nullptr,
|
||||
v.address())) {
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, item, nullptr, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ TableRowsCollection::NamedItem(JSContext* cx, const nsAString& name,
|
|||
JS::Rooted<JSObject*> wrapper(cx, nsWrapperCache::GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, v.address())) {
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -2808,7 +2808,7 @@ nsGenericHTMLElement::Focus(ErrorResult& aError)
|
|||
void
|
||||
nsGenericHTMLElement::Click()
|
||||
{
|
||||
if (HasFlag(NODE_HANDLING_CLICK))
|
||||
if (HandlingClick())
|
||||
return;
|
||||
|
||||
// Strong in case the event kills it
|
||||
|
@ -2823,7 +2823,7 @@ nsGenericHTMLElement::Click()
|
|||
}
|
||||
}
|
||||
|
||||
SetFlags(NODE_HANDLING_CLICK);
|
||||
SetHandlingClick();
|
||||
|
||||
// Click() is never called from native code, but it may be
|
||||
// called from chrome JS. Mark this event trusted if Click()
|
||||
|
@ -2834,7 +2834,7 @@ nsGenericHTMLElement::Click()
|
|||
|
||||
nsEventDispatcher::Dispatch(this, context, &event);
|
||||
|
||||
UnsetFlags(NODE_HANDLING_CLICK);
|
||||
ClearHandlingClick();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -3125,7 +3125,7 @@ nsGenericHTMLElement::GetItemValue(JSContext* aCx, JSObject* aScope,
|
|||
|
||||
if (ItemScope()) {
|
||||
JS::Rooted<JS::Value> v(aCx);
|
||||
if (!mozilla::dom::WrapObject(aCx, scope, this, v.address())) {
|
||||
if (!mozilla::dom::WrapObject(aCx, scope, this, &v)) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
|
|
@ -1063,8 +1063,7 @@ enum {
|
|||
// same time, so if it becomes an issue we can probably merge them into the
|
||||
// same bit. --bz
|
||||
|
||||
// Make sure we have enough space for those bits
|
||||
PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
|
||||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
||||
|
||||
#undef FORM_ELEMENT_FLAG_BIT
|
||||
|
||||
|
|
|
@ -2556,7 +2556,7 @@ nsFormControlList::NamedItem(JSContext* cx, const nsAString& name,
|
|||
JS::Rooted<JSObject*> wrapper(cx, nsWrapperCache::GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, v.address())) {
|
||||
if (!mozilla::dom::WrapObject(cx, wrapper, item, &v)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -2324,7 +2324,7 @@ nsHTMLDocument::NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound,
|
|||
JSAutoCompartment ac(cx, wrapper);
|
||||
// XXXbz Should we call the (slightly misnamed, really) WrapNativeParent
|
||||
// here?
|
||||
if (!dom::WrapObject(cx, wrapper, supp, cache, nullptr, val.address())) {
|
||||
if (!dom::WrapObject(cx, wrapper, supp, cache, nullptr, &val)) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -938,12 +938,6 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget)
|
|||
}
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
nsMathMLElement::GetLinkState() const
|
||||
{
|
||||
return Link::GetLinkState();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsMathMLElement::GetHrefURI() const
|
||||
{
|
||||
|
|
|
@ -86,7 +86,6 @@ public:
|
|||
bool aWithMouse = false) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
||||
virtual nsLinkState GetLinkState() const MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
|
|
|
@ -437,10 +437,29 @@ bool GStreamerReader::DecodeAudioData()
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Wait something to be decoded before return or continue */
|
||||
if (!mAudioSinkBufferCount) {
|
||||
return true;
|
||||
if(!mVideoSinkBufferCount) {
|
||||
/* We have nothing decoded so it makes no sense to return to the state machine
|
||||
* as it will call us back immediately, we'll return again and so on, wasting
|
||||
* CPU cycles for no job done. So, block here until there is either video or
|
||||
* audio data available
|
||||
*/
|
||||
mon.Wait();
|
||||
if (!mAudioSinkBufferCount) {
|
||||
/* There is still no audio data available, so either there is video data or
|
||||
* something else has happened (Eos, etc...). Return to the state machine
|
||||
* to process it.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
NotifyBytesConsumed();
|
||||
buffer = gst_app_sink_pull_buffer(mAudioAppSink);
|
||||
mAudioSinkBufferCount--;
|
||||
}
|
||||
|
@ -483,10 +502,29 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Wait something to be decoded before return or continue */
|
||||
if (!mVideoSinkBufferCount) {
|
||||
return true;
|
||||
if (!mAudioSinkBufferCount) {
|
||||
/* We have nothing decoded so it makes no sense to return to the state machine
|
||||
* as it will call us back immediately, we'll return again and so on, wasting
|
||||
* CPU cycles for no job done. So, block here until there is either video or
|
||||
* audio data available
|
||||
*/
|
||||
mon.Wait();
|
||||
if (!mVideoSinkBufferCount) {
|
||||
/* There is still no video data available, so either there is audio data or
|
||||
* something else has happened (Eos, etc...). Return to the state machine
|
||||
* to process it
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
NotifyBytesConsumed();
|
||||
mDecoder->NotifyDecodedFrames(0, 1);
|
||||
|
||||
buffer = gst_app_sink_pull_buffer(mVideoAppSink);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<script>
|
||||
o1 = new window.AudioContext();
|
||||
o5 = o1.createConvolver();
|
||||
o5.buffer = function() {
|
||||
var buffer = o1.createBuffer(2, 3, 33120);
|
||||
for(var c=0; c<2; c++) {
|
||||
for(var i=0; i<3; i++) {
|
||||
buffer.getChannelData(c)[i] = -1;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}();
|
||||
</script>
|
|
@ -44,3 +44,4 @@ load 880342-1.html
|
|||
load 880342-2.html
|
||||
load 880384.html
|
||||
load 880404.html
|
||||
load 880724.html
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioDestinationNode.h"
|
||||
#include "PannerNode.h"
|
||||
#include "GainProcessor.h"
|
||||
#include "speex/speex_resampler.h"
|
||||
#include <limits>
|
||||
|
||||
|
@ -19,7 +20,6 @@ namespace dom {
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBufferSourceNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBuffer)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaybackRate)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGain)
|
||||
if (tmp->Context()) {
|
||||
// AudioNode's Unlink implementation disconnects us from the graph
|
||||
// too, but we need to do this right here to make sure that
|
||||
|
@ -33,7 +33,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AudioBufferSourceNode, AudioNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBuffer)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlaybackRate)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGain)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioBufferSourceNode)
|
||||
|
@ -42,20 +41,19 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
|
|||
NS_IMPL_ADDREF_INHERITED(AudioBufferSourceNode, AudioNode)
|
||||
NS_IMPL_RELEASE_INHERITED(AudioBufferSourceNode, AudioNode)
|
||||
|
||||
class AudioBufferSourceNodeEngine : public AudioNodeEngine,
|
||||
public GainProcessor
|
||||
class AudioBufferSourceNodeEngine : public AudioNodeEngine
|
||||
{
|
||||
public:
|
||||
explicit AudioBufferSourceNodeEngine(AudioNode* aNode,
|
||||
AudioDestinationNode* aDestination) :
|
||||
AudioNodeEngine(aNode),
|
||||
GainProcessor(aDestination),
|
||||
mStart(0), mStop(TRACK_TICKS_MAX),
|
||||
mResampler(nullptr),
|
||||
mOffset(0), mDuration(0),
|
||||
mLoopStart(0), mLoopEnd(0),
|
||||
mBufferSampleRate(0), mPosition(0), mChannels(0), mPlaybackRate(1.0f),
|
||||
mDopplerShift(1.0f),
|
||||
mDestination(static_cast<AudioNodeStream*>(aDestination->Stream())),
|
||||
mPlaybackRateTimeline(1.0f), mLoop(false)
|
||||
{}
|
||||
|
||||
|
@ -84,9 +82,6 @@ public:
|
|||
}
|
||||
WebAudioUtils::ConvertAudioParamToTicks(mPlaybackRateTimeline, nullptr, mDestination);
|
||||
break;
|
||||
case AudioBufferSourceNode::GAIN:
|
||||
SetGainParameter(aValue);
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Bad AudioBufferSourceNodeEngine TimelineParameter");
|
||||
}
|
||||
|
@ -401,21 +396,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Process the gain on the AudioBufferSourceNode
|
||||
if (!aOutput->IsNull()) {
|
||||
if (!mGain.HasSimpleValue() &&
|
||||
aOutput->mBuffer == mBuffer) {
|
||||
// If we have borrowed out buffer, make sure to allocate a new one in case
|
||||
// the gain value is not a simple value.
|
||||
nsTArray<const void*> oldChannels;
|
||||
oldChannels.AppendElements(aOutput->mChannelData);
|
||||
AllocateAudioBlock(channels, aOutput);
|
||||
ProcessGain(aStream, 1.0f, oldChannels, aOutput);
|
||||
} else {
|
||||
ProcessGain(aStream, 1.0f, aOutput->mChannelData, aOutput);
|
||||
}
|
||||
}
|
||||
|
||||
// We've finished if we've gone past mStop, or if we're past mDuration when
|
||||
// looping is disabled.
|
||||
if (currentPosition >= mStop ||
|
||||
|
@ -437,6 +417,7 @@ public:
|
|||
uint32_t mChannels;
|
||||
float mPlaybackRate;
|
||||
float mDopplerShift;
|
||||
AudioNodeStream* mDestination;
|
||||
AudioParamTimeline mPlaybackRateTimeline;
|
||||
bool mLoop;
|
||||
};
|
||||
|
@ -451,15 +432,13 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
|||
, mOffset(0.0)
|
||||
, mDuration(std::numeric_limits<double>::min())
|
||||
, mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f))
|
||||
, mGain(new AudioParam(this, SendGainToStream, 1.0f))
|
||||
, mLoop(false)
|
||||
, mStartCalled(false)
|
||||
, mStopped(false)
|
||||
{
|
||||
AudioBufferSourceNodeEngine* engine =
|
||||
new AudioBufferSourceNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(
|
||||
new AudioBufferSourceNodeEngine(this, aContext->Destination()),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
||||
|
@ -642,13 +621,6 @@ AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode)
|
|||
SendTimelineParameterToStream(This, PLAYBACKRATE, *This->mPlaybackRate);
|
||||
}
|
||||
|
||||
void
|
||||
AudioBufferSourceNode::SendGainToStream(AudioNode* aNode)
|
||||
{
|
||||
AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
|
||||
SendTimelineParameterToStream(This, GAIN, *This->mGain);
|
||||
}
|
||||
|
||||
void
|
||||
AudioBufferSourceNode::SendDopplerShiftToStream(double aDopplerShift)
|
||||
{
|
||||
|
|
|
@ -76,10 +76,6 @@ public:
|
|||
{
|
||||
return mPlaybackRate;
|
||||
}
|
||||
AudioParam* Gain() const
|
||||
{
|
||||
return mGain;
|
||||
}
|
||||
bool Loop() const
|
||||
{
|
||||
return mLoop;
|
||||
|
@ -128,7 +124,6 @@ private:
|
|||
LOOPSTART,
|
||||
LOOPEND,
|
||||
PLAYBACKRATE,
|
||||
GAIN,
|
||||
DOPPLERSHIFT
|
||||
};
|
||||
|
||||
|
@ -138,7 +133,6 @@ private:
|
|||
double aOffset,
|
||||
double aDuration);
|
||||
static void SendPlaybackRateToStream(AudioNode* aNode);
|
||||
static void SendGainToStream(AudioNode* aNode);
|
||||
|
||||
private:
|
||||
double mLoopStart;
|
||||
|
@ -147,7 +141,6 @@ private:
|
|||
double mDuration;
|
||||
nsRefPtr<AudioBuffer> mBuffer;
|
||||
nsRefPtr<AudioParam> mPlaybackRate;
|
||||
nsRefPtr<AudioParam> mGain;
|
||||
SelfReference<AudioBufferSourceNode> mPlayingRef; // a reference to self while playing
|
||||
bool mLoop;
|
||||
bool mStartCalled;
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include "GainNode.h"
|
||||
#include "mozilla/dom/GainNodeBinding.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
#include "GainProcessor.h"
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioDestinationNode.h"
|
||||
#include "WebAudioUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -21,16 +23,23 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
|
|||
NS_IMPL_ADDREF_INHERITED(GainNode, AudioNode)
|
||||
NS_IMPL_RELEASE_INHERITED(GainNode, AudioNode)
|
||||
|
||||
class GainNodeEngine : public AudioNodeEngine,
|
||||
public GainProcessor
|
||||
class GainNodeEngine : public AudioNodeEngine
|
||||
{
|
||||
public:
|
||||
GainNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, GainProcessor(aDestination)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
// Keep the default value in sync with the default value in GainNode::GainNode.
|
||||
, mGain(1.f)
|
||||
{
|
||||
}
|
||||
|
||||
void SetSourceStream(AudioNodeStream* aSource)
|
||||
{
|
||||
mSource = aSource;
|
||||
}
|
||||
|
||||
enum Parameters {
|
||||
GAIN
|
||||
};
|
||||
|
@ -40,7 +49,9 @@ public:
|
|||
{
|
||||
switch (aIndex) {
|
||||
case GAIN:
|
||||
SetGainParameter(aValue);
|
||||
MOZ_ASSERT(mSource && mDestination);
|
||||
mGain = aValue;
|
||||
WebAudioUtils::ConvertAudioParamToTicks(mGain, mSource, mDestination);
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Bad GainNodeEngine TimelineParameter");
|
||||
|
@ -57,18 +68,37 @@ public:
|
|||
if (aInput.IsNull()) {
|
||||
// If input is silent, so is the output
|
||||
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
} else if (mGain.HasSimpleValue()) {
|
||||
// Optimize the case where we only have a single value set as the volume
|
||||
*aOutput = aInput;
|
||||
aOutput->mVolume *= mGain.GetValue();
|
||||
} else {
|
||||
if (mGain.HasSimpleValue()) {
|
||||
// Copy the input chunk to the output chunk, since we will only be
|
||||
// changing the mVolume member.
|
||||
*aOutput = aInput;
|
||||
} else {
|
||||
// Create a new output chunk to avoid modifying the input chunk.
|
||||
AllocateAudioBlock(aInput.mChannelData.Length(), aOutput);
|
||||
// First, compute a vector of gains for each track tick based on the
|
||||
// timeline at hand, and then for each channel, multiply the values
|
||||
// in the buffer with the gain vector.
|
||||
AllocateAudioBlock(aInput.mChannelData.Length(), aOutput);
|
||||
|
||||
// Compute the gain values for the duration of the input AudioChunk
|
||||
// XXX we need to add a method to AudioEventTimeline to compute this buffer directly.
|
||||
float computedGain[WEBAUDIO_BLOCK_SIZE];
|
||||
for (size_t counter = 0; counter < WEBAUDIO_BLOCK_SIZE; ++counter) {
|
||||
TrackTicks tick = aStream->GetCurrentPosition();
|
||||
computedGain[counter] = mGain.GetValueAtTime(tick, counter) * aInput.mVolume;
|
||||
}
|
||||
|
||||
// Apply the gain to the output buffer
|
||||
for (size_t channel = 0; channel < aOutput->mChannelData.Length(); ++channel) {
|
||||
const float* inputBuffer = static_cast<const float*> (aInput.mChannelData[channel]);
|
||||
float* buffer = static_cast<float*> (const_cast<void*>
|
||||
(aOutput->mChannelData[channel]));
|
||||
AudioBlockCopyChannelWithScale(inputBuffer, computedGain, buffer);
|
||||
}
|
||||
ProcessGain(aStream, aInput.mVolume, aInput.mChannelData, aOutput);
|
||||
}
|
||||
}
|
||||
|
||||
AudioNodeStream* mSource;
|
||||
AudioNodeStream* mDestination;
|
||||
AudioParamTimeline mGain;
|
||||
};
|
||||
|
||||
GainNode::GainNode(AudioContext* aContext)
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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 GainProcessor_h_
|
||||
#define GainProcessor_h_
|
||||
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioDestinationNode.h"
|
||||
#include "WebAudioUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// This class implements the gain processing logic used by GainNodeEngine
|
||||
// and AudioBufferSourceNodeEngine.
|
||||
class GainProcessor
|
||||
{
|
||||
public:
|
||||
explicit GainProcessor(AudioDestinationNode* aDestination)
|
||||
: mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mGain(1.f)
|
||||
{
|
||||
}
|
||||
|
||||
void SetSourceStream(AudioNodeStream* aSource)
|
||||
{
|
||||
mSource = aSource;
|
||||
}
|
||||
|
||||
void SetGainParameter(const AudioParamTimeline& aValue)
|
||||
{
|
||||
MOZ_ASSERT(mSource && mDestination);
|
||||
mGain = aValue;
|
||||
WebAudioUtils::ConvertAudioParamToTicks(mGain, mSource, mDestination);
|
||||
}
|
||||
|
||||
void ProcessGain(AudioNodeStream* aStream,
|
||||
float aInputVolume,
|
||||
const nsTArray<const void*>& aInputChannelData,
|
||||
AudioChunk* aOutput)
|
||||
{
|
||||
MOZ_ASSERT(mSource == aStream, "Invalid source stream");
|
||||
|
||||
if (mGain.HasSimpleValue()) {
|
||||
// Optimize the case where we only have a single value set as the volume
|
||||
aOutput->mVolume *= mGain.GetValue();
|
||||
} else {
|
||||
// First, compute a vector of gains for each track tick based on the
|
||||
// timeline at hand, and then for each channel, multiply the values
|
||||
// in the buffer with the gain vector.
|
||||
|
||||
// Compute the gain values for the duration of the input AudioChunk
|
||||
// XXX we need to add a method to AudioEventTimeline to compute this buffer directly.
|
||||
float computedGain[WEBAUDIO_BLOCK_SIZE];
|
||||
for (size_t counter = 0; counter < WEBAUDIO_BLOCK_SIZE; ++counter) {
|
||||
TrackTicks tick = aStream->GetCurrentPosition();
|
||||
computedGain[counter] = mGain.GetValueAtTime(tick, counter) * aInputVolume;
|
||||
}
|
||||
|
||||
// Apply the gain to the output buffer
|
||||
MOZ_ASSERT(aInputChannelData.Length() == aOutput->mChannelData.Length());
|
||||
for (size_t channel = 0; channel < aOutput->mChannelData.Length(); ++channel) {
|
||||
const float* inputBuffer = static_cast<const float*> (aInputChannelData[channel]);
|
||||
float* buffer = static_cast<float*> (const_cast<void*>
|
||||
(aOutput->mChannelData[channel]));
|
||||
AudioBlockCopyChannelWithScale(inputBuffer, computedGain, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
AudioNodeStream* mSource;
|
||||
AudioNodeStream* mDestination;
|
||||
AudioParamTimeline mGain;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -12,6 +12,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MOCHITEST_FILES := \
|
||||
webaudio.js \
|
||||
layouttest-glue.js \
|
||||
test_bug808374.html \
|
||||
test_bug827541.html \
|
||||
test_bug839753.html \
|
||||
|
@ -39,8 +40,6 @@ MOCHITEST_FILES := \
|
|||
test_audioParamTimelineDestinationOffset.html \
|
||||
test_audioBufferSourceNode.html \
|
||||
test_audioBufferSourceNodeEnded.html \
|
||||
test_audioBufferSourceNodeGain.html \
|
||||
test_audioBufferSourceNodeGainInLoop.html \
|
||||
test_audioBufferSourceNodeLazyLoopParam.html \
|
||||
test_audioBufferSourceNodeLoop.html \
|
||||
test_audioBufferSourceNodeLoopStartEnd.html \
|
||||
|
@ -56,7 +55,6 @@ MOCHITEST_FILES := \
|
|||
test_delayNode.html \
|
||||
test_delayNodeSmallMaxDelay.html \
|
||||
test_delayNodeWithGain.html \
|
||||
test_delayNodeWithGainAlternate.html \
|
||||
test_dynamicsCompressorNode.html \
|
||||
test_gainNode.html \
|
||||
test_gainNodeInLoop.html \
|
||||
|
@ -67,6 +65,7 @@ MOCHITEST_FILES := \
|
|||
test_offlineDestinationChannelCountLess.html \
|
||||
test_offlineDestinationChannelCountMore.html \
|
||||
test_pannerNode.html \
|
||||
test_pannerNode_equalPower.html \
|
||||
test_scriptProcessorNode.html \
|
||||
test_scriptProcessorNodeChannelCount.html \
|
||||
test_scriptProcessorNodeZeroInputOutput.html \
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# 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/.
|
||||
|
||||
DEPTH := @DEPTH@
|
||||
topsrcdir := @top_srcdir@
|
||||
srcdir := @srcdir@
|
||||
VPATH := @srcdir@
|
||||
relativesrcdir := @relativesrcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES := \
|
||||
panner-model-testing.js \
|
||||
audio-testing.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
This directory contains tests originally borrowed from the Blink Web Audio test
|
||||
suite.
|
||||
|
||||
The process of borrowing tests from Blink is as follows:
|
||||
|
||||
* Import the pristine file from the Blink repo, noting the revision in the
|
||||
commit message.
|
||||
* Modify the test files to turn the LayoutTest into a mochitest-plain and add
|
||||
* them to the test suite in a separate commit.
|
|
@ -0,0 +1,192 @@
|
|||
if (window.testRunner)
|
||||
testRunner.overridePreference("WebKitWebAudioEnabled", "1");
|
||||
|
||||
function writeString(s, a, offset) {
|
||||
for (var i = 0; i < s.length; ++i) {
|
||||
a[offset + i] = s.charCodeAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
function writeInt16(n, a, offset) {
|
||||
n = Math.floor(n);
|
||||
|
||||
var b1 = n & 255;
|
||||
var b2 = (n >> 8) & 255;
|
||||
|
||||
a[offset + 0] = b1;
|
||||
a[offset + 1] = b2;
|
||||
}
|
||||
|
||||
function writeInt32(n, a, offset) {
|
||||
n = Math.floor(n);
|
||||
var b1 = n & 255;
|
||||
var b2 = (n >> 8) & 255;
|
||||
var b3 = (n >> 16) & 255;
|
||||
var b4 = (n >> 24) & 255;
|
||||
|
||||
a[offset + 0] = b1;
|
||||
a[offset + 1] = b2;
|
||||
a[offset + 2] = b3;
|
||||
a[offset + 3] = b4;
|
||||
}
|
||||
|
||||
function writeAudioBuffer(audioBuffer, a, offset) {
|
||||
var n = audioBuffer.length;
|
||||
var channels = audioBuffer.numberOfChannels;
|
||||
|
||||
for (var i = 0; i < n; ++i) {
|
||||
for (var k = 0; k < channels; ++k) {
|
||||
var buffer = audioBuffer.getChannelData(k);
|
||||
var sample = buffer[i] * 32768.0;
|
||||
|
||||
// Clip samples to the limitations of 16-bit.
|
||||
// If we don't do this then we'll get nasty wrap-around distortion.
|
||||
if (sample < -32768)
|
||||
sample = -32768;
|
||||
if (sample > 32767)
|
||||
sample = 32767;
|
||||
|
||||
writeInt16(sample, a, offset);
|
||||
offset += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createWaveFileData(audioBuffer) {
|
||||
var frameLength = audioBuffer.length;
|
||||
var numberOfChannels = audioBuffer.numberOfChannels;
|
||||
var sampleRate = audioBuffer.sampleRate;
|
||||
var bitsPerSample = 16;
|
||||
var byteRate = sampleRate * numberOfChannels * bitsPerSample/8;
|
||||
var blockAlign = numberOfChannels * bitsPerSample/8;
|
||||
var wavDataByteLength = frameLength * numberOfChannels * 2; // 16-bit audio
|
||||
var headerByteLength = 44;
|
||||
var totalLength = headerByteLength + wavDataByteLength;
|
||||
|
||||
var waveFileData = new Uint8Array(totalLength);
|
||||
|
||||
var subChunk1Size = 16; // for linear PCM
|
||||
var subChunk2Size = wavDataByteLength;
|
||||
var chunkSize = 4 + (8 + subChunk1Size) + (8 + subChunk2Size);
|
||||
|
||||
writeString("RIFF", waveFileData, 0);
|
||||
writeInt32(chunkSize, waveFileData, 4);
|
||||
writeString("WAVE", waveFileData, 8);
|
||||
writeString("fmt ", waveFileData, 12);
|
||||
|
||||
writeInt32(subChunk1Size, waveFileData, 16); // SubChunk1Size (4)
|
||||
writeInt16(1, waveFileData, 20); // AudioFormat (2)
|
||||
writeInt16(numberOfChannels, waveFileData, 22); // NumChannels (2)
|
||||
writeInt32(sampleRate, waveFileData, 24); // SampleRate (4)
|
||||
writeInt32(byteRate, waveFileData, 28); // ByteRate (4)
|
||||
writeInt16(blockAlign, waveFileData, 32); // BlockAlign (2)
|
||||
writeInt32(bitsPerSample, waveFileData, 34); // BitsPerSample (4)
|
||||
|
||||
writeString("data", waveFileData, 36);
|
||||
writeInt32(subChunk2Size, waveFileData, 40); // SubChunk2Size (4)
|
||||
|
||||
// Write actual audio data starting at offset 44.
|
||||
writeAudioBuffer(audioBuffer, waveFileData, 44);
|
||||
|
||||
return waveFileData;
|
||||
}
|
||||
|
||||
function createAudioData(audioBuffer) {
|
||||
return createWaveFileData(audioBuffer);
|
||||
}
|
||||
|
||||
function finishAudioTest(event) {
|
||||
var audioData = createAudioData(event.renderedBuffer);
|
||||
testRunner.setAudioData(audioData);
|
||||
testRunner.notifyDone();
|
||||
}
|
||||
|
||||
// Create an impulse in a buffer of length sampleFrameLength
|
||||
function createImpulseBuffer(context, sampleFrameLength) {
|
||||
var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);
|
||||
var n = audioBuffer.length;
|
||||
var dataL = audioBuffer.getChannelData(0);
|
||||
|
||||
for (var k = 0; k < n; ++k) {
|
||||
dataL[k] = 0;
|
||||
}
|
||||
dataL[0] = 1;
|
||||
|
||||
return audioBuffer;
|
||||
}
|
||||
|
||||
// Create a buffer of the given length with a linear ramp having values 0 <= x < 1.
|
||||
function createLinearRampBuffer(context, sampleFrameLength) {
|
||||
var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);
|
||||
var n = audioBuffer.length;
|
||||
var dataL = audioBuffer.getChannelData(0);
|
||||
|
||||
for (var i = 0; i < n; ++i)
|
||||
dataL[i] = i / n;
|
||||
|
||||
return audioBuffer;
|
||||
}
|
||||
|
||||
// Create a buffer of the given length having a constant value.
|
||||
function createConstantBuffer(context, sampleFrameLength, constantValue) {
|
||||
var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);
|
||||
var n = audioBuffer.length;
|
||||
var dataL = audioBuffer.getChannelData(0);
|
||||
|
||||
for (var i = 0; i < n; ++i)
|
||||
dataL[i] = constantValue;
|
||||
|
||||
return audioBuffer;
|
||||
}
|
||||
|
||||
// Create a stereo impulse in a buffer of length sampleFrameLength
|
||||
function createStereoImpulseBuffer(context, sampleFrameLength) {
|
||||
var audioBuffer = context.createBuffer(2, sampleFrameLength, context.sampleRate);
|
||||
var n = audioBuffer.length;
|
||||
var dataL = audioBuffer.getChannelData(0);
|
||||
var dataR = audioBuffer.getChannelData(1);
|
||||
|
||||
for (var k = 0; k < n; ++k) {
|
||||
dataL[k] = 0;
|
||||
dataR[k] = 0;
|
||||
}
|
||||
dataL[0] = 1;
|
||||
dataR[0] = 1;
|
||||
|
||||
return audioBuffer;
|
||||
}
|
||||
|
||||
// Convert time (in seconds) to sample frames.
|
||||
function timeToSampleFrame(time, sampleRate) {
|
||||
return Math.floor(0.5 + time * sampleRate);
|
||||
}
|
||||
|
||||
// Compute the number of sample frames consumed by noteGrainOn with
|
||||
// the specified |grainOffset|, |duration|, and |sampleRate|.
|
||||
function grainLengthInSampleFrames(grainOffset, duration, sampleRate) {
|
||||
var startFrame = timeToSampleFrame(grainOffset, sampleRate);
|
||||
var endFrame = timeToSampleFrame(grainOffset + duration, sampleRate);
|
||||
|
||||
return endFrame - startFrame;
|
||||
}
|
||||
|
||||
// True if the number is not an infinity or NaN
|
||||
function isValidNumber(x) {
|
||||
return !isNaN(x) && (x != Infinity) && (x != -Infinity);
|
||||
}
|
||||
|
||||
function shouldThrowTypeError(func, text) {
|
||||
var ok = false;
|
||||
try {
|
||||
func();
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
testPassed(text + " threw TypeError.");
|
||||
} else {
|
||||
testFailed(text + " should throw TypeError.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
var sampleRate = 48000.0;
|
||||
|
||||
var numberOfChannels = 1;
|
||||
|
||||
// Time step when each panner node starts.
|
||||
var timeStep = 0.001;
|
||||
|
||||
// Length of the impulse signal.
|
||||
var pulseLengthFrames = Math.round(timeStep * sampleRate);
|
||||
|
||||
// How many panner nodes to create for the test
|
||||
var nodesToCreate = 100;
|
||||
|
||||
// Be sure we render long enough for all of our nodes.
|
||||
var renderLengthSeconds = timeStep * (nodesToCreate + 1);
|
||||
|
||||
// These are global mostly for debugging.
|
||||
var context;
|
||||
var impulse;
|
||||
var bufferSource;
|
||||
var panner;
|
||||
var position;
|
||||
var time;
|
||||
|
||||
var renderedBuffer;
|
||||
var renderedLeft;
|
||||
var renderedRight;
|
||||
|
||||
function createGraph(context, nodeCount) {
|
||||
bufferSource = new Array(nodeCount);
|
||||
panner = new Array(nodeCount);
|
||||
position = new Array(nodeCount);
|
||||
time = new Array(nodeCount);
|
||||
// Angle between panner locations. (nodeCount - 1 because we want
|
||||
// to include both 0 and 180 deg.
|
||||
var angleStep = Math.PI / (nodeCount - 1);
|
||||
|
||||
if (numberOfChannels == 2) {
|
||||
impulse = createStereoImpulseBuffer(context, pulseLengthFrames);
|
||||
}
|
||||
else
|
||||
impulse = createImpulseBuffer(context, pulseLengthFrames);
|
||||
|
||||
for (var k = 0; k < nodeCount; ++k) {
|
||||
bufferSource[k] = context.createBufferSource();
|
||||
bufferSource[k].buffer = impulse;
|
||||
|
||||
panner[k] = context.createPanner();
|
||||
panner[k].panningModel = "equalpower";
|
||||
panner[k].distanceModel = "linear";
|
||||
|
||||
var angle = angleStep * k;
|
||||
position[k] = {angle : angle, x : Math.cos(angle), z : Math.sin(angle)};
|
||||
panner[k].setPosition(position[k].x, 0, position[k].z);
|
||||
|
||||
bufferSource[k].connect(panner[k]);
|
||||
panner[k].connect(context.destination);
|
||||
|
||||
// Start the source
|
||||
time[k] = k * timeStep;
|
||||
bufferSource[k].noteOn(time[k]);
|
||||
}
|
||||
}
|
||||
|
||||
function createTestAndRun(context, nodeCount, numberOfSourceChannels) {
|
||||
numberOfChannels = numberOfSourceChannels;
|
||||
|
||||
createGraph(context, nodeCount);
|
||||
|
||||
context.oncomplete = checkResult;
|
||||
context.startRendering();
|
||||
}
|
||||
|
||||
// Map our position angle to the azimuth angle (in degrees).
|
||||
//
|
||||
// An angle of 0 corresponds to an azimuth of 90 deg; pi, to -90 deg.
|
||||
function angleToAzimuth(angle) {
|
||||
return 90 - angle * 180 / Math.PI;
|
||||
}
|
||||
|
||||
// The gain caused by the EQUALPOWER panning model
|
||||
function equalPowerGain(angle) {
|
||||
var azimuth = angleToAzimuth(angle);
|
||||
|
||||
if (numberOfChannels == 1) {
|
||||
var panPosition = (azimuth + 90) / 180;
|
||||
|
||||
var gainL = Math.cos(0.5 * Math.PI * panPosition);
|
||||
var gainR = Math.sin(0.5 * Math.PI * panPosition);
|
||||
|
||||
return { left : gainL, right : gainR };
|
||||
} else {
|
||||
if (azimuth <= 0) {
|
||||
var panPosition = (azimuth + 90) / 90;
|
||||
|
||||
var gainL = 1 + Math.cos(0.5 * Math.PI * panPosition);
|
||||
var gainR = Math.sin(0.5 * Math.PI * panPosition);
|
||||
|
||||
return { left : gainL, right : gainR };
|
||||
} else {
|
||||
var panPosition = azimuth / 90;
|
||||
|
||||
var gainL = Math.cos(0.5 * Math.PI * panPosition);
|
||||
var gainR = 1 + Math.sin(0.5 * Math.PI * panPosition);
|
||||
|
||||
return { left : gainL, right : gainR };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkResult(event) {
|
||||
renderedBuffer = event.renderedBuffer;
|
||||
renderedLeft = renderedBuffer.getChannelData(0);
|
||||
renderedRight = renderedBuffer.getChannelData(1);
|
||||
|
||||
// The max error we allow between the rendered impulse and the
|
||||
// expected value. This value is experimentally determined. Set
|
||||
// to 0 to make the test fail to see what the actual error is.
|
||||
var maxAllowedError = 1.3e-6;
|
||||
|
||||
var success = true;
|
||||
|
||||
// Number of impulses found in the rendered result.
|
||||
var impulseCount = 0;
|
||||
|
||||
// Max (relative) error and the index of the maxima for the left
|
||||
// and right channels.
|
||||
var maxErrorL = 0;
|
||||
var maxErrorIndexL = 0;
|
||||
var maxErrorR = 0;
|
||||
var maxErrorIndexR = 0;
|
||||
|
||||
// Number of impulses that don't match our expected locations.
|
||||
var timeCount = 0;
|
||||
|
||||
// Locations of where the impulses aren't at the expected locations.
|
||||
var timeErrors = new Array();
|
||||
|
||||
for (var k = 0; k < renderedLeft.length; ++k) {
|
||||
// We assume that the left and right channels start at the same instant.
|
||||
if (renderedLeft[k] != 0 || renderedRight[k] != 0) {
|
||||
// The expected gain for the left and right channels.
|
||||
var pannerGain = equalPowerGain(position[impulseCount].angle);
|
||||
var expectedL = pannerGain.left;
|
||||
var expectedR = pannerGain.right;
|
||||
|
||||
// Absolute error in the gain.
|
||||
var errorL = Math.abs(renderedLeft[k] - expectedL);
|
||||
var errorR = Math.abs(renderedRight[k] - expectedR);
|
||||
|
||||
if (Math.abs(errorL) > maxErrorL) {
|
||||
maxErrorL = Math.abs(errorL);
|
||||
maxErrorIndexL = impulseCount;
|
||||
}
|
||||
if (Math.abs(errorR) > maxErrorR) {
|
||||
maxErrorR = Math.abs(errorR);
|
||||
maxErrorIndexR = impulseCount;
|
||||
}
|
||||
|
||||
// Keep track of the impulses that didn't show up where we
|
||||
// expected them to be.
|
||||
var expectedOffset = timeToSampleFrame(time[impulseCount], sampleRate);
|
||||
if (k != expectedOffset) {
|
||||
timeErrors[timeCount] = { actual : k, expected : expectedOffset};
|
||||
++timeCount;
|
||||
}
|
||||
++impulseCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (impulseCount == nodesToCreate) {
|
||||
testPassed("Number of impulses matches the number of panner nodes.");
|
||||
} else {
|
||||
testFailed("Number of impulses is incorrect. (Found " + impulseCount + " but expected " + nodesToCreate + ")");
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (timeErrors.length > 0) {
|
||||
success = false;
|
||||
testFailed(timeErrors.length + " timing errors found in " + nodesToCreate + " panner nodes.");
|
||||
for (var k = 0; k < timeErrors.length; ++k) {
|
||||
testFailed("Impulse at sample " + timeErrors[k].actual + " but expected " + timeErrors[k].expected);
|
||||
}
|
||||
} else {
|
||||
testPassed("All impulses at expected offsets.");
|
||||
}
|
||||
|
||||
if (maxErrorL <= maxAllowedError) {
|
||||
testPassed("Left channel gain values are correct.");
|
||||
} else {
|
||||
testFailed("Left channel gain values are incorrect. Max error = " + maxErrorL + " at time " + time[maxErrorIndexL] + " (threshold = " + maxAllowedError + ")");
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (maxErrorR <= maxAllowedError) {
|
||||
testPassed("Right channel gain values are correct.");
|
||||
} else {
|
||||
testFailed("Right channel gain values are incorrect. Max error = " + maxErrorR + " at time " + time[maxErrorIndexR] + " (threshold = " + maxAllowedError + ")");
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (success) {
|
||||
testPassed("EqualPower panner test passed");
|
||||
} else {
|
||||
testFailed("EqualPower panner test failed");
|
||||
}
|
||||
|
||||
finishJSTest();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
// Reimplementation of the LayoutTest API from Blink so we can easily port
|
||||
// WebAudio tests to Simpletest, without touching the internals of the test.
|
||||
|
||||
function testFailed(msg) {
|
||||
ok(false, msg);
|
||||
}
|
||||
|
||||
function testPassed(msg) {
|
||||
ok(true, msg);
|
||||
}
|
||||
|
||||
function finishJSTest() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
@ -3,3 +3,5 @@
|
|||
# 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/.
|
||||
|
||||
PARALLEL_DIRS += ['blink']
|
||||
|
|
|
@ -19,8 +19,6 @@ var gTest = {
|
|||
}
|
||||
|
||||
var source = context.createBufferSource();
|
||||
ok("gain" in source, "AudioBufferSourceNode.gain must exist");
|
||||
is(source.gain.value, 1, "AudioBufferSourceNode.gain's default value must be 1");
|
||||
|
||||
var sp = context.createScriptProcessor(2048);
|
||||
source.start(0);
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test AudioBufferSourceNode.gain</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="webaudio.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gTest = {
|
||||
length: 2048,
|
||||
numberOfChannels: 1,
|
||||
createGraph: function(context) {
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var source = context.createBufferSource();
|
||||
|
||||
source.buffer = buffer;
|
||||
|
||||
source.gain.value = 0.5;
|
||||
|
||||
source.start(0);
|
||||
return source;
|
||||
},
|
||||
createExpectedBuffers: function(context) {
|
||||
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
expectedBuffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate) / 2;
|
||||
}
|
||||
return expectedBuffer;
|
||||
},
|
||||
};
|
||||
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test AudioBufferSourceNode.gain in presence of loops</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="webaudio.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gTest = {
|
||||
length: 4096,
|
||||
numberOfChannels: 1,
|
||||
createGraph: function(context) {
|
||||
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
sourceBuffer.getChannelData(0)[i] = 1;
|
||||
}
|
||||
|
||||
var source = context.createBufferSource();
|
||||
source.buffer = sourceBuffer;
|
||||
source.loop = true;
|
||||
source.start(0);
|
||||
source.stop(sourceBuffer.duration * 2);
|
||||
|
||||
// Adjust the gain in a way that we don't just end up modifying AudioChunk::mVolume
|
||||
source.gain.setValueAtTime(0.5, 0);
|
||||
return source;
|
||||
},
|
||||
createExpectedBuffers: function(context) {
|
||||
var expectedBuffer = context.createBuffer(1, 4096, context.sampleRate);
|
||||
for (var i = 0; i < 4096; ++i) {
|
||||
expectedBuffer.getChannelData(0)[i] = 0.5;
|
||||
}
|
||||
return expectedBuffer;
|
||||
},
|
||||
};
|
||||
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,51 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test DelayNode with an AudioBufferSourceNode.gain value</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script src="webaudio.js" type="text/javascript"></script>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gTest = {
|
||||
length: 4096,
|
||||
numberOfChannels: 1,
|
||||
createGraph: function(context) {
|
||||
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
||||
for (var i = 0; i < 2048; ++i) {
|
||||
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
||||
}
|
||||
|
||||
var source = context.createBufferSource();
|
||||
|
||||
var delay = context.createDelay();
|
||||
|
||||
source.buffer = buffer;
|
||||
source.gain.value = 0.5;
|
||||
|
||||
source.connect(delay);
|
||||
|
||||
// Delay the source stream by 2048 frames
|
||||
delay.delayTime.value = 2048 / context.sampleRate;
|
||||
|
||||
source.start(0);
|
||||
return delay;
|
||||
},
|
||||
createExpectedBuffers: function(context) {
|
||||
var expectedBuffer = context.createBuffer(1, 2048 * 2, context.sampleRate);
|
||||
for (var i = 2048; i < 2048 * 2; ++i) {
|
||||
expectedBuffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * (i - 2048) / context.sampleRate) / 2;
|
||||
}
|
||||
return expectedBuffer;
|
||||
},
|
||||
};
|
||||
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test PannerNode</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="webaudio.js"></script>
|
||||
<script type="text/javascript" src="layouttest-glue.js"></script>
|
||||
<script type="text/javascript" src="blink/audio-testing.js"></script>
|
||||
<script type="text/javascript" src="blink/panner-model-testing.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
||||
function checkFinished() {
|
||||
SpecialPowers.clearUserPref("media.webaudio.enabled");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
var ctx = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, sampleRate);
|
||||
createTestAndRun(ctx, nodesToCreate, 2, checkFinished);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
/*static*/ SMILBoolType SMILBoolType::sSingleton;
|
||||
|
||||
void
|
||||
SMILBoolType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ SMILBoolType::Destroy(nsSMILValue& aValue) const
|
|||
{
|
||||
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
|
||||
aValue.mU.mBool = false;
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -15,7 +15,11 @@ class SMILBoolType : public nsISMILType
|
|||
{
|
||||
public:
|
||||
// Singleton for nsSMILValue objects to hold onto.
|
||||
static SMILBoolType sSingleton;
|
||||
static SMILBoolType* Singleton()
|
||||
{
|
||||
static SMILBoolType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
protected:
|
||||
// nsISMILType Methods
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
/*static*/ SMILEnumType SMILEnumType::sSingleton;
|
||||
|
||||
void
|
||||
SMILEnumType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ SMILEnumType::Destroy(nsSMILValue& aValue) const
|
|||
{
|
||||
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
|
||||
aValue.mU.mUint = 0;
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -15,7 +15,12 @@ class SMILEnumType : public nsISMILType
|
|||
{
|
||||
public:
|
||||
// Singleton for nsSMILValue objects to hold onto.
|
||||
static SMILEnumType sSingleton;
|
||||
static SMILEnumType*
|
||||
Singleton()
|
||||
{
|
||||
static SMILEnumType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
protected:
|
||||
// nsISMILType Methods
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
/*static*/ SMILIntegerType SMILIntegerType::sSingleton;
|
||||
|
||||
void
|
||||
SMILIntegerType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ SMILIntegerType::Destroy(nsSMILValue& aValue) const
|
|||
{
|
||||
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
|
||||
aValue.mU.mInt = 0;
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -29,7 +29,12 @@ public:
|
|||
double aUnitDistance,
|
||||
nsSMILValue& aResult) const MOZ_OVERRIDE;
|
||||
|
||||
static SMILIntegerType sSingleton;
|
||||
static SMILIntegerType*
|
||||
Singleton()
|
||||
{
|
||||
static SMILIntegerType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
private:
|
||||
SMILIntegerType() {}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
/*static*/ SMILStringType SMILStringType::sSingleton;
|
||||
|
||||
void
|
||||
SMILStringType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
|
@ -26,7 +24,7 @@ SMILStringType::Destroy(nsSMILValue& aValue) const
|
|||
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
|
||||
delete static_cast<nsAString*>(aValue.mU.mPtr);
|
||||
aValue.mU.mPtr = nullptr;
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -15,7 +15,12 @@ class SMILStringType : public nsISMILType
|
|||
{
|
||||
public:
|
||||
// Singleton for nsSMILValue objects to hold onto.
|
||||
static SMILStringType sSingleton;
|
||||
static SMILStringType*
|
||||
Singleton()
|
||||
{
|
||||
static SMILStringType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
protected:
|
||||
// nsISMILType Methods
|
||||
|
|
|
@ -151,7 +151,7 @@ nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const
|
|||
{
|
||||
NS_ABORT_IF_FALSE(aValue.mType == this, "Unexpected SMIL value type");
|
||||
delete static_cast<ValueWrapper*>(aValue.mU.mPtr);
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "nsDebug.h"
|
||||
#include <math.h>
|
||||
|
||||
/*static*/ nsSMILFloatType nsSMILFloatType::sSingleton;
|
||||
|
||||
void
|
||||
nsSMILFloatType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
|
@ -23,7 +21,7 @@ nsSMILFloatType::Destroy(nsSMILValue& aValue) const
|
|||
{
|
||||
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
|
||||
aValue.mU.mDouble = 0.0;
|
||||
aValue.mType = &nsSMILNullType::sSingleton;
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -13,7 +13,12 @@ class nsSMILFloatType : public nsISMILType
|
|||
{
|
||||
public:
|
||||
// Singleton for nsSMILValue objects to hold onto.
|
||||
static nsSMILFloatType sSingleton;
|
||||
static nsSMILFloatType*
|
||||
Singleton()
|
||||
{
|
||||
static nsSMILFloatType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
protected:
|
||||
// nsISMILType Methods
|
||||
|
|
|
@ -7,15 +7,13 @@
|
|||
#include "nsSMILValue.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
/*static*/ nsSMILNullType nsSMILNullType::sSingleton;
|
||||
|
||||
nsresult
|
||||
nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
|
||||
{
|
||||
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
|
||||
NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
|
||||
aDest.mU = aSrc.mU;
|
||||
aDest.mType = &sSingleton;
|
||||
aDest.mType = Singleton();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,12 @@ class nsSMILNullType : public nsISMILType
|
|||
{
|
||||
public:
|
||||
// Singleton for nsSMILValue objects to hold onto.
|
||||
static nsSMILNullType sSingleton;
|
||||
static nsSMILNullType*
|
||||
Singleton()
|
||||
{
|
||||
static nsSMILNullType sSingleton;
|
||||
return &sSingleton;
|
||||
}
|
||||
|
||||
protected:
|
||||
// nsISMILType Methods
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// Public methods
|
||||
|
||||
nsSMILValue::nsSMILValue(const nsISMILType* aType)
|
||||
: mType(&nsSMILNullType::sSingleton)
|
||||
: mType(nsSMILNullType::Singleton())
|
||||
{
|
||||
if (!aType) {
|
||||
NS_ERROR("Trying to construct nsSMILValue with null mType pointer");
|
||||
|
@ -22,7 +22,7 @@ nsSMILValue::nsSMILValue(const nsISMILType* aType)
|
|||
}
|
||||
|
||||
nsSMILValue::nsSMILValue(const nsSMILValue& aVal)
|
||||
: mType(&nsSMILNullType::sSingleton)
|
||||
: mType(nsSMILNullType::Singleton())
|
||||
{
|
||||
InitAndCheckPostcondition(aVal.mType);
|
||||
mType->Assign(*this, aVal);
|
||||
|
@ -62,7 +62,7 @@ nsSMILValue::Swap(nsSMILValue& aOther)
|
|||
|
||||
// |tmp| is about to die -- we need to clear its mType, so that its
|
||||
// destructor doesn't muck with the data we just transferred out of it.
|
||||
tmp.mType = &nsSMILNullType::sSingleton;
|
||||
tmp.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
class nsSMILValue
|
||||
{
|
||||
public:
|
||||
nsSMILValue() : mU(), mType(&nsSMILNullType::sSingleton) { }
|
||||
nsSMILValue() : mU(), mType(nsSMILNullType::Singleton()) { }
|
||||
explicit nsSMILValue(const nsISMILType* aType);
|
||||
nsSMILValue(const nsSMILValue& aVal);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
bool IsNull() const
|
||||
{
|
||||
return (mType == &nsSMILNullType::sSingleton);
|
||||
return (mType == nsSMILNullType::Singleton());
|
||||
}
|
||||
|
||||
// Swaps the member data (mU & mPtr) of |this| with |aOther|
|
||||
|
|
|
@ -16,8 +16,14 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
static nsSVGAttrTearoffTable<SVGAnimatedLengthList, DOMSVGAnimatedLengthList>
|
||||
sSVGAnimatedLengthListTearoffTable;
|
||||
static inline
|
||||
nsSVGAttrTearoffTable<SVGAnimatedLengthList, DOMSVGAnimatedLengthList>&
|
||||
SVGAnimatedLengthListTearoffTable()
|
||||
{
|
||||
static nsSVGAttrTearoffTable<SVGAnimatedLengthList, DOMSVGAnimatedLengthList>
|
||||
sSVGAnimatedLengthListTearoffTable;
|
||||
return sSVGAnimatedLengthListTearoffTable;
|
||||
}
|
||||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedLengthList, mElement)
|
||||
|
||||
|
@ -62,10 +68,10 @@ DOMSVGAnimatedLengthList::GetDOMWrapper(SVGAnimatedLengthList *aList,
|
|||
uint8_t aAxis)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedLengthList> wrapper =
|
||||
sSVGAnimatedLengthListTearoffTable.GetTearoff(aList);
|
||||
SVGAnimatedLengthListTearoffTable().GetTearoff(aList);
|
||||
if (!wrapper) {
|
||||
wrapper = new DOMSVGAnimatedLengthList(aElement, aAttrEnum, aAxis);
|
||||
sSVGAnimatedLengthListTearoffTable.AddTearoff(aList, wrapper);
|
||||
SVGAnimatedLengthListTearoffTable().AddTearoff(aList, wrapper);
|
||||
}
|
||||
return wrapper.forget();
|
||||
}
|
||||
|
@ -73,14 +79,14 @@ DOMSVGAnimatedLengthList::GetDOMWrapper(SVGAnimatedLengthList *aList,
|
|||
/* static */ DOMSVGAnimatedLengthList*
|
||||
DOMSVGAnimatedLengthList::GetDOMWrapperIfExists(SVGAnimatedLengthList *aList)
|
||||
{
|
||||
return sSVGAnimatedLengthListTearoffTable.GetTearoff(aList);
|
||||
return SVGAnimatedLengthListTearoffTable().GetTearoff(aList);
|
||||
}
|
||||
|
||||
DOMSVGAnimatedLengthList::~DOMSVGAnimatedLengthList()
|
||||
{
|
||||
// Script no longer has any references to us, to our base/animVal objects, or
|
||||
// to any of their list items.
|
||||
sSVGAnimatedLengthListTearoffTable.RemoveTearoff(&InternalAList());
|
||||
SVGAnimatedLengthListTearoffTable().RemoveTearoff(&InternalAList());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -16,8 +16,14 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
static nsSVGAttrTearoffTable<SVGAnimatedNumberList, DOMSVGAnimatedNumberList>
|
||||
sSVGAnimatedNumberListTearoffTable;
|
||||
static inline
|
||||
nsSVGAttrTearoffTable<SVGAnimatedNumberList, DOMSVGAnimatedNumberList>&
|
||||
SVGAnimatedNumberListTearoffTable()
|
||||
{
|
||||
static nsSVGAttrTearoffTable<SVGAnimatedNumberList, DOMSVGAnimatedNumberList>
|
||||
sSVGAnimatedNumberListTearoffTable;
|
||||
return sSVGAnimatedNumberListTearoffTable;
|
||||
}
|
||||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedNumberList, mElement)
|
||||
|
||||
|
@ -61,10 +67,10 @@ DOMSVGAnimatedNumberList::GetDOMWrapper(SVGAnimatedNumberList *aList,
|
|||
uint8_t aAttrEnum)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedNumberList> wrapper =
|
||||
sSVGAnimatedNumberListTearoffTable.GetTearoff(aList);
|
||||
SVGAnimatedNumberListTearoffTable().GetTearoff(aList);
|
||||
if (!wrapper) {
|
||||
wrapper = new DOMSVGAnimatedNumberList(aElement, aAttrEnum);
|
||||
sSVGAnimatedNumberListTearoffTable.AddTearoff(aList, wrapper);
|
||||
SVGAnimatedNumberListTearoffTable().AddTearoff(aList, wrapper);
|
||||
}
|
||||
return wrapper.forget();
|
||||
}
|
||||
|
@ -72,14 +78,14 @@ DOMSVGAnimatedNumberList::GetDOMWrapper(SVGAnimatedNumberList *aList,
|
|||
/* static */ DOMSVGAnimatedNumberList*
|
||||
DOMSVGAnimatedNumberList::GetDOMWrapperIfExists(SVGAnimatedNumberList *aList)
|
||||
{
|
||||
return sSVGAnimatedNumberListTearoffTable.GetTearoff(aList);
|
||||
return SVGAnimatedNumberListTearoffTable().GetTearoff(aList);
|
||||
}
|
||||
|
||||
DOMSVGAnimatedNumberList::~DOMSVGAnimatedNumberList()
|
||||
{
|
||||
// Script no longer has any references to us, to our base/animVal objects, or
|
||||
// to any of their list items.
|
||||
sSVGAnimatedNumberListTearoffTable.RemoveTearoff(&InternalAList());
|
||||
SVGAnimatedNumberListTearoffTable().RemoveTearoff(&InternalAList());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,8 +18,14 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
static nsSVGAttrTearoffTable<void, DOMSVGPathSegList>
|
||||
sSVGPathSegListTearoffTable;
|
||||
static inline
|
||||
nsSVGAttrTearoffTable<void, DOMSVGPathSegList>&
|
||||
SVGPathSegListTearoffTable()
|
||||
{
|
||||
static nsSVGAttrTearoffTable<void, DOMSVGPathSegList>
|
||||
sSVGPathSegListTearoffTable;
|
||||
return sSVGPathSegListTearoffTable;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGPathSegList)
|
||||
// No unlinking of mElement, we'd need to null out the value pointer (the
|
||||
|
@ -49,10 +55,10 @@ DOMSVGPathSegList::GetDOMWrapper(void *aList,
|
|||
bool aIsAnimValList)
|
||||
{
|
||||
nsRefPtr<DOMSVGPathSegList> wrapper =
|
||||
sSVGPathSegListTearoffTable.GetTearoff(aList);
|
||||
SVGPathSegListTearoffTable().GetTearoff(aList);
|
||||
if (!wrapper) {
|
||||
wrapper = new DOMSVGPathSegList(aElement, aIsAnimValList);
|
||||
sSVGPathSegListTearoffTable.AddTearoff(aList, wrapper);
|
||||
SVGPathSegListTearoffTable().AddTearoff(aList, wrapper);
|
||||
}
|
||||
return wrapper.forget();
|
||||
}
|
||||
|
@ -60,7 +66,7 @@ DOMSVGPathSegList::GetDOMWrapper(void *aList,
|
|||
/* static */ DOMSVGPathSegList*
|
||||
DOMSVGPathSegList::GetDOMWrapperIfExists(void *aList)
|
||||
{
|
||||
return sSVGPathSegListTearoffTable.GetTearoff(aList);
|
||||
return SVGPathSegListTearoffTable().GetTearoff(aList);
|
||||
}
|
||||
|
||||
DOMSVGPathSegList::~DOMSVGPathSegList()
|
||||
|
@ -70,7 +76,7 @@ DOMSVGPathSegList::~DOMSVGPathSegList()
|
|||
void *key = mIsAnimValList ?
|
||||
InternalAList().GetAnimValKey() :
|
||||
InternalAList().GetBaseValKey();
|
||||
sSVGPathSegListTearoffTable.RemoveTearoff(key);
|
||||
SVGPathSegListTearoffTable().RemoveTearoff(key);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче