This commit is contained in:
Wes Kocher 2013-09-24 19:41:44 -07:00
Родитель 1a902ba29c c566455dd4
Коммит ea284218ed
876 изменённых файлов: 23190 добавлений и 14142 удалений

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

@ -23,7 +23,7 @@ endif
include $(topsrcdir)/config/config.mk
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
GARBAGE_DIRS += dist _javagen _profile staticlib
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
config/autoconf.mk \
mozilla-config.h \
@ -81,6 +81,13 @@ install-manifests: install-tests
install-tests: $(install_manifest_depends)
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests js/src/_build_manifests/install/tests)
# _tests should be purged during cleaning. However, we don't want it purged
# during PGO builds because it contains some auto-generated files.
ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
GARBAGE_DIRS += _tests
endif
# Windows PGO builds don't perform a clean before the 2nd pass. So, we want
# to preserve content for the 2nd pass on Windows. Everywhere else, we always
# process the install manifests as part of export.

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

@ -23,7 +23,7 @@ interface nsIAccessibleRelation;
* Mozilla creates the implementations of nsIAccessible on demand.
* See http://www.mozilla.org/projects/ui/accessibility for more information.
*/
[scriptable, uuid(45600c50-b06a-11e1-afa6-0800200c9a66)]
[scriptable, uuid(ee62158b-bb83-424b-a88d-d7d7f9cf460d)]
interface nsIAccessible : nsISupports
{
/**
@ -167,6 +167,7 @@ interface nsIAccessible : nsISupports
* inclusive of the current item
* @param positionInGroup - 1-based, similar to ARIA 'posinset' property
*/
[binaryname(ScriptableGroupPosition)]
void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
out long aPositionInGroup);

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

@ -1460,9 +1460,9 @@ Accessible::GroupPosition()
}
NS_IMETHODIMP
Accessible::GroupPosition(int32_t* aGroupLevel,
int32_t* aSimilarItemsInGroup,
int32_t* aPositionInGroup)
Accessible::ScriptableGroupPosition(int32_t* aGroupLevel,
int32_t* aSimilarItemsInGroup,
int32_t* aPositionInGroup)
{
NS_ENSURE_ARG_POINTER(aGroupLevel);
*aGroupLevel = 0;

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

@ -1783,6 +1783,14 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
nsINode* containerNode = aContainer->GetNode();
for (uint32_t idx = 0; idx < aContainer->ContentChildCount();) {
Accessible* child = aContainer->ContentChildAt(idx);
// If accessible doesn't have its own content then we assume parent
// will handle its update.
if (!child->HasOwnContent()) {
idx++;
continue;
}
nsINode* childNode = child->GetContent();
while (childNode != aChildNode && childNode != containerNode &&
(childNode = childNode->GetParentNode()));

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

@ -30,10 +30,20 @@
testStates("plugin-windowless", STATE_UNAVAILABLE);
testAccessibleTree("plugin-windowless", { EMBEDDED_OBJECT: [ ] });
testStates("plugin-windowless-fallback", STATE_UNAVAILABLE);
testAccessibleTree("plugin-windowless-fallback", { EMBEDDED_OBJECT: [ ] });
testStates("plugin-windowed", 0, 0, STATE_UNAVAILABLE);
testAccessibleTree("plugin-windowed", { EMBEDDED_OBJECT: [ { NOTHING: [] } ] });
SimpleTest.finish();
testStates("plugin-windowed-fallback", 0, 0, STATE_UNAVAILABLE);
testAccessibleTree("plugin-windowed-fallback",
{ EMBEDDED_OBJECT: [ { NOTHING: [] } ] });
// make sure we handle content changes under the plugin.
getNode("fallback1").setAttribute("href", "5");
getNode("fallback2").setAttribute("href", "5");
SimpleTest.executeSoon(function () { SimpleTest.finish(); });
}
SimpleTest.waitForExplicitFinish();
@ -49,6 +59,9 @@
<a target="_blank"
title="Embedded object accessibles for inaccessible/windowless plugins should not expose a NULL child"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=816856">Bug 816856</a>
<a target="_blank"
title="Updating accessible tree for plugin with fallback shouldn't crash"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=881636">Bug 881636</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -58,5 +71,9 @@
width="300" height="300"></embed>
<embed id="plugin-windowed" type="application/x-test" wmode="window"
width="300" height="300"></embed>
<embed id="plugin-windowless-fallback" type="application/x-test"
width="300" height="300"><a id="fallback1">foo</a></embed>
<embed id="plugin-windowed-fallback" type="application/x-test" wmode="window"
width="300" height="300"><a id="fallback2">foo</a></embed>
</body>
</html>

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

@ -71,6 +71,7 @@
}
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
addA11yLoadEvent(waitForPlugin);
</script>
</head>

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

@ -316,8 +316,21 @@ var gPluginHandler = {
// Hide the in-content UI if it's too big. The crashed plugin handler already did this.
if (eventType != "PluginCrashed" && eventType != "PluginRemoved") {
let overlay = this.getPluginUI(plugin, "main");
if (overlay != null && this.isTooSmall(plugin, overlay))
overlay.style.visibility = "hidden";
if (overlay != null) {
if (!this.isTooSmall(plugin, overlay))
overlay.style.visibility = "visible";
plugin.addEventListener("overflow", function(event) {
overlay.style.visibility = "hidden";
});
plugin.addEventListener("underflow", function(event) {
// this is triggered if only one dimension underflows,
// the other dimension might still overflow
if (!gPluginHandler.isTooSmall(plugin, overlay)) {
overlay.style.visibility = "visible";
}
});
}
}
// Only show the notification after we've done the isTooSmall check, so

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

@ -192,6 +192,7 @@ MOCHITEST_BROWSER_FILES = \
browser_contextSearchTabPosition.js \
browser_CTP_drag_drop.js \
browser_CTP_data_urls.js \
browser_CTP_resize.js \
browser_ctrlTab.js \
browser_customize_popupNotification.js \
browser_customize.js \
@ -316,6 +317,7 @@ MOCHITEST_BROWSER_FILES = \
plugin_clickToPlayAllow.html \
plugin_clickToPlayDeny.html \
plugin_hidden_to_visible.html \
plugin_small.html \
plugin_test.html \
plugin_test2.html \
plugin_test3.html \

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

@ -0,0 +1,162 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
Components.utils.import("resource://gre/modules/Services.jsm");
// This listens for the next opened tab and checks it is of the right url.
// opencallback is called when the new tab is fully loaded
// closecallback is called when the tab is closed
function TabOpenListener(url, opencallback, closecallback) {
this.url = url;
this.opencallback = opencallback;
this.closecallback = closecallback;
gBrowser.tabContainer.addEventListener("TabOpen", this, false);
}
TabOpenListener.prototype = {
url: null,
opencallback: null,
closecallback: null,
tab: null,
browser: null,
handleEvent: function(event) {
if (event.type == "TabOpen") {
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
this.tab = event.originalTarget;
this.browser = this.tab.linkedBrowser;
gBrowser.addEventListener("pageshow", this, false);
} else if (event.type == "pageshow") {
if (event.target.location.href != this.url)
return;
gBrowser.removeEventListener("pageshow", this, false);
this.tab.addEventListener("TabClose", this, false);
var url = this.browser.contentDocument.location.href;
is(url, this.url, "Should have opened the correct tab");
this.opencallback(this.tab, this.browser.contentWindow);
} else if (event.type == "TabClose") {
if (event.originalTarget != this.tab)
return;
this.tab.removeEventListener("TabClose", this, false);
this.opencallback = null;
this.tab = null;
this.browser = null;
// Let the window close complete
executeSoon(this.closecallback);
this.closecallback = null;
}
}
};
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
});
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
var newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
gTestBrowser = gBrowser.selectedBrowser;
gTestBrowser.addEventListener("load", pageLoad, true);
Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
prepareTest(runAfterPluginBindingAttached(test1), gHttpTestRoot + "plugin_small.html");
}
function finishTest() {
clearAllPluginPermissions();
gTestBrowser.removeEventListener("load", pageLoad, true);
gBrowser.removeCurrentTab();
window.focus();
finish();
}
function pageLoad() {
// The plugin events are async dispatched and can come after the load event
// This just allows the events to fire before we then go on to test the states
executeSoon(gNextTest);
}
function prepareTest(nextTest, url) {
gNextTest = nextTest;
gTestBrowser.contentWindow.location = url;
}
// Due to layout being async, "PluginBindAttached" may trigger later.
// This wraps a function to force a layout flush, thus triggering it,
// and schedules the function execution so they're definitely executed
// afterwards.
function runAfterPluginBindingAttached(func) {
return function() {
let doc = gTestBrowser.contentDocument;
let elems = doc.getElementsByTagName('embed');
if (elems.length < 1) {
elems = doc.getElementsByTagName('object');
}
elems[0].clientTop;
executeSoon(func);
};
}
// Test that the overlay is hidden for "small" plugin elements and is shown
// once they are resized to a size that can hold the overlay
function test1() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 1, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let doc = gTestBrowser.contentDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay, "Test 1, Should have an overlay.");
is(window.getComputedStyle(overlay).visibility, 'hidden', "Test 1, Overlay should be hidden");
plugin.style.width = '300px';
executeSoon(test2);
}
function test2() {
let plugin = gTestBrowser.contentDocument.getElementById("test");
let doc = gTestBrowser.contentDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay, "Test 2, Should have an overlay.");
is(window.getComputedStyle(overlay).visibility, 'hidden', "Test 2, Overlay should be hidden");
plugin.style.height = '300px';
let condition = () => window.getComputedStyle(overlay).visibility == 'visible';
waitForCondition(condition, test3, "Test 2, Waited too long for overlay to become visible");
}
function test3() {
let plugin = gTestBrowser.contentDocument.getElementById("test");
let doc = gTestBrowser.contentDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay, "Test 3, Should have an overlay.");
is(window.getComputedStyle(overlay).visibility, 'visible', "Test 3, Overlay should be visible");
plugin.style.width = '10px';
plugin.style.height = '10px';
let condition = () => window.getComputedStyle(overlay).visibility == 'hidden';
waitForCondition(condition, test4, "Test 3, Waited too long for overlay to become hidden");
}
function test4() {
let plugin = gTestBrowser.contentDocument.getElementById("test");
let doc = gTestBrowser.contentDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
ok(overlay, "Test 4, Should have an overlay.");
is(window.getComputedStyle(overlay).visibility, 'hidden', "Test 4, Overlay should be hidden");
clearAllPluginPermissions();
finishTest();
}

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

@ -111,6 +111,18 @@ function getTestPlugin(aName) {
return null;
}
// call this to set the test plugin(s) initially expected enabled state.
// it will automatically be reset to it's previous value after the test
// ends
function setTestPluginEnabledState(newEnabledState, pluginName) {
var plugin = getTestPlugin(pluginName);
var oldEnabledState = plugin.enabledState;
plugin.enabledState = newEnabledState;
SimpleTest.registerCleanupFunction(function() {
getTestPlugin(pluginName).enabledState = oldEnabledState;
});
}
// after a test is done using the plugin doorhanger, we should just clear
// any permissions that may have crept in
function clearAllPluginPermissions() {

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

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<embed id="test" style="width: 10px; height: 10px" type="application/x-test">
</body>
</html>

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

@ -1,7 +1,12 @@
[DEFAULT]
head = head_bookmarks.js
tail =
tail =
firefox-appdir = browser
support-files =
bookmarks.glue.html
bookmarks.glue.json
corruptDB.sqlite
distribution.ini
[test_421483.js]
[test_browserGlue_corrupt.js]

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

@ -2,6 +2,7 @@
head = head.js
tail =
firefox-appdir = browser
support-files = data/sessionstore_valid.js
[test_backup.js]
[test_backup_once.js]

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

@ -8,6 +8,9 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
// Debug test slaves are a bit slow at this test.
requestLongerTimeout(2);
let gTab, gDebuggee, gPanel, gDebugger;
let gEditor, gSources, gBreakpoints;

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

@ -23,46 +23,44 @@ function test() {
}
function performTest() {
Services.tm.currentThread.dispatch({ run: function() {
ok(gProcess._dbgProcess,
"The remote debugger process wasn't created properly!");
ok(gProcess._dbgProcess.isRunning,
"The remote debugger process isn't running!");
is(typeof gProcess._dbgProcess.pid, "number",
"The remote debugger process doesn't have a pid (?!)");
ok(gProcess._dbgProcess,
"The remote debugger process wasn't created properly!");
ok(gProcess._dbgProcess.isRunning,
"The remote debugger process isn't running!");
is(typeof gProcess._dbgProcess.pid, "number",
"The remote debugger process doesn't have a pid (?!)");
info("process location: " + gProcess._dbgProcess.location);
info("process pid: " + gProcess._dbgProcess.pid);
info("process name: " + gProcess._dbgProcess.processName);
info("process sig: " + gProcess._dbgProcess.processSignature);
info("process location: " + gProcess._dbgProcess.location);
info("process pid: " + gProcess._dbgProcess.pid);
info("process name: " + gProcess._dbgProcess.processName);
info("process sig: " + gProcess._dbgProcess.processSignature);
ok(gProcess._dbgProfile,
"The remote debugger profile wasn't created properly!");
ok(gProcess._dbgProfile.localDir,
"The remote debugger profile doesn't have a localDir...");
ok(gProcess._dbgProfile.rootDir,
"The remote debugger profile doesn't have a rootDir...");
ok(gProcess._dbgProfile.name,
"The remote debugger profile doesn't have a name...");
ok(gProcess._dbgProfile,
"The remote debugger profile wasn't created properly!");
ok(gProcess._dbgProfile.localDir,
"The remote debugger profile doesn't have a localDir...");
ok(gProcess._dbgProfile.rootDir,
"The remote debugger profile doesn't have a rootDir...");
ok(gProcess._dbgProfile.name,
"The remote debugger profile doesn't have a name...");
info("profile localDir: " + gProcess._dbgProfile.localDir.path);
info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
info("profile name: " + gProcess._dbgProfile.name);
info("profile localDir: " + gProcess._dbgProfile.localDir.path);
info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
info("profile name: " + gProcess._dbgProfile.name);
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
.createInstance(Ci.nsIToolkitProfileService);
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
.createInstance(Ci.nsIToolkitProfileService);
let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
ok(profile,
"The remote debugger profile wasn't *actually* created properly!");
is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
"The remote debugger profile doesn't have the correct localDir!");
is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
"The remote debugger profile doesn't have the correct rootDir!");
ok(profile,
"The remote debugger profile wasn't *actually* created properly!");
is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
"The remote debugger profile doesn't have the correct localDir!");
is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
"The remote debugger profile doesn't have the correct rootDir!");
gProcess.close();
}}, 0);
gProcess.close();
}
function aOnClose() {

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

@ -729,15 +729,6 @@ InspectorPanel.prototype = {
}
},
/**
* Trigger a high-priority layout change for things that need to be
* updated immediately
*/
immediateLayoutChange: function Inspector_immediateLayoutChange()
{
this.emit("layout-change");
},
/**
* Schedule a low-priority change event for things like paint
* and resize.

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

@ -17,7 +17,7 @@ function test() {
}
function getInspectorComputedProp(aName)
function getInspectorProp(aName)
{
let computedview = inspector.sidebar.getWindowForTab("computedview").computedview.view;
for each (let view in computedview.propertyViews) {
@ -27,18 +27,6 @@ function test() {
}
return null;
}
function getInspectorRuleProp(aName)
{
let ruleview = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
let inlineStyles = ruleview._elementStyle.rules[0];
for each (let prop in inlineStyles.textProps) {
if (prop.name == aName) {
return prop;
}
}
return null;
}
function runInspectorTests(aInspector)
{
@ -52,93 +40,50 @@ function test() {
testDiv.style.fontSize = "10px";
// Start up the style inspector panel...
inspector.once("computed-view-refreshed", computedStylePanelTests);
inspector.once("computed-view-refreshed", stylePanelTests);
inspector.selection.setNode(testDiv);
});
}
function computedStylePanelTests()
function stylePanelTests()
{
let computedview = inspector.sidebar.getWindowForTab("computedview").computedview;
ok(computedview, "Style Panel has a cssHtmlTree");
let propView = getInspectorComputedProp("font-size");
let propView = getInspectorProp("font-size");
is(propView.value, "10px", "Style inspector should be showing the correct font size.");
inspector.once("computed-view-refreshed", computedStylePanelAfterChange);
inspector.once("computed-view-refreshed", stylePanelAfterChange);
testDiv.style.cssText = "font-size: 15px; color: red;";
testDiv.style.fontSize = "15px";
inspector.emit("layout-change");
}
function computedStylePanelAfterChange()
function stylePanelAfterChange()
{
let propView = getInspectorComputedProp("font-size");
let propView = getInspectorProp("font-size");
is(propView.value, "15px", "Style inspector should be showing the new font size.");
let propView = getInspectorComputedProp("color");
is(propView.value, "#F00", "Style inspector should be showing the new color.");
computedStylePanelNotActive();
stylePanelNotActive();
}
function computedStylePanelNotActive()
function stylePanelNotActive()
{
// Tests changes made while the style panel is not active.
inspector.sidebar.select("ruleview");
testDiv.style.fontSize = "20px";
testDiv.style.color = "blue";
testDiv.style.textAlign = "center";
inspector.once("computed-view-refreshed", computedStylePanelAfterSwitch);
inspector.sidebar.select("computedview");
executeSoon(function() {
inspector.once("computed-view-refreshed", stylePanelAfterSwitch);
testDiv.style.fontSize = "20px";
inspector.sidebar.select("computedview");
});
}
function computedStylePanelAfterSwitch()
function stylePanelAfterSwitch()
{
let propView = getInspectorComputedProp("font-size");
is(propView.value, "20px", "Style inspector should be showing the new font size.");
let propView = getInspectorComputedProp("color");
is(propView.value, "#00F", "Style inspector should be showing the new color.");
let propView = getInspectorComputedProp("text-align");
is(propView.value, "center", "Style inspector should be showing the new text align.");
rulePanelTests();
}
function rulePanelTests()
{
inspector.sidebar.select("ruleview");
let ruleview = inspector.sidebar.getWindowForTab("ruleview").ruleview;
ok(ruleview, "Style Panel has a ruleview");
let propView = getInspectorRuleProp("text-align");
is(propView.value, "center", "Style inspector should be showing the new text align.");
testDiv.style.textAlign = "right";
testDiv.style.color = "lightgoldenrodyellow";
testDiv.style.fontSize = "3em";
testDiv.style.textTransform = "uppercase";
inspector.once("rule-view-refreshed", rulePanelAfterChange);
}
function rulePanelAfterChange()
{
let propView = getInspectorRuleProp("text-align");
is(propView.value, "right", "Style inspector should be showing the new text align.");
let propView = getInspectorRuleProp("color");
is(propView.value, "#FAFAD2", "Style inspector should be showing the new color.")
let propView = getInspectorRuleProp("font-size");
is(propView.value, "3em", "Style inspector should be showing the new font size.");
let propView = getInspectorRuleProp("text-transform");
is(propView.value, "uppercase", "Style inspector should be showing the new text transform.");
let propView = getInspectorProp("font-size");
is(propView.value, "20px", "Style inspector should be showing the newest font size.");
finishTest();
}

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

@ -397,7 +397,6 @@ MarkupView.prototype = {
*/
_mutationObserver: function MT__mutationObserver(aMutations)
{
let requiresLayoutChange = false;
for (let mutation of aMutations) {
let type = mutation.type;
let target = mutation.target;
@ -420,11 +419,6 @@ MarkupView.prototype = {
}
if (type === "attributes" || type === "characterData") {
container.update(false);
// Auto refresh style properties on selected node when they change.
if (type === "attributes" && container.selected) {
requiresLayoutChange = true;
}
} else if (type === "childList") {
container.childrenDirty = true;
// Update the children to take care of changes in the DOM
@ -433,10 +427,6 @@ MarkupView.prototype = {
this._updateChildren(container, {flash: true});
}
}
if (requiresLayoutChange) {
this._inspector.immediateLayoutChange();
}
this._waitForChildren().then(() => {
this._flashMutatedNodes(aMutations);
this._inspector.emit("markupmutation");

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

@ -1283,13 +1283,13 @@ CssRuleView.prototype = {
{
// Ignore refreshes during editing or when no element is selected.
if (this.isEditing || !this._elementStyle) {
return;
return promise.resolve(null);
}
this._clearRules();
// Repopulate the element style.
this._populate();
return this._populate();
},
_populate: function() {

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

@ -7,7 +7,6 @@ let doc;
let inspector;
let ruleView;
let testElement;
let rule;
function startTest(aInspector, aRuleView)
{
@ -44,29 +43,25 @@ function testRuleChanges()
is(selectors[2].textContent.indexOf(".testclass"), 0, "Third item is class rule.");
// Change the id and refresh.
inspector.once("rule-view-refreshed", testRuleChange1);
testElement.setAttribute("id", "differentid");
}
promiseDone(ruleView.nodeChanged().then(() => {
let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
is(selectors.length, 2, "Two rules visible.");
is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
is(selectors[1].textContent.indexOf(".testclass"), 0, "Second item is class rule.");
function testRuleChange1()
{
let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
is(selectors.length, 2, "Two rules visible.");
is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
is(selectors[1].textContent.indexOf(".testclass"), 0, "Second item is class rule.");
testElement.setAttribute("id", "testid");
return ruleView.nodeChanged();
}).then(() => {
// Put the id back.
let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
is(selectors.length, 3, "Three rules visible.");
is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
is(selectors[1].textContent.indexOf("#testid"), 0, "Second item is id rule.");
is(selectors[2].textContent.indexOf(".testclass"), 0, "Third item is class rule.");
inspector.once("rule-view-refreshed", testRuleChange2);
testElement.setAttribute("id", "testid");
}
function testRuleChange2()
{
let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
is(selectors.length, 3, "Three rules visible.");
is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
is(selectors[1].textContent.indexOf("#testid"), 0, "Second item is id rule.");
is(selectors[2].textContent.indexOf(".testclass"), 0, "Third item is class rule.");
testPropertyChanges();
testPropertyChanges();
}));
}
function validateTextProp(aProp, aEnabled, aName, aValue, aDesc)
@ -82,86 +77,65 @@ function validateTextProp(aProp, aEnabled, aName, aValue, aDesc)
function testPropertyChanges()
{
rule = ruleView._elementStyle.rules[0];
let ruleEditor = ruleView._elementStyle.rules[0].editor;
inspector.once("rule-view-refreshed", testPropertyChange0);
// Add a second margin-top value, just to make things interesting.
let rule = ruleView._elementStyle.rules[0];
let ruleEditor = ruleView._elementStyle.rules[0].editor;
ruleEditor.addProperty("margin-top", "5px", "");
}
promiseDone(expectRuleChange(rule).then(() => {
// Set the element style back to a 1px margin-top.
testElement.setAttribute("style", "margin-top: 1px; padding-top: 5px");
return ruleView.nodeChanged();
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], true, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], false, "margin-top", "5px", "Second margin property disabled");
function testPropertyChange0()
{
validateTextProp(rule.textProps[0], false, "margin-top", "1px", "Original margin property active");
// Now set it back to 5px, the 5px value should be re-enabled.
testElement.setAttribute("style", "margin-top: 5px; padding-top: 5px;");
return ruleView.nodeChanged();
inspector.once("rule-view-refreshed", testPropertyChange1);
testElement.setAttribute("style", "margin-top: 1px; padding-top: 5px");
}
function testPropertyChange1()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], true, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], false, "margin-top", "5px", "Second margin property disabled");
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], true, "margin-top", "5px", "Second margin property disabled");
inspector.once("rule-view-refreshed", testPropertyChange2);
// Set the margin property to a value that doesn't exist in the editor.
// Should reuse the currently-enabled element (the second one.)
testElement.setAttribute("style", "margin-top: 15px; padding-top: 5px;");
return ruleView.nodeChanged();
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], true, "margin-top", "15px", "Second margin property disabled");
// Now set it back to 5px, the 5px value should be re-enabled.
testElement.setAttribute("style", "margin-top: 5px; padding-top: 5px;");
}
function testPropertyChange2()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], true, "margin-top", "5px", "Second margin property disabled");
// Remove the padding-top attribute. Should disable the padding property but not remove it.
testElement.setAttribute("style", "margin-top: 5px;");
return ruleView.nodeChanged();
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[1], false, "padding-top", "5px", "Padding property disabled");
inspector.once("rule-view-refreshed", testPropertyChange3);
// Put the padding-top attribute back in, should re-enable the padding property.
testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px");
return ruleView.nodeChanged();
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[1], true, "padding-top", "25px", "Padding property enabled");
// Set the margin property to a value that doesn't exist in the editor.
// Should reuse the currently-enabled element (the second one.)
testElement.setAttribute("style", "margin-top: 15px; padding-top: 5px;");
}
function testPropertyChange3()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
validateTextProp(rule.textProps[2], true, "margin-top", "15px", "Second margin property disabled");
// Add an entirely new property.
testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px; padding-left: 20px;");
return ruleView.nodeChanged();
}).then(() => {
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 4, "Added a property");
validateTextProp(rule.textProps[3], true, "padding-left", "20px", "Padding property enabled");
inspector.once("rule-view-refreshed", testPropertyChange4);
// Remove the padding-top attribute. Should disable the padding property but not remove it.
testElement.setAttribute("style", "margin-top: 5px;");
}
function testPropertyChange4()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[1], false, "padding-top", "5px", "Padding property disabled");
inspector.once("rule-view-refreshed", testPropertyChange5);
// Put the padding-top attribute back in, should re-enable the padding property.
testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px");
}
function testPropertyChange5()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
validateTextProp(rule.textProps[1], true, "padding-top", "25px", "Padding property enabled");
inspector.once("rule-view-refreshed", testPropertyChange6);
// Add an entirely new property
testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px; padding-left: 20px;");
}
function testPropertyChange6()
{
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 4, "Added a property");
validateTextProp(rule.textProps[3], true, "padding-left", "20px", "Padding property enabled");
finishTest();
finishTest();
}));
}
function finishTest()
{
inspector = ruleView = rule = null;
inspector = ruleView = null;
doc = null;
gBrowser.removeCurrentTab();
finish();

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

@ -95,6 +95,7 @@ var TouchModule = {
window.addEventListener("CancelTouchSequence", this, true);
window.addEventListener("dblclick", this, true);
window.addEventListener("keydown", this, true);
window.addEventListener("MozMouseHittest", this, true);
// bubble phase
window.addEventListener("contextmenu", this, false);
@ -160,6 +161,13 @@ var TouchModule = {
case "keydown":
this._handleKeyDown(aEvent);
break;
case "MozMouseHittest":
// Used by widget to hit test chrome vs content
if (aEvent.target.ownerDocument == document) {
aEvent.preventDefault();
}
aEvent.stopPropagation();
break;
}
}
}

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

@ -2,6 +2,7 @@
head =
tail =
firefox-appdir = metro
support-files = blank.xhtml
[test_util_extend.js]
[test_util_populateFragmentFromString.js]

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

@ -37,6 +37,8 @@ pref("layers.offmainthreadcomposition.enabled", true);
pref("layers.async-pan-zoom.enabled", true);
pref("layers.componentalpha.enabled", false);
pref("gfx.azpc.touch_start_tolerance", "0.1"); // dpi * tolerance = pixel threshold
pref("gfx.azpc.pan_repaint_interval", "50"); // prefer 20 fps
pref("gfx.azpc.fling_repaint_interval", "50"); // prefer 20 fps
pref("gfx.axis.fling_friction", "0.002");
// Enable Microsoft TSF support by default for imes.

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

@ -2,7 +2,7 @@
head = head.js
tail =
firefox-appdir = browser
support-files = blocklist.xml
[test_social.js]
[test_socialDisabledStartup.js]

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

@ -18,6 +18,7 @@ import mdn_theme
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.graphviz',
'sphinx.ext.todo',
]
templates_path = ['_templates']

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

@ -20,6 +20,7 @@ Important Concepts
Profile Guided Optimization <pgo>
slow
environment-variables
test_manifests
mozbuild
========

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

@ -0,0 +1,153 @@
.. _test_manifests:
==============
Test Manifests
==============
Many test suites have their test metadata defined in files called
**test manifests**.
Test manifests are divided into two flavors: :ref:`manifest_destiny_manifests`
and :ref:`reftest_manifests`.
.. _manifest_destiny_manifests:
Manifest Destiny Manifests
==========================
Manifest destiny manifests are essentially ini files that conform to a basic
set of assumptions.
The `reference documentation <http://mozbase.readthedocs.org/en/latest/manifestdestiny.html>`_
for manifest destiny manifests describes the basic format of test manifests.
In summary, manifests are ini files with section names describing test files::
[test_foo.js]
[test_bar.js]
Keys under sections can hold metadata about each test::
[test_foo.js]
skip-if = os == win
There is a special **DEFAULT** section whose keys/metadata apply to all
sections/tests::
[DEFAULT]
property = value
[test_foo.js]
In the above example, **test_foo.js** inherits the metadata **property = value**
from the **DEFAULT** section.
Recognized Metadata
-------------------
Test manifests can define some common keys/metadata to influence behavior.
Those keys are as follows:
head
List of files that will be executed before the test file. (Used in
xpcshell tests.)
tail
List of files that will be executed after the test file. (Used in
xpcshell tests.)
support-files
List of additional files required to run tests. This is typically
defined in the **DEFAULT** section.
Unlike other file lists, *support-files* supports a globbing mechanism
to facilitate pulling in many files with minimal typing. This globbing
mechanism is activated if an entry in this value contains a ``*``
character. A single ``*`` will wildcard match all files in a directory.
A double ``**`` will descend into child directories. For example,
``data/*`` will match ``data/foo`` but not ``data/subdir/bar`` where
``data/**`` will match ``data/foo`` and ``data/subdir/bar``.
generated-files
List of files that are generated as part of the build and don't exist in
the source tree.
The build system assumes that each manifest file, test file, and file
listed in **head**, **tail**, and **support-files** is static and
provided by the source tree (and not automatically generated as part
of the build). This variable tells the build system not to make this
assumption.
This variable will likely go away sometime once all generated files are
accounted for in the build config.
If a generated file is not listed in this key, a clobber build will
likely fail.
dupe-manifest
Record that this manifest duplicates another manifest.
The common scenario is two manifest files will include a shared
manifest file via the ``[include:file]`` special section. The build
system enforces that each test file is only provided by a single
manifest. Having this key present bypasses that check.
The value of this key is ignored.
run-if
Run this test only if the specified condition is true.
See :ref:`manifest_filter_language`.
skip-if
Skip this test if the specified condition is true.
See :ref:`manifest_filter_language`.
fail-if
Expect test failure if the specified condition is true.
See :ref:`manifest_filter_language`.
run-sequentially
If present, the test should not be run in parallel with other tests.
Some test harnesses support parallel test execution on separate processes
and/or threads (behavior varies by test harness). If this key is present,
the test harness should not attempt to run this test in parallel with any
other test.
By convention, the value of this key is a string describing why the test
can't be run in parallel.
.. _manifest_filter_language:
Manifest Filter Language
------------------------
Some manifest keys accept a special filter syntax as their values. These
values are essentially boolean expressions that are evaluated at test
execution time.
See
`the source <https://hg.mozilla.org/mozilla-central/file/default/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py>`_.
.. todo::
Document manifest filter language.
.. _manifest_file_installation:
File Installation
-----------------
Files referenced by manifests are automatically installed into the object
directory into paths defined in
:py:func:`mozbuild.frontend.emitter.TreeMetadataEmitter._process_test_manifest`.
Referenced files in the manifest not in the same directory tree as the manifest
file are **not** installed.
.. _reftest_manifests:
Reftest Manifests
=================
See `MDN <https://developer.mozilla.org/en-US/docs/Creating_reftest-based_unit_tests>`_.

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

@ -1,6 +1,7 @@
if [ -d "/c/Program Files (x86)/Microsoft Visual Studio 10.0" ]; then
_VSPATH="/c/Program Files (x86)/Microsoft Visual Studio 10.0"
if [ -d "/c/PROGRA~2/MICROS~2.0" ]; then
# /c/Program Files (x86)/Microsoft Visual Studio 10.0
_VSPATH="/c/PROGRA~2/MICROS~2.0"
else
_VSPATH="/c/tools/msvs10"
fi

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

@ -1,6 +1,7 @@
if [ -d "/c/Program Files (x86)/Microsoft Visual Studio 10.0" ]; then
_VSPATH="/c/Program Files (x86)/Microsoft Visual Studio 10.0"
if [ -d "/c/PROGRA~2/MICROS~2.0" ]; then
# /c/Program Files (x86)/Microsoft Visual Studio 10.0
_VSPATH="/c/PROGRA~2/MICROS~2.0"
else
_VSPATH="/c/tools/msvs10"
fi
@ -20,7 +21,7 @@ export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/
# Use 32bit linker for PGO crash bug.
# https://connect.microsoft.com/VisualStudio/feedback/details/686117/
export LD=c:/tools/msvs10/VC/BIN/x86_amd64/link.exe
export LD="${_VSPATH}/VC/BIN/x86_amd64/link.exe"
. $topsrcdir/build/mozconfig.vs2010-common

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

@ -1,6 +1,7 @@
[DEFAULT]
head = head_crtestutils.js
tail =
tail =
support-files = data/**
[test_abi.js]
[test_bug292789.js]

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

@ -1,137 +0,0 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
ifndef INCLUDED_TESTS_XPCSHELL_MK #{
ifdef XPCSHELL_TESTS #{
ifndef relativesrcdir
$(error Must define relativesrcdir when defining XPCSHELL_TESTS.)
endif
define _INSTALL_TESTS
$(call install_cmd, $(filter-out %~,$(wildcard $(srcdir)/$(dir)/*)) $(testxpcobjdir)/$(relativesrcdir)/$(dir))
endef # do not remove the blank line!
SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
testxpcsrcdir = $(topsrcdir)/testing/xpcshell
libs:: libs-xpcshell-tests
###########################################################################
libs-xpcshell-tests:
$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
ifndef NO_XPCSHELL_MANIFEST_CHECK #{
$(call py_action,xpccheck,$(topsrcdir) $(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS)))
endif #} NO_XPCSHELL_MANIFEST_CHECK
###########################################################################
# Execute all tests in the $(XPCSHELL_TESTS) directories.
# See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
xpcshell-tests:
$(info Please consider running xpcshell tests via |mach xpcshell-test|. mach is more powerful, easier to use, and will be the only supported way to run tests in the future. Consider switching to mach today!)
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(DEPTH)/build \
-I$(topsrcdir)/build \
-I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
--tests-root-dir=$(testxpcobjdir) \
--testing-modules-dir=$(DEPTH)/_tests/modules \
--xunit-file=$(testxpcobjdir)/$(relativesrcdir)/results.xml \
--xunit-suite-name=xpcshell \
--test-plugin-path=$(DIST)/plugins \
$(EXTRA_TEST_ARGS) \
$(LIBXUL_DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
xpcshell-tests-remote: DM_TRANS?=adb
xpcshell-tests-remote:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(DEPTH)/build \
$(topsrcdir)/testing/xpcshell/remotexpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
--testing-modules-dir=$(DEPTH)/_tests/modules \
$(EXTRA_TEST_ARGS) \
--dm_trans=$(DM_TRANS) \
--deviceIP=${TEST_DEVICE} \
--objdir=$(DEPTH) \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
###########################################################################
# Execute a single test, specified in $(SOLO_FILE), but don't automatically
# start the test. Instead, present the xpcshell prompt so the user can
# attach a debugger and then start the test.
check-interactive:
$(info Please consider running xpcshell tests via mach: |mach xpcshell-test --interactive path/to/test|.)
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(DEPTH)/build \
-I$(topsrcdir)/build \
-I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
--test-path=$(SOLO_FILE) \
--testing-modules-dir=$(DEPTH)/_tests/modules \
--profile-name=$(MOZ_APP_NAME) \
--test-plugin-path=$(DIST)/plugins \
--interactive \
$(LIBXUL_DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
# Execute a single test, specified in $(SOLO_FILE)
check-one:
$(info Please consider running xpcshell tests via mach: |mach xpcshell-test path/to/test|.)
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(DEPTH)/build \
-I$(topsrcdir)/build \
-I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
--test-path=$(SOLO_FILE) \
--testing-modules-dir=$(DEPTH)/_tests/modules \
--profile-name=$(MOZ_APP_NAME) \
--test-plugin-path=$(DIST)/plugins \
--verbose \
$(EXTRA_TEST_ARGS) \
$(LIBXUL_DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
check-one-remote: DM_TRANS?=adb
check-one-remote:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(DEPTH)/build \
-I$(topsrcdir)/build \
-I$(topsrcdir)/build/mobile \
-I$(topsrcdir)/testing/mozbase/mozdevice/mozdevice \
$(testxpcsrcdir)/remotexpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
--test-path=$(SOLO_FILE) \
--testing-modules-dir=$(DEPTH)/_tests/modules \
--profile-name=$(MOZ_APP_NAME) \
--verbose \
$(EXTRA_TEST_ARGS) \
--dm_trans=$(DM_TRANS) \
--deviceIP=${TEST_DEVICE} \
--objdir=$(DEPTH) \
--noSetup \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
.PHONY: xpcshell-tests check-interactive check-one libs-xpcshell-tests
endif #} XPCSHELL_TESTS
INCLUDED_TESTS_XPCSHELL_MK = 1
endif #} INCLUDED_TESTS_XPCSHELL_MK

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

@ -32,12 +32,14 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
HOST_CSRCS \
HOST_LIBRARY_NAME \
IS_COMPONENT \
JS_MODULES_PATH \
LIBRARY_NAME \
LIBXUL_LIBRARY \
MODULE \
MSVC_ENABLE_PGO \
NO_DIST_INSTALL \
PARALLEL_DIRS \
SDK_HEADERS \
SIMPLE_PROGRAMS \
TEST_DIRS \
TIERS \
@ -104,11 +106,6 @@ endif
endif
endif
ifdef SDK_HEADERS
_EXTRA_EXPORTS := $(filter-out $(EXPORTS),$(SDK_HEADERS))
EXPORTS += $(_EXTRA_EXPORTS)
endif
ifdef REBUILD_CHECK
ifdef .PYMAKE
REPORT_BUILD = @%rebuild_check rebuild_check $@ $^
@ -166,10 +163,6 @@ ifdef ENABLE_TESTS
# locally against non-current test code.
DIRS += $(TEST_DIRS)
ifndef INCLUDED_TESTS_XPCSHELL_MK #{
include $(topsrcdir)/config/makefiles/xpcshell.mk
endif #}
ifndef INCLUDED_TESTS_MOCHITEST_MK #{
include $(topsrcdir)/config/makefiles/mochitest.mk
endif #}

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

@ -33,8 +33,8 @@
#include "mozilla/dom/Attr.h"
#include "nsISMILAttr.h"
#include "nsClientRect.h"
#include "nsEvent.h"
#include "nsAttrValue.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "Units.h"

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

@ -21,6 +21,7 @@
#include "js/TypeDecls.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/EventForwards.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/TimeStamp.h"
#include "nsContentListDeclarations.h"
@ -34,8 +35,6 @@ class imgIRequest;
class imgLoader;
class imgRequestProxy;
class nsAutoScriptBlockerSuppressNodeRemoved;
class nsDragEvent;
class nsEvent;
class nsEventListenerManager;
class nsHtml5StringParser;
class nsIChannel;
@ -84,7 +83,6 @@ class nsIWidget;
class nsIWordBreaker;
class nsIXPConnect;
class nsIXPConnectJSObjectHolder;
class nsKeyEvent;
class nsNodeInfoManager;
class nsPIDOMWindow;
class nsPresContext;

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

@ -170,7 +170,7 @@ public:
bool IsRootOfNativeAnonymousSubtree() const
{
NS_ASSERTION(!HasFlag(NODE_IS_NATIVE_ANONYMOUS_ROOT) ||
(HasFlag(NODE_IS_ANONYMOUS) &&
(HasFlag(NODE_IS_ANONYMOUS_ROOT) &&
HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE)),
"Some flags seem to be missing!");
return HasFlag(NODE_IS_NATIVE_ANONYMOUS_ROOT);
@ -186,9 +186,9 @@ public:
* Makes this content anonymous
* @see nsIAnonymousContentCreator
*/
void SetNativeAnonymous()
void SetIsNativeAnonymousRoot()
{
SetFlags(NODE_IS_ANONYMOUS | NODE_IS_IN_ANONYMOUS_SUBTREE |
SetFlags(NODE_IS_ANONYMOUS_ROOT | NODE_IS_IN_ANONYMOUS_SUBTREE |
NODE_IS_NATIVE_ANONYMOUS_ROOT);
}
@ -210,7 +210,7 @@ public:
"to binding parent");
NS_ASSERTION(!GetParent() ||
((GetBindingParent() == GetParent()) ==
HasFlag(NODE_IS_ANONYMOUS)) ||
HasFlag(NODE_IS_ANONYMOUS_ROOT)) ||
// Unfortunately default content for XBL insertion points is
// anonymous content that is bound with the parent of the
// insertion point as the parent but the bound element for the
@ -218,10 +218,10 @@ public:
// the assert a bit here.
(GetBindingParent() &&
(GetBindingParent() == GetParent()->GetBindingParent()) ==
HasFlag(NODE_IS_ANONYMOUS)),
HasFlag(NODE_IS_ANONYMOUS_ROOT)),
"For nodes with parent, flag and GetBindingParent() check "
"should match");
return HasFlag(NODE_IS_ANONYMOUS);
return HasFlag(NODE_IS_ANONYMOUS_ROOT);
}
/**

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

@ -83,7 +83,7 @@ enum {
// XBL-generated ones, will do. This flag is set-once: once a node has it,
// it must not be removed.
// NOTE: Should only be used on nsIContent nodes
NODE_IS_ANONYMOUS = NODE_FLAG_BIT(2),
NODE_IS_ANONYMOUS_ROOT = NODE_FLAG_BIT(2),
// Whether the node has some ancestor, possibly itself, that is native
// anonymous. This includes ancestors crossing XBL scopes, in cases when an
@ -802,7 +802,7 @@ public:
using mozilla::dom::EventTarget::RemoveEventListener;
using nsIDOMEventTarget::AddEventListener;
virtual void AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
mozilla::dom::EventListener* aListener,
bool aUseCapture,
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
@ -910,7 +910,7 @@ public:
void SetFlags(uint32_t aFlagsToSet)
{
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS |
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS_ROOT |
NODE_IS_NATIVE_ANONYMOUS_ROOT |
NODE_IS_IN_ANONYMOUS_SUBTREE |
NODE_ATTACH_BINDING_ON_POSTCREATE |
@ -925,7 +925,7 @@ public:
void UnsetFlags(uint32_t aFlagsToUnset)
{
NS_ASSERTION(!(aFlagsToUnset &
(NODE_IS_ANONYMOUS |
(NODE_IS_ANONYMOUS_ROOT |
NODE_IS_IN_ANONYMOUS_SUBTREE |
NODE_IS_NATIVE_ANONYMOUS_ROOT)),
"Trying to unset write-only flags");

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

@ -13,12 +13,12 @@ interface nsINode;
%{C++
class nsIFrame;
struct nsTextRangeStyle;
struct nsPoint;
struct ScrollAxis;
template<class T> class nsTArray;
#include "nsDirection.h"
#include "nsIPresShell.h" // TODO: Remove this include
#include "mozilla/EventForwards.h"
%}
[ptr] native nsIFrame(nsIFrame);

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

@ -10,6 +10,7 @@
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/AttrBinding.h"
#include "mozilla/dom/Element.h"
#include "mozilla/MutationEvent.h"
#include "nsContentCreatorFunctions.h"
#include "nsINameSpaceManager.h"
#include "nsError.h"
@ -25,7 +26,6 @@
#include "nsEventListenerManager.h"
#include "nsTextNode.h"
#include "mozAutoDocUpdate.h"
#include "nsMutationEvent.h"
#include "nsAsyncDOMEvent.h"
#include "nsWrapperCacheInlines.h"

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

@ -48,7 +48,7 @@
#include "nsDOMString.h"
#include "nsIScriptSecurityManager.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsNodeUtils.h"
#include "mozilla/dom/DirectionalityUtils.h"
#include "nsDocument.h"
@ -2213,7 +2213,7 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
break;
case NS_MOUSE_CLICK:
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
if (aVisitor.mEvent->IsLeftClickEvent()) {
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
if (inputEvent->IsControl() || inputEvent->IsMeta() ||
inputEvent->IsAlt() ||inputEvent->IsShift()) {

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

@ -51,7 +51,7 @@
#include "nsDOMString.h"
#include "nsIScriptSecurityManager.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsNodeUtils.h"
#include "nsDocument.h"
#include "nsAttrValueOrString.h"

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

@ -38,6 +38,7 @@
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/TextDecoder.h"
#include "mozilla/Likely.h"
#include "mozilla/MutationEvent.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/Util.h"
@ -144,7 +145,6 @@
#include "nsIXPConnect.h"
#include "nsJSUtils.h"
#include "nsLWBrkCIID.h"
#include "nsMutationEvent.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsNodeInfoManager.h"

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

@ -120,7 +120,7 @@
#include "nsDateTimeFormatCID.h"
#include "nsIDateTimeFormat.h"
#include "nsEventDispatcher.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsDOMCID.h"
#include "jsapi.h"

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

@ -17,7 +17,7 @@
#include "nsEventListenerManager.h"
#include "nsIDOMDocument.h"
#include "nsReadableUtils.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsINameSpaceManager.h"
#include "nsIURI.h"
#include "nsIDOMEvent.h"

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

@ -16,6 +16,7 @@
#include "mozilla/CORSMode.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/MutationEvent.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Util.h"
#include "nsAsyncDOMEvent.h"
@ -76,7 +77,6 @@
#include "nsIWebNavigation.h"
#include "nsIWidget.h"
#include "nsLayoutUtils.h"
#include "nsMutationEvent.h"
#include "nsNetUtil.h"
#include "nsNodeInfoManager.h"
#include "nsNodeUtils.h"
@ -1048,7 +1048,7 @@ nsINode::AddEventListener(const nsAString& aType,
void
nsINode::AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
EventListener* aListener,
bool aUseCapture,
const Nullable<bool>& aWantsUntrusted,
ErrorResult& aRv)
@ -1180,7 +1180,7 @@ nsINode::GetOwnerGlobal()
bool
nsINode::UnoptimizableCCNode() const
{
const uintptr_t problematicFlags = (NODE_IS_ANONYMOUS |
const uintptr_t problematicFlags = (NODE_IS_ANONYMOUS_ROOT |
NODE_IS_IN_ANONYMOUS_SUBTREE |
NODE_IS_NATIVE_ANONYMOUS_ROOT |
NODE_MAY_BE_IN_BINDING_MNGR);

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

@ -9,7 +9,7 @@
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "mozilla/dom/Element.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsDOMCSSDeclaration.h"
#include "nsDOMCSSAttrDeclaration.h"
#include "nsServiceManagerUtils.h"

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

@ -1,6 +1,24 @@
[DEFAULT]
head = head_utilities.js
tail =
tail =
support-files =
1_original.xml
1_result.xml
2_original.xml
2_result_1.xml
2_result_2.xml
2_result_3.xml
2_result_4.xml
3_original.xml
3_result.xml
3_result_2.xml
4_original.xml
4_result_1.xml
4_result_2.xml
4_result_3.xml
4_result_4.xml
4_result_5.xml
4_result_6.xml
[test_bug553888.js]
[test_bug558431.js]

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

@ -1078,7 +1078,7 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
new gfxImageSurface(imageBuffer.get(),
gfxIntSize(mWidth, mHeight),
mWidth * 4,
gfxASurface::ImageFormatARGB32);
gfxImageFormatARGB32);
if (!imgsurf || imgsurf->CairoStatus()) {
return NS_ERROR_FAILURE;
@ -3258,7 +3258,7 @@ CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* window, double x,
} else {
drawSurf =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(ceil(sw), ceil(sh)),
gfxASurface::CONTENT_COLOR_ALPHA);
GFX_CONTENT_COLOR_ALPHA);
if (!drawSurf) {
error.Throw(NS_ERROR_FAILURE);
return;
@ -3678,7 +3678,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w
}
nsRefPtr<gfxImageSurface> imgsurf = new gfxImageSurface(gfxIntSize(w, h),
gfxASurface::ImageFormatARGB32,
gfxImageFormatARGB32,
false);
if (!imgsurf || imgsurf->CairoStatus()) {
return NS_ERROR_FAILURE;

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

@ -71,7 +71,7 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
new gfxImageSurface(reinterpret_cast<uint8_t*>(data.BeginWriting()),
gfxIntSize(renderSize.width, renderSize.height),
4 * renderSize.width,
gfxASurface::ImageFormatARGB32);
gfxImageFormatARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
ctx->SetMatrix(transform);

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

@ -32,7 +32,7 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
new gfxImageSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
gfxIntSize(aSize.width, aSize.height),
aSize.width * 4,
gfxASurface::ImageFormatARGB32);
gfxImageFormatARGB32);
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));

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

@ -601,7 +601,7 @@ WebGLContext::Render(gfxContext *ctx, gfxPattern::GraphicsFilter f, uint32_t aFl
return NS_OK;
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
gfxASurface::ImageFormatARGB32);
gfxImageFormatARGB32);
if (surf->CairoStatus() != 0)
return NS_ERROR_FAILURE;
@ -731,7 +731,7 @@ WebGLContext::GetInputStream(const char* aMimeType,
return NS_ERROR_FAILURE;
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
gfxASurface::ImageFormatARGB32);
gfxImageFormatARGB32);
if (surf->CairoStatus() != 0)
return NS_ERROR_FAILURE;

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

@ -2532,7 +2532,7 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
{
if (!res.mSurface)
return NS_ERROR_FAILURE;
if (res.mSurface->GetType() != gfxASurface::SurfaceTypeImage) {
if (res.mSurface->GetType() != gfxSurfaceTypeImage) {
// SurfaceFromElement lied!
return NS_ERROR_FAILURE;
}
@ -2578,16 +2578,16 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
*imageOut = surf;
switch (surf->Format()) {
case gfxASurface::ImageFormatARGB32:
case gfxImageFormatARGB32:
*format = WebGLTexelConversions::BGRA8; // careful, our ARGB means BGRA
break;
case gfxASurface::ImageFormatRGB24:
case gfxImageFormatRGB24:
*format = WebGLTexelConversions::BGRX8; // careful, our RGB24 is not tightly packed. Whence BGRX8.
break;
case gfxASurface::ImageFormatA8:
case gfxImageFormatA8:
*format = WebGLTexelConversions::A8;
break;
case gfxASurface::ImageFormatRGB16_565:
case gfxImageFormatRGB16_565:
*format = WebGLTexelConversions::RGB565;
break;
default:

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

@ -40,12 +40,12 @@ public:
using nsIDOMEventTarget::RemoveEventListener;
using nsIDOMEventTarget::DispatchEvent;
virtual void AddEventListener(const nsAString& aType,
nsIDOMEventListener* aCallback,
EventListener* aCallback,
bool aCapture,
const Nullable<bool>& aWantsUntrusted,
ErrorResult& aRv) = 0;
virtual void RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aCallback,
EventListener* aCallback,
bool aCapture,
ErrorResult& aRv);
bool DispatchEvent(nsDOMEvent& aEvent, ErrorResult& aRv);

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

@ -3,19 +3,22 @@
* 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 nsMutationEvent_h__
#define nsMutationEvent_h__
#ifndef mozilla_MutationEvent_h__
#define mozilla_MutationEvent_h__
#include "nsGUIEvent.h"
#include "nsIDOMNode.h"
#include "mozilla/BasicEvents.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsIDOMNode.h"
class nsMutationEvent : public nsEvent
namespace mozilla {
class InternalMutationEvent : public WidgetEvent
{
public:
nsMutationEvent(bool isTrusted, uint32_t msg)
: nsEvent(isTrusted, msg, NS_MUTATION_EVENT),
mAttrChange(0)
InternalMutationEvent(bool aIsTrusted, uint32_t aMessage) :
WidgetEvent(aIsTrusted, aMessage, NS_MUTATION_EVENT),
mAttrChange(0)
{
mFlags.mCancelable = false;
}
@ -26,7 +29,8 @@ public:
nsCOMPtr<nsIAtom> mNewAttrValue;
unsigned short mAttrChange;
void AssignMutationEventData(const nsMutationEvent& aEvent, bool aCopyTargets)
void AssignMutationEventData(const InternalMutationEvent& aEvent,
bool aCopyTargets)
{
AssignEventData(aEvent, aCopyTargets);
@ -38,16 +42,6 @@ public:
}
};
#define NS_MUTATION_START 1800
#define NS_MUTATION_SUBTREEMODIFIED (NS_MUTATION_START)
#define NS_MUTATION_NODEINSERTED (NS_MUTATION_START+1)
#define NS_MUTATION_NODEREMOVED (NS_MUTATION_START+2)
#define NS_MUTATION_NODEREMOVEDFROMDOCUMENT (NS_MUTATION_START+3)
#define NS_MUTATION_NODEINSERTEDINTODOCUMENT (NS_MUTATION_START+4)
#define NS_MUTATION_ATTRMODIFIED (NS_MUTATION_START+5)
#define NS_MUTATION_CHARACTERDATAMODIFIED (NS_MUTATION_START+6)
#define NS_MUTATION_END (NS_MUTATION_START+6)
// Bits are actually checked to optimize mutation event firing.
// That's why I don't number from 0x00. The first event should
// always be 0x01.
@ -59,4 +53,9 @@ public:
#define NS_EVENT_BITS_MUTATION_ATTRMODIFIED 0x20
#define NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED 0x40
#endif // nsMutationEvent_h__
} // namespace mozilla
// TODO: Remove following typedef
typedef mozilla::InternalMutationEvent nsMutationEvent;
#endif // mozilla_MutationEvent_h__

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

@ -20,10 +20,13 @@ EXPORTS += [
'nsEventStates.h',
'nsIPrivateTextEvent.h',
'nsIPrivateTextRange.h',
'nsMutationEvent.h',
'nsVKList.h',
]
EXPORTS.mozilla += [
'MutationEvent.h',
]
EXPORTS.mozilla.dom += [
'EventTarget.h',
]

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

@ -7,8 +7,8 @@
#ifndef nsEventDispatcher_h___
#define nsEventDispatcher_h___
#include "mozilla/EventForwards.h"
#include "nsCOMPtr.h"
#include "nsEvent.h"
class nsEventTargetChainItem;
class nsIDOMEvent;
@ -220,7 +220,7 @@ public:
*
* If aTargets is non-null, event target chain will be created, but
* event won't be handled. In this case aEvent->message should be
* NS_EVENT_TYPE_NULL.
* NS_EVENT_NULL.
* @note Use this method when dispatching an nsEvent.
*/
static nsresult Dispatch(nsISupports* aTarget,

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

@ -154,11 +154,11 @@ EVENT(abort,
EVENT(canplay,
NS_CANPLAY,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(canplaythrough,
NS_CANPLAYTHROUGH,
EventNameType_HTML,
NS_EVENT_NULL )
NS_EVENT)
EVENT(change,
NS_FORM_CHANGE,
EventNameType_HTMLXUL,
@ -208,15 +208,15 @@ EVENT(drop,
EVENT(durationchange,
NS_DURATIONCHANGE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(emptied,
NS_EMPTIED,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(ended,
NS_ENDED,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(input,
NS_FORM_INPUT,
EventNameType_HTMLXUL,
@ -240,15 +240,15 @@ EVENT(keyup,
EVENT(loadeddata,
NS_LOADEDDATA,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(loadedmetadata,
NS_LOADEDMETADATA,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(loadstart,
NS_LOADSTART,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(mousedown,
NS_MOUSE_BUTTON_DOWN,
EventNameType_All,
@ -280,41 +280,41 @@ EVENT(mouseup,
EVENT(mozfullscreenchange,
NS_FULLSCREENCHANGE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(mozfullscreenerror,
NS_FULLSCREENERROR,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(mozpointerlockchange,
NS_POINTERLOCKCHANGE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(mozpointerlockerror,
NS_POINTERLOCKERROR,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
// Not supported yet; probably never because "wheel" is a better idea.
// EVENT(mousewheel)
EVENT(pause,
NS_PAUSE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(play,
NS_PLAY,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(playing,
NS_PLAYING,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(progress,
NS_PROGRESS,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(ratechange,
NS_RATECHANGE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(reset,
NS_FORM_RESET,
EventNameType_HTMLXUL,
@ -322,11 +322,11 @@ EVENT(reset,
EVENT(seeked,
NS_SEEKED,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(seeking,
NS_SEEKING,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(select,
NS_FORM_SELECTED,
EventNameType_HTMLXUL,
@ -338,7 +338,7 @@ EVENT(show,
EVENT(stalled,
NS_STALLED,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(submit,
NS_FORM_SUBMIT,
EventNameType_HTMLXUL,
@ -346,19 +346,19 @@ EVENT(submit,
EVENT(suspend,
NS_SUSPEND,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(timeupdate,
NS_TIMEUPDATE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(volumechange,
NS_VOLUMECHANGE,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(waiting,
NS_WAITING,
EventNameType_HTML,
NS_EVENT_NULL)
NS_EVENT)
EVENT(wheel,
NS_WHEEL_WHEEL,
EventNameType_All,
@ -404,7 +404,7 @@ FORWARDED_EVENT(load,
FORWARDED_EVENT(scroll,
NS_SCROLL_EVENT,
(EventNameType_HTMLXUL | EventNameType_SVGSVG),
NS_EVENT_NULL)
NS_EVENT)
WINDOW_EVENT(afterprint,
NS_AFTERPRINT,
@ -448,7 +448,7 @@ WINDOW_EVENT(pageshow,
WINDOW_EVENT(popstate,
NS_POPSTATE,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
NS_EVENT_NULL)
NS_EVENT)
// Not supported yet
// WINDOW_EVENT(redo)
WINDOW_EVENT(resize,
@ -530,7 +530,7 @@ TOUCH_EVENT(touchcancel,
DOCUMENT_ONLY_EVENT(readystatechange,
NS_READYSTATECHANGE,
EventNameType_HTMLXUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(MozMouseHittest,
NS_MOUSE_MOZHITTEST,
@ -616,7 +616,7 @@ NON_IDL_EVENT(warning,
NON_IDL_EVENT(text,
NS_TEXT_TEXT,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(compositionstart,
NS_COMPOSITION_START,
EventNameType_XUL,
@ -636,31 +636,31 @@ NON_IDL_EVENT(command,
NON_IDL_EVENT(close,
NS_XUL_CLOSE,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(popupshowing,
NS_XUL_POPUP_SHOWING,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(popupshown,
NS_XUL_POPUP_SHOWN,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(popuphiding,
NS_XUL_POPUP_HIDING,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(popuphidden,
NS_XUL_POPUP_HIDDEN,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(broadcast,
NS_XUL_BROADCAST,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(commandupdate,
NS_XUL_COMMAND_UPDATE,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(dragexit,
NS_DRAGDROP_EXIT_SYNTH,
EventNameType_XUL,
@ -676,11 +676,11 @@ NON_IDL_EVENT(draggesture,
NON_IDL_EVENT(overflow,
NS_SCROLLPORT_OVERFLOW,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(underflow,
NS_SCROLLPORT_UNDERFLOW,
EventNameType_XUL,
NS_EVENT_NULL)
NS_EVENT)
// Various SVG events
NON_IDL_EVENT(SVGLoad,
@ -719,14 +719,14 @@ NON_IDL_EVENT(SVGZoom,
NON_IDL_EVENT(zoom,
NS_SVG_ZOOM,
EventNameType_SVGSVG,
NS_EVENT_NULL)
NS_EVENT)
#endif
// Only map the ID to the real event name when ID_TO_EVENT is defined.
#ifndef ID_TO_EVENT
NON_IDL_EVENT(begin,
NS_SMIL_BEGIN,
EventNameType_SMIL,
NS_EVENT_NULL)
NS_EVENT)
#endif
NON_IDL_EVENT(beginEvent,
NS_SMIL_BEGIN,
@ -737,7 +737,7 @@ NON_IDL_EVENT(beginEvent,
NON_IDL_EVENT(end,
NS_SMIL_END,
EventNameType_SMIL,
NS_EVENT_NULL)
NS_EVENT)
#endif
NON_IDL_EVENT(endEvent,
NS_SMIL_END,
@ -748,7 +748,7 @@ NON_IDL_EVENT(endEvent,
NON_IDL_EVENT(repeat,
NS_SMIL_REPEAT,
EventNameType_SMIL,
NS_EVENT_NULL)
NS_EVENT)
#endif
NON_IDL_EVENT(repeatEvent,
NS_SMIL_REPEAT,
@ -758,7 +758,7 @@ NON_IDL_EVENT(repeatEvent,
NON_IDL_EVENT(MozAudioAvailable,
NS_MOZAUDIOAVAILABLE,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(MozAfterPaint,
NS_AFTERPAINT,
EventNameType_None,
@ -773,23 +773,23 @@ NON_IDL_EVENT(MozScrolledAreaChanged,
NON_IDL_EVENT(gamepadbuttondown,
NS_GAMEPAD_BUTTONDOWN,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(gamepadbuttonup,
NS_GAMEPAD_BUTTONUP,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(gamepadaxismove,
NS_GAMEPAD_AXISMOVE,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(gamepadconnected,
NS_GAMEPAD_CONNECTED,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
NON_IDL_EVENT(gamepaddisconnected,
NS_GAMEPAD_DISCONNECTED,
EventNameType_None,
NS_EVENT_NULL)
NS_EVENT)
#endif
// Simple gesture events

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

@ -6,7 +6,6 @@
#ifndef nsIPrivateTextEvent_h__
#define nsIPrivateTextEvent_h__
#include "nsEvent.h"
#include "nsISupports.h"
#include "nsIPrivateTextRange.h"

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

@ -9,7 +9,7 @@
#include "nsISupports.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsGUIEvent.h"
#include "mozilla/EventForwards.h"
#define NS_IPRIVATETEXTRANGE_IID \
{ 0xf795a44d, 0x413a, 0x4c63, \

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

@ -12,7 +12,7 @@ namespace dom {
void
EventTarget::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
EventListener* aListener,
bool aUseCapture,
ErrorResult& aRv)
{

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

@ -8,12 +8,12 @@
#define mozilla_TextComposition_h
#include "nsCOMPtr.h"
#include "nsEvent.h"
#include "nsINode.h"
#include "nsIWidget.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
class nsDispatchingCallback;
class nsIMEStateManager;

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

@ -7,12 +7,12 @@
#define mozilla_dom_Touch_h
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "Units.h"
class nsPresContext;
class nsEvent;
namespace mozilla {
namespace dom {

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

@ -10,11 +10,10 @@
#include "nsISelection.h"
#include "nsRange.h"
#include "mozilla/EventForwards.h"
class nsCaret;
class nsPresContext;
class nsQueryContentEvent;
class nsSelectionEvent;
struct nsRect;

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

@ -14,7 +14,7 @@
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsContentUtils.h"
#include "nsJSEnvironment.h"
#include "mozilla/Preferences.h"

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

@ -189,7 +189,7 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
void
nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
EventListener* aListener,
bool aUseCapture,
const Nullable<bool>& aWantsUntrusted,
ErrorResult& aRv)

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

@ -46,7 +46,7 @@ public:
NS_DECL_NSIDOMEVENTTARGET
using mozilla::dom::EventTarget::RemoveEventListener;
virtual void AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
mozilla::dom::EventListener* aListener,
bool aCapture,
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;

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

@ -5,14 +5,17 @@
#include "nsCOMPtr.h"
#include "nsDOMMutationEvent.h"
#include "mozilla/MutationEvent.h"
using namespace mozilla;
class nsPresContext;
nsDOMMutationEvent::nsDOMMutationEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsMutationEvent* aEvent)
InternalMutationEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new nsMutationEvent(false, 0))
aEvent ? aEvent : new InternalMutationEvent(false, 0))
{
mEventIsInternal = (aEvent == nullptr);
}
@ -20,7 +23,8 @@ nsDOMMutationEvent::nsDOMMutationEvent(mozilla::dom::EventTarget* aOwner,
nsDOMMutationEvent::~nsDOMMutationEvent()
{
if (mEventIsInternal) {
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutation =
static_cast<InternalMutationEvent*>(mEvent);
delete mutation;
mEvent = nullptr;
}
@ -33,6 +37,14 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMMutationEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMMutationEvent, nsDOMEvent)
already_AddRefed<nsINode>
nsDOMMutationEvent::GetRelatedNode()
{
nsCOMPtr<nsINode> n = do_QueryInterface(
static_cast<InternalMutationEvent*>(mEvent)->mRelatedNode);
return n.forget();
}
NS_IMETHODIMP
nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
{
@ -45,7 +57,7 @@ nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
NS_IMETHODIMP
nsDOMMutationEvent::GetPrevValue(nsAString& aPrevValue)
{
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutation = static_cast<InternalMutationEvent*>(mEvent);
if (mutation->mPrevAttrValue)
mutation->mPrevAttrValue->ToString(aPrevValue);
return NS_OK;
@ -54,7 +66,7 @@ nsDOMMutationEvent::GetPrevValue(nsAString& aPrevValue)
NS_IMETHODIMP
nsDOMMutationEvent::GetNewValue(nsAString& aNewValue)
{
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutation = static_cast<InternalMutationEvent*>(mEvent);
if (mutation->mNewAttrValue)
mutation->mNewAttrValue->ToString(aNewValue);
return NS_OK;
@ -63,12 +75,18 @@ nsDOMMutationEvent::GetNewValue(nsAString& aNewValue)
NS_IMETHODIMP
nsDOMMutationEvent::GetAttrName(nsAString& aAttrName)
{
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutation = static_cast<InternalMutationEvent*>(mEvent);
if (mutation->mAttrName)
mutation->mAttrName->ToString(aAttrName);
return NS_OK;
}
uint16_t
nsDOMMutationEvent::AttrChange()
{
return static_cast<InternalMutationEvent*>(mEvent)->mAttrChange;
}
NS_IMETHODIMP
nsDOMMutationEvent::GetAttrChange(uint16_t* aAttrChange)
{
@ -82,7 +100,7 @@ nsDOMMutationEvent::InitMutationEvent(const nsAString& aTypeArg, bool aCanBubble
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
NS_ENSURE_SUCCESS(rv, rv);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
InternalMutationEvent* mutation = static_cast<InternalMutationEvent*>(mEvent);
mutation->mRelatedNode = aRelatedNodeArg;
if (!aPrevValueArg.IsEmpty())
mutation->mPrevAttrValue = do_GetAtom(aPrevValueArg);
@ -99,7 +117,7 @@ nsDOMMutationEvent::InitMutationEvent(const nsAString& aTypeArg, bool aCanBubble
nsresult NS_NewDOMMutationEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsMutationEvent *aEvent)
InternalMutationEvent* aEvent)
{
nsDOMMutationEvent* it = new nsDOMMutationEvent(aOwner, aPresContext, aEvent);

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

@ -9,8 +9,8 @@
#include "nsIDOMMutationEvent.h"
#include "nsINode.h"
#include "nsDOMEvent.h"
#include "nsMutationEvent.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/EventForwards.h"
class nsDOMMutationEvent : public nsDOMEvent,
public nsIDOMMutationEvent
@ -39,17 +39,9 @@ public:
// GetNewValue(nsAString& aNewValue);
// GetAttrName(nsAString& aAttrName);
already_AddRefed<nsINode> GetRelatedNode()
{
nsCOMPtr<nsINode> n =
do_QueryInterface(static_cast<nsMutationEvent*>(mEvent)->mRelatedNode);
return n.forget();
}
already_AddRefed<nsINode> GetRelatedNode();
uint16_t AttrChange()
{
return static_cast<nsMutationEvent*>(mEvent)->mAttrChange;
}
uint16_t AttrChange();
void InitMutationEvent(const nsAString& aType,
bool& aCanBubble, bool& aCancelable,

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

@ -460,7 +460,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
bool
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
{
if (!NS_IS_INPUT_EVENT(mEvent)) {
if (!mEvent->IsInputDerivedEvent()) {
MOZ_CRASH("mEvent must be nsInputEvent or derived class");
}
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);

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

@ -10,7 +10,6 @@
#include "nsIDOMUIEvent.h"
#include "nsDOMEvent.h"
#include "nsLayoutUtils.h"
#include "nsEvent.h"
#include "mozilla/dom/UIEventBinding.h"
#include "nsPresContext.h"
#include "nsDeviceContext.h"

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

@ -10,7 +10,6 @@
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsError.h"
#include "nsMutationEvent.h"
#include <new>
#include "nsINode.h"
#include "nsPIDOMWindow.h"
@ -18,6 +17,7 @@
#include "GeckoProfiler.h"
#include "GeneratedEvents.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/MutationEvent.h"
using namespace mozilla;
using namespace mozilla::dom;

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

@ -26,7 +26,7 @@
#include "nsCOMPtr.h"
#include "nsError.h"
#include "nsIDocument.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsIXPConnect.h"
#include "nsDOMCID.h"
#include "nsContentUtils.h"
@ -236,7 +236,7 @@ nsEventListenerManager::AddEventListenerInternal(
}
}
mNoListenerForEvent = NS_EVENT_TYPE_NULL;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEventAtom = nullptr;
ls = aAllEvents ? mListeners.InsertElementAt(0) : mListeners.AppendElement();
@ -474,7 +474,7 @@ nsEventListenerManager::RemoveEventListenerInternal(
nsRefPtr<nsEventListenerManager> kungFuDeathGrip = this;
mListeners.RemoveElementAt(i);
--count;
mNoListenerForEvent = NS_EVENT_TYPE_NULL;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEventAtom = nullptr;
if (mTarget && aUserType) {
mTarget->EventListenerRemoved(aUserType);
@ -771,7 +771,7 @@ nsEventListenerManager::RemoveEventHandler(nsIAtom* aName,
if (ls) {
mListeners.RemoveElementAt(uint32_t(ls - &mListeners.ElementAt(0)));
mNoListenerForEvent = NS_EVENT_TYPE_NULL;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEventAtom = nullptr;
if (mTarget) {
mTarget->EventListenerRemoved(aName);
@ -1084,7 +1084,7 @@ nsEventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aListener,
flags.mAllowUntrustedEvents = aWantsUntrusted;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder holder(aListener);
AddEventListenerInternal(holder, NS_EVENT_TYPE_ALL, nullptr, EmptyString(),
AddEventListenerInternal(holder, NS_EVENT_ALL, nullptr, EmptyString(),
flags, false, true);
}
@ -1097,7 +1097,7 @@ nsEventListenerManager::RemoveListenerForAllEvents(nsIDOMEventListener* aListene
flags.mCapture = aUseCapture;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder holder(aListener);
RemoveEventListenerInternal(holder, NS_EVENT_TYPE_ALL, nullptr, EmptyString(),
RemoveEventListenerInternal(holder, NS_EVENT_ALL, nullptr, EmptyString(),
flags, true);
}

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

@ -192,7 +192,7 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
*aCount = 0;
*aOutArray = nullptr;
NS_ENSURE_ARG(aEventTarget);
nsEvent event(true, NS_EVENT_TYPE_NULL);
nsEvent event(true, NS_EVENT_NULL);
nsCOMArray<EventTarget> targets;
nsresult rv = nsEventDispatcher::Dispatch(aEventTarget, nullptr, &event,
nullptr, nullptr, nullptr, &targets);

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

@ -130,7 +130,7 @@ RoundDown(double aDouble)
static inline bool
IsMouseEventReal(nsEvent* aEvent)
{
NS_ABORT_IF_FALSE(NS_IS_MOUSE_EVENT_STRUCT(aEvent), "Not a mouse event");
NS_ABORT_IF_FALSE(aEvent->IsMouseDerivedEvent(), "Not a mouse event");
// Return true if not synthesized.
return static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal;
}
@ -796,7 +796,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (!mCurrentTarget) return NS_ERROR_NULL_POINTER;
}
#ifdef DEBUG
if (NS_IS_DRAG_EVENT(aEvent) && sIsPointerLocked) {
if (aEvent->HasDragEventMessage() && sIsPointerLocked) {
NS_ASSERTION(sIsPointerLocked,
"sIsPointerLocked is true. Drag events should be suppressed when the pointer is locked.");
}
@ -804,8 +804,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// Store last known screenPoint and clientPoint so pointer lock
// can use these values as constants.
if (aEvent->mFlags.mIsTrusted &&
((NS_IS_MOUSE_EVENT_STRUCT(aEvent) &&
IsMouseEventReal(aEvent)) ||
((aEvent->IsMouseDerivedEvent() && IsMouseEventReal(aEvent)) ||
aEvent->eventStructType == NS_WHEEL_EVENT)) {
if (!sIsPointerLocked) {
sLastScreenPoint = nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
@ -976,7 +975,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
WheelPrefs::GetInstance()->ApplyUserPrefsToDelta(wheelEvent);
// If we won't dispatch a DOM event for this event, nothing to do anymore.
if (!NS_IsAllowedToDispatchDOMEvent(wheelEvent)) {
if (!wheelEvent->IsAllowedToDispatchDOMEvent()) {
break;
}

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

@ -8,7 +8,6 @@
#include "mozilla/TypedEnum.h"
#include "nsEvent.h"
#include "nsGUIEvent.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
@ -28,7 +27,6 @@ class nsIDocShellTreeItem;
class imgIContainer;
class nsDOMDataTransfer;
class MouseEnterLeaveDispatcher;
class nsEventStates;
class nsIMarkupDocumentViewer;
class nsIScrollableFrame;
class nsITimer;
@ -882,7 +880,8 @@ private:
// Click and double-click events need to be handled even for content that
// has no frame. This is required for Web compatibility.
#define NS_EVENT_NEEDS_FRAME(event) \
(!NS_IS_ACTIVATION_EVENT(event) && (event)->message != NS_MOUSE_CLICK && \
(!(event)->HasPluginActivationEventMessage() && \
(event)->message != NS_MOUSE_CLICK && \
(event)->message != NS_MOUSE_DOUBLECLICK)
#endif // nsEventStateManager_h__

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

@ -6,7 +6,7 @@
#ifndef nsIMEStateManager_h__
#define nsIMEStateManager_h__
#include "nsEvent.h"
#include "mozilla/EventForwards.h"
#include "nsIWidget.h"
class nsDispatchingCallback;

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

@ -10,6 +10,7 @@
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"
#include "mozilla/TextEvents.h"
class nsPrivateTextRange MOZ_FINAL : public nsIPrivateTextRange
{

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

@ -197,7 +197,7 @@ HTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
// DOMActivate that was dispatched directly, this will be set, but if we're
// a DOMActivate dispatched from click handling, it will not be set.
bool outerActivateEvent =
(NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) ||
(aVisitor.mEvent->IsLeftClickEvent() ||
(aVisitor.mEvent->message == NS_UI_ACTIVATE &&
!mInInternalActivate));
@ -224,7 +224,7 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
}
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
aVisitor.mEvent->IsLeftClickEvent()) {
nsUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted, NS_UI_ACTIVATE, 1);
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();

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

@ -398,7 +398,7 @@ HTMLCanvasElement::ExtractData(const nsAString& aType,
nsRefPtr<gfxImageSurface> emptyCanvas;
nsIntSize size = GetWidthHeight();
if (!mCurrentContext) {
emptyCanvas = new gfxImageSurface(gfxIntSize(size.width, size.height), gfxASurface::ImageFormatARGB32);
emptyCanvas = new gfxImageSurface(gfxIntSize(size.width, size.height), gfxImageFormatARGB32);
if (emptyCanvas->CairoStatus()) {
return NS_ERROR_INVALID_ARG;
}

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

@ -58,7 +58,7 @@
#include "nsLayoutUtils.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsEventListenerManager.h"
#include "nsRuleData.h"
@ -3010,7 +3010,7 @@ HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
// DOMActivate that was dispatched directly, this will be set, but if we're
// a DOMActivate dispatched from click handling, it will not be set.
bool outerActivateEvent =
(NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) ||
(aVisitor.mEvent->IsLeftClickEvent() ||
(aVisitor.mEvent->message == NS_UI_ACTIVATE && !mInInternalActivate));
if (outerActivateEvent) {
@ -3240,7 +3240,7 @@ HTMLInputElement::MaybeInitPickers(nsEventChainPostVisitor& aVisitor)
// - it's the left mouse button.
// We do not prevent non-trusted click because authors can already use
// .click(). However, the pickers will follow the rules of popup-blocking.
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) &&
if (aVisitor.mEvent->IsLeftClickEvent() &&
!aVisitor.mEvent->mFlags.mDefaultPrevented) {
if (mType == NS_FORM_INPUT_FILE) {
return InitFilePicker(FILE_PICKER_FILE);
@ -3294,7 +3294,7 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
// the click.
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
!IsSingleLineTextControl(true) &&
NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) &&
aVisitor.mEvent->IsLeftClickEvent() &&
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
nsUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted, NS_UI_ACTIVATE, 1);

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

@ -115,7 +115,7 @@ nsresult
HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
if (mHandlingEvent ||
(!NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) &&
(!aVisitor.mEvent->IsLeftClickEvent() &&
aVisitor.mEvent->message != NS_MOUSE_BUTTON_DOWN) ||
aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
!aVisitor.mPresContext ||
@ -146,7 +146,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
break;
case NS_MOUSE_CLICK:
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
if (aVisitor.mEvent->IsLeftClickEvent()) {
const nsMouseEvent* event =
static_cast<const nsMouseEvent*>(aVisitor.mEvent);
LayoutDeviceIntPoint* mouseDownPoint =

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

@ -67,7 +67,7 @@
#include "nsFocusManager.h"
#include "nsAttrValueOrString.h"
#include "nsMutationEvent.h"
#include "mozilla/MutationEvent.h"
#include "nsDOMStringMap.h"
#include "nsIEditor.h"

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

@ -7,7 +7,7 @@
#if !defined(DirectShowReader_h_)
#define DirectShowReader_h_
#include "Windows.h" // HRESULT, DWORD
#include "windows.h" // HRESULT, DWORD
#include "MediaDecoderReader.h"
#include "mozilla/RefPtr.h"
#include "MP3FrameParser.h"

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

@ -4,9 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "dshow.h"
#include "Dmodshow.h"
#include "Wmcodecdsp.h"
#include "Dmoreg.h"
#include "dmodshow.h"
#include "wmcodecdsp.h"
#include "dmoreg.h"
#include "DirectShowUtils.h"
#include "nsAutoPtr.h"
#include "mozilla/RefPtr.h"

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

@ -222,6 +222,13 @@ private:
};
// For mingw __uuidof support
#ifdef __CRT_UUID_DECL
}
__CRT_UUID_DECL(mozilla::OutputPin, 0x18e5cfb2,0x1015,0x440c,0xa6,0x5c,0xe6,0x38,0x53,0x23,0x58,0x94);
namespace mozilla {
#endif
OutputPin::OutputPin(MediaResource* aResource,
SourceFilter* aParent,
CriticalSection& aFilterLock,
@ -402,7 +409,7 @@ OutputPin::Request(IMediaSample* aSample, DWORD_PTR aDwUser)
if (!aSample) return E_FAIL;
CriticalSectionAutoEnter lock(*mLock);
NS_ASSERTION(!mFlushCount, __FUNCTION__"() while flushing");
NS_ASSERTION(!mFlushCount, "Request() while flushing");
if (mFlushCount)
return VFW_E_WRONG_STATE;
@ -463,7 +470,7 @@ OutputPin::WaitForNext(DWORD aTimeout,
mSignal.Wait();
}
nsAutoPtr<ReadRequest> request = reinterpret_cast<ReadRequest*>(mPendingReads.PopFront());
nsAutoPtr<ReadRequest> request(reinterpret_cast<ReadRequest*>(mPendingReads.PopFront()));
if (!request)
return VFW_E_WRONG_STATE;

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

@ -68,4 +68,9 @@ protected:
} // namespace mozilla
// For mingw __uuidof support
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(mozilla::SourceFilter, 0x5c2a7ad0,0xba82,0x4659,0x91,0x78,0xc4,0x71,0x9a,0x27,0x65,0xd6);
#endif
#endif

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

@ -363,7 +363,7 @@ MediaPluginReader::ImageBufferCallback::operator()(size_t aWidth, size_t aHeight
case MPAPI::RGB565:
rgbImage = mozilla::layers::CreateSharedRGBImage(mImageContainer,
nsIntSize(aWidth, aHeight),
gfxASurface::ImageFormatRGB16_565);
gfxImageFormatRGB16_565);
if (!rgbImage) {
NS_WARNING("Could not create rgb image");
return nullptr;

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

@ -24,29 +24,29 @@ load 874952.html
load 875144.html
load 875596.html
load 875911.html
skip-if(B2G) load 876024-1.html # timeout-prone, bug 908306
load 876024-1.html
load 876024-2.html
skip-if(B2G) load 876118.html # timeout-prone, bug 908306
load 876118.html
load 876207.html
load 876215.html
load 876249.html
skip-if(B2G) load 876252.html # timeout-prone, bug 908306
load 876252.html
load 876834.html
skip-if(B2G) load 877820.html # timeout-prone, bug 908306
skip-if(B2G) load 878014.html # timeout-prone, bug 908306
load 877820.html
load 878014.html
load 878328.html
load 878407.html
skip-if(B2G) load 878478.html # timeout-prone, bug 908306
load 878478.html
load 877527.html
load 880129.html
skip-if(B2G) test-pref(media.webaudio.enabled,true) load 880202.html # load failed, bug 908306 for B2G
skip-if(B2G) load 880342-1.html # timeout-prone, bug 908306
load 880342-1.html
load 880342-2.html
load 880384.html
skip-if(B2G) load 880404.html # timeout-prone, bug 908306
skip-if(B2G) load 880724.html # timeout-prone, bug 908306
load 880404.html
load 880724.html
load 881775.html
skip-if(B2G) load 882956.html # timeout-prone, bug 908306
load 882956.html
test-pref(media.webvtt.enabled,true) load 882549.html
load 884459.html
load 889042.html
@ -56,3 +56,5 @@ load 907986-2.html
load 907986-3.html
load 907986-4.html
load 910171-1.html
load oscillator-ended-1.html
load oscillator-ended-2.html

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

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script>
function createContext() {
var context = new window.AudioContext();
var source = context.createOscillator();
source.onended = function(e) {
document.documentElement.removeAttribute("class");
};
source.connect(context.destination);
source.start(0.49);
source.stop(0.5);
}
createContext();
</script>

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

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script>
function createContext() {
var context = new window.AudioContext();
var source = context.createOscillator();
source.onended = function(e) {
document.documentElement.removeAttribute("class");
};
source.connect(context.destination);
source.start(60);
source.stop(0.5);
}
createContext();
</script>

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

@ -513,8 +513,7 @@ AudioBufferSourceNode::Start(double aWhen, double aOffset,
ns->SetStreamTimeParameter(START, Context()->DestinationStream(), aWhen);
}
MOZ_ASSERT(!mPlayingRef, "We can only accept a successful start() call once");
mPlayingRef.Take(this);
MarkActive();
}
void
@ -573,7 +572,7 @@ AudioBufferSourceNode::SendOffsetAndDurationParametersToStream(AudioNodeStream*
}
void
AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv, bool aShuttingDown)
AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv)
{
if (!WebAudioUtils::IsTimeValid(aWhen)) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
@ -585,11 +584,10 @@ AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv, bool aShuttingDown)
return;
}
if (!mBuffer || aShuttingDown) {
if (!mBuffer) {
// We don't have a buffer, so the stream is never marked as finished.
// This can also happen if the AudioContext is being shut down.
// Therefore we need to drop our playing ref right now.
mPlayingRef.Drop(this);
MarkInactive();
}
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
@ -633,7 +631,7 @@ AudioBufferSourceNode::NotifyMainThreadStateChanged()
// Drop the playing reference
// Warning: The below line might delete this.
mPlayingRef.Drop(this);
MarkInactive();
}
}

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

@ -56,7 +56,7 @@ public:
duration.Construct(aDuration);
Start(aWhen, aOffset, duration, aRv);
}
void Stop(double aWhen, ErrorResult& aRv, bool aShuttingDown = false);
void Stop(double aWhen, ErrorResult& aRv);
void NoteOff(double aWhen, ErrorResult& aRv)
{
Stop(aWhen, aRv);
@ -141,7 +141,6 @@ private:
double mDuration;
nsRefPtr<AudioBuffer> mBuffer;
nsRefPtr<AudioParam> mPlaybackRate;
SelfReference<AudioBufferSourceNode> mPlayingRef; // a reference to self while playing
bool mLoop;
bool mStartCalled;
bool mStopped;

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

@ -38,8 +38,25 @@
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED_2(AudioContext, nsDOMEventTargetHelper,
mDestination, mListener)
NS_IMPL_CYCLE_COLLECTION_CLASS(AudioContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDestination)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mListener)
if (!tmp->mIsStarted) {
NS_IMPL_CYCLE_COLLECTION_UNLINK(mActiveNodes)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AudioContext, nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDestination)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListener)
if (!tmp->mIsStarted) {
MOZ_ASSERT(tmp->mIsOffline,
"Online AudioContexts should always be started");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mActiveNodes)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(AudioContext, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(AudioContext, nsDOMEventTargetHelper)
@ -137,7 +154,6 @@ AudioContext::CreateBufferSource()
{
nsRefPtr<AudioBufferSourceNode> bufferNode =
new AudioBufferSourceNode(this);
mAudioBufferSourceNodes.PutEntry(bufferNode);
return bufferNode.forget();
}
@ -249,7 +265,6 @@ AudioContext::CreateScriptProcessor(uint32_t aBufferSize,
nsRefPtr<ScriptProcessorNode> scriptProcessor =
new ScriptProcessorNode(this, aBufferSize, aNumberOfInputChannels,
aNumberOfOutputChannels);
mScriptProcessorNodes.PutEntry(scriptProcessor);
return scriptProcessor.forget();
}
@ -379,7 +394,6 @@ AudioContext::CreateOscillator()
{
nsRefPtr<OscillatorNode> oscillatorNode =
new OscillatorNode(this);
mOscillatorNodes.PutEntry(oscillatorNode);
return oscillatorNode.forget();
}
@ -461,7 +475,6 @@ AudioContext::UnregisterActiveNode(AudioNode* aNode)
void
AudioContext::UnregisterAudioBufferSourceNode(AudioBufferSourceNode* aNode)
{
mAudioBufferSourceNodes.RemoveEntry(aNode);
UpdatePannerSource();
}
@ -474,18 +487,6 @@ AudioContext::UnregisterPannerNode(PannerNode* aNode)
}
}
void
AudioContext::UnregisterOscillatorNode(OscillatorNode* aNode)
{
mOscillatorNodes.RemoveEntry(aNode);
}
void
AudioContext::UnregisterScriptProcessorNode(ScriptProcessorNode* aNode)
{
mScriptProcessorNodes.RemoveEntry(aNode);
}
static PLDHashOperator
FindConnectedSourcesOn(nsPtrHashKey<PannerNode>* aEntry, void* aData)
{
@ -526,22 +527,6 @@ AudioContext::CurrentTime() const
return MediaTimeToSeconds(Destination()->Stream()->GetCurrentTime());
}
template <class T>
static PLDHashOperator
GetHashtableEntry(nsPtrHashKey<T>* aEntry, void* aData)
{
nsTArray<T*>* array = static_cast<nsTArray<T*>*>(aData);
array->AppendElement(aEntry->GetKey());
return PL_DHASH_NEXT;
}
template <class T>
static void
GetHashtableElements(nsTHashtable<nsPtrHashKey<T> >& aHashtable, nsTArray<T*>& aArray)
{
aHashtable.EnumerateEntries(&GetHashtableEntry<T>, &aArray);
}
void
AudioContext::Shutdown()
{
@ -554,34 +539,6 @@ AudioContext::Shutdown()
// Node is already unregistered.
mActiveNodes.Clear();
// Stop all audio buffer source nodes, to make sure that they release
// their self-references.
// We first gather an array of the nodes and then call Stop on each one,
// since Stop may delete the object and therefore trigger a re-entrant
// hashtable call to remove the pointer from the hashtable, which is
// not safe.
nsTArray<AudioBufferSourceNode*> sourceNodes;
GetHashtableElements(mAudioBufferSourceNodes, sourceNodes);
for (uint32_t i = 0; i < sourceNodes.Length(); ++i) {
ErrorResult rv;
sourceNodes[i]->Stop(0.0, rv, true);
}
// Stop all Oscillator nodes to make sure they release their
// playing reference.
nsTArray<OscillatorNode*> oscNodes;
GetHashtableElements(mOscillatorNodes, oscNodes);
for (uint32_t i = 0; i < oscNodes.Length(); ++i) {
ErrorResult rv;
oscNodes[i]->Stop(0.0, rv);
}
// Stop all script processor nodes, to make sure that they release
// their self-references.
nsTArray<ScriptProcessorNode*> spNodes;
GetHashtableElements(mScriptProcessorNodes, spNodes);
for (uint32_t i = 0; i < spNodes.Length(); ++i) {
spNodes[i]->Stop();
}
// For offline contexts, we can destroy the MediaStreamGraph at this point.
if (mIsOffline && mDestination) {
mDestination->OfflineShutdown();

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

@ -229,8 +229,6 @@ public:
void UnregisterAudioBufferSourceNode(AudioBufferSourceNode* aNode);
void UnregisterPannerNode(PannerNode* aNode);
void UnregisterOscillatorNode(OscillatorNode* aNode);
void UnregisterScriptProcessorNode(ScriptProcessorNode* aNode);
void UpdatePannerSource();
uint32_t MaxChannelCount() const;
@ -257,15 +255,9 @@ private:
// See RegisterActiveNode. These will keep the AudioContext alive while it
// is rendering and the window remains alive.
nsTHashtable<nsRefPtrHashKey<AudioNode> > mActiveNodes;
// Two hashsets containing all the PannerNodes and AudioBufferSourceNodes,
// to compute the doppler shift, and also to stop AudioBufferSourceNodes.
// These are all weak pointers.
// Hashsets containing all the PannerNodes, to compute the doppler shift.
// These are weak pointers.
nsTHashtable<nsPtrHashKey<PannerNode> > mPannerNodes;
nsTHashtable<nsPtrHashKey<AudioBufferSourceNode> > mAudioBufferSourceNodes;
nsTHashtable<nsPtrHashKey<OscillatorNode> > mOscillatorNodes;
// Hashset containing all ScriptProcessorNodes in order to stop them.
// These are all weak pointers.
nsTHashtable<nsPtrHashKey<ScriptProcessorNode> > mScriptProcessorNodes;
// Number of channels passed in the OfflineAudioContext ctor.
uint32_t mNumberOfChannels;
bool mIsOffline;

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

@ -57,44 +57,6 @@ private:
bool mHeld;
};
template<class T>
class SelfCountedReference {
public:
SelfCountedReference() : mRefCnt(0) {}
~SelfCountedReference()
{
NS_ASSERTION(mRefCnt == 0, "Forgot to drop the self reference?");
}
void Take(T* t)
{
if (mRefCnt++ == 0) {
t->AddRef();
}
}
void Drop(T* t)
{
if (mRefCnt > 0) {
--mRefCnt;
if (mRefCnt == 0) {
t->Release();
}
}
}
void ForceDrop(T* t)
{
if (mRefCnt > 0) {
mRefCnt = 0;
t->Release();
}
}
operator bool() const { return mRefCnt > 0; }
private:
nsrefcnt mRefCnt;
};
/**
* The DOM object representing a Web Audio AudioNode.
*
@ -212,6 +174,14 @@ public:
{
return mInputNodes;
}
const nsTArray<nsRefPtr<AudioNode> >& OutputNodes() const
{
return mOutputNodes;
}
const nsTArray<nsRefPtr<AudioParam> >& OutputParams() const
{
return mOutputParams;
}
void RemoveOutputParam(AudioParam* aParam);

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

@ -14,22 +14,8 @@
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_CLASS(OscillatorNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(OscillatorNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPeriodicWave)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrequency)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDetune)
if (tmp->Context()) {
tmp->Context()->UnregisterOscillatorNode(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(OscillatorNode, AudioNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPeriodicWave)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrequency)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDetune)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(OscillatorNode, AudioNode,
mPeriodicWave, mFrequency, mDetune)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(OscillatorNode)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
@ -438,17 +424,17 @@ public:
return;
}
if (ticks + WEBAUDIO_BLOCK_SIZE < mStart) {
// We're not playing yet.
ComputeSilence(aOutput);
return;
}
if (ticks >= mStop) {
// We've finished playing.
ComputeSilence(aOutput);
*aFinished = true;
return;
}
if (ticks + WEBAUDIO_BLOCK_SIZE < mStart) {
// We're not playing yet.
ComputeSilence(aOutput);
return;
}
AllocateAudioBlock(1, aOutput);
float* output = static_cast<float*>(
@ -520,13 +506,11 @@ OscillatorNode::OscillatorNode(AudioContext* aContext)
OscillatorNodeEngine* engine = new OscillatorNodeEngine(this, aContext->Destination());
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
mStream->AddMainThreadListener(this);
}
OscillatorNode::~OscillatorNode()
{
if (Context()) {
Context()->UnregisterOscillatorNode(this);
}
}
JSObject*
@ -598,8 +582,7 @@ OscillatorNode::Start(double aWhen, ErrorResult& aRv)
Context()->DestinationStream(),
aWhen);
MOZ_ASSERT(!mPlayingRef, "We can only accept a successful start() call once");
mPlayingRef.Take(this);
MarkActive();
}
void
@ -615,8 +598,6 @@ OscillatorNode::Stop(double aWhen, ErrorResult& aRv)
return;
}
mPlayingRef.Drop(this);
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
if (!ns || !Context()) {
// We've already stopped and had our stream shut down
@ -660,7 +641,7 @@ OscillatorNode::NotifyMainThreadStateChanged()
// Drop the playing reference
// Warning: The below line might delete this.
mPlayingRef.Drop(this);
MarkInactive();
}
}

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

@ -129,7 +129,6 @@ private:
nsRefPtr<PeriodicWave> mPeriodicWave;
nsRefPtr<AudioParam> mFrequency;
nsRefPtr<AudioParam> mDetune;
SelfReference<OscillatorNode> mPlayingRef;
bool mStartCalled;
bool mStopped;
};

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

@ -24,22 +24,7 @@ namespace dom {
// buffers.
static const float MAX_LATENCY_S = 0.5;
NS_IMPL_CYCLE_COLLECTION_CLASS(ScriptProcessorNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ScriptProcessorNode)
if (tmp->Context()) {
tmp->Context()->UnregisterScriptProcessorNode(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ScriptProcessorNode, AudioNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ScriptProcessorNode)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(ScriptProcessorNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(ScriptProcessorNode, AudioNode)
NS_IMPL_ISUPPORTS_INHERITED0(ScriptProcessorNode, AudioNode)
// This class manages a queue of output buffers shared between
// the main thread and the Media Stream Graph thread.
@ -424,9 +409,6 @@ ScriptProcessorNode::ScriptProcessorNode(AudioContext* aContext,
ScriptProcessorNode::~ScriptProcessorNode()
{
if (Context()) {
Context()->UnregisterScriptProcessorNode(this);
}
}
JSObject*

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

@ -26,7 +26,6 @@ public:
virtual ~ScriptProcessorNode();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ScriptProcessorNode, AudioNode)
IMPL_EVENT_HANDLER(audioprocess)
@ -38,7 +37,7 @@ public:
{
AudioNode::Connect(aDestination, aOutput, aInput, aRv);
if (!aRv.Failed()) {
mPlayingRef.Take(this);
MarkActive();
}
}
@ -47,15 +46,15 @@ public:
{
AudioNode::Connect(aDestination, aOutput, aRv);
if (!aRv.Failed()) {
mPlayingRef.Take(this);
MarkActive();
}
}
virtual void Disconnect(uint32_t aOutput, ErrorResult& aRv) MOZ_OVERRIDE
{
AudioNode::Disconnect(aOutput, aRv);
if (!aRv.Failed()) {
mPlayingRef.Drop(this);
if (!aRv.Failed() && OutputNodes().IsEmpty() && OutputParams().IsEmpty()) {
MarkInactive();
}
}
@ -91,16 +90,10 @@ public:
using nsDOMEventTargetHelper::DispatchTrustedEvent;
void Stop()
{
mPlayingRef.ForceDrop(this);
}
private:
nsAutoPtr<SharedBuffers> mSharedBuffers;
const uint32_t mBufferSize;
const uint32_t mNumberOfOutputChannels;
SelfCountedReference<ScriptProcessorNode> mPlayingRef; // a reference to self while planing
};
}

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

@ -75,6 +75,7 @@ MOCHITEST_FILES := \
test_offlineDestinationChannelCountLess.html \
test_offlineDestinationChannelCountMore.html \
test_oscillatorNode.html \
test_oscillatorNode2.html \
test_oscillatorNodeStart.html \
test_pannerNode.html \
test_pannerNodeAbove.html \

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

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test OscillatorNode lifetime and sine phase</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">
const signalLength = 2048;
function createOscillator(context) {
var osc = context.createOscillator();
osc.start(0);
osc.stop(signalLength/context.sampleRate);
return osc;
}
function connectUnreferencedOscillator(context, destination) {
var osc = createOscillator(context);
osc.connect(destination);
}
var gTest = {
length: signalLength,
numberOfChannels: 1,
createGraph: function(context) {
var blend = context.createGain();
connectUnreferencedOscillator(context, blend);
// Test that the unreferenced oscillator remains alive until it has finished.
SpecialPowers.forceGC();
SpecialPowers.forceCC();
// Create another sine wave oscillator in negative time, which should
// cancel when mixed with the unreferenced oscillator.
var oscillator = createOscillator(context);
oscillator.frequency.value = -440;
oscillator.connect(blend);
return blend;
},
};
runTest();
</script>
</pre>
</body>
</html>

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