--- a/accessible/jsat/EventManager.jsm
+++ b/accessible/jsat/EventManager.jsm
@@ -181,16 +181,24 @@ this.EventManager.prototype = {
} else if (state.contains(States.SELECTED)) {
this.present(
Presentation.
actionInvoked(aEvent.accessible,
event.isEnabled ? 'select' : 'unselect'));
}
break;
}
+ case Events.NAME_CHANGE:
+ {
+ let acc = aEvent.accessible;
+ if (acc === this.contentControl.vc.position) {
+ this.present(Presentation.nameChanged(acc));
+ }
+ break;
+ }
case Events.SCROLLING_START:
{
this.contentControl.autoMove(aEvent.accessible);
break;
}
case Events.TEXT_CARET_MOVED:
{
let acc = aEvent.accessible.QueryInterface(Ci.nsIAccessibleText);
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -70,16 +70,22 @@ Presenter.prototype = {
/**
* Selection has changed. TODO.
* @param {nsIAccessible} aObject the object that has been selected.
*/
selectionChanged: function selectionChanged(aObject) {}, // jshint ignore:line
/**
+ * Name has changed.
+ * @param {nsIAccessible} aAccessible the object whose value has changed.
+ */
+ nameChanged: function nameChanged(aAccessible) {}, // jshint ignore: line
+
+ /**
* Value has changed.
* @param {nsIAccessible} aAccessible the object whose value has changed.
*/
valueChanged: function valueChanged(aAccessible) {}, // jshint ignore:line
/**
* The tab, or the tab's document state has changed.
* @param {nsIAccessible} aDocObj the tab document accessible that has had its
@@ -509,16 +515,27 @@ B2GPresenter.prototype.pivotChanged =
reason: this.pivotChangedReasons[aReason],
isUserInput: aIsUserInput,
hints: aContext.interactionHints
}
}
};
};
+B2GPresenter.prototype.nameChanged =
+ function B2GPresenter_nameChanged(aAccessible) {
+ return {
+ type: this.type,
+ details: {
+ eventType: 'name-change',
+ data: aAccessible.name
+ }
+ };
+ };
+
B2GPresenter.prototype.valueChanged =
function B2GPresenter_valueChanged(aAccessible) {
// the editable value changes are handled in the text changed presenter
if (Utils.getState(aAccessible).contains(States.EDITABLE)) {
return null;
}
@@ -684,16 +701,20 @@ this.Presentation = { // jshint ignore:l
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd,
aOldStart, aOldEnd,
aIsFromUserInput) {
return [p.textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd, // jshint ignore:line
aIsFromUserInput) for each (p in this.presenters)]; // jshint ignore:line
},
+ nameChanged: function nameChanged(aAccessible) {
+ return [ p.nameChanged(aAccessible) for (p of this.presenters) ]; // jshint ignore:line
+ },
+
valueChanged: function valueChanged(aAccessible) {
return [ p.valueChanged(aAccessible) for (p of this.presenters) ]; // jshint ignore:line
},
tabStateChanged: function Presentation_tabStateChanged(aDocObj, aPageState) {
return [p.tabStateChanged(aDocObj, aPageState) // jshint ignore:line
for each (p in this.presenters)]; // jshint ignore:line
},
--- a/accessible/tests/mochitest/jsat/doc_content_integration.html
+++ b/accessible/tests/mochitest/jsat/doc_content_integration.html
@@ -35,16 +35,20 @@
function ariaShowIframe() {
document.getElementById('iframe').setAttribute('aria-hidden', false);
}
function ariaHideIframe() {
document.getElementById('iframe').setAttribute('aria-hidden', true);
}
+ function renameFruit() {
+ document.getElementById('fruit').setAttribute('aria-label', 'banana');
+ }
+
</script>
<style>
#windows {
position: relative;
width: 320px;
height: 480px;
}
@@ -79,10 +83,11 @@
<h1>This is an alert!</h1>
<p>Do you agree?</p>
<button onclick="setTimeout(hideAlert, 500)">Yes</button>
<button onclick="hideAlert()">No</button>
</div>
<div id="appframe"></div>
</div>
<button id="home">Home</button>
+ <button id="fruit" aria-label="apple"></button>
</body>
</html>
--- a/accessible/tests/mochitest/jsat/jsatcommon.js
+++ b/accessible/tests/mochitest/jsat/jsatcommon.js
@@ -612,16 +612,25 @@ function ExpectedCheckAction(aChecked, a
}, [{
eventType: AndroidEvent.VIEW_CLICKED,
checked: aChecked
}], aOptions);
}
ExpectedCheckAction.prototype = Object.create(ExpectedPresent.prototype);
+function ExpectedNameChange(aName, aOptions) {
+ ExpectedPresent.call(this, {
+ eventType: 'name-change',
+ data: aName
+ }, null, aOptions);
+}
+
+ExpectedNameChange.prototype = Object.create(ExpectedPresent.prototype);
+
function ExpectedValueChange(aValue, aOptions) {
ExpectedPresent.call(this, {
eventType: 'value-change',
data: [aValue]
}, null, aOptions);
}
ExpectedValueChange.prototype = Object.create(ExpectedPresent.prototype);
--- a/accessible/tests/mochitest/jsat/test_content_integration.html
+++ b/accessible/tests/mochitest/jsat/test_content_integration.html
@@ -51,19 +51,23 @@
new ExpectedCheckAction(true, { android_todo: true })],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', {'string': 'label'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])],
[ContentMessages.moveOrAdjustUp(), new ExpectedValueChange('6')],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
+ [ContentMessages.simpleMoveNext,
+ new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
// Simple traversal backward
[ContentMessages.simpleMovePrevious,
+ new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
+ [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', '6', {'string': 'slider'}, 'such app'])],
[ContentMessages.moveOrAdjustDown(), new ExpectedValueChange('5')],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', {'string': 'label'}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['many option', {'string': 'stateChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
@@ -83,17 +87,17 @@
// Moving to the absolute last item from an embedded document
// fails. Bug 972035.
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(
['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
// Move from an inner frame to the last element in the parent doc
[ContentMessages.simpleMoveLast,
new ExpectedCursorChange(
- ['Home', {'string': 'pushbutton'}], { b2g_todo: true })],
+ ['apple', {'string': 'pushbutton'}], { b2g_todo: true })],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
[ContentMessages.moveOrAdjustDown('FormElement'),
new ExpectedCursorChange(['Back', {"string": "pushbutton"}])],
[ContentMessages.moveOrAdjustDown('FormElement'),
@@ -131,16 +135,27 @@
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
[ContentMessages.simpleMoveFirst,
new ExpectedCursorChange(['Phone status bar'], { b2g_todo: true })],
// Reset cursors
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
+ // Current virtual cursor's position's name changes
+ [ContentMessages.simpleMoveNext,
+ new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+ [ContentMessages.focusSelector('button#fruit', false),
+ new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
+ [doc.defaultView.renameFruit, new ExpectedNameChange('banana')],
+
+ // Blur button and reset cursor
+ [ContentMessages.focusSelector('button#fruit', true), null],
+ [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
+
// Move cursor with focus in outside document
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
[ContentMessages.focusSelector('button#home', false),
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
@@ -202,24 +217,24 @@
new ExpectedCursorChange(
["wow", {"string": "headingLevel","args": [1]}, "such app"])],
[doc.defaultView.ariaShowBack],
[ContentMessages.focusSelector('button#back', true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog in outer doc, while cursor is also in outer doc
[ContentMessages.simpleMoveLast,
- new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
+ new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])],
[doc.defaultView.showAlert,
new ExpectedCursorChange(['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}])],
[doc.defaultView.hideAlert,
- new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
+ new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog in outer doc, while cursor is in inner frame
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
@@ -248,16 +263,18 @@
new ExpectedCursorChange(['This is an alert!',
{'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])],
[function hideAlertAndFocusHomeButton() {
doc.defaultView.hideAlert();
doc.querySelector('button#home').focus();
}, new ExpectedCursorChange(['Home', {'string': 'pushbutton'},
'Traversal Rule test document'])],
+ [ContentMessages.simpleMoveNext,
+ new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])]
[ContentMessages.simpleMoveNext, new ExpectedNoMove()]
]);
addA11yLoadEvent(function() {
contentTest.start(function () {
closeBrowserWindow();
SimpleTest.finish();
});
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1751,16 +1751,22 @@ pref("identity.fxaccounts.remote.force_a
// The remote content URL shown for signin in. Must use HTTPS.
pref("identity.fxaccounts.remote.signin.uri", "https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v1");
// The URL we take the user to when they opt to "manage" their Firefox Account.
// Note that this will always need to be in the same TLD as the
// "identity.fxaccounts.remote.signup.uri" pref.
pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings");
+// The remote URL of the FxA Profile Server
+pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1");
+
+// The remote URL of the FxA OAuth Server
+pref("identity.fxaccounts.remote.oauth.uri", "https://oauth.accounts.firefox.com/v1");
+
// Migrate any existing Firefox Account data from the default profile to the
// Developer Edition profile.
#ifdef MOZ_DEV_EDITION
pref("identity.fxaccounts.migrateToDevEdition", true);
#else
pref("identity.fxaccounts.migrateToDevEdition", false);
#endif
--- a/browser/base/content/test/general/accounts_testRemoteCommands.html
+++ b/browser/base/content/test/general/accounts_testRemoteCommands.html
@@ -56,22 +56,24 @@ function doTest(evt) {
if (tests[++currentTest])
sendToBrowser(tests[currentTest].event, tests[currentTest].data);
else
reportFinished();
}
function reportResult(info, pass, error) {
let data = {type: "testResult", info: info, pass: pass, error: error};
- window.parent.postMessage(data, "*");
+ let event = new CustomEvent("FirefoxAccountsTestResponse", {detail: {data: data}, bubbles: true});
+ document.dispatchEvent(event);
}
function reportFinished(cmd) {
let data = {type: "testsComplete", count: tests.length};
- window.parent.postMessage(data, "*");
+ let event = new CustomEvent("FirefoxAccountsTestResponse", {detail: {data: data}, bubbles: true});
+ document.dispatchEvent(event);
}
function sendToBrowser(type, data) {
let event = new CustomEvent("FirefoxAccountsCommand", {detail: {command: type, data: data}, bubbles: true});
document.dispatchEvent(event);
}
</script>
--- a/browser/base/content/test/general/browser_aboutAccounts.js
+++ b/browser/base/content/test/general/browser_aboutAccounts.js
@@ -40,36 +40,34 @@ let gTests = [
teardown: function* () {
gBrowser.removeCurrentTab();
yield fxAccounts.signOut();
},
run: function* ()
{
setPref("identity.fxaccounts.remote.signup.uri",
"https://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html");
- yield promiseNewTabLoadEvent("about:accounts");
+ let tab = yield promiseNewTabLoadEvent("about:accounts");
+ let mm = tab.linkedBrowser.messageManager;
let deferred = Promise.defer();
let results = 0;
try {
- let win = gBrowser.contentWindow;
- win.addEventListener("message", function testLoad(e) {
- if (e.data.type == "testResult") {
- ok(e.data.pass, e.data.info);
+ mm.addMessageListener("test:response", function responseHandler(msg) {
+ let data = msg.data.data;
+ if (data.type == "testResult") {
+ ok(data.pass, data.info);
results++;
- }
- else if (e.data.type == "testsComplete") {
- is(results, e.data.count, "Checking number of results received matches the number of tests that should have run");
- win.removeEventListener("message", testLoad, false, true);
+ } else if (data.type == "testsComplete") {
+ is(results, data.count, "Checking number of results received matches the number of tests that should have run");
+ mm.removeMessageListener("test:response", responseHandler);
deferred.resolve();
}
-
- }, false, true);
-
+ });
} catch(e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
yield deferred.promise;
}
},
{
--- a/browser/base/content/test/general/browser_aboutHealthReport.js
+++ b/browser/base/content/test/general/browser_aboutHealthReport.js
@@ -24,40 +24,39 @@ let gTests = [
{
desc: "Test the remote commands",
setup: function ()
{
Services.prefs.setCharPref("datareporting.healthreport.about.reportUrl",
"https://example.com/browser/browser/base/content/test/general/healthreport_testRemoteCommands.html");
},
- run: function ()
+ run: function (iframe)
{
let deferred = Promise.defer();
let policy = Cc["@mozilla.org/datareporting/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject
.policy;
let results = 0;
try {
- let win = gBrowser.contentWindow;
- win.addEventListener("message", function testLoad(e) {
- if (e.data.type == "testResult") {
- ok(e.data.pass, e.data.info);
+ iframe.contentWindow.addEventListener("FirefoxHealthReportTestResponse", function evtHandler(event) {
+ let data = event.detail.data;
+ if (data.type == "testResult") {
+ ok(data.pass, data.info);
results++;
}
- else if (e.data.type == "testsComplete") {
- is(results, e.data.count, "Checking number of results received matches the number of tests that should have run");
- win.removeEventListener("message", testLoad, false, true);
+ else if (data.type == "testsComplete") {
+ is(results, data.count, "Checking number of results received matches the number of tests that should have run");
+ iframe.contentWindow.removeEventListener("FirefoxHealthReportTestResponse", evtHandler, true);
deferred.resolve();
}
-
- }, false, true);
+ }, true);
} catch(e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
return deferred.promise;
}
},
@@ -72,34 +71,38 @@ function test()
// xxxmpc leaving this here until we resolve bug 854038 and bug 854060
requestLongerTimeout(10);
Task.spawn(function () {
for (let test of gTests) {
info(test.desc);
test.setup();
- yield promiseNewTabLoadEvent("about:healthreport");
+ let iframe = yield promiseNewTabLoadEvent("about:healthreport");
- yield test.run();
+ yield test.run(iframe);
gBrowser.removeCurrentTab();
}
finish();
});
}
function promiseNewTabLoadEvent(aUrl, aEventType="load")
{
let deferred = Promise.defer();
let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
tab.linkedBrowser.addEventListener(aEventType, function load(event) {
tab.linkedBrowser.removeEventListener(aEventType, load, true);
let iframe = tab.linkedBrowser.contentDocument.getElementById("remote-report");
iframe.addEventListener("load", function frameLoad(e) {
+ if (iframe.contentWindow.location.href == "about:blank" ||
+ e.target != iframe) {
+ return;
+ }
iframe.removeEventListener("load", frameLoad, false);
- deferred.resolve();
+ deferred.resolve(iframe);
}, false);
}, true);
return deferred.promise;
}
--- a/browser/base/content/test/general/content_aboutAccounts.js
+++ b/browser/base/content/test/general/content_aboutAccounts.js
@@ -24,16 +24,21 @@ addEventListener("DOMContentLoaded", fun
}
iframe.addEventListener("load", function iframeLoaded(event) {
if (iframe.contentWindow.location.href == "about:blank" ||
event.target != iframe) {
return;
}
iframe.removeEventListener("load", iframeLoaded, true);
sendAsyncMessage("test:iframe:load", {url: iframe.getAttribute("src")});
+ // And an event listener for the test responses, which we send to the test
+ // via a message.
+ iframe.contentWindow.addEventListener("FirefoxAccountsTestResponse", function (event) {
+ sendAsyncMessage("test:response", {data: event.detail.data});
+ }, true);
}, true);
}, true);
// Return the visibility state of a list of ids.
addMessageListener("test:check-visibilities", function (message) {
let result = {};
for (let id of message.data.ids) {
let elt = content.document.getElementById(id);
--- a/browser/base/content/test/general/healthreport_testRemoteCommands.html
+++ b/browser/base/content/test/general/healthreport_testRemoteCommands.html
@@ -114,22 +114,24 @@ function doTest(evt) {
if (tests[++currentTest])
sendToBrowser(tests[currentTest].event);
else
reportFinished();
}
function reportResult(info, pass, error) {
var data = {type: "testResult", info: info, pass: pass, error: error};
- window.parent.postMessage(data, "*");
+ var event = new CustomEvent("FirefoxHealthReportTestResponse", {detail: {data: data}, bubbles: true});
+ document.dispatchEvent(event);
}
function reportFinished(cmd) {
var data = {type: "testsComplete", count: tests.length};
- window.parent.postMessage(data, "*");
+ var event = new CustomEvent("FirefoxHealthReportTestResponse", {detail: {data: data}, bubbles: true});
+ document.dispatchEvent(event);
}
function sendToBrowser(type) {
var event = new CustomEvent("RemoteHealthReportCommand", {detail: {command: type}, bubbles: true});
document.dispatchEvent(event);
}
</script>
--- a/browser/components/places/tests/browser/browser.ini
+++ b/browser/components/places/tests/browser/browser.ini
@@ -19,16 +19,17 @@ skip-if = e10s
[browser_423515.js]
[browser_410196_paste_into_tags.js]
skip-if = e10s # Bug ?????? - clipboard operations don't seem to work in this test?
[browser_sort_in_library.js]
[browser_library_open_leak.js]
[browser_library_panel_leak.js]
[browser_library_search.js]
[browser_history_sidebar_search.js]
+skip-if = e10s && (os == 'linux' || os == 'mac') # Bug 1116457
[browser_bookmarksProperties.js]
skip-if = e10s
[browser_forgetthissite_single.js]
# disabled for very frequent oranges - bug 551540
skip-if = true
[browser_library_commands.js]
--- a/browser/components/search/test/browser_bing.js
+++ b/browser/components/search/test/browser_bing.js
@@ -8,17 +8,17 @@
"use strict";
const BROWSER_SEARCH_PREF = "browser.search.";
function test() {
let engine = Services.search.getEngineByName("Bing");
ok(engine, "Bing");
- let base = "http://www.bing.com/search?q=foo&pc=MOZI";
+ let base = "https://www.bing.com/search?q=foo&pc=MOZI";
let url;
// Test search URLs (including purposes).
url = engine.getSubmission("foo").uri.spec;
is(url, base, "Check search URL for 'foo'");
url = engine.getSubmission("foo", null, "contextmenu").uri.spec;
is(url, base + "&form=MOZCON", "Check context menu search URL for 'foo'");
url = engine.getSubmission("foo", null, "keyword").uri.spec;
@@ -27,34 +27,34 @@ function test() {
is(url, base + "&form=MOZSBR", "Check search bar search URL for 'foo'");
url = engine.getSubmission("foo", null, "homepage").uri.spec;
is(url, base + "&form=MOZSPG", "Check homepage search URL for 'foo'");
url = engine.getSubmission("foo", null, "newtab").uri.spec;
is(url, base + "&form=MOZTSB", "Check newtab search URL for 'foo'");
// Check search suggestion URL.
url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
- is(url, "http://api.bing.com/osjson.aspx?query=foo&form=OSDJAS&language=" + getLocale(), "Check search suggestion URL for 'foo'");
+ is(url, "https://www.bing.com/osjson.aspx?query=foo&form=OSDJAS&language=" + getLocale(), "Check search suggestion URL for 'foo'");
// Check all other engine properties.
const EXPECTED_ENGINE = {
name: "Bing",
alias: null,
description: "Bing. Search by Microsoft.",
- searchForm: "http://www.bing.com/search?q=&pc=MOZI",
+ searchForm: "https://www.bing.com/search?q=&pc=MOZI",
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
hidden: false,
wrappedJSObject: {
queryCharset: "UTF-8",
"_iconURL": "data:image/x-icon;base64,AAABAAIAEBAAAAEACADaCwAAJgAAACAgAAABAAgAlAIAAAAMAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIAgAAAJCRaDYAAAAJcEhZcwAACxMAAAsTAQCanBgAAApPaUNDUFBob3Rvc2hvcCBJQ0MgcHJvZmlsZQAAeNqdU2dUU+kWPffe9EJLiICUS29SFQggUkKLgBSRJiohCRBKiCGh2RVRwRFFRQQbyKCIA46OgIwVUSwMigrYB+Qhoo6Do4iKyvvhe6Nr1rz35s3+tdc+56zznbPPB8AIDJZIM1E1gAypQh4R4IPHxMbh5C5AgQokcAAQCLNkIXP9IwEA+H48PCsiwAe+AAF40wsIAMBNm8AwHIf/D+pCmVwBgIQBwHSROEsIgBQAQHqOQqYAQEYBgJ2YJlMAoAQAYMtjYuMAUC0AYCd/5tMAgJ34mXsBAFuUIRUBoJEAIBNliEQAaDsArM9WikUAWDAAFGZLxDkA2C0AMElXZkgAsLcAwM4QC7IACAwAMFGIhSkABHsAYMgjI3gAhJkAFEbyVzzxK64Q5yoAAHiZsjy5JDlFgVsILXEHV1cuHijOSRcrFDZhAmGaQC7CeZkZMoE0D+DzzAAAoJEVEeCD8/14zg6uzs42jrYOXy3qvwb/ImJi4/7lz6twQAAA4XR+0f4sL7MagDsGgG3+oiXuBGheC6B194tmsg9AtQCg6dpX83D4fjw8RaGQudnZ5eTk2ErEQlthyld9/mfCX8BX/Wz5fjz89/XgvuIkgTJdgUcE+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91+sC09o//7LJMn/NdXmkqHsSyzeQ0t8j9/znn8s7ql9Dy34cWogIbUSCQADAJ+jWQrH9LCsAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAACW0lEQVR4nGP8v5OBpoCJtsbTwQIWTKGUxe5mCi9M5V/oSL9mZf5HoQWMmHEQOD0AwuBg/WMo+8pB/ZGZwguyLcDiAzj48Zvl+D2pTz/YKLGAcBxcfSZCtulEWUAhGDQW3HstcOOF8P//jKRagC+SkQE/58/0pa7c7L9N5V+aKTw3kH3FxvKXmhYI83y3VXl64Jbs3htye2/IsbH8NZB9Zabw3FT+JR/nTypYwMDAEGBw+8AtWQj71x/mU/clT92XZGT8ry7+zlzxhbnic0n+LxRZIC/8yUju5blH4siC//8z3nghfOOF8MLj2jKCnydH7EXTRVoqCjC4g0f2yXteTEHSLNCVft0WcNhM4QXxiYmEIIIATcm3mpJvn37gmX7Q8OozYYLqycloTz/wLDulRYzpDMT4QFf6NZz95gvnyjMa+27I/SM6xxGwQJj7R6rtJQYGhk8/2NaeU9t+RfH3X2ZcihWEP5Fmgazg53qfY9zsv1ed0dh4UeXbL5yKudl/R5tdd9O6T4IFGhJvyz1OHbkts/qc2qfv7LiUMTIwOGk8irW4yo8jP2O3wEzxubHcy7I1Dq+/cOIymoGBQVn0Q5rtRTXx93jUYLFAX+b1sw88p+5L4tHGy/Er2uy6m9YDRsb/eJRht8BS+emCY7q4NDAyMLhpPYixuMbD/gu/0VD1WBtezz7w9O81vvNKEE1cTfxdmu0lZdEPxBiNzwIGBoa//xhXndFYfU4NUsnwcf6Ms7jmpPGQ1BoHpwUQcOOF0OT9RoayryJNr3Oz/ybRcCIsoBwMmkp/8FoAADmgy6ulKggYAAAAAElFTkSuQmCC",
_urls : [
{
type: "application/x-suggestions+json",
method: "GET",
- template: "http://api.bing.com/osjson.aspx",
+ template: "https://www.bing.com/osjson.aspx",
params: [
{
name: "query",
value: "{searchTerms}",
purpose: undefined,
},
{
name: "form",
@@ -66,17 +66,17 @@ function test() {
value: "{moz:locale}",
purpose: undefined,
},
],
},
{
type: "text/html",
method: "GET",
- template: "http://www.bing.com/search",
+ template: "https://www.bing.com/search",
params: [
{
name: "q",
value: "{searchTerms}",
purpose: undefined,
},
{
name: "pc",
--- a/browser/components/search/test/browser_bing_behavior.js
+++ b/browser/components/search/test/browser_bing_behavior.js
@@ -13,17 +13,17 @@ const BROWSER_SEARCH_PREF = "browser.sea
function test() {
let engine = Services.search.getEngineByName("Bing");
ok(engine, "Bing is installed");
let previouslySelectedEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
engine.alias = "b";
- let base = "http://www.bing.com/search?q=foo&pc=MOZI";
+ let base = "https://www.bing.com/search?q=foo&pc=MOZI";
let url;
// Test search URLs (including purposes).
url = engine.getSubmission("foo").uri.spec;
is(url, base, "Check search URL for 'foo'");
waitForExplicitFinish();
--- a/browser/components/search/test/browser_yahoo.js
+++ b/browser/components/search/test/browser_yahoo.js
@@ -8,33 +8,33 @@
"use strict";
const BROWSER_SEARCH_PREF = "browser.search.";
function test() {
let engine = Services.search.getEngineByName("Yahoo");
ok(engine, "Yahoo");
- let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla&hsimp=yhs-001";
+ let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla";
let url;
// Test search URLs (including purposes).
url = engine.getSubmission("foo").uri.spec;
is(url, base, "Check search URL for 'foo'");
// Check search suggestion URL.
url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
is(url, "https://search.yahoo.com/sugg/ff?output=fxjson&appid=ffd&command=foo", "Check search suggestion URL for 'foo'");
// Check all other engine properties.
const EXPECTED_ENGINE = {
name: "Yahoo",
alias: null,
description: "Yahoo Search",
- searchForm: "https://search.yahoo.com/yhs/search?p=&ei=UTF-8&hspart=mozilla&hsimp=yhs-001",
+ searchForm: "https://search.yahoo.com/yhs/search?p=&ei=UTF-8&hspart=mozilla",
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
hidden: false,
wrappedJSObject: {
queryCharset: "UTF-8",
"_iconURL": "data:image/x-icon;base64,AAABAAIAEBAAAAEACAA8DQAAJgAAACAgAAABAAgAowsAAGINAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAAJcEhZcwAACxMAAAsTAQCanBgAAApPaUNDUFBob3Rvc2hvcCBJQ0MgcHJvZmlsZQAAeNqdU2dUU+kWPffe9EJLiICUS29SFQggUkKLgBSRJiohCRBKiCGh2RVRwRFFRQQbyKCIA46OgIwVUSwMigrYB+Qhoo6Do4iKyvvhe6Nr1rz35s3+tdc+56zznbPPB8AIDJZIM1E1gAypQh4R4IPHxMbh5C5AgQokcAAQCLNkIXP9IwEA+H48PCsiwAe+AAF40wsIAMBNm8AwHIf/D+pCmVwBgIQBwHSROEsIgBQAQHqOQqYAQEYBgJ2YJlMAoAQAYMtjYuMAUC0AYCd/5tMAgJ34mXsBAFuUIRUBoJEAIBNliEQAaDsArM9WikUAWDAAFGZLxDkA2C0AMElXZkgAsLcAwM4QC7IACAwAMFGIhSkABHsAYMgjI3gAhJkAFEbyVzzxK64Q5yoAAHiZsjy5JDlFgVsILXEHV1cuHijOSRcrFDZhAmGaQC7CeZkZMoE0D+DzzAAAoJEVEeCD8/14zg6uzs42jrYOXy3qvwb/ImJi4/7lz6twQAAA4XR+0f4sL7MagDsGgG3+oiXuBGheC6B194tmsg9AtQCg6dpX83D4fjw8RaGQudnZ5eTk2ErEQlthyld9/mfCX8BX/Wz5fjz89/XgvuIkgTJdgUcE+ODCzPRMpRzPkgmEYtzmj0f8twv//B3TIsRJYrlYKhTjURJxjkSajPMypSKJQpIpxSXS/2Ti3yz7Az7fNQCwaj4Be5EtqF1jA/ZLJxBYdMDi9wAA8rtvwdQoCAOAaIPhz3f/7z/9R6AlAIBmSZJxAABeRCQuVMqzP8cIAABEoIEqsEEb9MEYLMAGHMEF3MEL/GA2hEIkxM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KdTs/AvvCmqXE235jAAAAAElFTkSuQmCC",
_urls : [
{
type: "application/x-suggestions+json",
@@ -76,17 +76,37 @@ function test() {
{
name: "hspart",
value: "mozilla",
purpose: undefined,
},
{
name: "hsimp",
value: "yhs-001",
- purpose: undefined,
+ purpose: "searchbar",
+ },
+ {
+ name: "hsimp",
+ value: "yhs-002",
+ purpose: "keyword",
+ },
+ {
+ name: "hsimp",
+ value: "yhs-003",
+ purpose: "homepage",
+ },
+ {
+ name: "hsimp",
+ value: "yhs-004",
+ purpose: "newtab",
+ },
+ {
+ name: "hsimp",
+ value: "yhs-005",
+ purpose: "contextmenu",
},
],
mozparams: {},
},
],
},
};
--- a/browser/components/search/test/browser_yahoo_behavior.js
+++ b/browser/components/search/test/browser_yahoo_behavior.js
@@ -13,70 +13,70 @@ const BROWSER_SEARCH_PREF = "browser.sea
function test() {
let engine = Services.search.getEngineByName("Yahoo");
ok(engine, "Yahoo is installed");
let previouslySelectedEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
engine.alias = "y";
- let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla&hsimp=yhs-001";
+ let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla";
let url;
// Test search URLs (including purposes).
url = engine.getSubmission("foo").uri.spec;
is(url, base, "Check search URL for 'foo'");
waitForExplicitFinish();
var gCurrTest;
var gTests = [
{
name: "context menu search",
- searchURL: base,
+ searchURL: base + "&hsimp=yhs-005",
run: function () {
// Simulate a contextmenu search
// FIXME: This is a bit "low-level"...
BrowserSearch.loadSearch("foo", false, "contextmenu");
}
},
{
name: "keyword search",
- searchURL: base,
+ searchURL: base + "&hsimp=yhs-002",
run: function () {
gURLBar.value = "? foo";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
}
},
{
- name: "keyword search",
- searchURL: base,
+ name: "keyword search with alias",
+ searchURL: base + "&hsimp=yhs-002",
run: function () {
gURLBar.value = "y foo";
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
}
},
{
name: "search bar search",
- searchURL: base,
+ searchURL: base + "&hsimp=yhs-001",
run: function () {
let sb = BrowserSearch.searchBar;
sb.focus();
sb.value = "foo";
registerCleanupFunction(function () {
sb.value = "";
});
EventUtils.synthesizeKey("VK_RETURN", {});
}
},
{
name: "new tab search",
- searchURL: base,
+ searchURL: base + "&hsimp=yhs-004",
run: function () {
function doSearch(doc) {
// Re-add the listener, and perform a search
gBrowser.addProgressListener(listener);
doc.getElementById("newtab-search-text").value = "foo";
doc.getElementById("newtab-search-submit").click();
}
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -535,17 +535,17 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_variables-view-popup-11.js]
skip-if = e10s && debug
[browser_dbg_variables-view-popup-12.js]
skip-if = e10s && debug
[browser_dbg_variables-view-popup-13.js]
skip-if = e10s && debug
[browser_dbg_variables-view-popup-14.js]
-skip-if = (e10s && debug) || (e10s && os == 'linux') # Linux e10s - bug 1029545
+skip-if = true # Bug 1029545
[browser_dbg_variables-view-popup-15.js]
skip-if = e10s && debug
[browser_dbg_variables-view-popup-16.js]
skip-if = e10s && debug
[browser_dbg_variables-view-reexpand-01.js]
skip-if = e10s && debug
[browser_dbg_variables-view-reexpand-02.js]
skip-if = e10s && debug
--- a/browser/locales/en-US/searchplugins/bing.xml
+++ b/browser/locales/en-US/searchplugins/bing.xml
@@ -4,22 +4,22 @@
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Bing</ShortName>
<Description>Bing. Search by Microsoft.</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAEACADaCwAAJgAAACAgAAABAAgAlAIAAAAMAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIAgAAAJCRaDYAAAAJcEhZcwAACxMAAAsTAQCanBgAAApPaUNDUFBob3Rvc2hv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fx620Sbh95VTvGObsLr0s/p5dIeKX+UqXXS+6iOphVm0EFDwcRW5dQWhCEERZyZuSEKgZlwiYWP+YxEEtVD7qYzhRm0L8n9S43IojJt4uGYjxB6FM1qooLbMk4GVGMdpiDEkJ5BYSig6syjIIQFmIHnlb+ce2Wx2QhpYzWFeM+Z9IHa0G84xoTRZvZFiYf7l7BTY7Nqr4c2fiKPYZpTd8Sjo11AP6cjtQQ0w1/KWexawgnullA6hCrmcnZAyxAHZTpVV6GyiAow6WOlc0WQ1EdDFIKNNAMDrBBEDno9wxYIwuvK+afzVgb4I6X0Mdqr5FW4FtWPW4zkU17Mdq2nB/1SAD8yjYmn0ba/I4lMI9wEPqnjkqC4inGoXyARdINyUp2/2v6uNpyv4ifITMB5Rla4oRFxHE7Pzs42G2OXEbZOtabHmwxIBKH24FblvxzMoup4jezAELGU4eZhRg2NGEWg4nmqqlglVhRzGBE1JPqRO4Vvqvhr3dg6NVxVfZ+iReXVPApmGhjnUc2M0rwsfueWFUbZwCVsl3TRaQrVyXwXM3C18DYrBDUKqPgDLufhCDbj7DeFANoCu6HaKa2O00upGrZpI9X6JDXERKoii5rHDg54b44RtsZhLUVPayNZhmTab8pZf5jKzxWQZv8rHwvgfwEGAFtXxJ2uv6OVAAAAAElFTkSuQmCC</Image>
- <Url type="application/x-suggestions+json" template="http://api.bing.com/osjson.aspx">
+ <Url type="application/x-suggestions+json" template="https://www.bing.com/osjson.aspx">
<Param name="query" value="{searchTerms}"/>
<Param name="form" value="OSDJAS"/>
<Param name="language" value="{moz:locale}"/>
</Url>
- <Url type="text/html" method="GET" template="http://www.bing.com/search" rel="searchform">
+ <Url type="text/html" method="GET" template="https://www.bing.com/search" rel="searchform">
<Param name="q" value="{searchTerms}"/>
<Param name="pc" value="MOZI"/>
<MozParam name="form" condition="purpose" purpose="contextmenu" value="MOZCON"/>
<MozParam name="form" condition="purpose" purpose="searchbar" value="MOZSBR"/>
<MozParam name="form" condition="purpose" purpose="homepage" value="MOZSPG"/>
<MozParam name="form" condition="purpose" purpose="keyword" value="MOZLBR"/>
<MozParam name="form" condition="purpose" purpose="newtab" value="MOZTSB"/>
</Url>
--- a/browser/locales/en-US/searchplugins/yahoo.xml
+++ b/browser/locales/en-US/searchplugins/yahoo.xml
@@ -15,11 +15,15 @@
<Param name="appid" value="ffd" />
<Param name="command" value="{searchTerms}" />
</Url>
<Url type="text/html" method="GET" template="https://search.yahoo.com/yhs/search"
resultdomain="yahoo.com" rel="searchform">
<Param name="p" value="{searchTerms}"/>
<Param name="ei" value="UTF-8"/>
<Param name="hspart" value="mozilla"/>
- <Param name="hsimp" value="yhs-001"/>
+ <MozParam name="hsimp" condition="purpose" purpose="searchbar" value="yhs-001"/>
+ <MozParam name="hsimp" condition="purpose" purpose="keyword" value="yhs-002"/>
+ <MozParam name="hsimp" condition="purpose" purpose="homepage" value="yhs-003"/>
+ <MozParam name="hsimp" condition="purpose" purpose="newtab" value="yhs-004"/>
+ <MozParam name="hsimp" condition="purpose" purpose="contextmenu" value="yhs-005"/>
</Url>
</SearchPlugin>
--- a/chrome/nsChromeRegistryContent.cpp
+++ b/chrome/nsChromeRegistryContent.cpp
@@ -17,18 +17,18 @@ nsChromeRegistryContent::nsChromeRegistr
void
nsChromeRegistryContent::RegisterRemoteChrome(
const InfallibleTArray<ChromePackage>& aPackages,
const InfallibleTArray<ResourceMapping>& aResources,
const InfallibleTArray<OverrideMapping>& aOverrides,
const nsACString& aLocale,
bool aReset)
{
- NS_ABORT_IF_FALSE(aReset || mLocale.IsEmpty(),
- "RegisterChrome twice?");
+ MOZ_ASSERT(aReset || mLocale.IsEmpty(),
+ "RegisterChrome twice?");
if (aReset) {
mPackagesHash.Clear();
mOverrideTable.Clear();
// XXX Can't clear resources.
}
for (uint32_t i = aPackages.Length(); i > 0; ) {
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -22,17 +22,17 @@ ComputedTimingFunction::Init(const nsTim
} else {
mSteps = aFunction.mSteps;
}
}
static inline double
StepEnd(uint32_t aSteps, double aPortion)
{
- NS_ABORT_IF_FALSE(0.0 <= aPortion && aPortion <= 1.0, "out of range");
+ MOZ_ASSERT(0.0 <= aPortion && aPortion <= 1.0, "out of range");
uint32_t step = uint32_t(aPortion * aSteps); // floor
return double(step) / double(aSteps);
}
double
ComputedTimingFunction::GetValue(double aPortion) const
{
switch (mType) {
@@ -42,17 +42,17 @@ ComputedTimingFunction::GetValue(double
// There are diagrams in the spec that seem to suggest this check
// and the bounds point should not be symmetric with StepEnd, but
// should actually step up at rather than immediately after the
// fraction points. However, we rely on rounding negative values
// up to zero, so we can't do that. And it's not clear the spec
// really meant it.
return 1.0 - StepEnd(mSteps, 1.0 - aPortion);
default:
- NS_ABORT_IF_FALSE(false, "bad type");
+ MOZ_ASSERT(false, "bad type");
// fall through
case nsTimingFunction::StepEnd:
return StepEnd(mSteps, aPortion);
}
}
// In the Web Animations model, the time fraction can be outside the range
// [0.0, 1.0] but it shouldn't be Infinity.
--- a/dom/archivereader/ArchiveRequest.cpp
+++ b/dom/archivereader/ArchiveRequest.cpp
@@ -37,17 +37,17 @@ protected:
private: //data
nsRefPtr<ArchiveRequest> mRequest;
};
NS_IMETHODIMP
ArchiveRequestEvent::Run()
{
- NS_ABORT_IF_FALSE(mRequest, "the request is not longer valid");
+ MOZ_ASSERT(mRequest, "the request is not longer valid");
mRequest->Run();
return NS_OK;
}
// ArchiveRequest
ArchiveRequest::ArchiveRequest(nsPIDOMWindow* aWindow,
ArchiveReader* aReader)
--- a/dom/base/Attr.cpp
+++ b/dom/base/Attr.cpp
@@ -43,19 +43,19 @@ namespace dom {
//----------------------------------------------------------------------
bool Attr::sInitialized;
Attr::Attr(nsDOMAttributeMap *aAttrMap,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
const nsAString &aValue, bool aNsAware)
: nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
{
- NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
- "Wrong nodeType");
+ MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
+ "Wrong nodeType");
// We don't add a reference to our content. It will tell us
// to drop our reference when it goes away.
}
NS_IMPL_CYCLE_COLLECTION_CLASS(Attr)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
--- a/dom/base/Comment.h
+++ b/dom/base/Comment.h
@@ -14,18 +14,18 @@ namespace mozilla {
namespace dom {
class Comment MOZ_FINAL : public nsGenericDOMDataNode,
public nsIDOMComment
{
private:
void Init()
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
+ "Bad NodeType in aNodeInfo");
}
virtual ~Comment();
public:
explicit Comment(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
--- a/dom/base/Crypto.cpp
+++ b/dom/base/Crypto.cpp
@@ -51,17 +51,17 @@ Crypto::WrapObject(JSContext* aCx)
return CryptoBinding::Wrap(aCx, this);
}
void
Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Called on the wrong thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Called on the wrong thread");
JS::Rooted<JSObject*> view(aCx, aArray.Obj());
// Throw if the wrong type of ArrayBufferView is passed in
// (Part of the Web Crypto API spec)
switch (JS_GetArrayBufferViewType(view)) {
case js::Scalar::Int8:
case js::Scalar::Uint8:
--- a/dom/base/DocumentFragment.h
+++ b/dom/base/DocumentFragment.h
@@ -22,21 +22,20 @@ namespace dom {
class Element;
class DocumentFragment : public FragmentOrElement,
public nsIDOMDocumentFragment
{
private:
void Init()
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() ==
- nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
- mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
- kNameSpaceID_None),
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
+ mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
+ kNameSpaceID_None),
+ "Bad NodeType in aNodeInfo");
}
public:
using FragmentOrElement::GetFirstChild;
using nsINode::QuerySelector;
using nsINode::QuerySelectorAll;
// Make sure bindings can see our superclass' protected GetElementById method.
using nsINode::GetElementById;
--- a/dom/base/DocumentType.cpp
+++ b/dom/base/DocumentType.cpp
@@ -69,18 +69,18 @@ DocumentType::DocumentType(already_AddRe
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset) :
DocumentTypeForward(aNodeInfo),
mPublicId(aPublicId),
mSystemId(aSystemId),
mInternalSubset(aInternalSubset)
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
+ "Bad NodeType in aNodeInfo");
}
DocumentType::~DocumentType()
{
}
NS_IMPL_ISUPPORTS_INHERITED(DocumentType, nsGenericDOMDataNode, nsIDOMNode,
nsIDOMDocumentType)
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -199,19 +199,19 @@ Element::NotifyStateChange(EventStates a
nsAutoScriptBlocker scriptBlocker;
doc->ContentStateChanged(this, aStates);
}
}
void
Element::UpdateLinkState(EventStates aState)
{
- NS_ABORT_IF_FALSE(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED |
- NS_EVENT_STATE_UNVISITED)),
- "Unexpected link state bits");
+ MOZ_ASSERT(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED |
+ NS_EVENT_STATE_UNVISITED)),
+ "Unexpected link state bits");
mState =
(mState & ~(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) |
aState;
}
void
Element::UpdateState(bool aNotify)
{
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -147,18 +147,18 @@ class DestinationInsertionPointList;
class Element : public FragmentOrElement
{
public:
#ifdef MOZILLA_INTERNAL_API
explicit Element(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) :
FragmentOrElement(aNodeInfo),
mState(NS_EVENT_STATE_MOZ_READONLY)
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE,
+ "Bad NodeType in aNodeInfo");
SetIsElement();
}
#endif // MOZILLA_INTERNAL_API
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -575,19 +575,19 @@ EventSource::AsyncOnChannelRedirect(nsIC
}
OnRedirectVerifyCallback(NS_OK);
return NS_OK;
}
nsresult
EventSource::OnRedirectVerifyCallback(nsresult aResult)
{
- NS_ABORT_IF_FALSE(mRedirectCallback, "mRedirectCallback not set in callback");
- NS_ABORT_IF_FALSE(mNewRedirectChannel,
- "mNewRedirectChannel not set in callback");
+ MOZ_ASSERT(mRedirectCallback, "mRedirectCallback not set in callback");
+ MOZ_ASSERT(mNewRedirectChannel,
+ "mNewRedirectChannel not set in callback");
NS_ENSURE_SUCCESS(aResult, aResult);
// update our channel
mHttpChannel = do_QueryInterface(mNewRedirectChannel);
NS_ENSURE_STATE(mHttpChannel);
--- a/dom/base/Link.cpp
+++ b/dom/base/Link.cpp
@@ -24,17 +24,17 @@ namespace dom {
Link::Link(Element *aElement)
: mElement(aElement)
, mHistory(services::GetHistoryService())
, mLinkState(eLinkState_NotLink)
, mNeedsRegistration(false)
, mRegistered(false)
{
- NS_ABORT_IF_FALSE(mElement, "Must have an element");
+ MOZ_ASSERT(mElement, "Must have an element");
}
Link::~Link()
{
UnregisterFromHistory();
}
bool
@@ -53,19 +53,19 @@ Link::SetLinkState(nsLinkState aState)
"Setting state to the currently set state!");
// Set our current state as appropriate.
mLinkState = aState;
// Per IHistory interface documentation, we are no longer registered.
mRegistered = false;
- NS_ABORT_IF_FALSE(LinkState() == NS_EVENT_STATE_VISITED ||
- LinkState() == NS_EVENT_STATE_UNVISITED,
- "Unexpected state obtained from LinkState()!");
+ MOZ_ASSERT(LinkState() == NS_EVENT_STATE_VISITED ||
+ LinkState() == NS_EVENT_STATE_UNVISITED,
+ "Unexpected state obtained from LinkState()!");
// Tell the element to update its visited state
mElement->UpdateState(true);
}
EventStates
Link::LinkState() const
{
--- a/dom/base/NodeInfo.cpp
+++ b/dom/base/NodeInfo.cpp
@@ -43,17 +43,17 @@ NodeInfo::~NodeInfo()
NS_IF_RELEASE(mInner.mExtraName);
}
NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
uint16_t aNodeType, nsIAtom* aExtraName,
nsNodeInfoManager *aOwnerManager)
{
CheckValidNodeInfo(aNodeType, aName, aNamespaceID, aExtraName);
- NS_ABORT_IF_FALSE(aOwnerManager, "Invalid aOwnerManager");
+ MOZ_ASSERT(aOwnerManager, "Invalid aOwnerManager");
// Initialize mInner
NS_ADDREF(mInner.mName = aName);
NS_IF_ADDREF(mInner.mPrefix = aPrefix);
mInner.mNamespaceID = aNamespaceID;
mInner.mNodeType = aNodeType;
mOwnerManager = aOwnerManager;
NS_IF_ADDREF(mInner.mExtraName = aExtraName);
@@ -99,18 +99,17 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAt
SetDOMStringToNull(mLocalName);
break;
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
case nsIDOMNode::DOCUMENT_TYPE_NODE:
mInner.mExtraName->ToString(mNodeName);
SetDOMStringToNull(mLocalName);
break;
default:
- NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX,
- "Unknown node type");
+ MOZ_ASSERT(aNodeType == UINT16_MAX, "Unknown node type");
}
}
// nsISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(NodeInfo)
--- a/dom/base/NodeInfoInlines.h
+++ b/dom/base/NodeInfoInlines.h
@@ -70,47 +70,47 @@ NodeInfo::QualifiedNameEquals(nsIAtom* a
} // namespace dom
} // namespace mozilla
inline void
CheckValidNodeInfo(uint16_t aNodeType, nsIAtom *aName, int32_t aNamespaceID,
nsIAtom* aExtraName)
{
- NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE ||
- aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
- aNodeType == nsIDOMNode::TEXT_NODE ||
- aNodeType == nsIDOMNode::CDATA_SECTION_NODE ||
- aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
- aNodeType == nsIDOMNode::COMMENT_NODE ||
- aNodeType == nsIDOMNode::DOCUMENT_NODE ||
- aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE ||
- aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE ||
- aNodeType == UINT16_MAX,
- "Invalid nodeType");
- NS_ABORT_IF_FALSE((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
- aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
- !!aExtraName,
- "Supply aExtraName for and only for PIs and doctypes");
- NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE ||
- aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
- aNodeType == UINT16_MAX ||
- aNamespaceID == kNameSpaceID_None,
- "Only attributes and elements can be in a namespace");
- NS_ABORT_IF_FALSE(aName && aName != nsGkAtoms::_empty, "Invalid localName");
- NS_ABORT_IF_FALSE(((aNodeType == nsIDOMNode::TEXT_NODE) ==
- (aName == nsGkAtoms::textTagName)) &&
- ((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) ==
- (aName == nsGkAtoms::cdataTagName)) &&
- ((aNodeType == nsIDOMNode::COMMENT_NODE) ==
- (aName == nsGkAtoms::commentTagName)) &&
- ((aNodeType == nsIDOMNode::DOCUMENT_NODE) ==
- (aName == nsGkAtoms::documentNodeName)) &&
- ((aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) ==
- (aName == nsGkAtoms::documentFragmentNodeName)) &&
- ((aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
- (aName == nsGkAtoms::documentTypeNodeName)) &&
- ((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) ==
- (aName == nsGkAtoms::processingInstructionTagName)),
- "Wrong localName for nodeType");
+ MOZ_ASSERT(aNodeType == nsIDOMNode::ELEMENT_NODE ||
+ aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
+ aNodeType == nsIDOMNode::TEXT_NODE ||
+ aNodeType == nsIDOMNode::CDATA_SECTION_NODE ||
+ aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
+ aNodeType == nsIDOMNode::COMMENT_NODE ||
+ aNodeType == nsIDOMNode::DOCUMENT_NODE ||
+ aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE ||
+ aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE ||
+ aNodeType == UINT16_MAX,
+ "Invalid nodeType");
+ MOZ_ASSERT((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
+ aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
+ !!aExtraName,
+ "Supply aExtraName for and only for PIs and doctypes");
+ MOZ_ASSERT(aNodeType == nsIDOMNode::ELEMENT_NODE ||
+ aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
+ aNodeType == UINT16_MAX ||
+ aNamespaceID == kNameSpaceID_None,
+ "Only attributes and elements can be in a namespace");
+ MOZ_ASSERT(aName && aName != nsGkAtoms::_empty, "Invalid localName");
+ MOZ_ASSERT(((aNodeType == nsIDOMNode::TEXT_NODE) ==
+ (aName == nsGkAtoms::textTagName)) &&
+ ((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) ==
+ (aName == nsGkAtoms::cdataTagName)) &&
+ ((aNodeType == nsIDOMNode::COMMENT_NODE) ==
+ (aName == nsGkAtoms::commentTagName)) &&
+ ((aNodeType == nsIDOMNode::DOCUMENT_NODE) ==
+ (aName == nsGkAtoms::documentNodeName)) &&
+ ((aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) ==
+ (aName == nsGkAtoms::documentFragmentNodeName)) &&
+ ((aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
+ (aName == nsGkAtoms::documentTypeNodeName)) &&
+ ((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) ==
+ (aName == nsGkAtoms::processingInstructionTagName)),
+ "Wrong localName for nodeType");
}
-#endif /* mozilla_dom_NodeInfoInlines_h___ */
\ No newline at end of file
+#endif /* mozilla_dom_NodeInfoInlines_h___ */
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -1477,17 +1477,17 @@ WebSocketImpl::Init(JSContext* aCx,
} else {
*aConnectionFailed = false;
}
}
void
WebSocketImpl::AsyncOpen(ErrorResult& aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsCString asciiOrigin;
aRv = nsContentUtils::GetASCIIOrigin(mPrincipal, asciiOrigin);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
ToLowerCase(asciiOrigin);
@@ -1522,17 +1522,17 @@ public:
private:
nsRefPtr<WebSocketImpl> mWebSocketImpl;
};
nsresult
WebSocketImpl::InitializeConnection()
{
AssertIsOnMainThread();
- NS_ABORT_IF_FALSE(!mChannel, "mChannel should be null");
+ MOZ_ASSERT(!mChannel, "mChannel should be null");
nsCOMPtr<nsIWebSocketChannel> wsChannel;
nsAutoCloseWS autoClose(this);
nsresult rv;
if (mSecure) {
wsChannel =
do_CreateInstance("@mozilla.org/network/protocol;1?name=wss", &rv);
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -1027,18 +1027,17 @@ nsAttrValue::Equals(const nsAttrValue& a
default:
{
if (IsSVGType(thisCont->mType)) {
// Currently this method is never called for nsAttrValue objects that
// point to SVG data types.
// If that changes then we probably want to add methods to the
// corresponding SVG types to compare their base values.
// As a shortcut, however, we can begin by comparing the pointers.
- NS_ABORT_IF_FALSE(false, "Comparing nsAttrValues that point to SVG "
- "data");
+ MOZ_ASSERT(false, "Comparing nsAttrValues that point to SVG data");
return false;
}
NS_NOTREACHED("unknown type stored in MiscContainer");
return false;
}
}
if (needsStringComparison) {
if (thisCont->mStringBits == otherCont->mStringBits) {
@@ -1749,17 +1748,17 @@ nsAttrValue::ResetMiscAtomOrString()
}
cont->mStringBits = 0;
}
}
void
nsAttrValue::SetSVGType(ValueType aType, const void* aValue,
const nsAString* aSerialized) {
- NS_ABORT_IF_FALSE(IsSVGType(aType), "Not an SVG type");
+ MOZ_ASSERT(IsSVGType(aType), "Not an SVG type");
MiscContainer* cont = EnsureEmptyMiscContainer();
// All SVG types are just pointers to classes so just setting any of them
// will do. We'll lose type-safety but the signature of the calling
// function should ensure we don't get anything unexpected, and once we
// stick aValue in a union we lose type information anyway.
cont->mValue.mSVGAngle = static_cast<const nsSVGAngle*>(aValue);
cont->mType = aType;
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -1236,123 +1236,54 @@ nsContentUtils::GetParserService()
if (NS_FAILED(rv)) {
sParserService = nullptr;
}
}
return sParserService;
}
-static nsIAtom** sSandboxFlagAttrs[] = {
- &nsGkAtoms::allowsameorigin, // SANDBOXED_ORIGIN
- &nsGkAtoms::allowforms, // SANDBOXED_FORMS
- &nsGkAtoms::allowscripts, // SANDBOXED_SCRIPTS | SANDBOXED_AUTOMATIC_FEATURES
- &nsGkAtoms::allowtopnavigation, // SANDBOXED_TOPLEVEL_NAVIGATION
- &nsGkAtoms::allowpointerlock, // SANDBOXED_POINTER_LOCK
- &nsGkAtoms::allowpopups // SANDBOXED_AUXILIARY_NAVIGATION
-};
-
-static const uint32_t sSandboxFlagValues[] = {
- SANDBOXED_ORIGIN, // allow-same-origin
- SANDBOXED_FORMS, // allow-forms
- SANDBOXED_SCRIPTS | SANDBOXED_AUTOMATIC_FEATURES, // allow-scripts
- SANDBOXED_TOPLEVEL_NAVIGATION, // allow-top-navigation
- SANDBOXED_POINTER_LOCK, // allow-pointer-lock
- SANDBOXED_AUXILIARY_NAVIGATION // allow-popups
-};
-
/**
* A helper function that parses a sandbox attribute (of an <iframe> or
* a CSP directive) and converts it to the set of flags used internally.
*
- * @param aSandboxAttr the sandbox attribute
- * @return the set of flags (SANDBOXED_NONE if aSandboxAttr is null)
+ * @param sandboxAttr the sandbox attribute
+ * @return the set of flags (0 if sandboxAttr is null)
*/
uint32_t
-nsContentUtils::ParseSandboxAttributeToFlags(const nsAttrValue* aSandboxAttr)
+nsContentUtils::ParseSandboxAttributeToFlags(const nsAttrValue* sandboxAttr)
{
// No sandbox attribute, no sandbox flags.
- if (!aSandboxAttr) { return SANDBOXED_NONE; }
+ if (!sandboxAttr) { return 0; }
// Start off by setting all the restriction flags.
uint32_t out = SANDBOXED_NAVIGATION
| SANDBOXED_AUXILIARY_NAVIGATION
| SANDBOXED_TOPLEVEL_NAVIGATION
| SANDBOXED_PLUGINS
| SANDBOXED_ORIGIN
| SANDBOXED_FORMS
| SANDBOXED_SCRIPTS
| SANDBOXED_AUTOMATIC_FEATURES
| SANDBOXED_POINTER_LOCK
| SANDBOXED_DOMAIN;
- MOZ_ASSERT(ArrayLength(sSandboxFlagAttrs) == ArrayLength(sSandboxFlagValues),
- "Lengths of SandboxFlagAttrs and SandboxFlagvalues do not match");
-
- // For each flag: if it's in the attribute, update the (out) flag
- for (uint32_t i = 0; i < ArrayLength(sSandboxFlagAttrs); i++) {
- if (aSandboxAttr->Contains(*sSandboxFlagAttrs[i], eIgnoreCase)) {
- out &= ~(sSandboxFlagValues[i]);
- }
- }
+// Macro for updating the flag according to the keywords
+#define IF_KEYWORD(atom, flags) \
+ if (sandboxAttr->Contains(nsGkAtoms::atom, eIgnoreCase)) { out &= ~(flags); }
+
+ IF_KEYWORD(allowsameorigin, SANDBOXED_ORIGIN)
+ IF_KEYWORD(allowforms, SANDBOXED_FORMS)
+ IF_KEYWORD(allowscripts, SANDBOXED_SCRIPTS | SANDBOXED_AUTOMATIC_FEATURES)
+ IF_KEYWORD(allowtopnavigation, SANDBOXED_TOPLEVEL_NAVIGATION)
+ IF_KEYWORD(allowpointerlock, SANDBOXED_POINTER_LOCK)
+ IF_KEYWORD(allowpopups, SANDBOXED_AUXILIARY_NAVIGATION)
return out;
-}
-
-/**
- * A helper function that checks if a string matches (case-insensitive) a valid
- * sandbox flag.
- *
- * @param aFlag the potential sandbox flag
- * @return true if the flag is a sandbox flag
- */
-bool
-nsContentUtils::IsValidSandboxFlag(const nsAString& aFlag)
-{
- for (uint32_t i = 0; i < ArrayLength(sSandboxFlagAttrs); i++) {
- if (EqualsIgnoreASCIICase(nsDependentAtomString(*sSandboxFlagAttrs[i]), aFlag)) {
- return true;
- }
- }
- return false;
-}
-
-/**
- * A helper function that returns a string attribute corresponding to the
- * sandbox flags.
- *
- * @param aFlags the sandbox flags
- * @param aString the attribute corresponding to the flags (null if flags is 0)
- */
-void
-nsContentUtils::SandboxFlagsToString(uint32_t aFlags, nsAString& aString)
-{
- if (!aFlags) {
- SetDOMStringToNull(aString);
- return;
- }
-
- aString.Truncate();
-
-// Macro for updating the string according to set flags
-#define IF_FLAG(flag, atom) \
- if (!(aFlags & flag)) { \
- if (!aString.IsEmpty()) { \
- aString.Append(NS_LITERAL_STRING(" ")); \
- } \
- aString.Append(nsDependentAtomString(nsGkAtoms::atom)); \
- }
-
- IF_FLAG(SANDBOXED_ORIGIN, allowsameorigin)
- IF_FLAG(SANDBOXED_FORMS, allowforms)
- IF_FLAG(SANDBOXED_SCRIPTS, allowscripts)
- IF_FLAG(SANDBOXED_TOPLEVEL_NAVIGATION, allowtopnavigation)
- IF_FLAG(SANDBOXED_POINTER_LOCK, allowpointerlock)
- IF_FLAG(SANDBOXED_AUXILIARY_NAVIGATION, allowpopups)
-#undef IF_FLAG
+#undef IF_KEYWORD
}
nsIBidiKeyboard*
nsContentUtils::GetBidiKeyboard()
{
if (!sBidiKeyboard) {
nsresult rv = CallGetService("@mozilla.org/widget/bidikeyboard;1", &sBidiKeyboard);
if (NS_FAILED(rv)) {
@@ -4337,17 +4268,17 @@ nsContentUtils::ParseFragmentXML(const n
parser.forget(&sXMLFragmentParser);
// sXMLFragmentParser now owns the parser
}
if (!sXMLFragmentSink) {
NS_NewXMLFragmentContentSink(&sXMLFragmentSink);
// sXMLFragmentSink now owns the sink
}
nsCOMPtr<nsIContentSink> contentsink = do_QueryInterface(sXMLFragmentSink);
- NS_ABORT_IF_FALSE(contentsink, "Sink doesn't QI to nsIContentSink!");
+ MOZ_ASSERT(contentsink, "Sink doesn't QI to nsIContentSink!");
sXMLFragmentParser->SetContentSink(contentsink);
sXMLFragmentSink->SetTargetDocument(aDocument);
sXMLFragmentSink->SetPreventScriptExecution(aPreventScriptExecution);
nsresult rv =
sXMLFragmentParser->ParseFragment(aSourceBuffer,
aTagStack);
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -827,38 +827,21 @@ public:
static nsresult GetLocalizedString(PropertiesFile aFile,
const char* aKey,
nsXPIDLString& aResult);
/**
* A helper function that parses a sandbox attribute (of an <iframe> or
* a CSP directive) and converts it to the set of flags used internally.
*
- * @param aSandboxAttr the sandbox attribute
- * @return the set of flags (SANDBOXED_NONE if aSandboxAttr is null)
+ * @param sandboxAttr the sandbox attribute
+ * @return the set of flags (0 if sandboxAttr is null)
*/
- static uint32_t ParseSandboxAttributeToFlags(const nsAttrValue* aSandboxAttr);
+ static uint32_t ParseSandboxAttributeToFlags(const nsAttrValue* sandboxAttr);
- /**
- * A helper function that checks if a string matches a valid sandbox
- * flag.
- *
- * @param aFlag the potential sandbox flag
- * @return true if the flag is a sandbox flag
- */
- static bool IsValidSandboxFlag(const nsAString& aFlag);
-
- /**
- * A helper function that returns a string attribute corresponding to the
- * sandbox flags.
- *
- * @param aFlags the sandbox flags
- * @param aString the attribute corresponding to the flags (null if flags is 0)
- */
- static void SandboxFlagsToString(uint32_t aFlags, nsAString& aString);
/**
* Fill (with the parameters given) the localized string named |aKey| in
* properties file |aFile|.
*/
private:
static nsresult FormatLocalizedString(PropertiesFile aFile,
const char* aKey,
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1760,17 +1760,17 @@ GetXPCProto(nsIXPConnect *aXPConnect, JS
NS_ASSERTION(aNameStruct->mType ==
nsGlobalNameStruct::eTypeClassConstructor ||
aNameStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo,
"Wrong type!");
nsCOMPtr<nsIClassInfo> ci;
if (aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
int32_t id = aNameStruct->mDOMClassInfoID;
- NS_ABORT_IF_FALSE(id >= 0, "Negative DOM classinfo?!?");
+ MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?");
nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
ci = NS_GetDOMClassInfoInstance(ci_id);
}
else {
ci = nsDOMClassInfo::GetClassInfoInstance(aNameStruct->mData);
}
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -264,17 +264,17 @@ nsDOMDataChannel::Send(const nsAString&
{
NS_ConvertUTF16toUTF8 msgString(aData);
Send(nullptr, msgString, msgString.Length(), false, aRv);
}
void
nsDOMDataChannel::Send(File& aData, ErrorResult& aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsCOMPtr<nsIInputStream> msgStream;
nsresult rv = aData.GetInternalStream(getter_AddRefs(msgStream));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
}
@@ -291,33 +291,33 @@ nsDOMDataChannel::Send(File& aData, Erro
}
Send(msgStream, EmptyCString(), msgLength, true, aRv);
}
void
nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
aData.ComputeLengthAndData();
static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
uint32_t len = aData.Length();
char* data = reinterpret_cast<char*>(aData.Data());
nsDependentCSubstring msgString(data, len);
Send(nullptr, msgString, len, true, aRv);
}
void
nsDOMDataChannel::Send(const ArrayBufferView& aData, ErrorResult& aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
aData.ComputeLengthAndData();
static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
uint32_t len = aData.Length();
char* data = reinterpret_cast<char*>(aData.Data());
--- a/dom/base/nsDOMTokenList.cpp
+++ b/dom/base/nsDOMTokenList.cpp
@@ -177,17 +177,17 @@ nsDOMTokenList::Add(const nsAString& aTo
tokens.AppendElement(aToken);
Add(tokens, aError);
}
void
nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr,
const nsTArray<nsString>& aTokens)
{
- NS_ABORT_IF_FALSE(aAttr, "Need an attribute");
+ MOZ_ASSERT(aAttr, "Need an attribute");
nsAutoString input;
aAttr->ToString(input);
nsAString::const_iterator copyStart, tokenStart, iter, end;
input.BeginReading(iter);
input.EndReading(end);
copyStart = iter;
@@ -199,17 +199,17 @@ nsDOMTokenList::RemoveInternal(const nsA
// skip whitespace.
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
++iter;
}
if (iter == end) {
// At this point we're sure the last seen token (if any) wasn't to be
// removed. So the trailing spaces will need to be kept.
- NS_ABORT_IF_FALSE(!lastTokenRemoved, "How did this happen?");
+ MOZ_ASSERT(!lastTokenRemoved, "How did this happen?");
output.Append(Substring(copyStart, end));
break;
}
tokenStart = iter;
do {
++iter;
@@ -222,18 +222,18 @@ nsDOMTokenList::RemoveInternal(const nsA
++iter;
}
copyStart = iter;
lastTokenRemoved = true;
} else {
if (lastTokenRemoved && !output.IsEmpty()) {
- NS_ABORT_IF_FALSE(!nsContentUtils::IsHTMLWhitespace(
- output.Last()), "Invalid last output token");
+ MOZ_ASSERT(!nsContentUtils::IsHTMLWhitespace(output.Last()),
+ "Invalid last output token");
output.Append(char16_t(' '));
}
lastTokenRemoved = false;
output.Append(Substring(copyStart, iter));
copyStart = iter;
}
}
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1711,19 +1711,19 @@ nsDOMWindowUtils::GetTranslationNodes(ns
static TemporaryRef<DataSourceSurface>
CanvasToDataSourceSurface(nsIDOMHTMLCanvasElement* aCanvas)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aCanvas);
if (!node) {
return nullptr;
}
- NS_ABORT_IF_FALSE(node->IsElement(),
- "An nsINode that implements nsIDOMHTMLCanvasElement should "
- "be an element.");
+ MOZ_ASSERT(node->IsElement(),
+ "An nsINode that implements nsIDOMHTMLCanvasElement should "
+ "be an element.");
nsLayoutUtils::SurfaceFromElementResult result =
nsLayoutUtils::SurfaceFromElement(node->AsElement());
return result.mSourceSurface->GetDataSurface();
}
NS_IMETHODIMP
nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement *aCanvas1,
nsIDOMHTMLCanvasElement *aCanvas2,
@@ -2304,17 +2304,17 @@ nsDOMWindowUtils::GetClassName(JS::Handl
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
// Our argument must be a non-null object.
if (aObject.isPrimitive()) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
*aName = NS_strdup(JS_GetClass(aObject.toObjectOrNull())->name);
- NS_ABORT_IF_FALSE(*aName, "NS_strdup should be infallible.");
+ MOZ_ASSERT(*aName, "NS_strdup should be infallible.");
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetVisitedDependentComputedStyle(
nsIDOMElement *aElement, const nsAString& aPseudoElement,
const nsAString& aPropertyName, nsAString& aResult)
{
@@ -2693,19 +2693,19 @@ nsDOMWindowUtils::ComputeAnimationDistan
NS_ENSURE_SUCCESS(rv, rv);
nsCSSProperty property =
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) {
property = eCSSProperty_UNKNOWN;
}
- NS_ABORT_IF_FALSE(property == eCSSProperty_UNKNOWN ||
- !nsCSSProps::IsShorthand(property),
- "should not have shorthand");
+ MOZ_ASSERT(property == eCSSProperty_UNKNOWN ||
+ !nsCSSProps::IsShorthand(property),
+ "should not have shorthand");
StyleAnimationValue v1, v2;
if (property == eCSSProperty_UNKNOWN ||
!ComputeAnimationValue(property, content->AsElement(), aValue1, v1) ||
!ComputeAnimationValue(property, content->AsElement(), aValue2, v2)) {
return NS_ERROR_ILLEGAL_VALUE;
}
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1051,18 +1051,18 @@ nsExternalResourceMap::ShowViewers()
{
mMap.EnumerateRead(ExternalResourceShower, nullptr);
}
void
TransferZoomLevels(nsIDocument* aFromDoc,
nsIDocument* aToDoc)
{
- NS_ABORT_IF_FALSE(aFromDoc && aToDoc,
- "transferring zoom levels from/to null doc");
+ MOZ_ASSERT(aFromDoc && aToDoc,
+ "transferring zoom levels from/to null doc");
nsIPresShell* fromShell = aFromDoc->GetShell();
if (!fromShell)
return;
nsPresContext* fromCtxt = fromShell->GetPresContext();
if (!fromCtxt)
return;
@@ -1078,18 +1078,18 @@ TransferZoomLevels(nsIDocument* aFromDoc
toCtxt->SetFullZoom(fromCtxt->GetFullZoom());
toCtxt->SetBaseMinFontSize(fromCtxt->BaseMinFontSize());
toCtxt->SetTextZoom(fromCtxt->TextZoom());
}
void
TransferShowingState(nsIDocument* aFromDoc, nsIDocument* aToDoc)
{
- NS_ABORT_IF_FALSE(aFromDoc && aToDoc,
- "transferring showing state from/to null doc");
+ MOZ_ASSERT(aFromDoc && aToDoc,
+ "transferring showing state from/to null doc");
if (aFromDoc->IsShowing()) {
aToDoc->OnPageShow(true, nullptr);
}
}
nsresult
nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
@@ -1619,18 +1619,18 @@ ClearAllBoxObjects(nsIContent* aKey, nsP
if (aBoxObject) {
aBoxObject->Clear();
}
return PL_DHASH_NEXT;
}
nsIDocument::~nsIDocument()
{
- NS_ABORT_IF_FALSE(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists),
- "must not have media query lists left");
+ MOZ_ASSERT(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists),
+ "must not have media query lists left");
if (mNodeInfoManager) {
mNodeInfoManager->DropDocumentReference();
}
}
nsDocument::~nsDocument()
@@ -2206,18 +2206,18 @@ nsDocument::Init()
mNodeInfoManager = new nsNodeInfoManager();
nsresult rv = mNodeInfoManager->Init(this);
NS_ENSURE_SUCCESS(rv, rv);
// mNodeInfo keeps NodeInfoManager alive!
mNodeInfo = mNodeInfoManager->GetDocumentNodeInfo();
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_OUT_OF_MEMORY);
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
+ "Bad NodeType in aNodeInfo");
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
// If after creation the owner js global is not set for a document
// we use the default compartment for this document, instead of creating
// wrapper in some random compartment when the document is exposed to js
// via some events.
nsCOMPtr<nsIGlobalObject> global = xpc::NativeGlobal(xpc::PrivilegedJunkScope());
@@ -2859,17 +2859,17 @@ nsDocument::InitCSP(nsIChannel* aChannel
httpChannel->GetResponseHeader(
NS_LITERAL_CSTRING("content-security-policy-report-only"),
tCspROHeaderValue);
}
NS_ConvertASCIItoUTF16 cspHeaderValue(tCspHeaderValue);
NS_ConvertASCIItoUTF16 cspROHeaderValue(tCspROHeaderValue);
// Figure out if we need to apply an app default CSP or a CSP from an app manifest
- nsCOMPtr<nsIPrincipal> principal = NodePrincipal();
+ nsIPrincipal* principal = NodePrincipal();
uint16_t appStatus = principal->GetAppStatus();
bool applyAppDefaultCSP = false;
bool applyAppManifestCSP = false;
nsAutoString appManifestCSP;
nsAutoString appDefaultCSP;
if (appStatus != nsIPrincipal::APP_STATUS_NOT_INSTALLED) {
@@ -3031,40 +3031,21 @@ nsDocument::InitCSP(nsIChannel* aChannel
#endif
}
// Referrer Policy is set separately for the speculative parser in
// nsHTMLDocument::StartDocumentLoad() so there's nothing to do here for
// speculative loads.
}
- // ----- Set sandbox flags according to CSP header
- // The document may already have some sandbox flags set (e.g., if the
- // document is an iframe with the sandbox attribute set). If we have a CSP
- // sandbox directive, intersect the CSP sandbox flags with the existing
- // flags. This corresponds to the _least_ permissive policy.
- uint32_t cspSandboxFlags = SANDBOXED_NONE;
- rv = csp->GetCSPSandboxFlags(&cspSandboxFlags);
- NS_ENSURE_SUCCESS(rv, rv);
-
- mSandboxFlags |= cspSandboxFlags;
-
- if (cspSandboxFlags & SANDBOXED_ORIGIN) {
- // If the new CSP sandbox flags do not have the allow-same-origin flag
- // reset the document principal to a null principal
- principal = do_CreateInstance("@mozilla.org/nullprincipal;1");
- SetPrincipal(principal);
- }
-
-
rv = principal->SetCsp(csp);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef PR_LOGGING
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
- ("Inserted CSP into principal %p", principal.get()));
+ ("Inserted CSP into principal %p", principal));
#endif
return NS_OK;
}
void
nsDocument::StopDocumentLoad()
{
@@ -3725,22 +3706,16 @@ nsDocument::AddCharSetObserver(nsIObserv
void
nsDocument::RemoveCharSetObserver(nsIObserver* aObserver)
{
mCharSetObservers.RemoveElement(aObserver);
}
void
-nsIDocument::GetSandboxFlagsAsString(nsAString& aFlags)
-{
- nsContentUtils::SandboxFlagsToString(mSandboxFlags, aFlags);
-}
-
-void
nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const
{
aData.Truncate();
const nsDocHeaderData* data = mHeaderData;
while (data) {
if (data->mField == aHeaderField) {
aData = data->mData;
@@ -4692,21 +4667,21 @@ nsDocument::SetScriptGlobalObject(nsIScr
#ifdef DEBUG
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aScriptGlobalObject));
NS_ASSERTION(!win || win->IsInnerWindow(),
"Script global object must be an inner window!");
}
#endif
- NS_ABORT_IF_FALSE(aScriptGlobalObject || !mAnimationController ||
- mAnimationController->IsPausedByType(
- nsSMILTimeContainer::PAUSE_PAGEHIDE |
- nsSMILTimeContainer::PAUSE_BEGIN),
- "Clearing window pointer while animations are unpaused");
+ MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
+ mAnimationController->IsPausedByType(
+ nsSMILTimeContainer::PAUSE_PAGEHIDE |
+ nsSMILTimeContainer::PAUSE_BEGIN),
+ "Clearing window pointer while animations are unpaused");
if (mScriptGlobalObject && !aScriptGlobalObject) {
// We're detaching from the window. We need to grab a pointer to
// our layout history state now.
mLayoutHistoryState = GetLayoutHistoryState();
if (mPresShell && !EventHandlingSuppressed()) {
RevokeAnimationFrameNotifications();
@@ -10426,18 +10401,18 @@ nsDocument::AddImage(imgIRequest* aImage
nsresult
nsDocument::RemoveImage(imgIRequest* aImage, uint32_t aFlags)
{
NS_ENSURE_ARG_POINTER(aImage);
// Get the old count. It should exist and be > 0.
uint32_t count = 0;
DebugOnly<bool> found = mImageTracker.Get(aImage, &count);
- NS_ABORT_IF_FALSE(found, "Removing image that wasn't in the tracker!");
- NS_ABORT_IF_FALSE(count > 0, "Entry in the cache tracker with count 0!");
+ MOZ_ASSERT(found, "Removing image that wasn't in the tracker!");
+ MOZ_ASSERT(count > 0, "Entry in the cache tracker with count 0!");
// We're removing, so decrement the count.
count--;
// If the count is now zero, remove from the tracker.
// Otherwise, set the new value.
if (count != 0) {
mImageTracker.Put(aImage, count);
--- a/dom/base/nsGenericDOMDataNode.cpp
+++ b/dom/base/nsGenericDOMDataNode.cpp
@@ -37,35 +37,33 @@
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsIContent(aNodeInfo)
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE ||
- mNodeInfo->NodeType() ==
- nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
+ "Bad NodeType in aNodeInfo");
}
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: nsIContent(aNodeInfo)
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE ||
- mNodeInfo->NodeType() ==
- nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
- mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
+ mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
+ "Bad NodeType in aNodeInfo");
}
nsGenericDOMDataNode::~nsGenericDOMDataNode()
{
NS_PRECONDITION(!IsInDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1525,17 +1525,17 @@ nsGlobalWindow::CleanUp()
if (IsInnerWindow()) {
DisableGamepadUpdates();
mHasGamepad = false;
} else {
MOZ_ASSERT(!mHasGamepad);
}
if (mCleanMessageManager) {
- NS_ABORT_IF_FALSE(mIsChrome, "only chrome should have msg manager cleaned");
+ MOZ_ASSERT(mIsChrome, "only chrome should have msg manager cleaned");
nsGlobalChromeWindow *asChrome = static_cast<nsGlobalChromeWindow*>(this);
if (asChrome->mMessageManager) {
static_cast<nsFrameMessageManager*>(
asChrome->mMessageManager.get())->Disconnect();
}
}
mArguments = nullptr;
@@ -8108,36 +8108,36 @@ PopulateMessagePortList(MessagePortBase*
array->AppendElement(aKey);
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
PostMessageEvent::Run()
{
- NS_ABORT_IF_FALSE(mTargetWindow->IsOuterWindow(),
- "should have been passed an outer window!");
- NS_ABORT_IF_FALSE(!mSource || mSource->IsOuterWindow(),
- "should have been passed an outer window!");
+ MOZ_ASSERT(mTargetWindow->IsOuterWindow(),
+ "should have been passed an outer window!");
+ MOZ_ASSERT(!mSource || mSource->IsOuterWindow(),
+ "should have been passed an outer window!");
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
// If we bailed before this point we're going to leak mMessage, but
// that's probably better than crashing.
nsRefPtr<nsGlobalWindow> targetWindow;
if (mTargetWindow->IsClosedOrClosing() ||
!(targetWindow = mTargetWindow->GetCurrentInnerWindowInternal()) ||
targetWindow->IsClosedOrClosing())
return NS_OK;
- NS_ABORT_IF_FALSE(targetWindow->IsInnerWindow(),
- "we ordered an inner window!");
+ MOZ_ASSERT(targetWindow->IsInnerWindow(),
+ "we ordered an inner window!");
JSAutoCompartment ac(cx, targetWindow->GetWrapperPreserveColor());
// Ensure that any origin which might have been provided is the origin of this
// window's document. Note that we do this *now* instead of when postMessage
// is called because the target window might have been navigated to a
// different location between then and now. If this check happened when
// postMessage was called, it would be fairly easy for a malicious webpage to
// intercept messages intended for another site by carefully timing navigation
@@ -8224,18 +8224,18 @@ nsGlobalWindow::PostMessageMoz(JSContext
//
// http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html
//
// First, get the caller's window
nsRefPtr<nsGlobalWindow> callerInnerWin = CallerInnerWindow();
nsIPrincipal* callerPrin;
if (callerInnerWin) {
- NS_ABORT_IF_FALSE(callerInnerWin->IsInnerWindow(),
- "should have gotten an inner window here");
+ MOZ_ASSERT(callerInnerWin->IsInnerWindow(),
+ "should have gotten an inner window here");
// Compute the caller's origin either from its principal or, in the case the
// principal doesn't carry a URI (e.g. the system principal), the caller's
// document. We must get this now instead of when the event is created and
// dispatched, because ultimately it is the identity of the calling window
// *now* that determines who sent the message (and not an identity which might
// have changed due to intervening navigations).
callerPrin = callerInnerWin->GetPrincipal();
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -1713,18 +1713,18 @@ protected:
mGroupMessageManagers(1)
{
mIsChrome = true;
mCleanMessageManager = true;
}
~nsGlobalChromeWindow()
{
- NS_ABORT_IF_FALSE(mCleanMessageManager,
- "chrome windows may always disconnect the msg manager");
+ MOZ_ASSERT(mCleanMessageManager,
+ "chrome windows may always disconnect the msg manager");
mGroupMessageManagers.EnumerateRead(DisconnectGroupMessageManager, nullptr);
mGroupMessageManagers.Clear();
if (mMessageManager) {
static_cast<nsFrameMessageManager *>(
mMessageManager.get())->Disconnect();
}
--- a/dom/base/nsHostObjectURI.cpp
+++ b/dom/base/nsHostObjectURI.cpp
@@ -89,18 +89,17 @@ nsHostObjectURI::CloneInternal(nsSimpleU
nsCOMPtr<nsIURI> simpleClone;
nsresult rv =
nsSimpleURI::CloneInternal(aRefHandlingMode, getter_AddRefs(simpleClone));
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG
nsRefPtr<nsHostObjectURI> uriCheck;
rv = simpleClone->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(uriCheck));
- NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) && uriCheck,
- "Unexpected!");
+ MOZ_ASSERT(NS_SUCCEEDED(rv) && uriCheck);
#endif
nsHostObjectURI* u = static_cast<nsHostObjectURI*>(simpleClone.get());
u->mPrincipal = mPrincipal;
simpleClone.forget(aClone);
return NS_OK;
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -593,22 +593,16 @@ public:
* Get the sandbox flags for this document.
* @see nsSandboxFlags.h for the possible flags
*/
uint32_t GetSandboxFlags() const
{
return mSandboxFlags;
}
- /**
- * Get string representation of sandbox flags (null if no flags as
- * set).
- */
- void GetSandboxFlagsAsString(nsAString& aFlags);
-
/**
* Set the sandbox flags for this document.
* @see nsSandboxFlags.h for the possible flags
*/
void SetSandboxFlags(uint32_t sandboxFlags)
{
mSandboxFlags = sandboxFlags;
}
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1057,17 +1057,17 @@ nsINode::IsEqualNode(nsINode* aOther)
docType2->GetInternalSubset(string2);
if (!string1.Equals(string2)) {
return false;
}
break;
}
default:
- NS_ABORT_IF_FALSE(false, "Unknown node type");
+ MOZ_ASSERT(false, "Unknown node type");
}
nsINode* nextNode = node1->GetFirstChild();
if (nextNode) {
node1 = nextNode;
node2 = node2->GetFirstChild();
}
else {
@@ -1352,17 +1352,17 @@ nsINode::Traverse(nsINode *tmp, nsCycleC
// If we're in a black document, return early.
if ((currentDoc && currentDoc->IsBlack())) {
return false;
}
// If we're not in anonymous content and we have a black parent,
// return early.
nsIContent* parent = tmp->GetParent();
if (parent && !parent->UnoptimizableCCNode() && parent->IsBlack()) {
- NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
+ MOZ_ASSERT(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
return false;
}
}
}
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNodeInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
@@ -2579,17 +2579,17 @@ FindMatchingElements(nsINode* aRoot, nsC
aList.AppendElement(results.ElementAt(i));
}
}
}
struct ElementHolder {
ElementHolder() : mElement(nullptr) {}
void AppendElement(Element* aElement) {
- NS_ABORT_IF_FALSE(!mElement, "Should only get one element");
+ MOZ_ASSERT(!mElement, "Should only get one element");
mElement = aElement;
}
void SetCapacity(uint32_t aCapacity) { MOZ_CRASH("Don't call me!"); }
uint32_t Length() { return 0; }
Element* ElementAt(uint32_t aIndex) { return nullptr; }
Element* mElement;
};
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -131,17 +131,17 @@ nsImageLoadingContent::Notify(imgIReques
if (aType == imgINotificationObserver::UNLOCKED_DRAW) {
OnUnlockedDraw();
return NS_OK;
}
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
// We should definitely have a request here
- NS_ABORT_IF_FALSE(aRequest, "no request?");
+ MOZ_ASSERT(aRequest, "no request?");
NS_PRECONDITION(aRequest == mCurrentRequest || aRequest == mPendingRequest,
"Unknown request");
}
{
nsAutoScriptBlocker scriptBlocker;
@@ -222,18 +222,18 @@ nsImageLoadingContent::OnLoadComplete(im
// Our state may change. Watch it.
AutoStateChanger changer(this, true);
// If the pending request is loaded, switch to it.
if (aRequest == mPendingRequest) {
MakePendingRequestCurrent();
}
- NS_ABORT_IF_FALSE(aRequest == mCurrentRequest,
- "One way or another, we should be current by now");
+ MOZ_ASSERT(aRequest == mCurrentRequest,
+ "One way or another, we should be current by now");
// We just loaded all the data we're going to get. If we're visible and
// haven't done an initial paint (*), we want to make sure the image starts
// decoding immediately, for two reasons:
//
// 1) This image is sitting idle but might need to be decoded as soon as we
// start painting, in which case we've wasted time.
//
@@ -885,19 +885,19 @@ nsImageLoadingContent::LoadImage(nsIURI*
AutoStateChanger changer(this, aNotify);
// Sanity check.
//
// We use the principal of aDocument to avoid having to QI |this| an extra
// time. It should always be the same as the principal of this node.
#ifdef DEBUG
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
- NS_ABORT_IF_FALSE(thisContent &&
- thisContent->NodePrincipal() == aDocument->NodePrincipal(),
- "Principal mismatch?");
+ MOZ_ASSERT(thisContent &&
+ thisContent->NodePrincipal() == aDocument->NodePrincipal(),
+ "Principal mismatch?");
#endif
// Are we blocked?
int16_t cpDecision = nsIContentPolicy::REJECT_REQUEST;
nsContentPolicyType policyType = PolicyTypeForLoad(aImageLoadType);
nsContentUtils::CanLoadImage(aNewURI,
static_cast<nsIImageLoadingContent*>(this),
@@ -1214,17 +1214,17 @@ nsImageLoadingContent::PrepareNextReques
// Otherwise, make it pending.
return PreparePendingRequest(aImageLoadType);
}
void
nsImageLoadingContent::SetBlockedRequest(nsIURI* aURI, int16_t aContentDecision)
{
// Sanity
- NS_ABORT_IF_FALSE(!NS_CP_ACCEPTED(aContentDecision), "Blocked but not?");
+ MOZ_ASSERT(!NS_CP_ACCEPTED(aContentDecision), "Blocked but not?");
// We do some slightly illogical stuff here to maintain consistency with
// old behavior that people probably depend on. Even in the case where the
// new image is blocked, the old one should really be canceled with the
// reason "image source changed". However, apparently there's some abuse
// over in nsImageFrame where the displaying of the "broken" icon for the
// next image depends on the cancel reason of the previous image. ugh.
ClearPendingRequest(NS_ERROR_IMAGE_BLOCKED, REQUEST_DISCARD);
@@ -1340,18 +1340,18 @@ nsImageLoadingContent::ClearCurrentReque
{
if (!mCurrentRequest) {
// Even if we didn't have a current request, we might have been keeping
// a URI and flags as a placeholder for a failed load. Clear that now.
mCurrentURI = nullptr;
mCurrentRequestFlags = 0;
return;
}
- NS_ABORT_IF_FALSE(!mCurrentURI,
- "Shouldn't have both mCurrentRequest and mCurrentURI!");
+ MOZ_ASSERT(!mCurrentURI,
+ "Shouldn't have both mCurrentRequest and mCurrentURI!");
// Deregister this image from the refresh driver so it no longer receives
// notifications.
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(), mCurrentRequest,
&mCurrentRequestRegistered);
// Clean up the request.
UntrackImage(mCurrentRequest, aFlags);
--- a/dom/base/nsPerformance.cpp
+++ b/dom/base/nsPerformance.cpp
@@ -593,28 +593,28 @@ nsPerformance::AddEntry(nsIHttpChannel*
}
}
bool
nsPerformance::PerformanceEntryComparator::Equals(
const PerformanceEntry* aElem1,
const PerformanceEntry* aElem2) const
{
- NS_ABORT_IF_FALSE(aElem1 && aElem2,
- "Trying to compare null performance entries");
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null performance entries");
return aElem1->StartTime() == aElem2->StartTime();
}
bool
nsPerformance::PerformanceEntryComparator::LessThan(
const PerformanceEntry* aElem1,
const PerformanceEntry* aElem2) const
{
- NS_ABORT_IF_FALSE(aElem1 && aElem2,
- "Trying to compare null performance entries");
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null performance entries");
return aElem1->StartTime() < aElem2->StartTime();
}
void
nsPerformance::InsertPerformanceEntry(PerformanceEntry* aEntry)
{
MOZ_ASSERT(aEntry);
MOZ_ASSERT(mEntries.Length() < mPrimaryBufferSize);
--- a/dom/base/nsReferencedElement.cpp
+++ b/dom/base/nsReferencedElement.cpp
@@ -13,17 +13,17 @@
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsCycleCollectionParticipant.h"
void
nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
bool aWatch, bool aReferenceImage)
{
- NS_ABORT_IF_FALSE(aFromContent, "Reset() expects non-null content pointer");
+ MOZ_ASSERT(aFromContent, "Reset() expects non-null content pointer");
Unlink();
if (!aURI)
return;
nsAutoCString refPart;
aURI->GetRef(refPart);
--- a/dom/base/nsSandboxFlags.h
+++ b/dom/base/nsSandboxFlags.h
@@ -7,21 +7,16 @@
* Constant flags that describe how a document is sandboxed according to the
* HTML5 spec.
*/
#ifndef nsSandboxFlags_h___
#define nsSandboxFlags_h___
/**
- * This constant denotes the lack of a sandbox attribute/directive.
- */
-const unsigned long SANDBOXED_NONE = 0x0;
-
-/**
* This flag prevents content from navigating browsing contexts other than
* itself, browsing contexts nested inside it, the top-level browsing context
* and browsing contexts that it has opened.
* As it is always on for sandboxed browsing contexts, it is used implicitly
* within the code by checking that the overall flags are non-zero.
* It is only uesd directly when the sandbox flags are initially set up.
*/
const unsigned long SANDBOXED_NAVIGATION = 0x1;
--- a/dom/base/nsTextNode.h
+++ b/dom/base/nsTextNode.h
@@ -21,18 +21,18 @@ class nsNodeInfoManager;
* Class used to implement DOM text nodes
*/
class nsTextNode : public mozilla::dom::Text,
public nsIDOMText
{
private:
void Init()
{
- NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
- "Bad NodeType in aNodeInfo");
+ MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
+ "Bad NodeType in aNodeInfo");
}
public:
explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: mozilla::dom::Text(aNodeInfo)
{
Init();
}
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1098,18 +1098,18 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
sheet->SetPrincipal(aDocument->NodePrincipal());
// Create the CSS parser, and parse the CSS text.
nsCSSParser parser(nullptr, sheet);
rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
aDocument->NodePrincipal(), 0, false);
NS_ENSURE_SUCCESS(rv, true);
// Mark the sheet as complete.
- NS_ABORT_IF_FALSE(!sheet->IsModified(),
- "should not get marked modified during parsing");
+ MOZ_ASSERT(!sheet->IsModified(),
+ "should not get marked modified during parsing");
sheet->SetComplete();
// Loop through all the rules found in the CSS text
int32_t ruleCount = sheet->StyleRuleCount();
for (int32_t i = 0; i < ruleCount; ++i) {
mozilla::css::Rule* rule = sheet->GetStyleRuleAt(i);
if (!rule)
continue;
switch (rule->GetType()) {
--- a/dom/base/nsXMLHttpRequest.cpp
+++ b/dom/base/nsXMLHttpRequest.cpp
@@ -316,17 +316,17 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
{
mState |= XML_HTTP_REQUEST_DELETED;
if (mState & (XML_HTTP_REQUEST_SENT |
XML_HTTP_REQUEST_LOADING)) {
Abort();
}
- NS_ABORT_IF_FALSE(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang");
+ MOZ_ASSERT(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang");
mState &= ~XML_HTTP_REQUEST_SYNCLOOPING;
mResultJSON.setUndefined();
mResultArrayBuffer = nullptr;
mozilla::DropJSObjects(this);
}
void
@@ -1910,17 +1910,17 @@ NS_IMETHODIMP
nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
nsISupports *ctxt,
nsIInputStream *inStr,
uint64_t sourceOffset,
uint32_t count)
{
NS_ENSURE_ARG_POINTER(inStr);
- NS_ABORT_IF_FALSE(mContext.get() == ctxt,"start context different from OnDataAvailable context");
+ MOZ_ASSERT(mContext.get() == ctxt,"start context different from OnDataAvailable context");
mProgressSinceLastProgressEvent = true;
bool cancelable = false;
if ((mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB ||
mResponseType == XML_HTTP_RESPONSE_TYPE_MOZ_BLOB) && !mDOMFile) {
cancelable = CreateDOMFile(request);
// The nsIStreamListener contract mandates us
@@ -3231,18 +3231,18 @@ nsXMLHttpRequest::SetTimeout(uint32_t aT
if (mRequestSentTime) {
StartTimeoutTimer();
}
}
void
nsXMLHttpRequest::StartTimeoutTimer()
{
- NS_ABORT_IF_FALSE(mRequestSentTime,
- "StartTimeoutTimer mustn't be called before the request was sent!");
+ MOZ_ASSERT(mRequestSentTime,
+ "StartTimeoutTimer mustn't be called before the request was sent!");
if (mState & XML_HTTP_REQUEST_DONE) {
// do nothing!
return;
}
if (mTimeoutTimer) {
mTimeoutTimer->Cancel();
}
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164.html
@@ -0,0 +1,15 @@
+<html>
+<head> <meta charset="utf-8"> </head>
+ <body>
+ <!-- sandbox="allow-same-origin" -->
+ <!-- Content-Security-Policy: default-src 'self' -->
+
+ <!-- these should be stopped by CSP -->
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img_bad&type=img/png"> </img>
+
+ <!-- these should load ok -->
+ <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img_good&type=img/png" />
+ <script src='/tests/dom/base/test/csp/file_CSP.sjs?testid=scripta_bad&type=text/javascript'></script>
+
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'self'
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_2.html
@@ -0,0 +1,14 @@
+<html>
+<head> <meta charset="utf-8"> </head>
+ <body>
+ <!-- sandbox -->
+ <!-- Content-Security-Policy: default-src 'self' -->
+
+ <!-- these should be stopped by CSP -->
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img2_bad&type=img/png"> </img>
+
+ <!-- these should load ok -->
+ <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img2a_good&type=img/png" />
+
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_2.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'self'
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_3.html
@@ -0,0 +1,12 @@
+<html>
+<head> <meta charset="utf-8"> </head>
+ <body>
+ <!-- sandbox -->
+ <!-- Content-Security-Policy: default-src 'none' -->
+
+ <!-- these should be stopped by CSP -->
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img3_bad&type=img/png"> </img>
+ <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img3a_bad&type=img/png" />
+
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_3.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'none'
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_4.html
@@ -0,0 +1,12 @@
+<html>
+<head> <meta charset="utf-8"> </head>
+ <body>
+ <!-- sandbox -->
+ <!-- Content-Security-Policy: default-src 'none' -->
+
+ <!-- these should be stopped by CSP -->
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img4_bad&type=img/png"> </img>
+ <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img4a_bad&type=img/png" />
+
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_4.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'none'
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_5.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+<head> <meta charset="utf-8"> </head>
+<script type="text/javascript">
+ function ok(result, desc) {
+ window.parent.postMessage({ok: result, desc: desc}, "*");
+ }
+
+ function doStuff() {
+ ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
+ }
+</script>
+<script src='file_iframe_sandbox_pass.js'></script>
+<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
+ I am sandboxed but with only inline "allow-scripts"
+
+ <!-- sandbox="allow-scripts" -->
+ <!-- Content-Security-Policy: default-src 'none' 'unsafe-inline'-->
+
+ <!-- these should be stopped by CSP -->
+ <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img5_bad&type=img/png" />
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img5a_bad&type=img/png"> </img>
+ <script src='/tests/dom/base/test/csp/file_CSP.sjs?testid=script5_bad&type=text/javascript'></script>
+ <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script5a_bad&type=text/javascript'></script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_5.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'none' 'unsafe-inline';
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_6.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+</head>
+<script type="text/javascript">
+ function ok(result, desc) {
+ window.parent.postMessage({ok: result, desc: desc}, "*");
+ }
+
+ function doStuff() {
+ ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
+
+ document.getElementById('a_form').submit();
+
+ // trigger the javascript: url test
+ sendMouseEvent({type:'click'}, 'a_link');
+ }
+</script>
+<script src='file_iframe_sandbox_pass.js'></script>
+<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
+ I am sandboxed but with "allow-scripts"
+ <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img6_bad&type=img/png"> </img>
+ <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script6_bad&type=text/javascript'></script>
+
+ <form method="get" action="file_iframe_sandbox_form_fail.html" id="a_form">
+ First name: <input type="text" name="firstname">
+ Last name: <input type="text" name="lastname">
+ <input type="submit" onclick="doSubmit()" id="a_button">
+ </form>
+
+ <a href = 'javascript:ok(true, "documents sandboxed with allow-scripts should be able to run script from javascript: URLs");' id='a_link'>click me</a>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/csp/file_bug886164_6.html^headers^
@@ -0,0 +1,1 @@
+Content-Security-Policy: default-src 'self' 'unsafe-inline';
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_1.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- sandbox="allow-same-origin" -->
- <!-- Content-Security-Policy: default-src 'self' -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img1_bad&type=img/png"> </img>
-
- <!-- these should load ok -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img1a_good&type=img/png" />
- <!-- should not execute script -->
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_10.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- Content-Security-Policy: default-src 'none'; sandbox -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img10_bad&type=img/png"> </img>
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img10a_bad&type=img/png" />
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_11.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head> <meta charset="utf-8"> </head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
- }
-
- function doStuff() {
- ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
- }
-</script>
-<script src='file_csp_sandbox_fail.js'></script>
-<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
- I am sandboxed but with only inline "allow-scripts"
-
- <!-- Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'; sandbox allow-scripts -->
-
- <!-- these should be stopped by CSP -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img11_bad&type=img/png" />
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img11a_bad&type=img/png"> </img>
- <script src='/tests/dom/base/test/csp/file_CSP.sjs?testid=script11_bad&type=text/javascript'></script>
- <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script11a_bad&type=text/javascript'></script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_12.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-</head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
- }
-
- function doStuff() {
- ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
-
- document.getElementById('a_form').submit();
-
- // trigger the javascript: url test
- sendMouseEvent({type:'click'}, 'a_link');
- }
-</script>
-<script src='file_csp_sandbox_pass.js'></script>
-<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
- I am sandboxed but with "allow-same-origin" and allow-scripts"
-
-
- <!-- Content-Security-Policy: sandbox allow-same-origin allow-scripts; default-src 'self' 'unsafe-inline'; -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img12_bad&type=img/png"> </img>
- <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script12_bad&type=text/javascript'></script>
-
- <form method="get" action="/tests/content/html/content/test/file_iframe_sandbox_form_fail.html" id="a_form">
- First name: <input type="text" name="firstname">
- Last name: <input type="text" name="lastname">
- <input type="submit" onclick="doSubmit()" id="a_button">
- </form>
-
- <a href = 'javascript:ok(true, "documents sandboxed with allow-scripts should be able to run script from javascript: URLs");' id='a_link'>click me</a>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_2.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- sandbox -->
- <!-- Content-Security-Policy: default-src 'self' -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img2_bad&type=img/png"> </img>
-
- <!-- these should load ok -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img2a_good&type=img/png" />
- <!-- should not execute script -->
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_3.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- sandbox="allow-same-origin" -->
- <!-- Content-Security-Policy: default-src 'none' -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img3_bad&type=img/png"> </img>
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img3a_bad&type=img/png" />
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_4.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- sandbox -->
- <!-- Content-Security-Policy: default-src 'none' -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img4_bad&type=img/png"> </img>
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img4a_bad&type=img/png" />
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_5.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head> <meta charset="utf-8"> </head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
- }
-
- function doStuff() {
- ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
- }
-</script>
-<script src='file_csp_sandbox_fail.js'></script>
-<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
- I am sandboxed but with only inline "allow-scripts"
-
- <!-- sandbox="allow-scripts" -->
- <!-- Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline' -->
-
- <!-- these should be stopped by CSP -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img5_bad&type=img/png" />
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img5a_bad&type=img/png"> </img>
- <script src='/tests/dom/base/test/csp/file_CSP.sjs?testid=script5_bad&type=text/javascript'></script>
- <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script5a_bad&type=text/javascript'></script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_6.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-</head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
- }
-
- function doStuff() {
- ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
-
- document.getElementById('a_form').submit();
-
- // trigger the javascript: url test
- sendMouseEvent({type:'click'}, 'a_link');
- }
-</script>
-<script src='file_csp_sandbox_pass.js'></script>
-<body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
- I am sandboxed but with "allow-same-origin" and allow-scripts"
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img6_bad&type=img/png"> </img>
- <script src='http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=script6_bad&type=text/javascript'></script>
-
- <form method="get" action="/tests/content/html/content/test/file_iframe_sandbox_form_fail.html" id="a_form">
- First name: <input type="text" name="firstname">
- Last name: <input type="text" name="lastname">
- <input type="submit" onclick="doSubmit()" id="a_button">
- </form>
-
- <a href = 'javascript:ok(true, "documents sandboxed with allow-scripts should be able to run script from javascript: URLs");' id='a_link'>click me</a>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_7.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- Content-Security-Policy: default-src 'self'; sandbox allow-same-origin -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img7_bad&type=img/png"> </img>
-
- <!-- these should load ok -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img7a_good&type=img/png" />
- <!-- should not execute script -->
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_8.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- Content-Security-Policy: sandbox; default-src 'self' -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img8_bad&type=img/png"> </img>
-
- <!-- these should load ok -->
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img8a_good&type=img/png" />
- <!-- should not execute script -->
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
-
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_9.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
-<head> <meta charset="utf-8"> </head>
- <body>
- <!-- Content-Security-Policy: default-src 'none'; sandbox allow-same-origin -->
-
- <!-- these should be stopped by CSP -->
- <img src="http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=img9_bad&type=img/png"> </img>
- <img src="/tests/dom/base/test/csp/file_CSP.sjs?testid=img9a_bad&type=img/png" />
-
- <script src='/tests/dom/base/test/csp/file_csp_sandbox_fail.js'></script>
- </body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_fail.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
-}
-ok(false, "documents sandboxed with allow-scripts should NOT be able to run <script src=...>");
deleted file mode 100644
--- a/dom/base/test/csp/file_csp_sandbox_pass.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
-}
-ok(true, "documents sandboxed with allow-scripts should be able to run <script src=...>");
--- a/dom/base/test/csp/file_csp_testserver.sjs
+++ b/dom/base/test/csp/file_csp_testserver.sjs
@@ -25,30 +25,21 @@ function loadHTMLFromFile(path) {
function handleRequest(request, response)
{
var query = {};
request.queryString.split('&').forEach(function (val) {
var [name, value] = val.split('=');
query[name] = unescape(value);
});
+ var csp = unescape(query['csp']);
+ var file = unescape(query['file']);
+
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
- if (query['csp']) {
- var csp = unescape(query['csp']);
- // Deliver the CSP policy encoded in the URI
- response.setHeader("Content-Security-Policy", csp, false);
- }
+ // Deliver the CSP policy encoded in the URI
+ response.setHeader("Content-Security-Policy", csp, false);
- if (query['cspRO']) {
- var cspRO = unescape(query['cspRO']);
- // Deliver the CSP report-only policy encoded in the URI
- response.setHeader("Content-Security-Policy-Report-Only", cspRO, false);
- }
-
- if (query['file']) {
- var file = unescape(query['file']);
- // Send HTML to test allowed/blocked behaviors
- response.setHeader("Content-Type", "text/html", false);
- response.write(loadHTMLFromFile(file));
- }
+ // Send HTML to test allowed/blocked behaviors
+ response.setHeader("Content-Type", "text/html", false);
+ response.write(loadHTMLFromFile(file));
}
deleted file mode 100644
--- a/dom/base/test/csp/file_iframe_sandbox_csp_document_write.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head> <meta charset="utf-8"> </head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.postMessage({ok: result, desc: desc}, "*");
- }
- function doStuff() {
- var beforePrincipal = SpecialPowers.wrap(document).nodePrincipal;
- document.open();
- document.write("rewritten sandboxed document");
- document.close();
- var afterPrincipal = SpecialPowers.wrap(document).nodePrincipal;
- ok(beforePrincipal.equals(afterPrincipal),
- "document.write() does not change underlying principal");
- }
-</script>
-<body onLoad='doStuff();'>
- sandboxed with allow-scripts
-</body>
-</html>
--- a/dom/base/test/csp/mochitest.ini
+++ b/dom/base/test/csp/mochitest.ini
@@ -40,30 +40,28 @@ support-files =
file_csp_invalid_source_expression.html
file_CSP_main.html
file_CSP_main.html^headers^
file_CSP_main.js
file_bug836922_npolicies.html
file_bug836922_npolicies.html^headers^
file_bug836922_npolicies_ro_violation.sjs
file_bug836922_npolicies_violation.sjs
- file_csp_sandbox_pass.js
- file_csp_sandbox_fail.js
- file_csp_sandbox_1.html
- file_csp_sandbox_2.html
- file_csp_sandbox_3.html
- file_csp_sandbox_4.html
- file_csp_sandbox_5.html
- file_csp_sandbox_6.html
- file_csp_sandbox_7.html
- file_csp_sandbox_8.html
- file_csp_sandbox_9.html
- file_csp_sandbox_10.html
- file_csp_sandbox_11.html
- file_csp_sandbox_12.html
+ file_bug886164.html
+ file_bug886164.html^headers^
+ file_bug886164_2.html
+ file_bug886164_2.html^headers^
+ file_bug886164_3.html
+ file_bug886164_3.html^headers^
+ file_bug886164_4.html
+ file_bug886164_4.html^headers^
+ file_bug886164_5.html
+ file_bug886164_5.html^headers^
+ file_bug886164_6.html
+ file_bug886164_6.html^headers^
file_csp_bug768029.html
file_csp_bug768029.sjs
file_csp_bug773891.html
file_csp_bug773891.sjs
file_csp_redirects_main.html
file_csp_redirects_page.sjs
file_csp_redirects_resource.sjs
file_CSP_bug910139.sjs
@@ -102,18 +100,16 @@ support-files =
file_multi_policy_injection_bypass.html^headers^
file_multi_policy_injection_bypass_2.html
file_multi_policy_injection_bypass_2.html^headers^
file_form-action.html
file_worker_redirect.html
file_worker_redirect.sjs
file_csp_referrerdirective.html
referrerdirective.sjs
- test_iframe_sandbox_csp_top_1.html^headers^
- file_iframe_sandbox_csp_document_write.html
[test_base-uri.html]
[test_connect-src.html]
[test_CSP.html]
[test_csp_allow_https_schemes.html]
skip-if = buildapp == 'b2g' #no ssl support
[test_CSP_bug663567.html]
[test_CSP_bug802872.html]
@@ -121,26 +117,24 @@ skip-if = buildapp == 'b2g' #no ssl supp
[test_CSP_bug888172.html]
[test_CSP_evalscript.html]
[test_CSP_frameancestors.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # Times out, not sure why (bug 1008445)
[test_CSP_inlinescript.html]
[test_CSP_inlinestyle.html]
[test_csp_invalid_source_expression.html]
[test_bug836922_npolicies.html]
-[test_csp_sandbox.html]
+[test_bug886164.html]
[test_csp_redirects.html]
[test_CSP_bug910139.html]
[test_CSP_bug909029.html]
[test_policyuri_regression_from_multipolicy.html]
[test_nonce_source.html]
[test_CSP_bug941404.html]
[test_form-action.html]
-[test_iframe_sandbox_csp.html]
-[test_iframe_sandbox_csp_top_1.html]
skip-if = e10s || buildapp == 'b2g' # http-on-opening-request observers are not available in child processes
[test_hash_source.html]
skip-if = e10s || buildapp == 'b2g' # can't compute hashes in child process (bug 958702)
[test_self_none_as_hostname_confusion.html]
[test_bug949549.html]
[test_csp_path_matching.html]
[test_csp_path_matching_redirect.html]
[test_report_uri_missing_in_report_only_header.html]
deleted file mode 100644
--- a/dom/base/test/csp/test_csp_sandbox.html
+++ /dev/null
@@ -1,240 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Tests for bugs 886164 and 671389</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<p id="display"></p>
-<div id="content">
-</div>
-
-<script class="testbody" type="text/javascript">
-
-var testCases = [
- {
- // Test 1: don't load image from non-same-origin; allow loading
- // images from same-same origin
- sandboxAttribute: "allow-same-origin",
- csp: "default-src 'self'",
- file: "file_csp_sandbox_1.html",
- results: { img1a_good: -1, img1_bad: -1 }
- // fails if scripts execute
- },
- {
- // Test 2: don't load image from non-same-origin; allow loading
- // images from same-same origin, even without allow-same-origin
- // flag
- sandboxAttribute: "",
- csp: "default-src 'self'",
- file: "file_csp_sandbox_2.html",
- results: { img2_bad: -1, img2a_good: -1 }
- // fails if scripts execute
- },
- {
- // Test 3: disallow loading images from any host, even with
- // allow-same-origin flag set
- sandboxAttribute: "allow-same-origin",
- csp: "default-src 'none'",
- file: "file_csp_sandbox_3.html",
- results: { img3_bad: -1, img3a_bad: -1 },
- // fails if scripts execute
- },
- {
- // Test 4: disallow loading images from any host
- sandboxAttribute: "",
- csp: "default-src 'none'",
- file: "file_csp_sandbox_4.html",
- results: { img4_bad: -1, img4a_bad: -1 }
- // fails if scripts execute
- },
- {
- // Test 5: disallow loading images or scripts, allow inline scripts
- sandboxAttribute: "allow-scripts",
- csp: "default-src 'none'; script-src 'unsafe-inline';",
- file: "file_csp_sandbox_5.html",
- results: { img5_bad: -1, img5a_bad: -1, script5_bad: -1, script5a_bad: -1 },
- nrOKmessages: 2 // sends 2 ok message
- // fails if scripts execute
- },
- {
- // Test 6: disallow non-same-origin images, allow inline and same origin scripts
- sandboxAttribute: "allow-same-origin allow-scripts",
- csp: "default-src 'self' 'unsafe-inline';",
- file: "file_csp_sandbox_6.html",
- results: { img6_bad: -1, script6_bad: -1 },
- nrOKmessages: 4 // sends 4 ok message
- // fails if forms are not disallowed
- },
- {
- // Test 7: same as Test 1
- csp: "default-src 'self'; sandbox allow-same-origin",
- file: "file_csp_sandbox_7.html",
- results: { img7a_good: -1, img7_bad: -1 }
- },
- {
- // Test 8: same as Test 2
- csp: "sandbox; default-src 'self'",
- file: "file_csp_sandbox_8.html",
- results: { img8_bad: -1, img8a_good: -1 }
- },
- {
- // Test 9: same as Test 3
- csp: "default-src 'none'; sandbox allow-same-origin",
- file: "file_csp_sandbox_9.html",
- results: { img9_bad: -1, img9a_bad: -1 }
- },
- {
- // Test 10: same as Test 4
- csp: "default-src 'none'; sandbox",
- file: "file_csp_sandbox_10.html",
- results: { img10_bad: -1, img10a_bad: -1 }
- },
- {
- // Test 11: same as Test 5
- csp: "default-src 'none'; script-src 'unsafe-inline'; sandbox allow-scripts",
- file: "file_csp_sandbox_11.html",
- results: { img11_bad: -1, img11a_bad: -1, script11_bad: -1, script11a_bad: -1 },
- nrOKmessages: 2 // sends 2 ok message
- },
- {
- // Test 12: same as Test 6
- csp: "sandbox allow-same-origin allow-scripts; default-src 'self' 'unsafe-inline';",
- file: "file_csp_sandbox_12.html",
- results: { img12_bad: -1, script12_bad: -1 },
- nrOKmessages: 4 // sends 4 ok message
- },
-];
-
-// a postMessage handler that is used by sandboxed iframes without
-// 'allow-same-origin' to communicate pass/fail back to this main page.
-// it expects to be called with an object like:
-// { ok: true/false,
-// desc: <description of the test> which it then forwards to ok() }
-window.addEventListener("message", receiveMessage, false);
-
-function receiveMessage(event) {
- ok_wrapper(event.data.ok, event.data.desc);
-}
-
-var completedTests = 0;
-var passedTests = 0;
-
-var totalTests = (function() {
- var nrCSPloadTests = 0;
- for(var i = 0; i < testCases.length; i++) {
- nrCSPloadTests += Object.keys(testCases[i].results).length;
- if (testCases[i].nrOKmessages) {
- // + number of expected postMessages from iframe
- nrCSPloadTests += testCases[i].nrOKmessages;
- }
- }
- return nrCSPloadTests;
-})();
-
-function ok_wrapper(result, desc) {
- ok(result, desc);
-
- completedTests++;
-
- if (result) {
- passedTests++;
- }
-
- if (completedTests === totalTests) {
- window.examiner.remove();
- SimpleTest.finish();
- }
-}
-
-// Set the iframe src and sandbox attribute
-function runTest(test) {
- var iframe = document.createElement('iframe');
-
- document.getElementById('content').appendChild(iframe);
-
- // set sandbox attribute
- if (test.sandboxAttribute !== undefined) {
- iframe.sandbox = test.sandboxAttribute;
- }
-
- // set query string
- var src = 'file_csp_testserver.sjs';
- // path where the files are
- var path = '/tests/dom/base/test/csp/';
-
- src += '?file=' + escape(path+test.file);
-
- if (test.csp !== undefined) {
- src += '&csp=' + escape(test.csp);
- }
-
- iframe.src = src;
- iframe.width = iframe.height = 10;
-}
-
-// Examiner related
-
-// This is used to watch the blocked data bounce off CSP and allowed data
-// get sent out to the wire.
-function examiner() {
- SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
- SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
-}
-
-examiner.prototype = {
- observe: function(subject, topic, data) {
- var testpat = new RegExp("testid=([a-z0-9_]+)");
-
- //_good things better be allowed!
- //_bad things better be stopped!
-
- if (topic === "specialpowers-http-notify-request") {
- //these things were allowed by CSP
- var uri = data;
- if (!testpat.test(uri)) return;
- var testid = testpat.exec(uri)[1];
-
- if(/_good/.test(testid)) {
- ok_wrapper(true, uri + " is allowed by csp");
- } else {
- ok_wrapper(false, uri + " should not be allowed by csp");
- }
- }
-
- if(topic === "csp-on-violate-policy") {
- //these were blocked... record that they were blocked
- var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec");
- if (!testpat.test(asciiSpec)) return;
- var testid = testpat.exec(asciiSpec)[1];
- if(/_bad/.test(testid)) {
- ok_wrapper(true, asciiSpec + " was blocked by \"" + data + "\"");
- } else {
- ok_wrapper(false, asciiSpec + " should have been blocked by \"" + data + "\"");
- }
- }
- },
-
- // must eventually call this to remove the listener,
- // or mochitests might get borked.
- remove: function() {
- SpecialPowers.removeObserver(this, "csp-on-violate-policy");
- SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
- }
-}
-
-window.examiner = new examiner();
-
-SimpleTest.waitForExplicitFinish();
-
-(function() { // Run tests:
- for(var i = 0; i < testCases.length; i++) {
- runTest(testCases[i]);
- }
-})();
-
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/test_iframe_sandbox_csp.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=671389
-Bug 671389 - Implement CSP sandbox directive
--->
-<head>
- <meta charset="utf-8">
- <title>Tests for Bug 671389</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<script type="application/javascript">
-
- SimpleTest.waitForExplicitFinish();
-
- // Check if two sandbox flags are the same, ignoring case-sensitivity.
- // getSandboxFlags returns a list of sandbox flags (if any) or
- // null if the flag is not set.
- // This function checks if two flags are the same, i.e., they're
- // either not set or have the same flags.
- function eqFlags(a, b) {
- if (a === null && b === null) { return true; }
- if (a === null || b === null) { return false; }
- if (a.length !== b.length) { return false; }
- var a_sorted = a.map(function(e) { return e.toLowerCase(); }).sort();
- var b_sorted = b.map(function(e) { return e.toLowerCase(); }).sort();
- for (var i in a_sorted) {
- if (a_sorted[i] !== b_sorted[i]) {
- return false;
- }
- }
- return true;
- }
-
- // Get the sandbox flags of document doc.
- // If the flag is not set sandboxFlagsAsString returns null,
- // this function also returns null.
- // If the flag is set it may have some flags; in this case
- // this function returns the (potentially empty) list of flags.
- function getSandboxFlags(doc) {
- var flags = doc.sandboxFlagsAsString;
- if (flags === null) { return null; }
- return flags? flags.split(" "):[];
- }
-
- // Constructor for a CSP sandbox flags test. The constructor
- // expectes a description 'desc' and set of options 'opts':
- // - sandboxAttribute: [null] or string corresponding to the iframe sandbox attributes
- // - csp: [null] or string corresponding to the CSP sandbox flags
- // - cspReportOnly: [null] or string corresponding to the CSP report-only sandbox flags
- // - file: [null] or string corresponding to file the server should serve
- // Above, we use [brackets] to denote default values.
- function CSPFlagsTest(desc, opts) {
- function ifundef(x, v) {
- return (x !== undefined) ? x : v;
- }
-
- function intersect(as, bs) { // Intersect two csp attributes:
- as = as === null ? null
- : as.split(' ').filter(function(x) { return !!x; });
- bs = bs === null ? null
- : bs.split(' ').filter(function(x) { return !!x; });
-
- if (as === null) { return bs; }
- if (bs === null) { return as; }
-
- var cs = [];
- as.forEach(function(a) {
- if (a && bs.indexOf(a) != -1)
- cs.push(a);
- });
- return cs;
- }
-
- this.desc = desc || "Untitled test";
- this.attr = ifundef(opts.sandboxAttribute, null);
- this.csp = ifundef(opts.csp, null);
- this.cspRO = ifundef(opts.cspReportOnly, null);
- this.file = ifundef(opts.file, null);
- this.expected = intersect(this.attr, this.csp);
- }
-
- // Return function that checks that the actual flags are the same as the
- // expected flags
- CSPFlagsTest.prototype.checkFlags = function(iframe) {
- var this_ = this;
- return function() {
- try {
- var actual = getSandboxFlags(SpecialPowers.wrap(iframe).contentDocument);
- ok(eqFlags(actual, this_.expected),
- this_.desc, 'expected: "' + this_.expected + '", got: "' + actual + '"');
- } catch (e) {
- ok(false, this_.desc, 'expected: "' + this_.expected + '", failed with: "' + e + '"');
- }
- runNextTest();
- };
- };
-
- // Set the iframe src and sandbox attribute
- CSPFlagsTest.prototype.runTest = function () {
- var iframe = document.createElement('iframe');
- document.getElementById("content").appendChild(iframe);
- iframe.onload = this.checkFlags(iframe);
-
- // set sandbox attribute
- if (this.attr === null) {
- iframe.removeAttribute('sandbox');
- } else {
- iframe.sandbox = this.attr;
- }
-
- // set query string
- var src = 'file_csp_testserver.sjs';
-
- var delim = '?';
-
- if (this.csp !== null) {
- src += delim + 'csp=' + escape('sandbox ' + this.csp);
- delim = '&';
- }
-
- if (this.cspRO !== null) {
- src += delim + 'cspRO=' + escape('sandbox ' + this.cspRO);
- delim = '&';
- }
-
- if (this.file !== null) {
- src += delim + 'file=' + escape(this.file);
- delim = '&';
- }
-
- iframe.src = src;
- iframe.width = iframe.height = 10;
-
- }
-
- testCases = [
- {
- desc: "Test 1: Header should not override attribute",
- sandboxAttribute: "",
- csp: "allow-forms aLLOw-POinter-lock alLOW-popups aLLOW-SAME-ORIGin ALLOW-SCRIPTS allow-top-navigation"
- },
- {
- desc: "Test 2: Attribute should not override header",
- sandboxAttribute: "sandbox allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation",
- csp: ""
- },
- {
- desc: "Test 3: Header and attribute intersect",
- sandboxAttribute: "allow-same-origin allow-scripts",
- csp: "allow-forms allow-same-origin allow-scripts"
- },
- {
- desc: "Test 4: CSP sandbox sets the right flags (pt 1)",
- csp: "alLOW-FORms ALLOW-pointer-lock allow-popups allow-same-origin allow-scripts ALLOW-TOP-NAVIGation"
- },
- {
- desc: "Test 5: CSP sandbox sets the right flags (pt 2)",
- csp: "allow-same-origin allow-TOP-navigation"
- },
- {
- desc: "Test 6: CSP sandbox sets the right flags (pt 3)",
- csp: "allow-FORMS ALLOW-scripts"
- },
- {
- desc: "Test 7: CSP sandbox sets the right flags (pt 4)",
- csp: ""
- },
- {
- desc: "Test 8: CSP sandbox sets the right flags (pt 5)",
- csp: null
- },
- {
- desc: "Test 9: Read-only header should not override attribute",
- sandboxAttribute: "",
- cspReportOnly: "allow-forms ALLOW-pointer-lock allow-POPUPS allow-same-origin ALLOW-scripts allow-top-NAVIGATION"
- },
- {
- desc: "Test 10: Read-only header should not override CSP header",
- csp: "allow-forms allow-scripts",
- cspReportOnly: "allow-forms aLlOw-PoInTeR-lOcK aLLow-pOPupS aLLoW-SaME-oRIgIN alLow-scripts allow-tOp-navigation"
- },
- {
- desc: "Test 11: Read-only header should not override attribute or CSP header",
- sandboxAttribute: "allow-same-origin allow-scripts",
- csp: "allow-forms allow-same-origin allow-scripts",
- cspReportOnly: "allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation"
- },
- {
- desc: "Test 12: CSP sandbox not affected by document.write()",
- csp: "allow-scripts",
- file: 'tests/dom/base/test/csp/file_iframe_sandbox_csp_document_write.html'
- },
- ].map(function(t) { return (new CSPFlagsTest(t.desc,t)); });
-
-
- var testCaseIndex = 0;
-
- // Track ok messages from iframes
- var childMessages = 0;
- var totalChildMessages = 1;
-
-
- // Check to see if we ran all the tests and received all messges
- // from child iframes. If so, finish.
- function tryFinish() {
- if (testCaseIndex === testCases.length && childMessages === totalChildMessages){
- SimpleTest.finish();
- }
- }
-
- function runNextTest() {
-
- tryFinish();
-
- if (testCaseIndex < testCases.length) {
- testCases[testCaseIndex].runTest();
- testCaseIndex++;
- }
- }
-
- function receiveMessage(event) {
- ok(event.data.ok, event.data.desc);
- childMessages++;
- tryFinish();
- }
-
- window.addEventListener("message", receiveMessage, false);
-
- addLoadEvent(runNextTest);
-</script>
-<body>
- <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=671389">Mozilla Bug 671389</a> - Implement CSP sandbox directive
- <p id="display"></p>
- <div id="content">
- </div>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/test_iframe_sandbox_csp_top_1.html
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=671389
-Bug 671389 - Implement CSP sandbox directive
-
-Tests CSP sandbox attribute on top-level page.
-
-Minimal flags: allow-same-origin allow-scripts:
-Since we need to load the SimpleTest files, we have to set the
-allow-same-origin flag. Additionally, we set the allow-scripts flag
-since we need JS to check the flags.
-
-Though not necessary, for this test we also set the allow-forms flag.
-We may later wish to extend the testing suite with sandbox_csp_top_*
-tests that set different permutations of the flags.
-
-CSP header: Content-Security-Policy: sandbox allow-forms allow-scripts allow-same-origin
--->
-<head>
- <meta charset="utf-8">
- <title>Tests for Bug 671389</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<script type="application/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-// Check if two sandbox flags are the same.
-// getSandboxFlags returns a list of sandbox flags (if any) or
-// null if the flag is not set.
-// This function checks if two flags are the same, i.e., they're
-// either not set or have the same flags.
-function eqFlags(a, b) {
- if (a === null && b === null) { return true; }
- if (a === null || b === null) { return false; }
- if (a.length !== b.length) { return false; }
- var a_sorted = a.sort();
- var b_sorted = b.sort();
- for (var i in a_sorted) {
- if (a_sorted[i] !== b_sorted[i]) {
- return false;
- }
- }
- return true;
-}
-
-// Get the sandbox flags of document doc.
-// If the flag is not set sandboxFlagsAsString returns null,
-// this function also returns null.
-// If the flag is set it may have some flags; in this case
-// this function returns the (potentially empty) list of flags.
-function getSandboxFlags(doc) {
- var flags = doc.sandboxFlagsAsString;
- if (flags === null) { return null; }
- return flags? flags.split(" "):[];
-}
-
-function checkFlags(expected) {
- try {
- var flags = getSandboxFlags(SpecialPowers.wrap(document));
- ok(eqFlags(flags, expected), name + ' expected: "' + expected + '", got: "' + flags + '"');
- } catch (e) {
- ok(false, name + ' expected "' + expected + ', but failed with ' + e);
- }
- SimpleTest.finish();
-}
-
-</script>
-
-<body onLoad='checkFlags(["allow-forms", "allow-scripts", "allow-same-origin"]);'>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=671389">Mozilla Bug 671389</a> - Implement CSP sandbox directive
-<p id="display"></p>
-<div id="content">
- I am a top-level page sandboxed with "allow-scripts allow-forms
- allow-same-origin".
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/dom/base/test/csp/test_iframe_sandbox_csp_top_1.html^headers^
+++ /dev/null
@@ -1,1 +0,0 @@
-Content-Security-Policy: sAnDbOx aLLow-FOrms aLlOw-ScRiPtS ALLOW-same-origin
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -246,19 +246,18 @@ static uint32_t CountNewlinesInXPLength(
{
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
"aContent is not a text node!");
const nsTextFragment* text = aContent->GetText();
if (!text) {
return 0;
}
// For automated tests, we should abort on debug build.
- NS_ABORT_IF_FALSE(
- (aXPLength == UINT32_MAX || aXPLength <= text->GetLength()),
- "aXPLength is out-of-bounds");
+ MOZ_ASSERT(aXPLength == UINT32_MAX || aXPLength <= text->GetLength(),
+ "aXPLength is out-of-bounds");
const uint32_t length = std::min(aXPLength, text->GetLength());
uint32_t newlines = 0;
for (uint32_t i = 0; i < length; ++i) {
if (text->CharAt(i) == '\n') {
++newlines;
}
}
return newlines;
@@ -278,17 +277,17 @@ static uint32_t CountNewlinesInNativeLen
(aNativeLength == UINT32_MAX || aNativeLength <= text->GetLength() * 2),
"aNativeLength is unexpected value");
const uint32_t xpLength = text->GetLength();
uint32_t newlines = 0;
for (uint32_t i = 0, nativeOffset = 0;
i < xpLength && nativeOffset < aNativeLength;
++i, ++nativeOffset) {
// For automated tests, we should abort on debug build.
- NS_ABORT_IF_FALSE(i < text->GetLength(), "i is out-of-bounds");
+ MOZ_ASSERT(i < text->GetLength(), "i is out-of-bounds");
if (text->CharAt(i) == '\n') {
++newlines;
++nativeOffset;
}
}
return newlines;
}
#endif
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -345,17 +345,17 @@ FetchDriver::HttpFetch(bool aCORSFlag, b
// From here on we create a channel and set its properties with the
// information from the InternalRequest. This is an implementation detail.
MOZ_ASSERT(mLoadGroup);
nsCOMPtr<nsIChannel> chan;
rv = NS_NewChannel(getter_AddRefs(chan),
uri,
mPrincipal,
nsILoadInfo::SEC_NORMAL,
- mRequest->GetContext(),
+ mRequest->ContentPolicyType(),
mLoadGroup,
nullptr, /* aCallbacks */
nsIRequest::LOAD_NORMAL | credentialsFlag,
ios);
mLoadGroup = nullptr;
if (NS_WARN_IF(NS_FAILED(rv))) {
FailWithNetworkError();
return rv;
--- a/dom/fetch/InternalRequest.cpp
+++ b/dom/fetch/InternalRequest.cpp
@@ -31,17 +31,17 @@ InternalRequest::GetRequestConstructorCo
copy->mForceOriginHeader = true;
// The "client" is not stored in our implementation. Fetch API users should
// use the appropriate window/document/principal and other Gecko security
// mechanisms as appropriate.
copy->mSameOriginDataURL = true;
copy->mPreserveContentCodings = true;
// The default referrer is already about:client.
- copy->mContext = nsIContentPolicy::TYPE_FETCH;
+ copy->mContentPolicyType = nsIContentPolicy::TYPE_FETCH;
copy->mMode = mMode;
copy->mCredentialsMode = mCredentialsMode;
copy->mCacheMode = mCacheMode;
return copy.forget();
}
InternalRequest::~InternalRequest()
{
--- a/dom/fetch/InternalRequest.h
+++ b/dom/fetch/InternalRequest.h
@@ -32,35 +32,26 @@ class Request;
class InternalRequest MOZ_FINAL
{
friend class Request;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(InternalRequest)
- enum ContextFrameType
- {
- FRAMETYPE_AUXILIARY = 0,
- FRAMETYPE_TOP_LEVEL,
- FRAMETYPE_NESTED,
- FRAMETYPE_NONE,
- };
-
enum ResponseTainting
{
RESPONSETAINT_BASIC,
RESPONSETAINT_CORS,
RESPONSETAINT_OPAQUE,
};
explicit InternalRequest()
: mMethod("GET")
, mHeaders(new InternalHeaders(HeadersGuardEnum::None))
- , mContextFrameType(FRAMETYPE_NONE)
, mReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR))
, mMode(RequestMode::No_cors)
, mCredentialsMode(RequestCredentials::Omit)
, mResponseTainting(RESPONSETAINT_BASIC)
, mCacheMode(RequestCache::Default)
, mAuthenticationFlag(false)
, mForceOriginHeader(false)
, mPreserveContentCodings(false)
@@ -76,18 +67,17 @@ public:
{
}
explicit InternalRequest(const InternalRequest& aOther)
: mMethod(aOther.mMethod)
, mURL(aOther.mURL)
, mHeaders(aOther.mHeaders)
, mBodyStream(aOther.mBodyStream)
- , mContext(aOther.mContext)
- , mContextFrameType(aOther.mContextFrameType)
+ , mContentPolicyType(aOther.mContentPolicyType)
, mReferrer(aOther.mReferrer)
, mMode(aOther.mMode)
, mCredentialsMode(aOther.mCredentialsMode)
, mResponseTainting(aOther.mResponseTainting)
, mCacheMode(aOther.mCacheMode)
, mAuthenticationFlag(aOther.mAuthenticationFlag)
, mForceOriginHeader(aOther.mForceOriginHeader)
, mPreserveContentCodings(aOther.mPreserveContentCodings)
@@ -235,19 +225,19 @@ public:
RequestCache
GetCacheMode() const
{
return mCacheMode;
}
nsContentPolicyType
- GetContext() const
+ ContentPolicyType() const
{
- return mContext;
+ return mContentPolicyType;
}
bool
UnsafeRequest() const
{
return mUnsafeRequest;
}
@@ -307,19 +297,17 @@ private:
nsCString mMethod;
nsCString mURL;
nsRefPtr<InternalHeaders> mHeaders;
nsCOMPtr<nsIInputStream> mBodyStream;
// nsContentPolicyType does not cover the complete set defined in the spec,
// but it is a good start.
- nsContentPolicyType mContext;
-
- ContextFrameType mContextFrameType;
+ nsContentPolicyType mContentPolicyType;
// Empty string: no-referrer
// "about:client": client (default)
// URL: an URL
nsString mReferrer;
RequestMode mMode;
RequestCredentials mCredentialsMode;
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -28,16 +28,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
Request::Request(nsIGlobalObject* aOwner, InternalRequest* aRequest)
: FetchBody<Request>()
, mOwner(aOwner)
, mRequest(aRequest)
+ , mContext(RequestContext::Fetch)
{
}
Request::~Request()
{
}
already_AddRefed<InternalRequest>
--- a/dom/fetch/Request.h
+++ b/dom/fetch/Request.h
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_Request_h
#define mozilla_dom_Request_h
+#include "nsIContentPolicy.h"
#include "nsISupportsImpl.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/InternalRequest.h"
// Required here due to certain WebIDL enums/classes being declared in both
// files.
#include "mozilla/dom/RequestBinding.h"
@@ -69,16 +70,29 @@ public:
}
RequestCache
Cache() const
{
return mRequest->GetCacheMode();
}
+ RequestContext
+ Context() const
+ {
+ return mContext;
+ }
+
+ // [ChromeOnly]
+ void
+ SetContext(RequestContext aContext)
+ {
+ mContext = aContext;
+ }
+
void
GetReferrer(nsAString& aReferrer) const
{
mRequest->GetReferrer(aReferrer);
}
InternalHeaders*
GetInternalHeaders() const
@@ -107,14 +121,15 @@ public:
GetInternalRequest();
private:
~Request();
nsCOMPtr<nsIGlobalObject> mOwner;
nsRefPtr<InternalRequest> mRequest;
// Lazily created.
nsRefPtr<Headers> mHeaders;
+ RequestContext mContext;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Request_h
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -396,18 +396,18 @@ HTMLImageElement::BeforeSetAttr(int32_t
nsresult
HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && mForm &&
(aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
aValue && !aValue->IsEmptyString()) {
// add the image to the hashtable as needed
- NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
- "Expected atom value for name/id");
+ MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom,
+ "Expected atom value for name/id");
mForm->AddImageElementToTable(this,
nsDependentAtomString(aValue->GetAtomValue()));
}
// Handle src/srcset/crossorigin updates. If aNotify is false, we are coming
// from the parser or some such place; we'll get bound after all the
// attributes have been set, so we'll do the image load from BindToTree.
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -270,17 +270,17 @@ class HTMLMediaElement::MediaLoadListene
NS_DECL_NSIOBSERVER
NS_DECL_NSIINTERFACEREQUESTOR
public:
explicit MediaLoadListener(HTMLMediaElement* aElement)
: mElement(aElement),
mLoadID(aElement->GetCurrentLoadID())
{
- NS_ABORT_IF_FALSE(mElement, "Must pass an element to call back");
+ MOZ_ASSERT(mElement, "Must pass an element to call back");
}
private:
nsRefPtr<HTMLMediaElement> mElement;
nsCOMPtr<nsIStreamListener> mNextListener;
uint32_t mLoadID;
};
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -707,18 +707,18 @@ nsGenericHTMLElement::GetHrefURIForAncho
}
nsresult
nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (IsEventAttributeName(aName) && aValue) {
- NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
- "Expected string value for script body");
+ MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
+ "Expected string value for script body");
nsresult rv = SetEventHandler(aName, aValue->GetStringValue());
NS_ENSURE_SUCCESS(rv, rv);
}
else if (aNotify && aName == nsGkAtoms::spellcheck) {
SyncEditorsOnSubtree(this);
}
else if (aName == nsGkAtoms::dir) {
Directionality dir = eDir_LTR;
@@ -2147,18 +2147,18 @@ nsresult
nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
// add the control to the hashtable as needed
if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
aValue && !aValue->IsEmptyString()) {
- NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
- "Expected atom value for name/id");
+ MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom,
+ "Expected atom value for name/id");
mForm->AddElementToTable(this,
nsDependentAtomString(aValue->GetAtomValue()));
}
if (mForm && aName == nsGkAtoms::type) {
nsAutoString tmp;
GetAttr(kNameSpaceID_None, nsGkAtoms::name, tmp);
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1894,18 +1894,18 @@ nsHTMLDocument::WriteCommon(JSContext *c
1, getter_AddRefs(ignored));
// If Open() fails, or if it didn't create a parser (as it won't
// if the user chose to not discard the current document through
// onbeforeunload), don't write anything.
if (NS_FAILED(rv) || !mParser) {
return rv;
}
- NS_ABORT_IF_FALSE(!JS_IsExceptionPending(cx),
- "Open() succeeded but JS exception is pending");
+ MOZ_ASSERT(!JS_IsExceptionPending(cx),
+ "Open() succeeded but JS exception is pending");
}
static NS_NAMED_LITERAL_STRING(new_line, "\n");
// Save the data in cache if the write isn't from within the doc
if (mWyciwygChannel && !key) {
if (!aText.IsEmpty()) {
mWyciwygChannel->WriteToCacheEntry(aText);
@@ -2768,17 +2768,17 @@ nsHTMLDocument::EditingStateChanged()
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditor> existingEditor;
editSession->GetEditorForWindow(window, getter_AddRefs(existingEditor));
if (existingEditor) {
// We might already have an editor if it was set up for mail, let's see
// if this is actually the case.
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(existingEditor);
- NS_ABORT_IF_FALSE(htmlEditor, "If we have an editor, it must be an HTML editor");
+ MOZ_ASSERT(htmlEditor, "If we have an editor, it must be an HTML editor");
uint32_t flags = 0;
existingEditor->GetFlags(&flags);
if (flags & nsIPlaintextEditor::eEditorMailMask) {
// We already have a mail editor, then we should not attempt to create
// another one.
return NS_OK;
}
}
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -2102,17 +2102,17 @@ nsTextEditorState::UpdatePlaceholderVisi
if (mBoundFrame && aNotify) {
mBoundFrame->InvalidateFrame();
}
}
void
nsTextEditorState::HideSelectionIfBlurred()
{
- NS_ABORT_IF_FALSE(mSelCon, "Should have a selection controller if we have a frame!");
+ MOZ_ASSERT(mSelCon, "Should have a selection controller if we have a frame!");
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
if (!nsContentUtils::IsFocusedContent(content)) {
mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN);
}
}
NS_IMPL_ISUPPORTS(nsAnonDivObserver, nsIMutationObserver)
deleted file mode 100644
--- a/dom/html/test/file_iframe_sandbox_c_if9.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 671389</title>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
- I am
- <ul>
- <li>sandboxed but with "allow-forms", "allow-pointer-lock", "allow-popups", "allow-same-origin", "allow-scripts", and "allow-top-navigation", </li>
- <li>sandboxed but with "allow-same-origin", "allow-scripts", </li>
- <li>sandboxed, or </li>
- <li>not sandboxed.</li>
- </ul>
-</body>
-</html>
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -87,17 +87,16 @@ support-files =
file_iframe_sandbox_c_if1.html
file_iframe_sandbox_c_if2.html
file_iframe_sandbox_c_if3.html
file_iframe_sandbox_c_if4.html
file_iframe_sandbox_c_if5.html
file_iframe_sandbox_c_if6.html
file_iframe_sandbox_c_if7.html
file_iframe_sandbox_c_if8.html
- file_iframe_sandbox_c_if9.html
file_iframe_sandbox_close.html
file_iframe_sandbox_d_if1.html
file_iframe_sandbox_d_if10.html
file_iframe_sandbox_d_if11.html
file_iframe_sandbox_d_if12.html
file_iframe_sandbox_d_if13.html
file_iframe_sandbox_d_if14.html
file_iframe_sandbox_d_if15.html
--- a/dom/html/test/test_iframe_sandbox_general.html
+++ b/dom/html/test/test_iframe_sandbox_general.html
@@ -36,17 +36,17 @@ function ok_wrapper(result, desc) {
ok(result, desc);
completedTests++;
if (result) {
passedTests++;
}
- if (completedTests == 33) {
+ if (completedTests == 27) {
is(passedTests, completedTests, "There are " + completedTests + " general tests that should pass");
SimpleTest.finish();
}
}
function doTest() {
// passes twice if good
// 1) test that inline scripts (<script>) can run in an iframe sandboxed with "allow-scripts"
@@ -175,24 +175,16 @@ function doTest() {
// done via file_iframe_sandbox_c_if8.html, which has sandbox='allow-scripts allow-same-origin'
// fails if bad
// 28) Test that a sandboxed iframe can't open a new window using the target.attribute for a
// non-existing browsing context (BC341604).
// This is done via file_iframe_sandbox_c_if4.html which is sandboxed with "allow-scripts" and "allow-same-origin"
// the window it attempts to open calls window.opener.ok(false, ...) and file_iframe_c_if4.html has an ok()
// function that calls window.parent.ok_wrapper.
-
- // passes twice if good
- // 29-32) Test that sandboxFlagsAsString returns the set flags.
- // see if_14 and if_15
-
- // passes once if good
- // 33) Test that sandboxFlagsAsString returns null if iframe does not have sandbox flag set.
- // see if_16
}
addLoadEvent(doTest);
var started_if_9 = false;
var started_if_10 = false;
function start_if_9() {
@@ -215,46 +207,16 @@ function do_if_9() {
var if_9 = document.getElementById('if_9');
if_9.src = 'javascript:"<html><script>window.parent.ok_wrapper(false, \'an iframe sandboxed without allow-scripts should not execute script in a javascript URL in a newly set src attribute\');<\/script><\/html>"';
}
function do_if_10() {
var if_10 = document.getElementById('if_10');
if_10.src = 'javascript:"<html><script>window.parent.ok_wrapper(true, \'an iframe sandboxed with allow-scripts should execute script in a javascript URL in a newly set src attribute\');<\/script><\/html>"';
}
-
-function eqFlags(a, b) {
- // both a and b should be either null or have the array same flags
- if (a === null && b === null) { return true; }
- if (a === null || b === null) { return false; }
- if (a.length !== b.length) { return false; }
- var a_sorted = a.sort();
- var b_sorted = b.sort();
- for (var i in a_sorted) {
- if (a_sorted[i] !== b_sorted[i]) { return false; }
- }
- return true;
-}
-
-function getSandboxFlags(doc) {
- var flags = doc.sandboxFlagsAsString;
- if (flags === null) { return null; }
- return flags? flags.split(" "):[];
-}
-
-function test_sandboxFlagsAsString(name, expected) {
- var ifr = document.getElementById(name);
- try {
- var flags = getSandboxFlags(SpecialPowers.wrap(ifr).contentDocument);
- ok_wrapper(eqFlags(flags, expected), name + ' expected: "' + expected + '", got: "' + flags + '"');
- } catch (e) {
- ok_wrapper(false, name + ' expected "' + expected + ', but failed with ' + e);
- }
-}
-
</script>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=341604">Mozilla Bug 341604</a> - Implement HTML5 sandbox attribute for IFRAMEs
<p id="display"></p>
<div id="content">
<iframe sandbox="allow-same-origin allow-scripts" id="if_1" src="file_iframe_sandbox_c_if1.html" height="10" width="10"></iframe>
<iframe sandbox="aLlOw-SAME-oRiGin ALLOW-sCrIpTs" id="if_1_case_insensitive" src="file_iframe_sandbox_c_if1.html" height="10" width="10"></iframe>
<iframe sandbox="" id="if_2" src="file_iframe_sandbox_c_if2.html" height="10" width="10"></iframe>
@@ -267,17 +229,13 @@ function test_sandboxFlagsAsString(name,
<iframe sandbox="allow-same-originallow-scripts" id="if_6_d" src="file_iframe_sandbox_c_if6.html" height="10" width="10"></iframe>
<iframe sandbox="
allow-same-origin
allow-scripts
" id="if_6_e" src="file_iframe_sandbox_c_if6.html" height="10" width="10"></iframe>
<iframe sandbox="allow-same-origin" id='if_7' src="javascript:'<html><script>window.parent.ok_wrapper(false, \'an iframe sandboxed without allow-scripts should not execute script in a javascript URL in its src attribute\');<\/script><\/html>';" height="10" width="10"></iframe>
<iframe sandbox="allow-same-origin allow-scripts" id='if_8' src="javascript:'<html><script>window.parent.ok_wrapper(true, \'an iframe sandboxed without allow-scripts should execute script in a javascript URL in its src attribute\');<\/script><\/html>';" height="10" width="10"></iframe>
<iframe sandbox="allow-same-origin" onload='start_if_9()' id='if_9' src="about:blank" height="10" width="10"></iframe>
<iframe sandbox="allow-same-origin allow-scripts" onload='start_if_10()' id='if_10' src="about:blank" height="10" width="10"></iframe>
<iframe sandbox="allow-scripts" id='if_11' src="file_iframe_sandbox_c_if7.html" height="10" width="10"></iframe>
<iframe sandbox="allow-same-origin allow-scripts" id='if_12' src="file_iframe_sandbox_c_if8.html" height="10" width="10"></iframe>
-<iframe sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation " id='if_13' src="file_iframe_sandbox_c_if9.html" height="10" width="10" onload='test_sandboxFlagsAsString("if_13",["allow-forms", "allow-pointer-lock", "allow-popups", "allow-same-origin", "allow-scripts", "allow-top-navigation"])'></iframe>
-<iframe sandbox="	allow-same-origin	allow-scripts	" id="if_14" src="file_iframe_sandbox_c_if6.html" height="10" width="10" onload='test_sandboxFlagsAsString("if_14",["allow-same-origin","allow-scripts"])'></iframe>
-<iframe sandbox="" id="if_15" src="file_iframe_sandbox_c_if9.html" height="10" width="10" onload='test_sandboxFlagsAsString("if_15",[])'></iframe>
-<iframe id="if_16" src="file_iframe_sandbox_c_if9.html" height="10" width="10" onload='test_sandboxFlagsAsString("if_16",null)'></iframe>
<input type='button' id="a_button" onclick='do_if_9()'>
<input type='button' id="a_button2" onclick='do_if_10()'>
</div>
</body>
</html>
--- a/dom/identity/tests/mochitest/file_declareAudience.html
+++ b/dom/identity/tests/mochitest/file_declareAudience.html
@@ -14,17 +14,17 @@
<title>Test app for bug 947374</title>
</head>
<body>
<div id='test'>
<script type="application/javascript;version=1.8">
function postResults(message) {
- window.realParent.postMessage(JSON.stringify(message), "*");
+ doPostMessage(JSON.stringify(message), "*");
}
onmessage = function(event) {
try {
navigator.mozId.watch({
wantIssuer: "firefox-accounts",
audience: event.data.audience,
onready: function() {
--- a/dom/identity/tests/mochitest/file_syntheticEvents.html
+++ b/dom/identity/tests/mochitest/file_syntheticEvents.html
@@ -15,17 +15,17 @@
<title>Test app for bug 971379</title>
</head>
<body>
<div id='test'>
<script type="application/javascript;version=1.8">
function postResults(message) {
- window.realParent.postMessage(JSON.stringify(message), "*");
+ doPostMessage(JSON.stringify(message), "*");
}
onmessage = function(event) {
navigator.mozId.watch({
wantIssuer: event.data.wantIssuer,
onready: function() {
try {
navigator.mozId.request();
--- a/dom/identity/tests/mochitest/test_declareAudience.html
+++ b/dom/identity/tests/mochitest/test_declareAudience.html
@@ -219,18 +219,18 @@ function runTest() {
iframe.contentDocument
);
let principal = iframe.contentDocument.nodePrincipal;
is(principal.appStatus, app.appStatus,
"Iframe's document.nodePrincipal has expected appStatus");
// Because the <iframe mozapp> can't parent its way back to us, we
- // provide this handle to our window so it can postMessage to us.
- iframe.contentWindow.wrappedJSObject.realParent = window;
+ // provide this handle it can use to postMessage to us.
+ Components.utils.exportFunction(window.postMessage.bind(window), iframe.contentWindow, {defineAs: 'doPostMessage'});
// Test what we want to test, viz. whether or not the app can request
// an assertion with an audience the same as or different from its
// origin. The client will post back its success or failure in procuring
// an identity assertion from Firefox Accounts.
iframe.contentWindow.postMessage({
audience: app.wantAudience,
appIndex: _index
--- a/dom/identity/tests/mochitest/test_syntheticEvents.html
+++ b/dom/identity/tests/mochitest/test_syntheticEvents.html
@@ -171,18 +171,19 @@ function runTest() {
SpecialPowers.addPermission(
"firefox-accounts",
SpecialPowers.Ci.nsIPermissionManager.ALLOW_ACTION,
iframe.contentDocument
);
// Because the <iframe mozapp> can't parent its way back to us, we
- // provide this handle to our window so it can postMessage to us.
- iframe.contentWindow.wrappedJSObject.realParent = window;
+ // provide this handle it can use to postMessage to us.
+ Components.utils.exportFunction(window.postMessage.bind(window), iframe.contentWindow, {defineAs: 'doPostMessage'});
+
iframe.contentWindow.postMessage({
wantIssuer: app.wantIssuer,
appIndex: _index
}, "*");
}, false);
})(index);
yield undefined;
}
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -92,19 +92,19 @@ namespace dom {
namespace indexedDB {
using namespace mozilla::dom::quota;
using namespace mozilla::ipc;
#define DISABLE_ASSERTS_FOR_FUZZING 0
#if DISABLE_ASSERTS_FOR_FUZZING
-#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
+#define ASSERT_UNLESS_FUZZING() do { } while (0)
#else
-#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
+#define ASSERT_UNLESS_FUZZING() MOZ_ASSERT(false)
#endif
namespace {
class Cursor;
class Database;
struct DatabaseActorInfo;
class DatabaseLoggingInfo;
--- a/dom/interfaces/security/nsIContentSecurityPolicy.idl
+++ b/dom/interfaces/security/nsIContentSecurityPolicy.idl
@@ -15,17 +15,17 @@ interface nsIURI;
* nsIContentSecurityPolicy
* Describes an XPCOM component used to model and enforce CSPs. Instances of
* this class may have multiple policies within them, but there should only be
* one of these per document/principal.
*/
typedef unsigned short CSPDirective;
-[scriptable, uuid(9454a677-5342-4220-8154-e619410e07e7)]
+[scriptable, uuid(68434447-b816-4473-a731-efc4f6d59902)]
interface nsIContentSecurityPolicy : nsISerializable
{
/**
* Directives supported by Content Security Policy. These are enums for
* the CSPDirective type.
* The NO_DIRECTIVE entry is used for checking default permissions and
* returning failure when asking CSP which directive to check.
*
@@ -43,17 +43,16 @@ interface nsIContentSecurityPolicy : nsI
const unsigned short FONT_SRC_DIRECTIVE = 8;
const unsigned short CONNECT_SRC_DIRECTIVE = 9;
const unsigned short REPORT_URI_DIRECTIVE = 10;
const unsigned short FRAME_ANCESTORS_DIRECTIVE = 11;
const unsigned short REFLECTED_XSS_DIRECTIVE = 12;
const unsigned short BASE_URI_DIRECTIVE = 13;
const unsigned short FORM_ACTION_DIRECTIVE = 14;
const unsigned short REFERRER_DIRECTIVE = 15;
- const unsigned short SANDBOX_DIRECTIVE = 16;
/**
* Accessor method for a read-only string version of the policy at a given
* index.
*/
AString getPolicy(in unsigned long index);
/**
@@ -259,27 +258,16 @@ interface nsIContentSecurityPolicy : nsI
* directives that don't fall-back.
* @return
* Whether or not the provided URI is allowed by CSP under the given
* directive. (block the pending operation if false).
*/
boolean permits(in nsIURI aURI, in CSPDirective aDir, in boolean aSpecific);
/**
- * Delegate method called by the service when the protected document is loaded.
- * Returns the intersection of all the sandbox flags contained in
- * CSP policies. This is the most restricting sandbox policy.
- * See nsSandboxFlags.h for the possible flags.
- *
- * @return
- * sandbox flags or SANDBOXED_NONE if no sandbox directive exists
- */
- uint32_t getCSPSandboxFlags();
-
- /**
* Delegate method called by the service when sub-elements of the protected
* document are being loaded. Given a bit of information about the request,
* decides whether or not the policy is satisfied.
*
* Calls to this may trigger violation reports when queried, so
* this value should not be cached.
*/
short shouldLoad(in nsContentPolicyType aContentType,
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -50,19 +50,19 @@
#ifdef OS_POSIX
#include "chrome/common/file_descriptor_set_posix.h"
#endif
#define DISABLE_ASSERTS_FOR_FUZZING 0
#if DISABLE_ASSERTS_FOR_FUZZING
-#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
+#define ASSERT_UNLESS_FUZZING() do { } while (0)
#else
-#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
+#define ASSERT_UNLESS_FUZZING() MOZ_ASSERT(false)
#endif
#define PRIVATE_REMOTE_INPUT_STREAM_IID \
{0x30c7699f, 0x51d2, 0x48c8, {0xad, 0x56, 0xc0, 0x16, 0xd7, 0x6f, 0x71, 0x27}}
namespace mozilla {
namespace dom {
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1951,18 +1951,18 @@ ContentChild::RecvUpdateDictionaryList(I
bool
ContentChild::RecvAddPermission(const IPC::Permission& permission)
{
#if MOZ_PERMISSIONS
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
services::GetPermissionManager();
nsPermissionManager* permissionManager =
static_cast<nsPermissionManager*>(permissionManagerIface.get());
- NS_ABORT_IF_FALSE(permissionManager,
- "We have no permissionManager in the Content process !");
+ MOZ_ASSERT(permissionManager,
+ "We have no permissionManager in the Content process !");
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host));
NS_ENSURE_TRUE(uri, true);
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
MOZ_ASSERT(secMan);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2420,22 +2420,22 @@ ContentParent::RecvReadFontList(Infallib
bool
ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions)
{
#ifdef MOZ_PERMISSIONS
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
services::GetPermissionManager();
nsPermissionManager* permissionManager =
static_cast<nsPermissionManager*>(permissionManagerIface.get());
- NS_ABORT_IF_FALSE(permissionManager,
- "We have no permissionManager in the Chrome process !");
+ MOZ_ASSERT(permissionManager,
+ "We have no permissionManager in the Chrome process !");
nsCOMPtr<nsISimpleEnumerator> enumerator;
DebugOnly<nsresult> rv = permissionManager->GetEnumerator(getter_AddRefs(enumerator));
- NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not get enumerator!");
+ MOZ_ASSERT(NS_SUCCEEDED(rv), "Could not get enumerator!");
while(1) {
bool hasMore;
enumerator->HasMoreElements(&hasMore);
if (!hasMore)
break;
nsCOMPtr<nsISupports> supp;
enumerator->GetNext(getter_AddRefs(supp));
@@ -4420,18 +4420,18 @@ ContentParent::RecvRemoveIdleObserver(co
}
bool
ContentParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
{
#ifndef MOZ_X11
NS_RUNTIMEABORT("This message only makes sense on X11 platforms");
#else
- NS_ABORT_IF_FALSE(0 > mChildXSocketFdDup.get(),
- "Already backed up X resources??");
+ MOZ_ASSERT(0 > mChildXSocketFdDup.get(),
+ "Already backed up X resources??");
mChildXSocketFdDup.forget();
if (aXSocketFd.IsValid()) {
mChildXSocketFdDup.reset(aXSocketFd.PlatformHandle());
}
#endif
return true;
}
--- a/dom/ipc/ContentProcessManager.cpp
+++ b/dom/ipc/ContentProcessManager.cpp
@@ -10,19 +10,19 @@
#include "mozilla/StaticPtr.h"
#include "mozilla/ClearOnShutdown.h"
#include "nsPrintfCString.h"
// XXX need another bug to move this to a common header.
#ifdef DISABLE_ASSERTS_FOR_FUZZING
-#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
+#define ASSERT_UNLESS_FUZZING() do { } while (0)
#else
-#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
+#define ASSERT_UNLESS_FUZZING() MOZ_ASSERT(false)
#endif
namespace mozilla {
namespace dom {
static uint64_t gTabId = 0;
/* static */
@@ -73,17 +73,17 @@ ContentProcessManager::RemoveContentProc
bool
ContentProcessManager::AddGrandchildProcess(const ContentParentId& aParentCpId,
const ContentParentId& aChildCpId)
{
MOZ_ASSERT(NS_IsMainThread());
auto iter = mContentParentMap.find(aParentCpId);
if (NS_WARN_IF(iter == mContentParentMap.end())) {
- ASSERT_UNLESS_FUZZING("Parent process should be already in map!");
+ ASSERT_UNLESS_FUZZING();
return false;
}
iter->second.mChildrenCpId.insert(aChildCpId);
return true;
}
bool
ContentProcessManager::GetParentProcessId(const ContentParentId& aChildCpId,
@@ -150,28 +150,28 @@ ContentProcessManager::AllocateTabId(con
struct RemoteFrameInfo info;
const IPCTabAppBrowserContext& appBrowser = aContext.appBrowserContext();
// If it's a PopupIPCTabContext, it's the case that a TabChild want to
// open a new tab. aOpenerTabId has to be it's parent frame's opener id.
if (appBrowser.type() == IPCTabAppBrowserContext::TPopupIPCTabContext) {
auto remoteFrameIter = iter->second.mRemoteFrames.find(aOpenerTabId);
if (remoteFrameIter == iter->second.mRemoteFrames.end()) {
- ASSERT_UNLESS_FUZZING("Failed to find parent frame's opener id.");
+ ASSERT_UNLESS_FUZZING();
return TabId(0);
}
info.mOpenerTabId = remoteFrameIter->second.mOpenerTabId;
const PopupIPCTabContext &ipcContext = appBrowser.get_PopupIPCTabContext();
MOZ_ASSERT(ipcContext.opener().type() == PBrowserOrId::TTabId);
remoteFrameIter = iter->second.mRemoteFrames.find(ipcContext.opener().get_TabId());
if (remoteFrameIter == iter->second.mRemoteFrames.end()) {
- ASSERT_UNLESS_FUZZING("Failed to find tab id.");
+ ASSERT_UNLESS_FUZZING();
return TabId(0);
}
info.mContext = remoteFrameIter->second.mContext;
}
else {
MaybeInvalidTabContext tc(aContext);
if (!tc.IsValid()) {
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -3168,18 +3168,18 @@ TabChild::InitRenderingState(const Scrol
// This results in |remoteFrame| being deleted.
PRenderFrameChild::Send__delete__(remoteFrame);
return false;
}
ShadowLayerForwarder* lf =
mWidget->GetLayerManager(shadowManager, mTextureFactoryIdentifier.mParentBackend)
->AsShadowForwarder();
- NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
- "PuppetWidget should have shadow manager");
+ MOZ_ASSERT(lf && lf->HasShadowManager(),
+ "PuppetWidget should have shadow manager");
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
mRemoteFrame = remoteFrame;
if (aLayersId != 0) {
if (!sTabChildren) {
sTabChildren = new TabChildMap;
}
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2181,29 +2181,29 @@ TabParent::RecvIsParentWindowMainWidgetV
return NS_SUCCEEDED(rv);
}
bool
TabParent::RecvGetDPI(float* aValue)
{
TryCacheDPIAndScale();
- NS_ABORT_IF_FALSE(mDPI > 0,
- "Must not ask for DPI before OwnerElement is received!");
+ MOZ_ASSERT(mDPI > 0,
+ "Must not ask for DPI before OwnerElement is received!");
*aValue = mDPI;
return true;
}
bool
TabParent::RecvGetDefaultScale(double* aValue)
{
TryCacheDPIAndScale();
- NS_ABORT_IF_FALSE(mDefaultScale.scale > 0,
- "Must not ask for scale before OwnerElement is received!");
+ MOZ_ASSERT(mDefaultScale.scale > 0,
+ "Must not ask for scale before OwnerElement is received!");
*aValue = mDefaultScale.scale;
return true;
}
bool
TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue)
{
*aValue = 0;
--- a/dom/ipc/nsIContentParent.cpp
+++ b/dom/ipc/nsIContentParent.cpp
@@ -21,19 +21,19 @@
#include "nsFrameMessageManager.h"
#include "nsIJSRuntimeService.h"
#include "nsPrintfCString.h"
using namespace mozilla::jsipc;
// XXX need another bug to move this to a common header.
#ifdef DISABLE_ASSERTS_FOR_FUZZING
-#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
+#define ASSERT_UNLESS_FUZZING() do { } while (0)
#else
-#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
+#define ASSERT_UNLESS_FUZZING() MOZ_ASSERT(false)
#endif
namespace mozilla {
namespace dom {
nsIContentParent::nsIContentParent()
{
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
@@ -72,37 +72,37 @@ nsIContentParent::CanOpenBrowser(const I
{
const IPCTabAppBrowserContext& appBrowser = aContext.appBrowserContext();
// We don't trust the IPCTabContext we receive from the child, so we'll bail
// if we receive an IPCTabContext that's not a PopupIPCTabContext.
// (PopupIPCTabContext lets the child process prove that it has access to
// the app it's trying to open.)
if (appBrowser.type() != IPCTabAppBrowserContext::TPopupIPCTabContext) {
- ASSERT_UNLESS_FUZZING("Unexpected IPCTabContext type. Aborting AllocPBrowserParent.");
+ ASSERT_UNLESS_FUZZING();
return false;
}
const PopupIPCTabContext& popupContext = appBrowser.get_PopupIPCTabContext();
if (popupContext.opener().type() != PBrowserOrId::TPBrowserParent) {
- ASSERT_UNLESS_FUZZING("Unexpected PopupIPCTabContext type. Aborting AllocPBrowserParent.");
+ ASSERT_UNLESS_FUZZING();
return false;
}
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
if (!opener) {
- ASSERT_UNLESS_FUZZING("Got null opener from child; aborting AllocPBrowserParent.");
+ ASSERT_UNLESS_FUZZING();
return false;
}
// Popup windows of isBrowser frames must be isBrowser if the parent
// isBrowser. Allocating a !isBrowser frame with same app ID would allow
// the content to access data it's not supposed to.
if (!popupContext.isBrowserElement() && opener->IsBrowserElement()) {
- ASSERT_UNLESS_FUZZING("Child trying to escalate privileges! Aborting AllocPBrowserParent.");
+ ASSERT_UNLESS_FUZZING();
return false;
}
MaybeInvalidTabContext tc(aContext);
if (!tc.IsValid()) {
NS_ERROR(nsPrintfCString("Child passed us an invalid TabContext. (%s) "
"Aborting AllocPBrowserParent.",
tc.GetInvalidReason()).get());
--- a/dom/json/nsJSON.cpp
+++ b/dom/json/nsJSON.cpp
@@ -640,17 +640,17 @@ nsJSONListener::ConsumeConverted(const c
rv = mDecoder->GetMaxLength(aBuffer, srcLen, &unicharLength);
NS_ENSURE_SUCCESS(rv, rv);
char16_t* endelems = mBufferedChars.AppendElements(unicharLength);
int32_t preLength = unicharLength;
rv = mDecoder->Convert(aBuffer, &srcLen, endelems, &unicharLength);
if (NS_FAILED(rv))
return rv;
- NS_ABORT_IF_FALSE(preLength >= unicharLength, "GetMaxLength lied");
+ MOZ_ASSERT(preLength >= unicharLength, "GetMaxLength lied");
if (preLength > unicharLength)
mBufferedChars.TruncateLength(mBufferedChars.Length() - (preLength - unicharLength));
return NS_OK;
}
nsresult
nsJSONListener::Consume(const char16_t* aBuffer, uint32_t aByteLength)
{
--- a/dom/locales/en-US/chrome/security/csp.properties
+++ b/dom/locales/en-US/chrome/security/csp.properties
@@ -45,19 +45,16 @@ inlineScriptBlocked = An attempt to exec
# inline style refers to CSS code that is embedded into the HTML document.
inlineStyleBlocked = An attempt to apply inline style sheets has been blocked
# LOCALIZATION NOTE (scriptFromStringBlocked):
# eval is a name and should not be localized.
scriptFromStringBlocked = An attempt to call JavaScript from a string (by calling a function like eval) has been blocked
# LOCALIZATION NOTE (hostNameMightBeKeyword):
# %1$S is the hostname in question and %2$S is the keyword
hostNameMightBeKeyword = Interpreting %1$S as a hostname, not a keyword. If you intended this to be a keyword, use '%2$S' (wrapped in single quotes).
-# LOCALIZATION NOTE (ignoringReportOnlyDirective):
-# %1$S is the directive that is ignore in report-only mode.
-ignoringReportOnlyDirective = Ignoring sandbox directive when delivered in a report-only policy '%1$S'.
# LOCALIZATION NOTE (notSupportingDirective):
# directive is not supported (e.g. 'reflected-xss')
notSupportingDirective = Not supporting directive '%1$S'. Directive and values will be ignored.
# CSP Errors:
# LOCALIZATION NOTE (couldntParseInvalidSource):
# %1$S is the source that could not be parsed
couldntParseInvalidSource = Couldn't parse invalid source %1$S
@@ -68,11 +65,8 @@ couldntParseInvalidHost = Couldn't parse
# %1$S is the string source
couldntParseScheme = Couldn't parse scheme in %1$S
# LOCALIZATION NOTE (couldntParsePort):
# %1$S is the string source
couldntParsePort = Couldn't parse port in %1$S
# LOCALIZATION NOTE (duplicateDirective):
# %1$S is the name of the duplicate directive
duplicateDirective = Duplicate %1$S directives detected. All but the first instance will be ignored.
-# LOCALIZATION NOTE (couldntParseInvalidSandboxFlag):
-# %1$S is the option that could not be understood
-couldntParseInvalidSandboxFlag = Couldn't parse invalid sandbox flag %1$S
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -366,17 +366,17 @@ AudioStream::Init(int32_t aNumChannels,
mBytesPerFrame = sizeof(AudioDataValue) * mOutChannels;
mAudioClock.Init();
// Size mBuffer for one second of audio. This value is arbitrary, and was
// selected based on the observed behaviour of the existing AudioStream
// implementations.
uint32_t bufferLimit = FramesToBytes(aRate);
- NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
+ MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
mBuffer.SetCapacity(bufferLimit);
if (aLatencyRequest == LowLatency) {
// Don't block this thread to initialize a cubeb stream.
// When this is done, it will start callbacks from Cubeb. Those will
// cause us to move from INITIALIZED to RUNNING. Until then, we
// can't access any cubeb functions.
// Use a RefPtr to avoid leaks if Dispatch fails
@@ -627,18 +627,18 @@ AudioStream::Write(const AudioDataValue*
timeMs = 0;
}
struct Inserts insert = { timeMs, aFrames};
mInserts.AppendElement(insert);
}
while (bytesToCopy > 0) {
uint32_t available = std::min(bytesToCopy, mBuffer.Available());
- NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0,
- "Must copy complete frames.");
+ MOZ_ASSERT(available % mBytesPerFrame == 0,
+ "Must copy complete frames.");
mBuffer.AppendElements(src, available);
src += available;
bytesToCopy -= available;
if (bytesToCopy > 0) {
// Careful - the CubebInit thread may not have gotten to STARTED yet
if ((mState == INITIALIZED || mState == STARTED) && mLatencyRequest == LowLatency) {
@@ -673,24 +673,24 @@ AudioStream::Write(const AudioDataValue*
mWritten += aFrames;
return NS_OK;
}
uint32_t
AudioStream::Available()
{
MonitorAutoLock mon(mMonitor);
- NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated.");
+ MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated.");
return BytesToFrames(mBuffer.Available());
}
void
AudioStream::SetVolume(double aVolume)
{
- NS_ABORT_IF_FALSE(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume");
+ MOZ_ASSERT(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume");
if (cubeb_stream_set_volume(mCubebStream.get(), aVolume * CubebUtils::GetVolumeScale()) != CUBEB_OK) {
NS_WARNING("Could not change volume on cubeb stream.");
}
}
void
AudioStream::SetMicrophoneActive(bool aActive)
@@ -1030,17 +1030,17 @@ AudioStream::Reset()
params.format = CUBEB_SAMPLE_FLOAT32NE;
}
mBytesPerFrame = sizeof(AudioDataValue) * mOutChannels;
// Size mBuffer for one second of audio. This value is arbitrary, and was
// selected based on the observed behaviour of the existing AudioStream
// implementations.
uint32_t bufferLimit = FramesToBytes(mInRate);
- NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
+ MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
mBuffer.Reset();
mBuffer.SetCapacity(bufferLimit);
// Don't block this thread to initialize a cubeb stream.
// When this is done, it will start callbacks from Cubeb. Those will
// cause us to move from INITIALIZED to RUNNING. Until then, we
// can't access any cubeb functions.
// Use a RefPtr to avoid leaks if Dispatch fails
@@ -1049,17 +1049,17 @@ AudioStream::Reset()
}
long
AudioStream::DataCallback(void* aBuffer, long aFrames)
{
MonitorAutoLock mon(mMonitor);
MOZ_ASSERT(mState != SHUTDOWN, "No data callback after shutdown");
uint32_t available = std::min(static_cast<uint32_t>(FramesToBytes(aFrames)), mBuffer.Length());
- NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0, "Must copy complete frames");
+ MOZ_ASSERT(available % mBytesPerFrame == 0, "Must copy complete frames");
AudioDataValue* output = reinterpret_cast<AudioDataValue*>(aBuffer);
uint32_t underrunFrames = 0;
uint32_t servicedFrames = 0;
int64_t insertTime;
mShouldDropFrames = false;
// NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN)
@@ -1108,17 +1108,17 @@ AudioStream::DataCallback(void* aBuffer,
servicedFrames = GetUnprocessedWithSilencePadding(output, aFrames, insertTime);
} else {
servicedFrames = GetUnprocessed(output, aFrames, insertTime);
}
} else {
servicedFrames = GetTimeStretched(output, aFrames, insertTime);
}
- NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames");
+ MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames");
// Notify any blocked Write() call that more space is available in mBuffer.
mon.NotifyAll();
} else {
GetBufferInsertTime(insertTime);
}
underrunFrames = aFrames - servicedFrames;
--- a/dom/media/AudioStream.h
+++ b/dom/media/AudioStream.h
@@ -83,17 +83,17 @@ class CircularByteBuffer
public:
CircularByteBuffer()
: mBuffer(nullptr), mCapacity(0), mStart(0), mCount(0)
{}
// Set the capacity of the buffer in bytes. Must be called before any
// call to append or pop elements.
void SetCapacity(uint32_t aCapacity) {
- NS_ABORT_IF_FALSE(!mBuffer, "Buffer allocated.");
+ MOZ_ASSERT(!mBuffer, "Buffer allocated.");
mCapacity = aCapacity;
mBuffer = new uint8_t[mCapacity];
}
uint32_t Length() {
return mCount;
}
@@ -103,48 +103,48 @@ public:
uint32_t Available() {
return Capacity() - Length();
}
// Append aLength bytes from aSrc to the buffer. Caller must check that
// sufficient space is available.
void AppendElements(const uint8_t* aSrc, uint32_t aLength) {
- NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
- NS_ABORT_IF_FALSE(aLength <= Available(), "Buffer full.");
+ MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
+ MOZ_ASSERT(aLength <= Available(), "Buffer full.");
uint32_t end = (mStart + mCount) % mCapacity;
uint32_t toCopy = std::min(mCapacity - end, aLength);
memcpy(&mBuffer[end], aSrc, toCopy);
memcpy(&mBuffer[0], aSrc + toCopy, aLength - toCopy);
mCount += aLength;
}
// Remove aSize bytes from the buffer. Caller must check returned size in
// aSize{1,2} before using the pointer returned in aData{1,2}. Caller
// must not specify an aSize larger than Length().
void PopElements(uint32_t aSize, void** aData1, uint32_t* aSize1,
void** aData2, uint32_t* aSize2) {
- NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
- NS_ABORT_IF_FALSE(aSize <= Length(), "Request too large.");
+ MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
+ MOZ_ASSERT(aSize <= Length(), "Request too large.");
*aData1 = &mBuffer[mStart];
*aSize1 = std::min(mCapacity - mStart, aSize);
*aData2 = &mBuffer[0];
*aSize2 = aSize - *aSize1;
mCount -= *aSize1 + *aSize2;
mStart += *aSize1 + *aSize2;
mStart %= mCapacity;
}
// Throw away all but aSize bytes from the buffer. Returns new size, which
// may be less than aSize
uint32_t ContractTo(uint32_t aSize) {
- NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
+ MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
if (aSize >= mCount) {
return mCount;
}
mStart += (mCount - aSize);
mCount = aSize;
mStart %= mCapacity;
return mCount;
}
--- a/dom/media/FileBlockCache.cpp
+++ b/dom/media/FileBlockCache.cpp
@@ -207,18 +207,19 @@ nsresult FileBlockCache::Run()
// This also ensures we will insert a new index into mChangeIndexList
// when this happens.
// Hold a reference to the change, in case another change
// overwrites the mBlockChanges entry for this block while we drop
// mDataMonitor to take mFileMonitor.
int32_t blockIndex = mChangeIndexList.PopFront();
nsRefPtr<BlockChange> change = mBlockChanges[blockIndex];
- NS_ABORT_IF_FALSE(change,
- "Change index list should only contain entries for blocks with changes");
+ MOZ_ASSERT(change,
+ "Change index list should only contain entries for blocks "
+ "with changes");
{
MonitorAutoUnlock unlock(mDataMonitor);
MonitorAutoLock lock(mFileMonitor);
if (change->IsWrite()) {
WriteBlockToFile(blockIndex, change->mData.get());
} else if (change->IsMove()) {
MoveBlockInFile(change->mSourceBlockIndex, blockIndex);
}
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2259,17 +2259,17 @@ MediaCacheStream::Read(char* aBuffer, ui
}
if (streamWithPartialBlock) {
// We can just use the data in mPartialBlockBuffer. In fact we should
// use it rather than waiting for the block to fill and land in
// the cache.
int64_t bytes = std::min<int64_t>(size, streamWithPartialBlock->mChannelOffset - mStreamOffset);
// Clamp bytes until 64-bit file size issues are fixed.
bytes = std::min(bytes, int64_t(INT32_MAX));
- NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= aCount, "Bytes out of range.");
+ MOZ_ASSERT(bytes >= 0 && bytes <= aCount, "Bytes out of range.");
memcpy(aBuffer,
reinterpret_cast<char*>(streamWithPartialBlock->mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes);
if (mCurrentMode == MODE_METADATA) {
streamWithPartialBlock->mMetadataInPartialBlockBuffer = true;
}
mStreamOffset += bytes;
count = bytes;
break;
@@ -2284,17 +2284,17 @@ MediaCacheStream::Read(char* aBuffer, ui
}
continue;
}
gMediaCache->NoteBlockUsage(this, cacheBlock, mCurrentMode, TimeStamp::Now());
int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
int32_t bytes;
- NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range.");
+ MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range.");
nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes);
if (NS_FAILED(rv)) {
if (count == 0)
return rv;
// If we did successfully read some data, may as well return it
break;
}
mStreamOffset += bytes;
@@ -2356,26 +2356,26 @@ MediaCacheStream::ReadFromCache(char* aB
int32_t cacheBlock = streamBlock < mBlocks.Length() ? mBlocks[streamBlock] : -1;
if (channelBlock == streamBlock && streamOffset < mChannelOffset) {
// We can just use the data in mPartialBlockBuffer. In fact we should
// use it rather than waiting for the block to fill and land in
// the cache.
// Clamp bytes until 64-bit file size issues are fixed.
int64_t toCopy = std::min<int64_t>(size, mChannelOffset - streamOffset);
bytes = std::min(toCopy, int64_t(INT32_MAX));
- NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= toCopy, "Bytes out of range.");
+ MOZ_ASSERT(bytes >= 0 && bytes <= toCopy, "Bytes out of range.");
memcpy(aBuffer + count,
reinterpret_cast<char*>(mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes);
} else {
if (cacheBlock < 0) {
// We expect all blocks to be cached! Fail!
return NS_ERROR_FAILURE;
}
int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
- NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range.");
+ MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range.");
nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes);
if (NS_FAILED(rv)) {
return rv;
}
}
streamOffset += bytes;
count += bytes;
}
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -713,17 +713,17 @@ nsresult MediaDecoder::Play()
}
nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType)
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
UpdateDormantState(false /* aDormantTimeout */, true /* aActivity */);
- NS_ABORT_IF_FALSE(aTime >= 0.0, "Cannot seek to a negative value.");
+ MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value.");
int64_t timeUsecs = 0;
nsresult rv = SecondsToUsecs(aTime, timeUsecs);
NS_ENSURE_SUCCESS(rv, rv);
mRequestedSeekTarget = SeekTarget(timeUsecs, aSeekType);
mCurrentTime = aTime;
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -974,17 +974,17 @@ MediaRecorder::Constructor(const GlobalO
ownerWindow);
object->SetMimeType(aInitDict.mMimeType);
return object.forget();
}
nsresult
MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
if (!CheckPrincipal()) {
// Media is not same-origin, don't allow the data out.
nsRefPtr<nsIDOMBlob> blob = aBlob;
return NS_ERROR_DOM_SECURITY_ERR;
}
BlobEventInit init;
init.mBubbles = false;
init.mCancelable = false;
@@ -998,17 +998,17 @@ MediaRecorder::CreateAndDispatchBlobEven
init);
event->SetTrusted(true);
return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
void
MediaRecorder::DispatchSimpleEvent(const nsAString & aStr)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
nsCOMPtr<nsIDOMEvent> event;
rv = NS_NewDOMEvent(getter_AddRefs(event), this, nullptr, nullptr);
if (NS_FAILED(rv)) {
@@ -1029,17 +1029,17 @@ MediaRecorder::DispatchSimpleEvent(const
NS_ERROR("Failed to dispatch the event!!!");
return;
}
}
void
MediaRecorder::NotifyError(nsresult aRv)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
nsString errorMsg;
switch (aRv) {
case NS_ERROR_DOM_SECURITY_ERR:
errorMsg = NS_LITERAL_STRING("SecurityError");
@@ -1065,17 +1065,17 @@ MediaRecorder::NotifyError(nsresult aRv)
NS_ERROR("Failed to dispatch the error event!!!");
return;
}
return;
}
bool MediaRecorder::CheckPrincipal()
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
if (!mDOMStream && !mAudioNode) {
return false;
}
if (!GetOwner())
return false;
nsCOMPtr<nsIDocument> doc = GetOwner()->GetExtantDoc();
if (!doc) {
return false;
--- a/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp
+++ b/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp
@@ -242,22 +242,16 @@ GonkMediaDataDecoder::Drain()
return NS_OK;
}
bool
GonkMediaDataDecoder::IsWaitingMediaResources() {
return mDecoder->IsWaitingResources();
}
-bool
-GonkMediaDataDecoder::IsDormantNeeded()
-{
- return mDecoder.get() ? true : false;
-}
-
void
GonkMediaDataDecoder::AllocateMediaResources()
{
mManager->AllocateMediaResources();
}
void
GonkMediaDataDecoder::ReleaseMediaResources()
--- a/dom/media/fmp4/gonk/GonkMediaDataDecoder.h
+++ b/dom/media/fmp4/gonk/GonkMediaDataDecoder.h
@@ -93,17 +93,17 @@ public:
virtual nsresult Flush() MOZ_OVERRIDE;
virtual nsresult Drain() MOZ_OVERRIDE;
virtual nsresult Shutdown() MOZ_OVERRIDE;
virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
- virtual bool IsDormantNeeded() MOZ_OVERRIDE;
+ virtual bool IsDormantNeeded() { return true;}
virtual void AllocateMediaResources() MOZ_OVERRIDE;
virtual void ReleaseMediaResources() MOZ_OVERRIDE;
private:
// Called on the task queue. Inserts the sample into the decoder, and
--- a/dom/media/fmp4/gonk/GonkVideoDecoderManager.cpp
+++ b/dom/media/fmp4/gonk/GonkVideoDecoderManager.cpp
@@ -651,12 +651,15 @@ void GonkVideoDecoderManager::ReleaseAll
mDecoder->ReleaseMediaBuffer(buffer);
buffer = nullptr;
}
releasingVideoBuffers.clear();
}
void GonkVideoDecoderManager::ReleaseMediaResources() {
GVDM_LOG("ReleseMediaResources");
+ if (mDecoder == nullptr) {
+ return;
+ }
ReleaseAllPendingVideoBuffers();
mDecoder->ReleaseMediaResources();
}
} // namespace mozilla
--- a/dom/media/gmp/GMPProcessChild.cpp
+++ b/dom/media/gmp/GMPProcessChild.cpp
@@ -31,22 +31,22 @@ GMPProcessChild::Init()
std::string pluginFilename;
std::string voucherFilename;
#if defined(OS_POSIX)
// NB: need to be very careful in ensuring that the first arg
// (after the binary name) here is indeed the plugin module path.
// Keep in sync with dom/plugins/PluginModuleParent.
std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
- NS_ABORT_IF_FALSE(values.size() >= 3, "not enough args");
+ MOZ_ASSERT(values.size() >= 3, "not enough args");
pluginFilename = values[1];
voucherFilename = values[2];
#elif defined(OS_WIN)
std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues();
- NS_ABORT_IF_FALSE(values.size() >= 2, "not enough loose args");
+ MOZ_ASSERT(values.size() >= 2, "not enough loose args");
pluginFilename = WideToUTF8(values[0]);
voucherFilename = WideToUTF8(values[1]);
#else
#error Not implemented
#endif
BackgroundHangMonitor::Startup();
--- a/dom/media/omx/MediaCodecReader.cpp
+++ b/dom/media/omx/MediaCodecReader.cpp
@@ -322,22 +322,16 @@ MediaCodecReader::IsWaitingMediaResource
void
MediaCodecReader::UpdateIsWaitingMediaResources()
{
mIsWaitingResources = (mVideoTrack.mCodec != nullptr) &&
(!mVideoTrack.mCodec->allocated());
}
-bool
-MediaCodecReader::IsDormantNeeded()
-{
- return mVideoTrack.mSource != nullptr;
-}
-
void
MediaCodecReader::ReleaseMediaResources()
{
// Stop the mSource because we are in the dormant state and the stop function
// will rewind the mSource to the beginning of the stream.
if (mVideoTrack.mSource != nullptr && !mVideoTrack.mSourceIsStopped) {
mVideoTrack.mSource->stop();
mVideoTrack.mSourceIsStopped = true;
@@ -1258,17 +1252,18 @@ MediaCodecReader::CreateMediaSources()
if (audioSource != nullptr && audioSource->start() == OK) {
mAudioTrack.mSource = audioSource;
mAudioTrack.mSourceIsStopped = false;
}
// Get one another track instance for audio offload playback.
mAudioOffloadTrack.mSource = mExtractor->getTrack(audioTrackIndex);
}
- if (videoTrackIndex != invalidTrackIndex && mVideoTrack.mSource == nullptr) {
+ if (videoTrackIndex != invalidTrackIndex && mVideoTrack.mSource == nullptr &&
+ mDecoder->GetImageContainer()) {
sp<MediaSource> videoSource = mExtractor->getTrack(videoTrackIndex);
if (videoSource != nullptr && videoSource->start() == OK) {
mVideoTrack.mSource = videoSource;
mVideoTrack.mSourceIsStopped = false;
}
}
return
--- a/dom/media/omx/MediaCodecReader.h
+++ b/dom/media/omx/MediaCodecReader.h
@@ -60,17 +60,17 @@ public:
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
// on failure.
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
// True if this reader is waiting media resource allocation
virtual bool IsWaitingMediaResources();
// True when this reader need to become dormant state
- virtual bool IsDormantNeeded();
+ virtual bool IsDormantNeeded() { return true;}
// Release media resources they should be released in dormant state
virtual void ReleaseMediaResources();
// Destroys the decoding state. The reader cannot be made usable again.
// This is different from ReleaseMediaResources() as Shutdown() is
// irreversible, whereas ReleaseMediaResources() is reversible.
virtual nsRefPtr<ShutdownPromise> Shutdown();
--- a/dom/media/omx/MediaOmxReader.cpp
+++ b/dom/media/omx/MediaOmxReader.cpp
@@ -202,24 +202,16 @@ void MediaOmxReader::UpdateIsWaitingMedi
{
if (mOmxDecoder.get()) {
mIsWaitingResources = mOmxDecoder->IsWaitingMediaResources();
} else {
mIsWaitingResources = false;
}
}
-bool MediaOmxReader::IsDormantNeeded()
-{
- if (!mOmxDecoder.get()) {
- return false;
- }
- return mOmxDecoder->IsDormantNeeded();
-}
-
void MediaOmxReader::ReleaseMediaResources()
{
ResetDecode();
// Before freeing a video codec, all video buffers needed to be released
// even from graphics pipeline.
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container) {
container->ClearCurrentFrame();
--- a/dom/media/omx/MediaOmxReader.h
+++ b/dom/media/omx/MediaOmxReader.h
@@ -87,17 +87,17 @@ public:
virtual bool HasVideo()
{
return mHasVideo;
}
// Return mIsWaitingResources.
virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
- virtual bool IsDormantNeeded();
+ virtual bool IsDormantNeeded() { return true;}
virtual void ReleaseMediaResources();
virtual void PreReadMetadata() MOZ_OVERRIDE;
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags);
virtual nsRefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) MOZ_OVERRIDE;
--- a/dom/media/omx/OmxDecoder.cpp
+++ b/dom/media/omx/OmxDecoder.cpp
@@ -145,17 +145,17 @@ bool OmxDecoder::Init(sp<MediaExtractor>
if (videoTrackIndex == -1 && audioTrackIndex == -1) {
NS_WARNING("OMX decoder could not find video or audio tracks");
return false;
}
mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
- if (videoTrackIndex != -1) {
+ if (videoTrackIndex != -1 && mDecoder->GetImageContainer()) {
mVideoTrack = extractor->getTrack(videoTrackIndex);
}
if (audioTrackIndex != -1) {
mAudioTrack = extractor->getTrack(audioTrackIndex);
#ifdef MOZ_AUDIO_OFFLOAD
// mAudioTrack is be used by OMXCodec. For offloaded audio track, using same
@@ -214,24 +214,16 @@ bool OmxDecoder::EnsureMetadata() {
NS_WARNING("Couldn't set audio format");
return false;
}
}
return true;
}
-bool OmxDecoder::IsDormantNeeded()
-{
- if (mVideoTrack.get()) {
- return true;
- }
- return false;
-}
-
bool OmxDecoder::IsWaitingMediaResources()
{
if (mVideoSource.get()) {
return mVideoSource->IsWaitingResources();
}
return false;
}
--- a/dom/media/omx/OmxDecoder.h
+++ b/dom/media/omx/OmxDecoder.h
@@ -149,18 +149,16 @@ public:
// MediaExtractor::getTrackMetaData().
// In general cases, the extractor is created by a sp<DataSource> which
// connect to a MediaResource like ChannelMediaResource.
// Data is read from the MediaResource to create a suitable extractor which
// extracts data from a container.
// Note: RTSP requires a custom extractor because it doesn't have a container.
bool Init(sp<MediaExtractor>& extractor);
- bool IsDormantNeeded();
-
// Called after resources(video/audio codec) are allocated, set the
// mDurationUs and video/audio metadata.
bool EnsureMetadata();
// Only called by MediaOmxDecoder, do not call this function arbitrarily.
// See bug 1050667.
bool IsWaitingMediaResources();
--- a/dom/media/wave/WaveReader.cpp
+++ b/dom/media/wave/WaveReader.cpp
@@ -333,18 +333,18 @@ WaveReader::ReadAll(char* aBuf, int64_t
}
bool
WaveReader::LoadRIFFChunk()
{
char riffHeader[RIFF_INITIAL_SIZE];
const char* p = riffHeader;
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() == 0,
- "LoadRIFFChunk called when resource in invalid state");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() == 0,
+ "LoadRIFFChunk called when resource in invalid state");
if (!ReadAll(riffHeader, sizeof(riffHeader))) {
return false;
}
static_assert(sizeof(uint32_t) * 3 <= RIFF_INITIAL_SIZE,
"Reads would overflow riffHeader buffer.");
if (ReadUint32BE(&p) != RIFF_CHUNK_MAGIC) {
@@ -366,18 +366,18 @@ WaveReader::LoadRIFFChunk()
bool
WaveReader::LoadFormatChunk(uint32_t aChunkSize)
{
uint32_t rate, channels, frameSize, sampleFormat;
char waveFormat[WAVE_FORMAT_CHUNK_SIZE];
const char* p = waveFormat;
// RIFF chunks are always word (two byte) aligned.
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "LoadFormatChunk called with unaligned resource");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "LoadFormatChunk called with unaligned resource");
if (!ReadAll(waveFormat, sizeof(waveFormat))) {
return false;
}
static_assert(sizeof(uint16_t) +
sizeof(uint16_t) +
sizeof(uint32_t) +
@@ -428,18 +428,18 @@ WaveReader::LoadFormatChunk(uint32_t aCh
nsAutoArrayPtr<char> chunkExtension(new char[extra]);
if (!ReadAll(chunkExtension.get(), extra)) {
return false;
}
}
}
// RIFF chunks are always word (two byte) aligned.
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "LoadFormatChunk left resource unaligned");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "LoadFormatChunk left resource unaligned");
// Make sure metadata is fairly sane. The rate check is fairly arbitrary,
// but the channels check is intentionally limited to mono or stereo
// when the media is intended for direct playback because that's what the
// audio backend currently supports.
unsigned int actualFrameSize = (sampleFormat == 8 ? 1 : 2) * channels;
if (rate < 100 || rate > 96000 ||
(((channels < 1 || channels > MAX_CHANNELS) ||
@@ -462,49 +462,49 @@ WaveReader::LoadFormatChunk(uint32_t aCh
}
return true;
}
bool
WaveReader::FindDataOffset(uint32_t aChunkSize)
{
// RIFF chunks are always word (two byte) aligned.
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "FindDataOffset called with unaligned resource");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "FindDataOffset called with unaligned resource");
int64_t offset = mDecoder->GetResource()->Tell();
if (offset <= 0 || offset > UINT32_MAX) {
NS_WARNING("PCM data offset out of range");
return false;
}
ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
mWaveLength = aChunkSize;
mWavePCMOffset = uint32_t(offset);
return true;
}
double
WaveReader::BytesToTime(int64_t aBytes) const
{
- NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0");
+ MOZ_ASSERT(aBytes >= 0, "Must be >= 0");
return float(aBytes) / mSampleRate / mFrameSize;
}
int64_t
WaveReader::TimeToBytes(double aTime) const
{
- NS_ABORT_IF_FALSE(aTime >= 0.0f, "Must be >= 0");
+ MOZ_ASSERT(aTime >= 0.0f, "Must be >= 0");
return RoundDownToFrame(int64_t(aTime * mSampleRate * mFrameSize));
}
int64_t
WaveReader::RoundDownToFrame(int64_t aBytes) const
{
- NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0");
+ MOZ_ASSERT(aBytes >= 0, "Must be >= 0");
return aBytes - (aBytes % mFrameSize);
}
int64_t
WaveReader::GetDataLength()
{
int64_t length = mWaveLength;
// If the decoder has a valid content length, and it's shorter than the
@@ -522,20 +522,20 @@ int64_t
WaveReader::GetPosition()
{
return mDecoder->GetResource()->Tell();
}
bool
WaveReader::GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize)
{
- NS_ABORT_IF_FALSE(aChunk, "Must have aChunk");
- NS_ABORT_IF_FALSE(aChunkSize, "Must have aChunkSize");
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "GetNextChunk called with unaligned resource");
+ MOZ_ASSERT(aChunk, "Must have aChunk");
+ MOZ_ASSERT(aChunkSize, "Must have aChunkSize");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "GetNextChunk called with unaligned resource");
char chunkHeader[CHUNK_HEADER_SIZE];
const char* p = chunkHeader;
if (!ReadAll(chunkHeader, sizeof(chunkHeader))) {
return false;
}
@@ -547,18 +547,18 @@ WaveReader::GetNextChunk(uint32_t* aChun
return true;
}
bool
WaveReader::LoadListChunk(uint32_t aChunkSize,
nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags)
{
// List chunks are always word (two byte) aligned.
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "LoadListChunk called with unaligned resource");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "LoadListChunk called with unaligned resource");
static const unsigned int MAX_CHUNK_SIZE = 1 << 16;
static_assert(uint64_t(MAX_CHUNK_SIZE) < UINT_MAX / sizeof(char),
"MAX_CHUNK_SIZE too large for enumerator.");
if (aChunkSize > MAX_CHUNK_SIZE || aChunkSize < 4) {
return false;
}
@@ -623,18 +623,18 @@ WaveReader::LoadListChunk(uint32_t aChun
return true;
}
bool
WaveReader::LoadAllChunks(nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags)
{
// Chunks are always word (two byte) aligned.
- NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
- "LoadAllChunks called with unaligned resource");
+ MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
+ "LoadAllChunks called with unaligned resource");
bool loadFormatChunk = false;
bool findDataOffset = false;
for (;;) {
static const unsigned int CHUNK_HEADER_SIZE = 8;
char chunkHeader[CHUNK_HEADER_SIZE];
const char* p = chunkHeader;
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -31,17 +31,17 @@ support-files =
[test_AudioBuffer.html]
[test_audioBufferSourceNode.html]
[test_audioBufferSourceNodeEnded.html]
[test_audioBufferSourceNodeLazyLoopParam.html]
[test_audioBufferSourceNodeLoop.html]
[test_audioBufferSourceNodeLoopStartEnd.html]
[test_audioBufferSourceNodeLoopStartEndSame.html]
[test_audioBufferSourceNodeNeutered.html]
-skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
+skip-if = (toolkit == 'android' && processor == 'x86') || os == 'win' # bug 1127845
[test_audioBufferSourceNodeNoStart.html]
[test_audioBufferSourceNodeNullBuffer.html]
[test_audioBufferSourceNodeOffset.html]
skip-if = (toolkit == 'gonk') || (toolkit == 'android') || debug #bug 906752
[test_audioBufferSourceNodePassThrough.html]
[test_AudioContext.html]
[test_audioDestinationNode.html]
[test_AudioListener.html]
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1503,18 +1503,19 @@ bool
JS::Rooted<JSObject*> obj(cx, nsNPObjWrapper::GetNewOrUsed(npp, cx, npobj));
if (!obj) {
return false;
}
obj = JS_ObjectToInnerObject(cx, obj);
- NS_ABORT_IF_FALSE(obj,
- "JS_ObjectToInnerObject should never return null with non-null input.");
+ MOZ_ASSERT(obj,
+ "JS_ObjectToInnerObject should never return null with non-null "
+ "input.");
if (result) {
// Initialize the out param to void
VOID_TO_NPVARIANT(*result);
}
if (!script || !script->UTF8Length || !script->UTF8Characters) {
// Nothing to evaluate.
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -2664,18 +2664,18 @@ PluginInstanceChild::DoAsyncSetWindow(co
if (!mAccumulatedInvalidRect.IsEmpty()) {
AsyncShowPluginFrame();
}
}
bool
PluginInstanceChild::CreateOptSurface(void)
{
- NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceType::Max,
- "Need a valid surface type here");
+ MOZ_ASSERT(mSurfaceType != gfxSurfaceType::Max,
+ "Need a valid surface type here");
NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync.");
nsRefPtr<gfxASurface> retsurf;
// Use an opaque surface unless we're transparent and *don't* have
// a background to source from.
gfxImageFormat format =
(mIsTransparent && !mBackground) ? gfxImageFormat::ARGB32 :
gfxImageFormat::RGB24;
@@ -3094,18 +3094,18 @@ PluginInstanceChild::PaintRectToSurface(
dt->CopySurface(surface, ToIntRect(aRect), ToIntPoint(aRect.TopLeft()));
}
}
void
PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
gfxASurface* aSurface)
{
- NS_ABORT_IF_FALSE(aSurface->GetContentType() == gfxContentType::COLOR_ALPHA,
- "Refusing to pointlessly recover alpha");
+ MOZ_ASSERT(aSurface->GetContentType() == gfxContentType::COLOR_ALPHA,
+ "Refusing to pointlessly recover alpha");
nsIntRect rect(aRect);
// If |aSurface| can be used to paint and can have alpha values
// recovered directly to it, do that to save a tmp surface and
// copy.
bool useSurfaceSubimageForBlack = false;
if (gfxSurfaceType::Image == aSurface->GetType()) {
gfxImageSurface* surfaceAsImage =
@@ -3174,17 +3174,17 @@ PluginInstanceChild::PaintRectWithAlphaE
gfxImageFormat::ARGB32);
}
// Paint onto black background
blackImage->SetDeviceOffset(deviceOffset);
PaintRectToSurface(rect, blackImage, gfxRGBA(0.0, 0.0, 0.0));
#endif
- NS_ABORT_IF_FALSE(whiteImage && blackImage, "Didn't paint enough!");
+ MOZ_ASSERT(whiteImage && blackImage, "Didn't paint enough!");
// Extract alpha from black and white image and store to black
// image
if (!gfxAlphaRecovery::RecoverAlpha(blackImage, whiteImage)) {
return;
}
// If we had to use a temporary black surface, copy the pixels
@@ -3538,17 +3538,17 @@ PluginInstanceChild::InvalidateRect(NPRe
// before their first SetWindow().
SendNPN_InvalidateRect(*aInvalidRect);
}
bool
PluginInstanceChild::RecvUpdateBackground(const SurfaceDescriptor& aBackground,
const nsIntRect& aRect)
{
- NS_ABORT_IF_FALSE(mIsTransparent, "Only transparent plugins use backgrounds");
+ MOZ_ASSERT(mIsTransparent, "Only transparent plugins use backgrounds");
if (!mBackground) {
// XXX refactor me
switch (aBackground.type()) {
#ifdef MOZ_X11
case SurfaceDescriptor::TSurfaceDescriptorX11: {
mBackground = aBackground.get_SurfaceDescriptorX11().OpenForeign();
break;
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -740,17 +740,17 @@ PluginInstanceParent::ContentsScaleFacto
nsresult
PluginInstanceParent::SetBackgroundUnknown()
{
PLUGIN_LOG_DEBUG(("[InstanceParent][%p] SetBackgroundUnknown", this));
if (mBackground) {
DestroyBackground();
- NS_ABORT_IF_FALSE(!mBackground, "Background not destroyed");
+ MOZ_ASSERT(!mBackground, "Background not destroyed");
}
return NS_OK;
}
nsresult
PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect,
gfxContext** aCtx)
@@ -759,28 +759,28 @@ PluginInstanceParent::BeginUpdateBackgro
("[InstanceParent][%p] BeginUpdateBackground for <x=%d,y=%d, w=%d,h=%d>",
this, aRect.x, aRect.y, aRect.width, aRect.height));
if (!mBackground) {
// XXX if we failed to create a background surface on one
// update, there's no guarantee that later updates will be for
// the entire background area until successful. We might want
// to fix that eventually.
- NS_ABORT_IF_FALSE(aRect.TopLeft() == nsIntPoint(0, 0),
- "Expecting rect for whole frame");
+ MOZ_ASSERT(aRect.TopLeft() == nsIntPoint(0, 0),
+ "Expecting rect for whole frame");
if (!CreateBackground(aRect.Size())) {
*aCtx = nullptr;
return NS_OK;
}
}
gfxIntSize sz = mBackground->GetSize();
#ifdef DEBUG
- NS_ABORT_IF_FALSE(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect),
- "Update outside of background area");
+ MOZ_ASSERT(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect),
+ "Update outside of background area");
#endif
RefPtr<gfx::DrawTarget> dt = gfxPlatform::GetPlatform()->
CreateDrawTargetForSurface(mBackground, gfx::IntSize(sz.width, sz.height));
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
ctx.forget(aCtx);
return NS_OK;
@@ -816,17 +816,17 @@ PluginAsyncSurrogate*
PluginInstanceParent::GetAsyncSurrogate()
{
return mSurrogate;
}
bool
PluginInstanceParent::CreateBackground(const nsIntSize& aSize)
{
- NS_ABORT_IF_FALSE(!mBackground, "Already have a background");
+ MOZ_ASSERT(!mBackground, "Already have a background");
// XXX refactor me
#if defined(MOZ_X11)
Screen* screen = DefaultScreenOfDisplay(DefaultXDisplay());
Visual* visual = DefaultVisualOfScreen(screen);
mBackground = gfxXlibSurface::Create(screen, visual,
gfxIntSize(aSize.width, aSize.height));
@@ -861,28 +861,28 @@ PluginInstanceParent::DestroyBackground(
// If this fails, there's no problem: |bd| will be destroyed along
// with the old background surface.
unused << SendPPluginBackgroundDestroyerConstructor(pbd);
}
mozilla::plugins::SurfaceDescriptor
PluginInstanceParent::BackgroundDescriptor()
{
- NS_ABORT_IF_FALSE(mBackground, "Need a background here");
+ MOZ_ASSERT(mBackground, "Need a background here");
// XXX refactor me
#ifdef MOZ_X11
gfxXlibSurface* xsurf = static_cast<gfxXlibSurface*>(mBackground.get());
return SurfaceDescriptorX11(xsurf);
#endif
#ifdef XP_WIN
- NS_ABORT_IF_FALSE(gfxSharedImageSurface::IsSharedImage(mBackground),
- "Expected shared image surface");
+ MOZ_ASSERT(gfxSharedImageSurface::IsSharedImage(mBackground),
+ "Expected shared image surface");
gfxSharedImageSurface* shmem =
static_cast<gfxSharedImageSurface*>(mBackground.get());
return shmem->GetShmem();
#endif
// If this is ever used, which it shouldn't be, it will trigger a
// hard assertion in IPDL-generated code.
return mozilla::plugins::SurfaceDescriptor();
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -511,20 +511,20 @@ static const gint kBrowserEventPriority
static const guint kBrowserEventIntervalMs = 10;
// static
gboolean
PluginModuleChild::DetectNestedEventLoop(gpointer data)
{
PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
- NS_ABORT_IF_FALSE(0 != pmc->mNestedLoopTimerId,
- "callback after descheduling");
- NS_ABORT_IF_FALSE(pmc->mTopLoopDepth < g_main_depth(),
- "not canceled before returning to main event loop!");
+ MOZ_ASSERT(0 != pmc->mNestedLoopTimerId,
+ "callback after descheduling");
+ MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+ "not canceled before returning to main event loop!");
PLUGIN_LOG_DEBUG(("Detected nested glib event loop"));
// just detected a nested loop; start a timer that will
// periodically rpc-call back into the browser and process some
// events
pmc->mNestedLoopTimerId =
g_timeout_add_full(kBrowserEventPriority,
@@ -537,68 +537,68 @@ PluginModuleChild::DetectNestedEventLoop
}
// static
gboolean
PluginModuleChild::ProcessBrowserEvents(gpointer data)
{
PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
- NS_ABORT_IF_FALSE(pmc->mTopLoopDepth < g_main_depth(),
- "not canceled before returning to main event loop!");
+ MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
+ "not canceled before returning to main event loop!");
pmc->CallProcessSomeEvents();
return TRUE;
}
void
PluginModuleChild::EnteredCxxStack()
{
- NS_ABORT_IF_FALSE(0 == mNestedLoopTimerId,
- "previous timer not descheduled");
+ MOZ_ASSERT(0 == mNestedLoopTimerId,
+ "previous timer not descheduled");
mNestedLoopTimerId =
g_timeout_add_full(kNestedLoopDetectorPriority,
kNestedLoopDetectorIntervalMs,
PluginModuleChild::DetectNestedEventLoop,
this,
nullptr);
#ifdef DEBUG
mTopLoopDepth = g_main_depth();
#endif
}
void
PluginModuleChild::ExitedCxxStack()
{
- NS_ABORT_IF_FALSE(0 < mNestedLoopTimerId,
- "nested loop timeout not scheduled");
+ MOZ_ASSERT(0 < mNestedLoopTimerId,
+ "nested loop timeout not scheduled");
g_source_remove(mNestedLoopTimerId);
mNestedLoopTimerId = 0;
}
#elif defined (MOZ_WIDGET_QT)
void
PluginModuleChild::EnteredCxxStack()
{
- NS_ABORT_IF_FALSE(mNestedLoopTimerObject == nullptr,
- "previous timer not descheduled");
+ MOZ_ASSERT(mNestedLoopTimerObject == nullptr,
+ "previous timer not descheduled");
mNestedLoopTimerObject = new NestedLoopTimer(this);
QTimer::singleShot(kNestedLoopDetectorIntervalMs,
mNestedLoopTimerObject, SLOT(timeOut()));
}
void
PluginModuleChild::ExitedCxxStack()
{
- NS_ABORT_IF_FALSE(mNestedLoopTimerObject != nullptr,
- "nested loop timeout not scheduled");
+ MOZ_ASSERT(mNestedLoopTimerObject != nullptr,
+ "nested loop timeout not scheduled");
delete mNestedLoopTimerObject;
mNestedLoopTimerObject = nullptr;
}
#endif
bool
PluginModuleChild::RecvSetParentHangTimeout(const uint32_t& aSeconds)
@@ -631,18 +631,18 @@ PluginModuleChild::InitGraphics()
// GtkPlug is a static class so will leak anyway but this ref makes sure.
gpointer gtk_plug_class = g_type_class_ref(GTK_TYPE_PLUG);
// The dispose method is a good place to hook into the destruction process
// because the reference count should be 1 the last time dispose is
// called. (Toggle references wouldn't detect if the reference count
// might be higher.)
GObjectDisposeFn* dispose = &G_OBJECT_CLASS(gtk_plug_class)->dispose;
- NS_ABORT_IF_FALSE(*dispose != wrap_gtk_plug_dispose,
- "InitGraphics called twice");
+ MOZ_ASSERT(*dispose != wrap_gtk_plug_dispose,
+ "InitGraphics called twice");
real_gtk_plug_dispose = *dispose;
*dispose = wrap_gtk_plug_dispose;
// If we ever stop setting GDK_NATIVE_WINDOWS, we'll also need to
// gtk_widget_add_events GDK_SCROLL_MASK or GDK client-side windows will
// not tell us about the scroll events that it intercepts. With native
// windows, this is called when GDK intercepts the events; if GDK doesn't
// intercept the events, then the X server will instead send them directly
@@ -1083,17 +1083,17 @@ const NPNetscapeFuncs PluginModuleChild:
nullptr, // handleevent, unimplemented
nullptr, // unfocusinstance, unimplemented
mozilla::plugins::child::_urlredirectresponse
};
PluginInstanceChild*
InstCast(NPP aNPP)
{
- NS_ABORT_IF_FALSE(!!(aNPP->ndata), "nil instance");
+ MOZ_ASSERT(!!(aNPP->ndata), "nil instance");
return static_cast<PluginInstanceChild*>(aNPP->ndata);
}
namespace mozilla {
namespace plugins {
namespace child {
NPError
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1507,18 +1507,18 @@ PluginModuleParent::NPP_SetValue(NPP ins
}
bool
PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
{
#ifndef MOZ_X11
NS_RUNTIMEABORT("This message only makes sense on X11 platforms");
#else
- NS_ABORT_IF_FALSE(0 > mPluginXSocketFdDup.get(),
- "Already backed up X resources??");
+ MOZ_ASSERT(0 > mPluginXSocketFdDup.get(),
+ "Already backed up X resources??");
mPluginXSocketFdDup.forget();
if (aXSocketFd.IsValid()) {
mPluginXSocketFdDup.reset(aXSocketFd.PlatformHandle());
}
#endif
return true;
}
--- a/dom/plugins/ipc/PluginProcessChild.cpp
+++ b/dom/plugins/ipc/PluginProcessChild.cpp
@@ -104,24 +104,24 @@ PluginProcessChild::Init()
std::string pluginFilename;
#if defined(OS_POSIX)
// NB: need to be very careful in ensuring that the first arg
// (after the binary name) here is indeed the plugin module path.
// Keep in sync with dom/plugins/PluginModuleParent.
std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
- NS_ABORT_IF_FALSE(values.size() >= 2, "not enough args");
+ MOZ_ASSERT(values.size() >= 2, "not enough args");
pluginFilename = UnmungePluginDsoPath(values[1]);
#elif defined(OS_WIN)
std::vector<std::wstring> values =
CommandLine::ForCurrentProcess()->GetLooseValues();
- NS_ABORT_IF_FALSE(values.size() >= 1, "not enough loose args");
+ MOZ_ASSERT(values.size() >= 1, "not enough loose args");
if (ShouldProtectPluginCurrentDirectory(values[0].c_str())) {
SanitizeEnvironmentVariables();
SetDllDirectory(L"");
}
pluginFilename = WideToUTF8(values[0]);
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -32,17 +32,16 @@
#include "nsNullPrincipal.h"
#include "nsIContentPolicy.h"
#include "nsSupportsPrimitives.h"
#include "nsThreadUtils.h"
#include "nsString.h"
#include "prlog.h"
#include "mozilla/dom/CSPReportBinding.h"
#include "mozilla/net/ReferrerPolicy.h"
-#include "nsSandboxFlags.h"
using namespace mozilla;
#if defined(PR_LOGGING)
static PRLogModuleInfo *
GetCspContextLog()
{
static PRLogModuleInfo *gCspContextPRLog;
@@ -1182,59 +1181,16 @@ nsCSPContext::Permits(nsIURI* aURI,
spec.get(), aDir,
*outPermits ? "allow" : "deny"));
}
#endif
return NS_OK;
}
-NS_IMETHODIMP
-nsCSPContext::GetCSPSandboxFlags(uint32_t* aOutSandboxFlags)
-{
- if (aOutSandboxFlags == nullptr) {
- return NS_ERROR_FAILURE;
- }
- *aOutSandboxFlags = SANDBOXED_NONE;
-
- for (uint32_t i = 0; i < mPolicies.Length(); i++) {
- uint32_t flags = mPolicies[i]->getSandboxFlags();
-
- // current policy doesn't have sandbox flag, check next policy
- if (!flags) {
- continue;
- }
-
- // current policy has sandbox flags, if the policy is in
- // enforcement-mode (i.e., not report-only) set these flags
- // and check for policies with more restrictions
- if (!mPolicies[i]->getReportOnlyFlag()) {
- *aOutSandboxFlags |= flags;
- } else {
- // sandbox directive is ignored in report-only mode, warn about
- // it and continue the loop checking for an enforcement-mode policy
- nsAutoString policy;
- mPolicies[i]->toString(policy);
-
- CSPCONTEXTLOG(("nsCSPContext::ShouldSandbox, report only policy, ignoring sandbox in: %s",
- policy.get()));
-
- const char16_t* params[] = { policy.get() };
- CSP_LogLocalizedStr(MOZ_UTF16("ignoringReportOnlyDirective"),
- params, ArrayLength(params),
- EmptyString(),
- EmptyString(),
- 0, 0,
- nsIScriptError::warningFlag,
- "CSP", mInnerWindowID);
- }
- }
- return NS_OK;
-}
-
/* ========== CSPViolationReportListener implementation ========== */
NS_IMPL_ISUPPORTS(CSPViolationReportListener, nsIStreamListener, nsIRequestObserver, nsISupports);
CSPViolationReportListener::CSPViolationReportListener()
{
}
--- a/dom/security/nsCSPParser.cpp
+++ b/dom/security/nsCSPParser.cpp
@@ -10,17 +10,16 @@
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIStringBundle.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsUnicharUtils.h"
#include "mozilla/net/ReferrerPolicy.h"
-#include "nsContentUtils.h"
using namespace mozilla;
#if defined(PR_LOGGING)
static PRLogModuleInfo*
GetCspParserLog()
{
static PRLogModuleInfo* gCspParserPRLog;
@@ -908,49 +907,16 @@ nsCSPParser::reportURIList(nsTArray<nsCS
}
// Create new nsCSPReportURI and append to the list.
nsCSPReportURI* reportURI = new nsCSPReportURI(uri);
outSrcs.AppendElement(reportURI);
}
}
-/* Helper function for parsing sandbox flags. This function solely
- * concatenates all the source list tokens (the sandbox flags) so the
- * attribute parser (nsContentUtils::ParseSandboxAttributeToFlags) can
- * use them.
- */
-void
-nsCSPParser::sandboxFlagList(nsTArray<nsCSPBaseSrc*>& outSrcs)
-{
- nsAutoString flags;
-
- // remember, srcs start at index 1
- for (uint32_t i = 1; i < mCurDir.Length(); i++) {
- mCurToken = mCurDir[i];
-
- CSPPARSERLOG(("nsCSPParser::sandboxFlagList, mCurToken: %s, mCurValue: %s",
- NS_ConvertUTF16toUTF8(mCurToken).get(),
- NS_ConvertUTF16toUTF8(mCurValue).get()));
-
- if (!nsContentUtils::IsValidSandboxFlag(mCurToken)) {
- const char16_t* params[] = { mCurToken.get() };
- logWarningErrorToConsole(nsIScriptError::warningFlag, "couldntParseInvalidSandboxFlag",
- params, ArrayLength(params));
- continue;
- }
- flags.Append(mCurToken);
- if (i != mCurDir.Length() - 1) {
- flags.AppendASCII(" ");
- }
- }
- nsCSPSandboxFlags* sandboxFlags = new nsCSPSandboxFlags(flags);
- outSrcs.AppendElement(sandboxFlags);
-}
-
// directive-value = *( WSP / <VCHAR except ";" and ","> )
void
nsCSPParser::directiveValue(nsTArray<nsCSPBaseSrc*>& outSrcs)
{
CSPPARSERLOG(("nsCSPParser::directiveValue"));
// The tokenzier already generated an array in the form of
// [ name, src, src, ... ], no need to parse again, but
@@ -962,23 +928,16 @@ nsCSPParser::directiveValue(nsTArray<nsC
// special case handling of the referrer directive (since it doesn't contain
// source lists)
if (CSP_IsDirective(mCurDir[0], nsIContentSecurityPolicy::REFERRER_DIRECTIVE)) {
referrerDirectiveValue();
return;
}
- // For the sandbox flag the source list is a list of flags, so we're
- // special casing this directive
- if (CSP_IsDirective(mCurDir[0], nsIContentSecurityPolicy::SANDBOX_DIRECTIVE)) {
- sandboxFlagList(outSrcs);
- return;
- }
-
// Otherwise just forward to sourceList
sourceList(outSrcs);
}
// directive-name = 1*( ALPHA / DIGIT / "-" )
nsCSPDirective*
nsCSPParser::directiveName()
{
--- a/dom/security/nsCSPParser.h
+++ b/dom/security/nsCSPParser.h
@@ -123,25 +123,24 @@ class nsCSPParser {
nsCSPHashSrc* hashSource();
nsCSPHostSrc* appHost(); // helper function to support app specific hosts
nsCSPHostSrc* host();
bool hostChar();
bool schemeChar();
bool port();
bool path(nsCSPHostSrc* aCspHost);
- bool subHost(); // helper function to parse subDomains
- bool atValidUnreservedChar(); // helper function to parse unreserved
- bool atValidSubDelimChar(); // helper function to parse sub-delims
- bool atValidPctEncodedChar(); // helper function to parse pct-encoded
- bool subPath(nsCSPHostSrc* aCspHost); // helper function to parse paths
- void reportURIList(nsTArray<nsCSPBaseSrc*>& outSrcs); // helper function to parse report-uris
- void percentDecodeStr(const nsAString& aEncStr, // helper function to percent-decode
+ bool subHost(); // helper function to parse subDomains
+ bool atValidUnreservedChar(); // helper function to parse unreserved
+ bool atValidSubDelimChar(); // helper function to parse sub-delims
+ bool atValidPctEncodedChar(); // helper function to parse pct-encoded
+ bool subPath(nsCSPHostSrc* aCspHost); // helper function to parse paths
+ void reportURIList(nsTArray<nsCSPBaseSrc*>& outSrcs); // helper function to parse report-uris
+ void percentDecodeStr(const nsAString& aEncStr, // helper function to percent-decode
nsAString& outDecStr);
- void sandboxFlagList(nsTArray<nsCSPBaseSrc*>& outSrcs); // helper function to parse sandbox flags
inline bool atEnd()
{
return mCurChar >= mEndChar;
}
inline bool accept(char16_t aSymbol)
{
--- a/dom/security/nsCSPUtils.cpp
+++ b/dom/security/nsCSPUtils.cpp
@@ -7,19 +7,16 @@
#include "nsDebug.h"
#include "nsIConsoleService.h"
#include "nsICryptoHash.h"
#include "nsIScriptError.h"
#include "nsIServiceManager.h"
#include "nsIStringBundle.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
-#include "nsContentUtils.h"
-#include "nsAttrValue.h"
-#include "nsSandboxFlags.h"
#if defined(PR_LOGGING)
static PRLogModuleInfo*
GetCspUtilsLog()
{
static PRLogModuleInfo* gCspUtilsPRLog;
if (!gCspUtilsPRLog)
gCspUtilsPRLog = PR_NewLogModule("CSPUtils");
@@ -670,33 +667,16 @@ nsCSPReportURI::toString(nsAString& outS
nsAutoCString spec;
nsresult rv = mReportURI->GetSpec(spec);
if (NS_FAILED(rv)) {
return;
}
outStr.AppendASCII(spec.get());
}
-/* ===== nsCSPSandboxFlags ===================== */
-
-nsCSPSandboxFlags::nsCSPSandboxFlags(const nsAString& aFlags)
- : mFlags(aFlags)
-{
-}
-
-nsCSPSandboxFlags::~nsCSPSandboxFlags()
-{
-}
-
-void
-nsCSPSandboxFlags::toString(nsAString& outStr) const
-{
- outStr.Append(mFlags);
-}
-
/* ===== nsCSPDirective ====================== */
nsCSPDirective::nsCSPDirective(CSPDirective aDirective)
{
mDirective = aDirective;
}
nsCSPDirective::~nsCSPDirective()
@@ -989,31 +969,8 @@ nsCSPPolicy::getReportURIs(nsTArray<nsSt
{
for (uint32_t i = 0; i < mDirectives.Length(); i++) {
if (mDirectives[i]->equals(nsIContentSecurityPolicy::REPORT_URI_DIRECTIVE)) {
mDirectives[i]->getReportURIs(outReportURIs);
return;
}
}
}
-
-/*
- * Helper function that returns the underlying bit representation of
- * sandbox flags. The function returns SANDBOXED_NONE if there is no
- * sandbox directives.
- */
-uint32_t
-nsCSPPolicy::getSandboxFlags() const
-{
- nsAutoString flags;
- for (uint32_t i = 0; i < mDirectives.Length(); i++) {
- if (mDirectives[i]->equals(nsIContentSecurityPolicy::SANDBOX_DIRECTIVE)) {
- flags.Truncate();
- mDirectives[i]->toString(flags);
-
- nsAttrValue attr;
- attr.ParseAtomArray(flags);
-
- return nsContentUtils::ParseSandboxAttributeToFlags(&attr);
- }
- }
- return SANDBOXED_NONE;
-}
--- a/dom/security/nsCSPUtils.h
+++ b/dom/security/nsCSPUtils.h
@@ -69,18 +69,17 @@ static const char* CSPStrDirectives[] =
"frame-src", // FRAME_SRC_DIRECTIVE
"font-src", // FONT_SRC_DIRECTIVE
"connect-src", // CONNECT_SRC_DIRECTIVE
"report-uri", // REPORT_URI_DIRECTIVE
"frame-ancestors", // FRAME_ANCESTORS_DIRECTIVE
"reflected-xss", // REFLECTED_XSS_DIRECTIVE
"base-uri", // BASE_URI_DIRECTIVE
"form-action", // FORM_ACTION_DIRECTIVE
- "referrer", // REFERRER_DIRECTIVE
- "sandbox", // SANDBOX_DIRECTIVE
+ "referrer" // REFERRER_DIRECTIVE
};
inline const char* CSP_CSPDirectiveToString(CSPDirective aDir)
{
return CSPStrDirectives[static_cast<uint32_t>(aDir)];
}
inline CSPDirective CSP_StringToCSPDirective(const nsAString& aDir)
@@ -264,29 +263,16 @@ class nsCSPReportURI : public nsCSPBaseS
virtual ~nsCSPReportURI();
void toString(nsAString& outStr) const;
private:
nsCOMPtr<nsIURI> mReportURI;
};
-/* =============== nsCSPSandboxFlag ============ */
-
-class nsCSPSandboxFlags : public nsCSPBaseSrc {
- public:
- explicit nsCSPSandboxFlags(const nsAString& aFlags);
- virtual ~nsCSPSandboxFlags();
-
- void toString(nsAString& outStr) const;
-
- private:
- nsString mFlags;
-};
-
/* =============== nsCSPDirective ============= */
class nsCSPDirective {
public:
nsCSPDirective();
explicit nsCSPDirective(CSPDirective aDirective);
virtual ~nsCSPDirective();
@@ -358,17 +344,15 @@ class nsCSPPolicy {
void getDirectiveStringForContentType(nsContentPolicyType aContentType,
nsAString& outDirective) const;
void getDirectiveAsString(CSPDirective aDir, nsAString& outDirective) const;
inline uint32_t getNumDirectives() const
{ return mDirectives.Length(); }
- uint32_t getSandboxFlags() const;
-
private:
nsTArray<nsCSPDirective*> mDirectives;
bool mReportOnly;
nsString mReferrerPolicy;
};
#endif /* nsCSPUtils_h___ */
--- a/dom/smil/SMILIntegerType.cpp
+++ b/dom/smil/SMILIntegerType.cpp
@@ -8,17 +8,17 @@
#include "nsDebug.h"
#include <math.h>
namespace mozilla {
void
SMILIntegerType::Init(nsSMILValue& aValue) const
{
- NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type");
+ MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mInt = 0;
aValue.mType = this;
}
void
SMILIntegerType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -27,17 +27,17 @@ using namespace mozilla::dom;
nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
: mAvgTimeBetweenSamples(0),
mResampleNeeded(false),
mDeferredStartSampling(false),
mRunningSample(false),
mRegisteredWithRefreshDriver(false),
mDocument(aDoc)
{
- NS_ABORT_IF_FALSE(aDoc, "need a non-null document");
+ MOZ_ASSERT(aDoc, "need a non-null document");
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (refreshDriver) {
mStartTime = refreshDriver->MostRecentRefresh();
} else {
mStartTime = mozilla::TimeStamp::Now();
}
mCurrentSampleTime = mStartTime;
@@ -52,19 +52,19 @@ nsSMILAnimationController::~nsSMILAnimat
" elements when it dies");
NS_ASSERTION(!mRegisteredWithRefreshDriver,
"Leaving stale entry in refresh driver's observer list");
}
void
nsSMILAnimationController::Disconnect()
{
- NS_ABORT_IF_FALSE(mDocument, "disconnecting when we weren't connected...?");
- NS_ABORT_IF_FALSE(mRefCnt.get() == 1,
- "Expecting to disconnect when doc is sole remaining owner");
+ MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?");
+ MOZ_ASSERT(mRefCnt.get() == 1,
+ "Expecting to disconnect when doc is sole remaining owner");
NS_ASSERTION(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE,
"Expecting to be paused for pagehide before disconnect");
StopSampling(GetRefreshDriver());
mDocument = nullptr; // (raw pointer)
}
@@ -165,19 +165,19 @@ void
nsSMILAnimationController::RegisterAnimationElement(
SVGAnimationElement* aAnimationElement)
{
mAnimationElementTable.PutEntry(aAnimationElement);
if (mDeferredStartSampling) {
mDeferredStartSampling = false;
if (mChildContainerTable.Count()) {
// mAnimationElementTable was empty, but now we've added its 1st element
- NS_ABORT_IF_FALSE(mAnimationElementTable.Count() == 1,
- "we shouldn't have deferred sampling if we already had "
- "animations registered");
+ MOZ_ASSERT(mAnimationElementTable.Count() == 1,
+ "we shouldn't have deferred sampling if we already had "
+ "animations registered");
StartSampling(GetRefreshDriver());
Sample(); // Run the first sample manually
} // else, don't sample until a time container is registered (via AddChild)
}
}
void
nsSMILAnimationController::UnregisterAnimationElement(
@@ -260,36 +260,34 @@ void
nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver)
{
NS_ASSERTION(mPauseState == 0, "Starting sampling but controller is paused");
NS_ASSERTION(!mDeferredStartSampling,
"Started sampling but the deferred start flag is still set");
if (aRefreshDriver) {
MOZ_ASSERT(!mRegisteredWithRefreshDriver,
"Redundantly registering with refresh driver");
- NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
- aRefreshDriver == GetRefreshDriver(),
- "Starting sampling with wrong refresh driver");
+ MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
+ "Starting sampling with wrong refresh driver");
// We're effectively resuming from a pause so update our current sample time
// or else it will confuse our "average time between samples" calculations.
mCurrentSampleTime = mozilla::TimeStamp::Now();
aRefreshDriver->AddRefreshObserver(this, Flush_Style);
mRegisteredWithRefreshDriver = true;
}
}
void
nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver)
{
if (aRefreshDriver && mRegisteredWithRefreshDriver) {
// NOTE: The document might already have been detached from its PresContext
// (and RefreshDriver), which would make GetRefreshDriver() return null.
- NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
- aRefreshDriver == GetRefreshDriver(),
- "Stopping sampling with wrong refresh driver");
+ MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
+ "Stopping sampling with wrong refresh driver");
aRefreshDriver->RemoveRefreshObserver(this, Flush_Style);
mRegisteredWithRefreshDriver = false;
}
}
void
nsSMILAnimationController::MaybeStartSampling(nsRefreshDriver* aRefreshDriver)
{
@@ -477,18 +475,18 @@ nsSMILAnimationController::RewindElement
mAnimationElementTable.EnumerateEntries(RewindAnimation, nullptr);
mChildContainerTable.EnumerateEntries(ClearRewindNeeded, nullptr);
}
/*static*/ PLDHashOperator
nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey,
void* aData)
{
- NS_ABORT_IF_FALSE(aData,
- "Null data pointer during time container enumeration");
+ MOZ_ASSERT(aData,
+ "Null data pointer during time container enumeration");
bool* rewindNeeded = static_cast<bool*>(aData);
nsSMILTimeContainer* container = aKey->GetKey();
if (container->NeedsRewind()) {
*rewindNeeded = true;
return PL_DHASH_STOP;
}
@@ -564,17 +562,17 @@ nsSMILAnimationController::DoMilestoneSa
//
// Because we're only performing this clamping at the last moment, the
// animations will still all get sampled in the correct order and
// dependencies will be appropriately resolved.
sampleTime = std::max(nextMilestone.mTime, sampleTime);
for (uint32_t i = 0; i < length; ++i) {
SVGAnimationElement* elem = params.mElements[i].get();
- NS_ABORT_IF_FALSE(elem, "nullptr animation element in list");
+ MOZ_ASSERT(elem, "nullptr animation element in list");
nsSMILTimeContainer* container = elem->GetTimeContainer();
if (!container)
// The container may be nullptr if the element has been detached from its
// parent since registering a milestone.
continue;
nsSMILTimeValue containerTimeValue =
container->ParentToContainerTime(sampleTime);
@@ -592,20 +590,20 @@ nsSMILAnimationController::DoMilestoneSa
}
}
}
/*static*/ PLDHashOperator
nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey,
void* aData)
{
- NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table");
- NS_ABORT_IF_FALSE(aKey->GetKey(), "Null time container key in hash table");
- NS_ABORT_IF_FALSE(aData,
- "Null data pointer during time container enumeration");
+ MOZ_ASSERT(aKey, "Null hash key for time container hash table");
+ MOZ_ASSERT(aKey->GetKey(), "Null time container key in hash table");
+ MOZ_ASSERT(aData,
+ "Null data pointer during time container enumeration");
nsSMILMilestone* nextMilestone = static_cast<nsSMILMilestone*>(aData);
nsSMILTimeContainer* container = aKey->GetKey();
if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
return PL_DHASH_NEXT;
nsSMILMilestone thisMilestone;
@@ -617,20 +615,20 @@ nsSMILAnimationController::GetNextMilest
return PL_DHASH_NEXT;
}
/*static*/ PLDHashOperator
nsSMILAnimationController::GetMilestoneElements(TimeContainerPtrKey* aKey,
void* aData)
{
- NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table");
- NS_ABORT_IF_FALSE(aKey->GetKey(), "Null time container key in hash table");
- NS_ABORT_IF_FALSE(aData,
- "Null data pointer during time container enumeration");
+ MOZ_ASSERT(aKey, "Null hash key for time container hash table");
+ MOZ_ASSERT(aKey->GetKey(), "Null time container key in hash table");
+ MOZ_ASSERT(aData,
+ "Null data pointer during time container enumeration");
GetMilestoneElementsParams* params =
static_cast<GetMilestoneElementsParams*>(aData);
nsSMILTimeContainer* container = aKey->GetKey();
if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
return PL_DHASH_NEXT;
@@ -697,18 +695,18 @@ nsSMILAnimationController::SampleTimedEl
// Instead we build up a hashmap of active time containers during the previous
// step (SampleTimeContainer) and then test here if the container for this
// timed element is in the list.
if (!aActiveContainers->GetEntry(timeContainer))
return;
nsSMILTime containerTime = timeContainer->GetCurrentTime();
- NS_ABORT_IF_FALSE(!timeContainer->IsSeeking(),
- "Doing a regular sample but the time container is still seeking");
+ MOZ_ASSERT(!timeContainer->IsSeeking(),
+ "Doing a regular sample but the time container is still seeking");
aElement->TimedElement().SampleAt(containerTime);
}
/*static*/ void
nsSMILAnimationController::AddAnimationToCompositorTable(
SVGAnimationElement* aElement, nsSMILCompositorTable* aCompositorTable)
{
// Add a compositor to the hash table if there's not already one there
--- a/dom/smil/nsSMILAnimationFunction.cpp
+++ b/dom/smil/nsSMILAnimationFunction.cpp
@@ -215,20 +215,20 @@ nsSMILAnimationFunction::ComposeResult(c
return;
// Check that we have the right number of keySplines and keyTimes
CheckValueListDependentAttrs(values.Length());
if (mErrorFlags != 0)
return;
// If this interval is active, we must have a non-negative mSampleTime
- NS_ABORT_IF_FALSE(mSampleTime >= 0 || !mIsActive,
- "Negative sample time for active animation");
- NS_ABORT_IF_FALSE(mSimpleDuration.IsResolved() || mLastValue,
- "Unresolved simple duration for active or frozen animation");
+ MOZ_ASSERT(mSampleTime >= 0 || !mIsActive,
+ "Negative sample time for active animation");
+ MOZ_ASSERT(mSimpleDuration.IsResolved() || mLastValue,
+ "Unresolved simple duration for active or frozen animation");
// If we want to add but don't have a base value then just fail outright.
// This can happen when we skipped getting the base value because there's an
// animation function in the sandwich that should replace it but that function
// failed unexpectedly.
bool isAdditive = IsAdditive();
if (isAdditive && aResult.IsNull())
return;
@@ -298,18 +298,18 @@ nsSMILAnimationFunction::CompareTo(const
aOther->mAnimationElement->TimedElement();
if (thisTimedElement.IsTimeDependent(otherTimedElement))
return 1;
if (otherTimedElement.IsTimeDependent(thisTimedElement))
return -1;
// Animations that appear later in the document sort after those earlier in
// the document
- NS_ABORT_IF_FALSE(mAnimationElement != aOther->mAnimationElement,
- "Two animations cannot have the same animation content element!");
+ MOZ_ASSERT(mAnimationElement != aOther->mAnimationElement,
+ "Two animations cannot have the same animation content element!");
return (nsContentUtils::PositionIsBefore(mAnimationElement, aOther->mAnimationElement))
? -1 : 1;
}
bool
nsSMILAnimationFunction::WillReplace() const
{
@@ -363,18 +363,18 @@ nsSMILAnimationFunction::InterpolateResu
// If we have an indefinite simple duration, just set the progress to be
// 0 which will give us the expected behaviour of the animation being fixed at
// its starting point.
double simpleProgress = 0.0;
if (mSimpleDuration.IsDefinite()) {
nsSMILTime dur = mSimpleDuration.GetMillis();
- NS_ABORT_IF_FALSE(dur >= 0, "Simple duration should not be negative");
- NS_ABORT_IF_FALSE(mSampleTime >= 0, "Sample time should not be negative");
+ MOZ_ASSERT(dur >= 0, "Simple duration should not be negative");
+ MOZ_ASSERT(mSampleTime >= 0, "Sample time should not be negative");
if (mSampleTime >= dur || mSampleTime < 0) {
NS_ERROR("Animation sampled outside interval");
return NS_ERROR_FAILURE;
}
if (dur > 0) {
simpleProgress = (double)mSampleTime / dur;
@@ -383,17 +383,17 @@ nsSMILAnimationFunction::InterpolateResu
nsresult rv = NS_OK;
nsSMILCalcMode calcMode = GetCalcMode();
if (calcMode != CALC_DISCRETE) {
// Get the normalised progress between adjacent values
const nsSMILValue* from = nullptr;
const nsSMILValue* to = nullptr;
// Init to -1 to make sure that if we ever forget to set this, the
- // NS_ABORT_IF_FALSE that tests that intervalProgress is in range will fail.
+ // MOZ_ASSERT that tests that intervalProgress is in range will fail.
double intervalProgress = -1.f;
if (IsToAnimation()) {
from = &aBaseValue;
to = &aValues[0];
if (calcMode == CALC_PACED) {
// Note: key[Times/Splines/Points] are ignored for calcMode="paced"
intervalProgress = simpleProgress;
} else {
@@ -416,20 +416,20 @@ nsSMILAnimationFunction::InterpolateResu
from = &aValues[index];
to = &aValues[index + 1];
intervalProgress =
scaledSimpleProgress * (aValues.Length() - 1) - index;
intervalProgress = ScaleIntervalProgress(intervalProgress, index);
}
if (NS_SUCCEEDED(rv)) {
- NS_ABORT_IF_FALSE(from, "NULL from-value during interpolation");
- NS_ABORT_IF_FALSE(to, "NULL to-value during interpolation");
- NS_ABORT_IF_FALSE(0.0f <= intervalProgress && intervalProgress < 1.0f,
- "Interval progress should be in the range [0, 1)");
+ MOZ_ASSERT(from, "NULL from-value during interpolation");
+ MOZ_ASSERT(to, "NULL to-value during interpolation");
+ MOZ_ASSERT(0.0f <= intervalProgress && intervalProgress < 1.0f,
+ "Interval progress should be in the range [0, 1)");
rv = from->Interpolate(*to, intervalProgress, aResult);
}
}
// Discrete-CalcMode case
// Note: If interpolation failed (isn't supported for this type), the SVG
// spec says to force discrete mode.
if (calcMode == CALC_DISCRETE || NS_FAILED(rv)) {
@@ -497,17 +497,17 @@ nsSMILAnimationFunction::ComputePacedPos
double& aIntervalProgress,
const nsSMILValue*& aFrom,
const nsSMILValue*& aTo)
{
NS_ASSERTION(0.0f <= aSimpleProgress && aSimpleProgress < 1.0f,
"aSimpleProgress is out of bounds");
NS_ASSERTION(GetCalcMode() == CALC_PACED,
"Calling paced-specific function, but not in paced mode");
- NS_ABORT_IF_FALSE(aValues.Length() >= 2, "Unexpected number of values");
+ MOZ_ASSERT(aValues.Length() >= 2, "Unexpected number of values");
// Trivial case: If we have just 2 values, then there's only one interval
// for us to traverse, and our progress across that interval is the exact
// same as our overall progress.
if (aValues.Length() == 2) {
aIntervalProgress = aSimpleProgress;
aFrom = &aValues[0];
aTo = &aValues[1];
@@ -543,19 +543,19 @@ nsSMILAnimationFunction::ComputePacedPos
NS_ASSERTION(remainingDist >= 0, "distance values must be non-negative");
double curIntervalDist;
#ifdef DEBUG
nsresult rv =
#endif
aValues[i].ComputeDistance(aValues[i+1], curIntervalDist);
- NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv),
- "If we got through ComputePacedTotalDistance, we should "
- "be able to recompute each sub-distance without errors");
+ MOZ_ASSERT(NS_SUCCEEDED(rv),
+ "If we got through ComputePacedTotalDistance, we should "
+ "be able to recompute each sub-distance without errors");
NS_ASSERTION(curIntervalDist >= 0, "distance values must be non-negative");
// Clamp distance value at 0, just in case ComputeDistance is evil.
curIntervalDist = std::max(curIntervalDist, 0.0);
if (remainingDist >= curIntervalDist) {
remainingDist -= curIntervalDist;
} else {
@@ -599,17 +599,17 @@ nsSMILAnimationFunction::ComputePacedTot
double tmpDist;
nsresult rv = aValues[i].ComputeDistance(aValues[i+1], tmpDist);
if (NS_FAILED(rv)) {
return COMPUTE_DISTANCE_ERROR;
}
// Clamp distance value to 0, just in case we have an evil ComputeDistance
// implementation somewhere
- NS_ABORT_IF_FALSE(tmpDist >= 0.0f, "distance values must be non-negative");
+ MOZ_ASSERT(tmpDist >= 0.0f, "distance values must be non-negative");
tmpDist = std::max(tmpDist, 0.0);
totalDistance += tmpDist;
}
return totalDistance;
}
@@ -629,19 +629,19 @@ nsSMILAnimationFunction::ScaleSimpleProg
for (; i < numTimes - 2 && aProgress >= mKeyTimes[i+1]; ++i) { }
if (aCalcMode == CALC_DISCRETE) {
// discrete calcMode behaviour differs in that each keyTime defines the time
// from when the corresponding value is set, and therefore the last value
// needn't be 1. So check if we're in the last 'interval', that is, the
// space between the final value and 1.0.
if (aProgress >= mKeyTimes[i+1]) {
- NS_ABORT_IF_FALSE(i == numTimes - 2,
- "aProgress is not in range of the current interval, yet the current"
- " interval is not the last bounded interval either.");
+ MOZ_ASSERT(i == numTimes - 2,
+ "aProgress is not in range of the current interval, yet the "
+ "current interval is not the last bounded interval either.");
++i;
}
return (double)i / numTimes;
}
double& intervalStart = mKeyTimes[i];
double& intervalEnd = mKeyTimes[i+1];
@@ -658,18 +658,18 @@ nsSMILAnimationFunction::ScaleIntervalPr
uint32_t aIntervalIndex)
{
if (GetCalcMode() != CALC_SPLINE)
return aProgress;
if (!HasAttr(nsGkAtoms::keySplines))
return aProgress;
- NS_ABORT_IF_FALSE(aIntervalIndex < mKeySplines.Length(),
- "Invalid interval index");
+ MOZ_ASSERT(aIntervalIndex < mKeySplines.Length(),
+ "Invalid interval index");
nsSMILKeySpline const &spline = mKeySplines[aIntervalIndex];
return spline.GetSplineValue(aProgress);
}
bool
nsSMILAnimationFunction::HasAttr(nsIAtom* aAttName) const
{
--- a/dom/smil/nsSMILAnimationFunction.h
+++ b/dom/smil/nsSMILAnimationFunction.h
@@ -201,20 +201,20 @@ public:
* after we've reacted to their change to the 'inactive' state, so that we
* won't needlessly recompose their targets in every sample.
*
* This should only be called on an animation function that is inactive and
* that returns true from HasChanged().
*/
void ClearHasChanged()
{
- NS_ABORT_IF_FALSE(HasChanged(),
- "clearing mHasChanged flag, when it's already false");
- NS_ABORT_IF_FALSE(!IsActiveOrFrozen(),
- "clearing mHasChanged flag for active animation");
+ MOZ_ASSERT(HasChanged(),
+ "clearing mHasChanged flag, when it's already false");
+ MOZ_ASSERT(!IsActiveOrFrozen(),
+ "clearing mHasChanged flag for active animation");
mHasChanged = false;
}
/**
* Updates the cached record of our animation target, and returns a boolean
* that indicates whether the target has changed since the last call to this
* function. (This lets nsSMILCompositor check whether its animation
* functions have changed value or target since the last sample. If none of
--- a/dom/smil/nsSMILCSSProperty.cpp
+++ b/dom/smil/nsSMILCSSProperty.cpp
@@ -17,20 +17,20 @@
using namespace mozilla::dom;
// Helper function
static bool
GetCSSComputedValue(Element* aElem,
nsCSSProperty aPropID,
nsAString& aResult)
{
- NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aPropID),
- "Can't look up computed value of shorthand property");
- NS_ABORT_IF_FALSE(nsSMILCSSProperty::IsPropertyAnimatable(aPropID),
- "Shouldn't get here for non-animatable properties");
+ MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID),
+ "Can't look up computed value of shorthand property");
+ MOZ_ASSERT(nsSMILCSSProperty::IsPropertyAnimatable(aPropID),
+ "Shouldn't get here for non-animatable properties");
nsIDocument* doc = aElem->GetCurrentDoc();
if (!doc) {
// This can happen if we process certain types of restyles mid-sample
// and remove anonymous animated content from the document as a result.
// See bug 534975.
return false;
}
@@ -48,19 +48,19 @@ GetCSSComputedValue(Element* aElem,
return true;
}
// Class Methods
nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID,
Element* aElement)
: mPropID(aPropID), mElement(aElement)
{
- NS_ABORT_IF_FALSE(IsPropertyAnimatable(mPropID),
- "Creating a nsSMILCSSProperty for a property "
- "that's not supported for animation");
+ MOZ_ASSERT(IsPropertyAnimatable(mPropID),
+ "Creating a nsSMILCSSProperty for a property "
+ "that's not supported for animation");
}
nsSMILValue
nsSMILCSSProperty::GetBaseValue() const
{
// To benefit from Return Value Optimization and avoid copy constructor calls
// due to our use of return-by-value, we must return the exact same object
// from ALL return points. This function must only return THIS variable:
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -40,18 +40,18 @@ GetZeroValueForUnit(StyleAnimationValue:
sZeroCoord(0, StyleAnimationValue::CoordConstructor);
static const StyleAnimationValue
sZeroPercent(0.0f, StyleAnimationValue::PercentConstructor);
static const StyleAnimationValue
sZeroFloat(0.0f, StyleAnimationValue::FloatConstructor);
static const StyleAnimationValue
sZeroColor(NS_RGB(0,0,0), StyleAnimationValue::ColorConstructor);
- NS_ABORT_IF_FALSE(aUnit != StyleAnimationValue::eUnit_Null,
- "Need non-null unit for a zero value");
+ MOZ_ASSERT(aUnit != StyleAnimationValue::eUnit_Null,
+ "Need non-null unit for a zero value");
switch (aUnit) {
case StyleAnimationValue::eUnit_Coord:
return &sZeroCoord;
case StyleAnimationValue::eUnit_Percent:
return &sZeroPercent;
case StyleAnimationValue::eUnit_Float:
return &sZeroFloat;
case StyleAnimationValue::eUnit_Color:
@@ -70,18 +70,18 @@ GetZeroValueForUnit(StyleAnimationValue:
// may apply a workaround for the special case where a 0 length-value is mixed
// with a eUnit_Float value. (See comment below.)
//
// Returns true on success, or false.
static const bool
FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
const StyleAnimationValue*& aValue2)
{
- NS_ABORT_IF_FALSE(aValue1 || aValue2,
- "expecting at least one non-null value");
+ MOZ_ASSERT(aValue1 || aValue2,
+ "expecting at least one non-null value");
// Are we missing either val? (If so, it's an implied 0 in other val's units)
if (!aValue1) {
aValue1 = GetZeroValueForUnit(aValue2->GetUnit());
return !!aValue1; // Fail if we have no zero value for this unit.
}
if (!aValue2) {
aValue2 = GetZeroValueForUnit(aValue1->GetUnit());
@@ -137,35 +137,35 @@ ExtractValueWrapper(const nsSMILValue& a
return static_cast<const ValueWrapper*>(aValue.mU.mPtr);
}
// Class methods
// -------------
void
nsSMILCSSValueType::Init(nsSMILValue& aValue) const
{
- NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected SMIL value type");
+ MOZ_ASSERT(aValue.IsNull(), "Unexpected SMIL value type");
aValue.mU.mPtr = nullptr;
aValue.mType = this;
}
void
nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const
{
- NS_ABORT_IF_FALSE(aValue.mType == this, "Unexpected SMIL value type");
+ MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<ValueWrapper*>(aValue.mU.mPtr);
aValue.mType = nsSMILNullType::Singleton();
}
nsresult
nsSMILCSSValueType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
- NS_ABORT_IF_FALSE(aDest.mType == aSrc.mType, "Incompatible SMIL types");
- NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL value type");
+ MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
+ MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value type");
const ValueWrapper* srcWrapper = ExtractValueWrapper(aSrc);
ValueWrapper* destWrapper = ExtractValueWrapper(aDest);
if (srcWrapper) {
if (!destWrapper) {
// barely-initialized dest -- need to alloc & copy
aDest.mU.mPtr = new ValueWrapper(*srcWrapper);
} else {
@@ -180,18 +180,18 @@ nsSMILCSSValueType::Assign(nsSMILValue&
return NS_OK;
}
bool
nsSMILCSSValueType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
- NS_ABORT_IF_FALSE(aLeft.mType == aRight.mType, "Incompatible SMIL types");
- NS_ABORT_IF_FALSE(aLeft.mType == this, "Unexpected SMIL value");
+ MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
+ MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL value");
const ValueWrapper* leftWrapper = ExtractValueWrapper(aLeft);
const ValueWrapper* rightWrapper = ExtractValueWrapper(aRight);
if (leftWrapper) {
if (rightWrapper) {
// Both non-null
NS_WARN_IF_FALSE(leftWrapper != rightWrapper,
"Two nsSMILValues with matching ValueWrapper ptr");
@@ -208,24 +208,24 @@ nsSMILCSSValueType::IsEqual(const nsSMIL
// Both null
return true;
}
nsresult
nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
- NS_ABORT_IF_FALSE(aValueToAdd.mType == aDest.mType,
- "Trying to add invalid types");
- NS_ABORT_IF_FALSE(aValueToAdd.mType == this, "Unexpected source type");
+ MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
+ "Trying to add invalid types");
+ MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
ValueWrapper* destWrapper = ExtractValueWrapper(aDest);
const ValueWrapper* valueToAddWrapper = ExtractValueWrapper(aValueToAdd);
- NS_ABORT_IF_FALSE(destWrapper || valueToAddWrapper,
- "need at least one fully-initialized value");
+ MOZ_ASSERT(destWrapper || valueToAddWrapper,
+ "need at least one fully-initialized value");
nsCSSProperty property = (valueToAddWrapper ? valueToAddWrapper->mPropID :
destWrapper->mPropID);
// Special case: font-size-adjust and stroke-dasharray are explicitly
// non-additive (even though StyleAnimationValue *could* support adding them)
if (property == eCSSProperty_font_size_adjust ||
property == eCSSProperty_stroke_dasharray) {
return NS_ERROR_FAILURE;
@@ -255,23 +255,23 @@ nsSMILCSSValueType::Add(nsSMILValue& aDe
NS_OK : NS_ERROR_FAILURE;
}
nsresult
nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
- NS_ABORT_IF_FALSE(aFrom.mType == aTo.mType,
- "Trying to compare different types");
- NS_ABORT_IF_FALSE(aFrom.mType == this, "Unexpected source type");
+ MOZ_ASSERT(aFrom.mType == aTo.mType,
+ "Trying to compare different types");
+ MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
const ValueWrapper* fromWrapper = ExtractValueWrapper(aFrom);
const ValueWrapper* toWrapper = ExtractValueWrapper(aTo);
- NS_ABORT_IF_FALSE(toWrapper, "expecting non-null endpoint");
+ MOZ_ASSERT(toWrapper, "expecting non-null endpoint");
const StyleAnimationValue* fromCSSValue = fromWrapper ?
&fromWrapper->mCSSValue : nullptr;
const StyleAnimationValue* toCSSValue = &toWrapper->mCSSValue;
if (!FinalizeStyleAnimationValues(fromCSSValue, toCSSValue)) {
return NS_ERROR_FAILURE;
}
@@ -282,28 +282,28 @@ nsSMILCSSValueType::ComputeDistance(cons
}
nsresult
nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
const nsSMILValue& aEndVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
- NS_ABORT_IF_FALSE(aStartVal.mType == aEndVal.mType,
- "Trying to interpolate different types");
- NS_ABORT_IF_FALSE(aStartVal.mType == this,
- "Unexpected types for interpolation");
- NS_ABORT_IF_FALSE(aResult.mType == this, "Unexpected result type");
- NS_ABORT_IF_FALSE(aUnitDistance >= 0.0 && aUnitDistance <= 1.0,
- "unit distance value out of bounds");
- NS_ABORT_IF_FALSE(!aResult.mU.mPtr, "expecting barely-initialized outparam");
+ MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
+ "Trying to interpolate different types");
+ MOZ_ASSERT(aStartVal.mType == this,
+ "Unexpected types for interpolation");
+ MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
+ MOZ_ASSERT(aUnitDistance >= 0.0 && aUnitDistance <= 1.0,
+ "unit distance value out of bounds");
+ MOZ_ASSERT(!aResult.mU.mPtr, "expecting barely-initialized outparam");
const ValueWrapper* startWrapper = ExtractValueWrapper(aStartVal);
const ValueWrapper* endWrapper = ExtractValueWrapper(aEndVal);
- NS_ABORT_IF_FALSE(endWrapper, "expecting non-null endpoint");
+ MOZ_ASSERT(endWrapper, "expecting non-null endpoint");
const StyleAnimationValue* startCSSValue = startWrapper ?
&startWrapper->mCSSValue : nullptr;
const StyleAnimationValue* endCSSValue = &endWrapper->mCSSValue;
if (!FinalizeStyleAnimationValues(startCSSValue, endCSSValue)) {
return NS_ERROR_FAILURE;
}
@@ -365,34 +365,33 @@ ValueFromStringHelper(nsCSSProperty aPro
return false;
}
if (isNegative) {
InvertSign(aStyleAnimValue);
}
if (aPropID == eCSSProperty_font_size) {
// Divide out text-zoom, since SVG is supposed to ignore it
- NS_ABORT_IF_FALSE(aStyleAnimValue.GetUnit() ==
- StyleAnimationValue::eUnit_Coord,
- "'font-size' value with unexpected style unit");
+ MOZ_ASSERT(aStyleAnimValue.GetUnit() == StyleAnimationValue::eUnit_Coord,
+ "'font-size' value with unexpected style unit");
aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() /
aPresContext->TextZoom());
}
return true;
}
// static
void
nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
Element* aTargetElement,
const nsAString& aString,
nsSMILValue& aValue,
bool* aIsContextSensitive)
{
- NS_ABORT_IF_FALSE(aValue.IsNull(), "Outparam should be null-typed");
+ MOZ_ASSERT(aValue.IsNull(), "Outparam should be null-typed");
nsPresContext* presContext = GetPresContextForElement(aTargetElement);
if (!presContext) {
NS_WARNING("Not parsing animation value; unable to get PresContext");
return;
}
nsIDocument* doc = aTargetElement->GetCurrentDoc();
if (doc && !nsStyleUtil::CSPAllowsInlineStyle(nullptr,
@@ -410,15 +409,15 @@ nsSMILCSSValueType::ValueFromString(nsCS
}
}
// static
bool
nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
nsAString& aString)
{
- NS_ABORT_IF_FALSE(aValue.mType == &nsSMILCSSValueType::sSingleton,
- "Unexpected SMIL value type");
+ MOZ_ASSERT(aValue.mType == &nsSMILCSSValueType::sSingleton,
+ "Unexpected SMIL value type");
const ValueWrapper* wrapper = ExtractValueWrapper(aValue);
return !wrapper ||
StyleAnimationValue::UncomputeValue(wrapper->mPropID,
wrapper->mCSSValue, aString);
}
--- a/dom/smil/nsSMILInstanceTime.cpp
+++ b/dom/smil/nsSMILInstanceTime.cpp
@@ -42,21 +42,21 @@ nsSMILInstanceTime::nsSMILInstanceTime(c
break;
}
SetBaseInterval(aBaseInterval);
}
nsSMILInstanceTime::~nsSMILInstanceTime()
{
- NS_ABORT_IF_FALSE(!mBaseInterval,
- "Destroying instance time without first calling Unlink()");
- NS_ABORT_IF_FALSE(mFixedEndpointRefCnt == 0,
- "Destroying instance time that is still used as the fixed endpoint of an "
- "interval");
+ MOZ_ASSERT(!mBaseInterval,
+ "Destroying instance time without first calling Unlink()");
+ MOZ_ASSERT(mFixedEndpointRefCnt == 0,
+ "Destroying instance time that is still used as the fixed "
+ "endpoint of an interval");
}
void
nsSMILInstanceTime::Unlink()
{
nsRefPtr<nsSMILInstanceTime> deathGrip(this);
if (mBaseInterval) {
mBaseInterval->RemoveDependentTime(*this);
@@ -73,17 +73,17 @@ nsSMILInstanceTime::HandleChangedInterva
{
// It's possible a sequence of notifications might cause our base interval to
// be updated and then deleted. Furthermore, the delete might happen whilst
// we're still in the queue to be notified of the change. In any case, if we
// don't have a base interval, just ignore the change.
if (!mBaseInterval)
return;
- NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not.");
+ MOZ_ASSERT(mCreator, "Base interval is set but creator is not.");
if (mVisited) {
// Break the cycle here
Unlink();
return;
}
bool objectChanged = mCreator->DependsOnBegin() ? aBeginObjectChanged :
@@ -95,33 +95,35 @@ nsSMILInstanceTime::HandleChangedInterva
nsRefPtr<nsSMILInstanceTime> deathGrip(this);
mCreator->HandleChangedInstanceTime(*GetBaseTime(), aSrcContainer, *this,
objectChanged);
}
void
nsSMILInstanceTime::HandleDeletedInterval()
{
- NS_ABORT_IF_FALSE(mBaseInterval,
- "Got call to HandleDeletedInterval on an independent instance time");
- NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not");
+ MOZ_ASSERT(mBaseInterval,
+ "Got call to HandleDeletedInterval on an independent instance "
+ "time");
+ MOZ_ASSERT(mCreator, "Base interval is set but creator is not");
mBaseInterval = nullptr;
mFlags &= ~kMayUpdate; // Can't update without a base interval
nsRefPtr<nsSMILInstanceTime> deathGrip(this);
mCreator->HandleDeletedInstanceTime(*this);
mCreator = nullptr;
}
void
nsSMILInstanceTime::HandleFilteredInterval()
{
- NS_ABORT_IF_FALSE(mBaseInterval,
- "Got call to HandleFilteredInterval on an independent instance time");
+ MOZ_ASSERT(mBaseInterval,
+ "Got call to HandleFilteredInterval on an independent instance "
+ "time");
mBaseInterval = nullptr;
mFlags &= ~kMayUpdate; // Can't update without a base interval
mCreator = nullptr;
}
bool
nsSMILInstanceTime::ShouldPreserve() const
@@ -133,26 +135,26 @@ void
nsSMILInstanceTime::UnmarkShouldPreserve()
{
mFlags &= ~kWasDynamicEndpoint;
}
void
nsSMILInstanceTime::AddRefFixedEndpoint()
{
- NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < UINT16_MAX,
- "Fixed endpoint reference count upper limit reached");
+ MOZ_ASSERT(mFixedEndpointRefCnt < UINT16_MAX,
+ "Fixed endpoint reference count upper limit reached");
++mFixedEndpointRefCnt;
mFlags &= ~kMayUpdate; // Once fixed, always fixed
}
void
nsSMILInstanceTime::ReleaseFixedEndpoint()
{
- NS_ABORT_IF_FALSE(mFixedEndpointRefCnt > 0, "Duplicate release");
+ MOZ_ASSERT(mFixedEndpointRefCnt > 0, "Duplicate release");
--mFixedEndpointRefCnt;
if (mFixedEndpointRefCnt == 0 && IsDynamic()) {
mFlags |= kWasDynamicEndpoint;
}
}
bool
nsSMILInstanceTime::IsDependentOn(const nsSMILInstanceTime& aOther) const
@@ -174,35 +176,36 @@ nsSMILInstanceTime::IsDependentOn(const
const nsSMILInstanceTime*
nsSMILInstanceTime::GetBaseTime() const
{
if (!mBaseInterval) {
return nullptr;
}
- NS_ABORT_IF_FALSE(mCreator, "Base interval is set but there is no creator.");
+ MOZ_ASSERT(mCreator, "Base interval is set but there is no creator.");
if (!mCreator) {
return nullptr;
}
return mCreator->DependsOnBegin() ? mBaseInterval->Begin() :
mBaseInterval->End();
}
void
nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval)
{
- NS_ABORT_IF_FALSE(!mBaseInterval,
- "Attempting to reassociate an instance time with a different interval.");
+ MOZ_ASSERT(!mBaseInterval,
+ "Attempting to reassociate an instance time with a different "
+ "interval.");
if (aBaseInterval) {
- NS_ABORT_IF_FALSE(mCreator,
- "Attempting to create a dependent instance time without reference "
- "to the creating nsSMILTimeValueSpec object.");
+ MOZ_ASSERT(mCreator,
+ "Attempting to create a dependent instance time without "
+ "reference to the creating nsSMILTimeValueSpec object.");
if (!mCreator)
return;
aBaseInterval->AddDependentTime(*this);
}
mBaseInterval = aBaseInterval;
}
--- a/dom/smil/nsSMILInstanceTime.h
+++ b/dom/smil/nsSMILInstanceTime.h
@@ -72,18 +72,18 @@ public:
bool ShouldPreserve() const;
void UnmarkShouldPreserve();
void AddRefFixedEndpoint();
void ReleaseFixedEndpoint();
void DependentUpdate(const nsSMILTimeValue& aNewTime)
{
- NS_ABORT_IF_FALSE(!IsFixedTime(),
- "Updating an instance time that is not expected to be updated");
+ MOZ_ASSERT(!IsFixedTime(),
+ "Updating an instance time that is not expected to be updated");
mTime = aNewTime;
}
bool IsDependent() const { return !!mBaseInterval; }
bool IsDependentOn(const nsSMILInstanceTime& aOther) const;
const nsSMILInterval* GetBaseInterval() const { return mBaseInterval; }
const nsSMILInstanceTime* GetBaseTime() const;
--- a/dom/smil/nsSMILInterval.cpp
+++ b/dom/smil/nsSMILInterval.cpp
@@ -14,33 +14,33 @@ nsSMILInterval::nsSMILInterval()
nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther)
:
mBegin(aOther.mBegin),
mEnd(aOther.mEnd),
mBeginFixed(false),
mEndFixed(false)
{
- NS_ABORT_IF_FALSE(aOther.mDependentTimes.IsEmpty(),
- "Attempting to copy-construct an interval with dependent times, "
- "this will lead to instance times being shared between intervals.");
+ MOZ_ASSERT(aOther.mDependentTimes.IsEmpty(),
+ "Attempt to copy-construct an interval with dependent times; this "
+ "will lead to instance times being shared between intervals.");
// For the time being we don't allow intervals with fixed endpoints to be
// copied since we only ever copy-construct to establish a new current
// interval. If we ever need to copy historical intervals we may need to move
// the ReleaseFixedEndpoint calls from Unlink to the dtor.
- NS_ABORT_IF_FALSE(!aOther.mBeginFixed && !aOther.mEndFixed,
- "Attempting to copy-construct an interval with fixed endpoints");
+ MOZ_ASSERT(!aOther.mBeginFixed && !aOther.mEndFixed,
+ "Attempt to copy-construct an interval with fixed endpoints");
}
nsSMILInterval::~nsSMILInterval()
{
- NS_ABORT_IF_FALSE(mDependentTimes.IsEmpty(),
- "Destroying interval without disassociating dependent instance times. "
- "Unlink was not called");
+ MOZ_ASSERT(mDependentTimes.IsEmpty(),
+ "Destroying interval without disassociating dependent instance "
+ "times. Unlink was not called");
}
void
nsSMILInterval::Unlink(bool aFiltered)
{
for (int32_t i = mDependentTimes.Length() - 1; i >= 0; --i) {
if (aFiltered) {
mDependentTimes[i]->HandleFilteredInterval();
@@ -57,76 +57,76 @@ nsSMILInterval::Unlink(bool aFiltered)
mEnd->ReleaseFixedEndpoint();
}
mEnd = nullptr;
}
nsSMILInstanceTime*
nsSMILInterval::Begin()
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Requesting Begin() on un-initialized interval.");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting Begin() on un-initialized interval.");
return mBegin;
}
nsSMILInstanceTime*
nsSMILInterval::End()
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Requesting End() on un-initialized interval.");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting End() on un-initialized interval.");
return mEnd;
}
void
nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin)
{
- NS_ABORT_IF_FALSE(aBegin.Time().IsDefinite(),
- "Attempting to set unresolved or indefinite begin time on interval");
- NS_ABORT_IF_FALSE(!mBeginFixed,
- "Attempting to set begin time but the begin point is fixed");
+ MOZ_ASSERT(aBegin.Time().IsDefinite(),
+ "Attempt to set unresolved or indefinite begin time on interval");
+ MOZ_ASSERT(!mBeginFixed,
+ "Attempt to set begin time but the begin point is fixed");
// Check that we're not making an instance time dependent on itself. Such an
// arrangement does not make intuitive sense and should be detected when
// creating or updating intervals.
- NS_ABORT_IF_FALSE(!mBegin || aBegin.GetBaseTime() != mBegin,
- "Attempting to make self-dependent instance time");
+ MOZ_ASSERT(!mBegin || aBegin.GetBaseTime() != mBegin,
+ "Attempt to make self-dependent instance time");
mBegin = &aBegin;
}
void
nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd)
{
- NS_ABORT_IF_FALSE(!mEndFixed,
- "Attempting to set end time but the end point is fixed");
+ MOZ_ASSERT(!mEndFixed,
+ "Attempt to set end time but the end point is fixed");
// As with SetBegin, check we're not making an instance time dependent on
// itself.
- NS_ABORT_IF_FALSE(!mEnd || aEnd.GetBaseTime() != mEnd,
- "Attempting to make self-dependent instance time");
+ MOZ_ASSERT(!mEnd || aEnd.GetBaseTime() != mEnd,
+ "Attempting to make self-dependent instance time");
mEnd = &aEnd;
}
void
nsSMILInterval::FixBegin()
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Fixing begin point on un-initialized interval");
- NS_ABORT_IF_FALSE(!mBeginFixed, "Duplicate calls to FixBegin()");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Fixing begin point on un-initialized interval");
+ MOZ_ASSERT(!mBeginFixed, "Duplicate calls to FixBegin()");
mBeginFixed = true;
mBegin->AddRefFixedEndpoint();
}
void
nsSMILInterval::FixEnd()
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Fixing end point on un-initialized interval");
- NS_ABORT_IF_FALSE(mBeginFixed,
- "Fixing the end of an interval without a fixed begin");
- NS_ABORT_IF_FALSE(!mEndFixed, "Duplicate calls to FixEnd()");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Fixing end point on un-initialized interval");
+ MOZ_ASSERT(mBeginFixed,
+ "Fixing the end of an interval without a fixed begin");
+ MOZ_ASSERT(!mEndFixed, "Duplicate calls to FixEnd()");
mEndFixed = true;
mEnd->AddRefFixedEndpoint();
}
void
nsSMILInterval::AddDependentTime(nsSMILInstanceTime& aTime)
{
nsRefPtr<nsSMILInstanceTime>* inserted =
@@ -138,17 +138,17 @@ nsSMILInterval::AddDependentTime(nsSMILI
void
nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime)
{
#ifdef DEBUG
bool found =
#endif
mDependentTimes.RemoveElementSorted(&aTime);
- NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete.");
+ MOZ_ASSERT(found, "Couldn't find instance time to delete.");
}
void
nsSMILInterval::GetDependentTimes(InstanceTimeList& aTimes)
{
aTimes = mDependentTimes;
}
--- a/dom/smil/nsSMILInterval.h
+++ b/dom/smil/nsSMILInterval.h
@@ -23,26 +23,26 @@ class nsSMILInterval
public:
nsSMILInterval();
nsSMILInterval(const nsSMILInterval& aOther);
~nsSMILInterval();
void Unlink(bool aFiltered = false);
const nsSMILInstanceTime* Begin() const
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Requesting Begin() on un-initialized instance time");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting Begin() on un-initialized instance time");
return mBegin;
}
nsSMILInstanceTime* Begin();
const nsSMILInstanceTime* End() const
{
- NS_ABORT_IF_FALSE(mBegin && mEnd,
- "Requesting End() on un-initialized instance time");
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting End() on un-initialized instance time");
return mEnd;
}
nsSMILInstanceTime* End();
void SetBegin(nsSMILInstanceTime& aBegin);
void SetEnd(nsSMILInstanceTime& aEnd);
void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd)
{
--- a/dom/smil/nsSMILParserUtils.cpp
+++ b/dom/smil/nsSMILParserUtils.cpp
@@ -266,26 +266,25 @@ ParseOptionalOffset(RangedPtr<const char
return SkipWhitespace(aIter, aEnd) &&
ParseOffsetValue(aIter, aEnd, aResult);
}
bool
ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult)
{
- NS_ABORT_IF_FALSE(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) ||
- StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC),
- "Calling ParseAccessKey on non-accesskey-type spec");
+ MOZ_ASSERT(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) ||
+ StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC),
+ "Calling ParseAccessKey on non-accesskey-type spec");
nsSMILTimeValueSpecParams result;
result.mType = nsSMILTimeValueSpecParams::ACCESSKEY;
- NS_ABORT_IF_FALSE(
- ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(),
- "Case variations for accesskey prefix differ in length");
+ MOZ_ASSERT(ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(),
+ "Case variations for accesskey prefix differ in length");
RangedPtr<const char16_t> iter(SVGContentUtils::GetStartRangedPtr(aSpec));
RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec));
iter += ACCESSKEY_PREFIX_LC.Length();
// Expecting at least <accesskey> + ')'
if (end - iter < 2)
@@ -366,17 +365,17 @@ ConvertTokenToAtom(const nsAString& aTok
nsAutoString token(aToken);
const char16_t* read = token.BeginReading();
const char16_t* const end = token.EndReading();
char16_t* write = token.BeginWriting();
bool escape = false;
while (read != end) {
- NS_ABORT_IF_FALSE(write <= read, "Writing past where we've read");
+ MOZ_ASSERT(write <= read, "Writing past where we've read");
if (!escape && *read == '\\') {
escape = true;
++read;
} else {
*write++ = *read++;
escape = false;
}
}
--- a/dom/smil/nsSMILTimeContainer.cpp
+++ b/dom/smil/nsSMILTimeContainer.cpp
@@ -249,19 +249,19 @@ nsSMILTimeContainer::PopMilestoneElement
nsSMILTimeValue containerTime = ParentToContainerTime(aMilestone.mTime);
if (!containerTime.IsDefinite())
return false;
nsSMILMilestone containerMilestone(containerTime.GetMillis(),
aMilestone.mIsEnd);
- NS_ABORT_IF_FALSE(mMilestoneEntries.Top().mMilestone >= containerMilestone,
- "Trying to pop off earliest times but we have earlier ones that were "
- "overlooked");
+ MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone,
+ "Trying to pop off earliest times but we have earlier ones that "
+ "were overlooked");
bool gotOne = false;
while (!mMilestoneEntries.IsEmpty() &&
mMilestoneEntries.Top().mMilestone == containerMilestone)
{
aMatchedElements.AppendElement(mMilestoneEntries.Pop().mTimebase);
gotOne = true;
}
@@ -286,17 +286,17 @@ nsSMILTimeContainer::Unlink()
mMilestoneEntries.Clear();
}
void
nsSMILTimeContainer::UpdateCurrentTime()
{
nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime();
mCurrentTime = now - mParentOffset;
- NS_ABORT_IF_FALSE(mCurrentTime >= 0, "Container has negative time");
+ MOZ_ASSERT(mCurrentTime >= 0, "Container has negative time");
}
void
nsSMILTimeContainer::NotifyTimeChange()
{
// Called when the container time is changed with respect to the document
// time. When this happens time dependencies in other time containers need to
// re-resolve their times because begin and end times are stored in container
@@ -308,14 +308,14 @@ nsSMILTimeContainer::NotifyTimeChange()
// registered. Other timed elements don't matter.
const MilestoneEntry* p = mMilestoneEntries.Elements();
#if DEBUG
uint32_t queueLength = mMilestoneEntries.Length();
#endif
while (p < mMilestoneEntries.Elements() + mMilestoneEntries.Length()) {
mozilla::dom::SVGAnimationElement* elem = p->mTimebase.get();
elem->TimedElement().HandleContainerTimeChange();
- NS_ABORT_IF_FALSE(queueLength == mMilestoneEntries.Length(),
- "Call to HandleContainerTimeChange resulted in a change to the "
- "queue of milestones");
+ MOZ_ASSERT(queueLength == mMilestoneEntries.Length(),
+ "Call to HandleContainerTimeChange resulted in a change to the "
+ "queue of milestones");
++p;
}
}
--- a/dom/smil/nsSMILTimeValue.h
+++ b/dom/smil/nsSMILTimeValue.h
@@ -83,18 +83,18 @@ public:
{
mState = STATE_UNRESOLVED;
mMilliseconds = kUnresolvedMillis;
}
bool IsDefinite() const { return mState == STATE_DEFINITE; }
nsSMILTime GetMillis() const
{
- NS_ABORT_IF_FALSE(mState == STATE_DEFINITE,
- "GetMillis() called for unresolved or indefinite time");
+ MOZ_ASSERT(mState == STATE_DEFINITE,
+ "GetMillis() called for unresolved or indefinite time");
return mState == STATE_DEFINITE ? mMilliseconds : kUnresolvedMillis;
}
void SetMillis(nsSMILTime aMillis)
{
mState = STATE_DEFINITE;
mMilliseconds = aMillis;
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -87,18 +87,18 @@ nsSMILTimeValueSpec::SetSpec(const nsASt
}
void
nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode)
{
if (mParams.mType != nsSMILTimeValueSpecParams::SYNCBASE && !IsEventBased())
return;
- NS_ABORT_IF_FALSE(aContextNode,
- "null context node for resolving timing references against");
+ MOZ_ASSERT(aContextNode,
+ "null context node for resolving timing references against");
// If we're not bound to the document yet, don't worry, we'll get called again
// when that happens
if (!aContextNode->IsInDoc())
return;
// Hold ref to the old element so that it isn't destroyed in between resetting
// the referenced element and using the pointer to update the referenced
@@ -108,20 +108,20 @@ nsSMILTimeValueSpec::ResolveReferences(n
if (mParams.mDependentElemID) {
mReferencedElement.ResetWithID(aContextNode,
nsDependentAtomString(mParams.mDependentElemID));
} else if (mParams.mType == nsSMILTimeValueSpecParams::EVENT) {
Element* target = mOwner->GetTargetElement();
mReferencedElement.ResetWithElement(target);
} else if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) {
nsIDocument* doc = aContextNode->GetCurrentDoc();
- NS_ABORT_IF_FALSE(doc, "We are in the document but current doc is null");
+ MOZ_ASSERT(doc, "We are in the document but current doc is null");
mReferencedElement.ResetWithElement(doc->GetRootElement());
} else {
- NS_ABORT_IF_FALSE(false, "Syncbase or repeat spec without ID");
+ MOZ_ASSERT(false, "Syncbase or repeat spec without ID");
}
UpdateReferencedElement(oldReferencedElement, mReferencedElement.get());
}
bool
nsSMILTimeValueSpec::IsEventBased() const
{
return mParams.mType == nsSMILTimeValueSpecParams::EVENT ||
@@ -292,21 +292,22 @@ nsSMILTimeValueSpec::IsWhitelistedEvent(
}
return false;
}
void
nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget)
{
- NS_ABORT_IF_FALSE(IsEventBased(),
- "Attempting to register event-listener for unexpected nsSMILTimeValueSpec"
- " type");
- NS_ABORT_IF_FALSE(mParams.mEventSymbol,
- "Attempting to register event-listener but there is no event name");
+ MOZ_ASSERT(IsEventBased(),
+ "Attempting to register event-listener for unexpected "
+ "nsSMILTimeValueSpec type");
+ MOZ_ASSERT(mParams.mEventSymbol,
+ "Attempting to register event-listener but there is no event "
+ "name");
if (!aTarget)
return;
// When script is disabled, only allow registration for whitelisted events.
if (!aTarget->GetOwnerDocument()->IsScriptEnabled() &&
!IsWhitelistedEvent()) {
return;
@@ -338,17 +339,17 @@ nsSMILTimeValueSpec::UnregisterEventList
elm->RemoveEventListenerByType(mEventListener,
nsDependentAtomString(mParams.mEventSymbol),
AllEventsAtSystemGroupBubble());
}
EventListenerManager*
nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget)
{
- NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager");
+ MOZ_ASSERT(aTarget, "null target; can't get EventListenerManager");
nsCOMPtr<EventTarget> target;
if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) {
nsIDocument* doc = aTarget->GetCurrentDoc();
if (!doc)
return nullptr;
nsPIDOMWindow* win = doc->GetWindow();
@@ -362,20 +363,20 @@ nsSMILTimeValueSpec::GetEventListenerMan
return nullptr;
return target->GetOrCreateListenerManager();
}
void
nsSMILTimeValueSpec::HandleEvent(nsIDOMEvent* aEvent)
{
- NS_ABORT_IF_FALSE(mEventListener, "Got event without an event listener");
- NS_ABORT_IF_FALSE(IsEventBased(),
- "Got event for non-event nsSMILTimeValueSpec");
- NS_ABORT_IF_FALSE(aEvent, "No event supplied");
+ MOZ_ASSERT(mEventListener, "Got event without an event listener");
+ MOZ_ASSERT(IsEventBased(),
+ "Got event for non-event nsSMILTimeValueSpec");
+ MOZ_ASSERT(aEvent, "No event supplied");
// XXX In the long run we should get the time from the event itself which will
// store the time in global document time which we'll need to convert to our
// time container
nsSMILTimeContainer* container = mOwner->GetTimeContainer();
if (!container)
return;
@@ -504,18 +505,18 @@ nsSMILTimeValueSpec::ConvertBetweenTimeC
nsSMILTimeValue docTime =
aSrcContainer->ContainerToParentTime(aSrcTime.GetMillis());
if (docTime.IsIndefinite())
// This will happen if the source container is paused and we have a future
// time. Just return the indefinite time.
return docTime;
- NS_ABORT_IF_FALSE(docTime.IsDefinite(),
- "ContainerToParentTime gave us an unresolved or indefinite time");
+ MOZ_ASSERT(docTime.IsDefinite(),
+ "ContainerToParentTime gave us an unresolved or indefinite time");
return dstContainer->ParentToContainerTime(docTime.GetMillis());
}
bool
nsSMILTimeValueSpec::ApplyOffset(nsSMILTimeValue& aTime) const
{
// indefinite + offset = indefinite. Likewise for unresolved times.
--- a/dom/smil/nsSMILTimedElement.cpp
+++ b/dom/smil/nsSMILTimedElement.cpp
@@ -43,35 +43,35 @@ using namespace mozilla::dom;
//
// The serial number also means that every instance time has an unambiguous
// position in the array so we can use RemoveElementSorted and the like.
bool
nsSMILTimedElement::InstanceTimeComparator::Equals(
const nsSMILInstanceTime* aElem1,
const nsSMILInstanceTime* aElem2) const
{
- NS_ABORT_IF_FALSE(aElem1 && aElem2,
- "Trying to compare null instance time pointers");
- NS_ABORT_IF_FALSE(aElem1->Serial() && aElem2->Serial(),
- "Instance times have not been assigned serial numbers");
- NS_ABORT_IF_FALSE(aElem1 == aElem2 || aElem1->Serial() != aElem2->Serial(),
- "Serial numbers are not unique");
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null instance time pointers");
+ MOZ_ASSERT(aElem1->Serial() && aElem2->Serial(),
+ "Instance times have not been assigned serial numbers");
+ MOZ_ASSERT(aElem1 == aElem2 || aElem1->Serial() != aElem2->Serial(),
+ "Serial numbers are not unique");
return aElem1->Serial() == aElem2->Serial();
}
bool
nsSMILTimedElement::InstanceTimeComparator::LessThan(
const nsSMILInstanceTime* aElem1,
const nsSMILInstanceTime* aElem2) const
{
- NS_ABORT_IF_FALSE(aElem1 && aElem2,
- "Trying to compare null instance time pointers");
- NS_ABORT_IF_FALSE(aElem1->Serial() && aElem2->Serial(),
- "Instance times have not been assigned serial numbers");
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null instance time pointers");
+ MOZ_ASSERT(aElem1->Serial() && aElem2->Serial(),
+ "Instance times have not been assigned serial numbers");
int8_t cmp = aElem1->Time().CompareTo(aElem2->Time());
return cmp == 0 ? aElem1->Serial() < aElem2->Serial() : cmp < 0;
}
//----------------------------------------------------------------------
// Helper class: AsyncTimeEventRunner
@@ -190,19 +190,18 @@ nsSMILTimedElement::RemoveInstanceTimes(
// instance time that corresponds to the previous interval's end time.
//
// Most functors supplied here fulfil this condition by checking if the
// instance time is marked as "ShouldPreserve" and if so, not deleting it.
//
// However, when filtering instance times, we sometimes need to drop even
// instance times marked as "ShouldPreserve". In that case we take special
// care not to delete the end instance time of the previous interval.
- NS_ABORT_IF_FALSE(!GetPreviousInterval() ||
- item != GetPreviousInterval()->End(),
- "Removing end instance time of previous interval");
+ MOZ_ASSERT(!GetPreviousInterval() || item != GetPreviousInterval()->End(),
+ "Removing end instance time of previous interval");
item->Unlink();
} else {
newArray.AppendElement(item);
}
}
aArray.Clear();
aArray.SwapElements(newArray);
}
@@ -277,29 +276,29 @@ nsSMILTimedElement::~nsSMILTimedElement(
// (We shouldn't get any callbacks from this because all our instance times
// are now disassociated with any intervals)
ClearIntervals();
// The following assertions are important in their own right (for checking
// correct behavior) but also because AutoIntervalUpdateBatcher holds pointers
// to class so if they fail there's the possibility we might have dangling
// pointers.
- NS_ABORT_IF_FALSE(!mDeferIntervalUpdates,
- "Interval updates should no longer be blocked when an nsSMILTimedElement "
- "disappears");
- NS_ABORT_IF_FALSE(!mDoDeferredUpdate,
- "There should no longer be any pending updates when an "
- "nsSMILTimedElement disappears");
+ MOZ_ASSERT(!mDeferIntervalUpdates,
+ "Interval updates should no longer be blocked when an "
+ "nsSMILTimedElement disappears");
+ MOZ_ASSERT(!mDoDeferredUpdate,
+ "There should no longer be any pending updates when an "
+ "nsSMILTimedElement disappears");
}
void
nsSMILTimedElement::SetAnimationElement(SVGAnimationElement* aElement)
{
- NS_ABORT_IF_FALSE(aElement, "NULL owner element");
- NS_ABORT_IF_FALSE(!mAnimationElement, "Re-setting owner");
+ MOZ_ASSERT(aElement, "NULL owner element");
+ MOZ_ASSERT(!mAnimationElement, "Re-setting owner");
mAnimationElement = aElement;
}
nsSMILTimeContainer*
nsSMILTimedElement::GetTimeContainer()
{
return mAnimationElement ? mAnimationElement->GetTimeContainer() : nullptr;
}
@@ -380,28 +379,28 @@ nsSMILTimedElement::GetHyperlinkTime() c
//----------------------------------------------------------------------
// nsSMILTimedElement
void
nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime,
bool aIsBegin)
{
- NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to add null instance time");
+ MOZ_ASSERT(aInstanceTime, "Attempting to add null instance time");
// Event-sensitivity: If an element is not active (but the parent time
// container is), then events are only handled for begin specifications.
if (mElementState != STATE_ACTIVE && !aIsBegin &&
aInstanceTime->IsDynamic())
{
// No need to call Unlink here--dynamic instance times shouldn't be linked
// to anything that's going to miss them
- NS_ABORT_IF_FALSE(!aInstanceTime->GetBaseInterval(),
- "Dynamic instance time has a base interval--we probably need to unlink"
- " it if we're not going to use it");
+ MOZ_ASSERT(!aInstanceTime->GetBaseInterval(),
+ "Dynamic instance time has a base interval--we probably need "
+ "to unlink it if we're not going to use it");
return;
}
aInstanceTime->SetSerial(++mInstanceSerialIndex);
InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances;
nsRefPtr<nsSMILInstanceTime>* inserted =
instanceList.InsertElementSorted(aInstanceTime, InstanceTimeComparator());
if (!inserted) {
@@ -412,17 +411,17 @@ nsSMILTimedElement::AddInstanceTime(nsSM
UpdateCurrentInterval();
}
void
nsSMILTimedElement::UpdateInstanceTime(nsSMILInstanceTime* aInstanceTime,
nsSMILTimeValue& aUpdatedTime,
bool aIsBegin)
{
- NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to update null instance time");
+ MOZ_ASSERT(aInstanceTime, "Attempting to update null instance time");
// The reason we update the time here and not in the nsSMILTimeValueSpec is
// that it means we *could* re-sort more efficiently by doing a sorted remove
// and insert but currently this doesn't seem to be necessary given how
// infrequently we get these change notices.
aInstanceTime->DependentUpdate(aUpdatedTime);
InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances;
instanceList.Sort(InstanceTimeComparator());
@@ -444,29 +443,29 @@ nsSMILTimedElement::UpdateInstanceTime(n
UpdateCurrentInterval(changedCurrentInterval);
}
void
nsSMILTimedElement::RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime,
bool aIsBegin)
{
- NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to remove null instance time");
+ MOZ_ASSERT(aInstanceTime, "Attempting to remove null instance time");
// If the instance time should be kept (because it is or was the fixed end
// point of an interval) then just disassociate it from the creator.
if (aInstanceTime->ShouldPreserve()) {
aInstanceTime->Unlink();
return;
}
InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances;
mozilla::DebugOnly<bool> found =
instanceList.RemoveElementSorted(aInstanceTime, InstanceTimeComparator());
- NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete");
+ MOZ_ASSERT(found, "Couldn't find instance time to delete");
UpdateCurrentInterval();
}
namespace
{
class MOZ_STACK_CLASS RemoveByCreator
{
@@ -493,17 +492,17 @@ namespace
const nsSMILTimeValueSpec* mCreator;
};
}
void
nsSMILTimedElement::RemoveInstanceTimesForCreator(
const nsSMILTimeValueSpec* aCreator, bool aIsBegin)
{
- NS_ABORT_IF_FALSE(aCreator, "Creator not set");
+ MOZ_ASSERT(aCreator, "Creator not set");
InstanceTimeList& instances = aIsBegin ? mBeginInstances : mEndInstances;
RemoveByCreator removeByCreator(aCreator);
RemoveInstanceTimes(instances, removeByCreator);
UpdateCurrentInterval();
}
@@ -555,20 +554,20 @@ nsSMILTimedElement::SampleEndAt(nsSMILTi
// our next real milestone is registered.
RegisterMilestone();
}
}
void
nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly)
{
- NS_ABORT_IF_FALSE(mAnimationElement,
- "Got sample before being registered with an animation element");
- NS_ABORT_IF_FALSE(GetTimeContainer(),
- "Got sample without being registered with a time container");
+ MOZ_ASSERT(mAnimationElement,
+ "Got sample before being registered with an animation element");
+ MOZ_ASSERT(GetTimeContainer(),
+ "Got sample without being registered with a time container");
// This could probably happen if we later implement externalResourcesRequired
// (bug 277955) and whilst waiting for those resources (and the animation to
// start) we transfer a node from another document fragment that has already
// started. In such a case we might receive milestone samples registered with
// the already active container.
if (GetTimeContainer()->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
return;
@@ -599,21 +598,22 @@ nsSMILTimedElement::DoSampleAt(nsSMILTim
bool stateChanged;
nsSMILTimeValue sampleTime(aContainerTime);
do {
#ifdef DEBUG
// Check invariant
if (mElementState == STATE_STARTUP || mElementState == STATE_POSTACTIVE) {
- NS_ABORT_IF_FALSE(!mCurrentInterval,
- "Shouldn't have current interval in startup or postactive states");
+ MOZ_ASSERT(!mCurrentInterval,
+ "Shouldn't have current interval in startup or postactive "
+ "states");
} else {
- NS_ABORT_IF_FALSE(mCurrentInterval,
- "Should have current interval in waiting and active states");
+ MOZ_ASSERT(mCurrentInterval,
+ "Should have current interval in waiting and active states");
}
#endif
stateChanged = false;
switch (mElementState)
{
case STATE_STARTUP:
@@ -689,18 +689,18 @@ nsSMILTimedElement::DoSampleAt(nsSMILTim
mOldIntervals[mOldIntervals.Length() - 1], false, true);
}
if (mElementState == STATE_WAITING) {
NotifyNewInterval();
}
FilterHistory();
stateChanged = true;
} else {
- NS_ABORT_IF_FALSE(!didApplyEarlyEnd,
- "We got an early end, but didn't end");
+ MOZ_ASSERT(!didApplyEarlyEnd,
+ "We got an early end, but didn't end");
nsSMILTime beginTime = mCurrentInterval->Begin()->Time().GetMillis();
NS_ASSERTION(aContainerTime >= beginTime,
"Sample time should not precede current interval");
nsSMILTime activeTime = aContainerTime - beginTime;
// The 'min' attribute can cause the active interval to be longer than
// the 'repeating interval'.
// In that extended period we apply the fill mode.
@@ -766,53 +766,53 @@ nsSMILTimedElement::HandleContainerTimeC
namespace
{
bool
RemoveNonDynamic(nsSMILInstanceTime* aInstanceTime)
{
// Generally dynamically-generated instance times (DOM calls, event-based
// times) are not associated with their creator nsSMILTimeValueSpec since
// they may outlive them.
- NS_ABORT_IF_FALSE(!aInstanceTime->IsDynamic() ||
- !aInstanceTime->GetCreator(),
- "Dynamic instance time should be unlinked from its creator");
+ MOZ_ASSERT(!aInstanceTime->IsDynamic() || !aInstanceTime->GetCreator(),
+ "Dynamic instance time should be unlinked from its creator");
return !aInstanceTime->IsDynamic() && !aInstanceTime->ShouldPreserve();
}
}
void
nsSMILTimedElement::Rewind()
{
- NS_ABORT_IF_FALSE(mAnimationElement,
- "Got rewind request before being attached to an animation element");
+ MOZ_ASSERT(mAnimationElement,
+ "Got rewind request before being attached to an animation "
+ "element");
// It's possible to get a rewind request whilst we're already in the middle of
// a backwards seek. This can happen when we're performing tree surgery and
// seeking containers at the same time because we can end up requesting
// a local rewind on an element after binding it to a new container and then
// performing a rewind on that container as a whole without sampling in
// between.
//
// However, it should currently be impossible to get a rewind in the middle of
// a forwards seek since forwards seeks are detected and processed within the
// same (re)sample.
if (mSeekState == SEEK_NOT_SEEKING) {
mSeekState = mElementState == STATE_ACTIVE ?
SEEK_BACKWARD_FROM_ACTIVE :
SEEK_BACKWARD_FROM_INACTIVE;
}
- NS_ABORT_IF_FALSE(mSeekState == SEEK_BACKWARD_FROM_INACTIVE ||
- mSeekState == SEEK_BACKWARD_FROM_ACTIVE,
- "Rewind in the middle of a forwards seek?");
+ MOZ_ASSERT(mSeekState == SEEK_BACKWARD_FROM_INACTIVE ||
+ mSeekState == SEEK_BACKWARD_FROM_ACTIVE,
+ "Rewind in the middle of a forwards seek?");
ClearTimingState(RemoveNonDynamic);
RebuildTimingState(RemoveNonDynamic);
- NS_ABORT_IF_FALSE(!mCurrentInterval,
- "Current interval is set at end of rewind");
+ MOZ_ASSERT(!mCurrentInterval,
+ "Current interval is set at end of rewind");
}
namespace
{
bool
RemoveAll(nsSMILInstanceTime* aInstanceTime)
{
return true;
@@ -967,18 +967,18 @@ nsSMILTimedElement::SetSimpleDuration(co
if (!nsSMILParserUtils::ParseClockValue(dur, &duration) ||
duration.GetMillis() == 0L) {
mSimpleDur.SetIndefinite();
return NS_ERROR_FAILURE;
}
}
// mSimpleDur should never be unresolved. ParseClockValue will either set
// duration to resolved or will return false.
- NS_ABORT_IF_FALSE(duration.IsResolved(),
- "Setting unresolved simple duration");
+ MOZ_ASSERT(duration.IsResolved(),
+ "Setting unresolved simple duration");
mSimpleDur = duration;
return NS_OK;
}
void
nsSMILTimedElement::UnsetSimpleDuration()
@@ -1000,17 +1000,17 @@ nsSMILTimedElement::SetMin(const nsAStri
duration.SetMillis(0L);
} else {
if (!nsSMILParserUtils::ParseClockValue(min, &duration)) {
mMin.SetMillis(0L);
return NS_ERROR_FAILURE;
}
}
- NS_ABORT_IF_FALSE(duration.GetMillis() >= 0L, "Invalid duration");
+ MOZ_ASSERT(duration.GetMillis() >= 0L, "Invalid duration");
mMin = duration;
return NS_OK;
}
void
nsSMILTimedElement::UnsetMin()
@@ -1031,17 +1031,17 @@ nsSMILTimedElement::SetMax(const nsAStri
if (max.EqualsLiteral("media") || max.EqualsLiteral("indefinite")) {
duration.SetIndefinite();
} else {
if (!nsSMILParserUtils::ParseClockValue(max, &duration) ||
duration.GetMillis() == 0L) {
mMax.SetIndefinite();
return NS_ERROR_FAILURE;
}
- NS_ABORT_IF_FALSE(duration.GetMillis() > 0L, "Invalid duration");
+ MOZ_ASSERT(duration.GetMillis() > 0L, "Invalid duration");
}
mMax = duration;
return NS_OK;
}
void
@@ -1157,18 +1157,18 @@ nsSMILTimedElement::UnsetFillMode()
}
}
void
nsSMILTimedElement::AddDependent(nsSMILTimeValueSpec& aDependent)
{
// There's probably no harm in attempting to register a dependent
// nsSMILTimeValueSpec twice, but we're not expecting it to happen.
- NS_ABORT_IF_FALSE(!mTimeDependents.GetEntry(&aDependent),
- "nsSMILTimeValueSpec is already registered as a dependency");
+ MOZ_ASSERT(!mTimeDependents.GetEntry(&aDependent),
+ "nsSMILTimeValueSpec is already registered as a dependency");
mTimeDependents.PutEntry(&aDependent);
// Add current interval. We could add historical intervals too but that would
// cause unpredictable results since some intervals may have been filtered.
// SMIL doesn't say what to do here so for simplicity and consistency we
// simply add the current interval if there is one.
//
// It's not necessary to call SyncPauseTime since we're dealing with
@@ -1246,47 +1246,47 @@ nsSMILTimedElement::HandleTargetElementC
}
void
nsSMILTimedElement::Traverse(nsCycleCollectionTraversalCallback* aCallback)
{
uint32_t count = mBeginSpecs.Length();
for (uint32_t i = 0; i < count; ++i) {
nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i];
- NS_ABORT_IF_FALSE(beginSpec,
- "null nsSMILTimeValueSpec in list of begin specs");
+ MOZ_ASSERT(beginSpec,
+ "null nsSMILTimeValueSpec in list of begin specs");
beginSpec->Traverse(aCallback);
}
count = mEndSpecs.Length();
for (uint32_t j = 0; j < count; ++j) {
nsSMILTimeValueSpec* endSpec = mEndSpecs[j];
- NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs");
+ MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs");
endSpec->Traverse(aCallback);
}
}
void
nsSMILTimedElement::Unlink()
{
AutoIntervalUpdateBatcher updateBatcher(*this);
// Remove dependencies on other elements
uint32_t count = mBeginSpecs.Length();
for (uint32_t i = 0; i < count; ++i) {
nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i];
- NS_ABORT_IF_FALSE(beginSpec,
- "null nsSMILTimeValueSpec in list of begin specs");
+ MOZ_ASSERT(beginSpec,
+ "null nsSMILTimeValueSpec in list of begin specs");
beginSpec->Unlink();
}
count = mEndSpecs.Length();
for (uint32_t j = 0; j < count; ++j) {
nsSMILTimeValueSpec* endSpec = mEndSpecs[j];
- NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs");
+ MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs");
endSpec->Unlink();
}
ClearIntervals();
// Make sure we don't notify other elements of new intervals
mTimeDependents.Clear();
}
@@ -1381,18 +1381,18 @@ nsSMILTimedElement::ClearIntervals()
}
mOldIntervals.Clear();
}
bool
nsSMILTimedElement::ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime)
{
// This should only be called within DoSampleAt as a helper function
- NS_ABORT_IF_FALSE(mElementState == STATE_ACTIVE,
- "Unexpected state to try to apply an early end");
+ MOZ_ASSERT(mElementState == STATE_ACTIVE,
+ "Unexpected state to try to apply an early end");
bool updated = false;
// Only apply an early end if we're not already ending.
if (mCurrentInterval->End()->Time() > aSampleTime) {
nsSMILInstanceTime* earlyEnd = CheckForEarlyEnd(aSampleTime);
if (earlyEnd) {
if (earlyEnd->IsDependent()) {
@@ -1692,18 +1692,18 @@ nsSMILTimedElement::FilterInstanceTimes(
// http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-LC-Start
//
bool
nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval,
const nsSMILInterval* aReplacedInterval,
const nsSMILInstanceTime* aFixedBeginTime,
nsSMILInterval& aResult) const
{
- NS_ABORT_IF_FALSE(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(),
- "Unresolved or indefinite begin time specified for interval start");
+ MOZ_ASSERT(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(),
+ "Unresolved or indefinite begin time given for interval start");
static const nsSMILTimeValue zeroTime(0L);
if (mRestartMode == RESTART_NEVER && aPrevInterval)
return false;
// Calc starting point
nsSMILTimeValue beginAfter;
bool prevIntervalWasZeroDur = false;
@@ -1741,19 +1741,19 @@ nsSMILTimedElement::GetNextInterval(cons
// If we're updating the current interval then skip any begin time that is
// dependent on the current interval's begin time. e.g.
// <animate id="a" begin="b.begin; a.begin+2s"...
// If b's interval disappears whilst 'a' is in the waiting state the begin
// time at "a.begin+2s" should be skipped since 'a' never begun.
} while (aReplacedInterval &&
tempBegin->GetBaseTime() == aReplacedInterval->Begin());
}
- NS_ABORT_IF_FALSE(tempBegin && tempBegin->Time().IsDefinite() &&
- tempBegin->Time() >= beginAfter,
- "Got a bad begin time while fetching next interval");
+ MOZ_ASSERT(tempBegin && tempBegin->Time().IsDefinite() &&
+ tempBegin->Time() >= beginAfter,
+ "Got a bad begin time while fetching next interval");
// Calculate end time
{
int32_t endPos = 0;
do {
tempEnd =
GetNextGreaterOrEqual(mEndInstances, tempBegin->Time(), endPos);
@@ -1806,17 +1806,17 @@ nsSMILTimedElement::GetNextInterval(cons
nsSMILTimeValue intervalEnd = tempEnd
? tempEnd->Time() : nsSMILTimeValue();
nsSMILTimeValue activeEnd = CalcActiveEnd(tempBegin->Time(), intervalEnd);
if (!tempEnd || intervalEnd != activeEnd) {
tempEnd = new nsSMILInstanceTime(activeEnd);
}
}
- NS_ABORT_IF_FALSE(tempEnd, "Failed to get end point for next interval");
+ MOZ_ASSERT(tempEnd, "Failed to get end point for next interval");
// When we choose the interval endpoints, we don't allow coincident
// zero-duration intervals, so if we arrive here and we have a zero-duration
// interval starting at the same point as a previous zero-duration interval,
// then it must be because we've applied constraints to the active duration.
// In that case, we will potentially run into an infinite loop, so we break
// it by searching for the next interval that starts AFTER our current
// zero-duration interval.
@@ -1864,17 +1864,17 @@ nsSMILTimedElement::GetNextGreaterOrEqua
const nsSMILTimeValue& aBase,
int32_t& aPosition) const
{
nsSMILInstanceTime* result = nullptr;
int32_t count = aList.Length();
for (; aPosition < count && !result; ++aPosition) {
nsSMILInstanceTime* val = aList[aPosition].get();
- NS_ABORT_IF_FALSE(val, "NULL instance time in list");
+ MOZ_ASSERT(val, "NULL instance time in list");
if (val->Time() >= aBase) {
result = val;
}
}
return result;
}
@@ -1882,20 +1882,20 @@ nsSMILTimedElement::GetNextGreaterOrEqua
* @see SMILANIM 3.3.4
*/
nsSMILTimeValue
nsSMILTimedElement::CalcActiveEnd(const nsSMILTimeValue& aBegin,
const nsSMILTimeValue& aEnd) const
{
nsSMILTimeValue result;
- NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(),
- "Unresolved simple duration in CalcActiveEnd");
- NS_ABORT_IF_FALSE(aBegin.IsDefinite(),
- "Indefinite or unresolved begin time in CalcActiveEnd");
+ MOZ_ASSERT(mSimpleDur.IsResolved(),
+ "Unresolved simple duration in CalcActiveEnd");
+ MOZ_ASSERT(aBegin.IsDefinite(),
+ "Indefinite or unresolved begin time in CalcActiveEnd");
result = GetRepeatDuration();
if (aEnd.IsDefinite()) {
nsSMILTime activeDur = aEnd.GetMillis() - aBegin.GetMillis();
if (result.IsDefinite()) {
result.SetMillis(std::min(result.GetMillis(), activeDur));
@@ -1963,19 +1963,19 @@ nsSMILTimedElement::ApplyMinAndMax(const
}
nsSMILTime
nsSMILTimedElement::ActiveTimeToSimpleTime(nsSMILTime aActiveTime,
uint32_t& aRepeatIteration)
{
nsSMILTime result;
- NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(),
- "Unresolved simple duration in ActiveTimeToSimpleTime");
- NS_ABORT_IF_FALSE(aActiveTime >= 0, "Expecting non-negative active time");
+ MOZ_ASSERT(mSimpleDur.IsResolved(),
+ "Unresolved simple duration in ActiveTimeToSimpleTime");
+ MOZ_ASSERT(aActiveTime >= 0, "Expecting non-negative active time");
// Note that a negative aActiveTime will give us a negative value for
// aRepeatIteration, which is bad because aRepeatIteration is unsigned
if (mSimpleDur.IsIndefinite() || mSimpleDur.GetMillis() == 0L) {
aRepeatIteration = 0;
result = aActiveTime;
} else {
result = aActiveTime % mSimpleDur.GetMillis();
@@ -1996,18 +1996,18 @@ nsSMILTimedElement::ActiveTimeToSimpleTi
// than) the defined end for the current interval. Ending in this manner will
// also send a changed time notice to all time dependents for the current
// interval end.'
//
nsSMILInstanceTime*
nsSMILTimedElement::CheckForEarlyEnd(
const nsSMILTimeValue& aContainerTime) const
{
- NS_ABORT_IF_FALSE(mCurrentInterval,
- "Checking for an early end but the current interval is not set");
+ MOZ_ASSERT(mCurrentInterval,
+ "Checking for an early end but the current interval is not set");
if (mRestartMode != RESTART_ALWAYS)
return nullptr;
int32_t position = 0;
nsSMILInstanceTime* nextBegin =
GetNextGreater(mBeginInstances, mCurrentInterval->Begin()->Time(),
position);
@@ -2047,45 +2047,46 @@ nsSMILTimedElement::UpdateCurrentInterva
// In order to provide consistent behavior in such cases, we detect two
// deletes in a row and then refuse to create any further intervals. That is,
// we say the configuration is invalid.
if (mDeleteCount > 1) {
// When we update the delete count we also set the state to post active, so
// if we're not post active here then something other than
// UpdateCurrentInterval has updated the element state in between and all
// bets are off.
- NS_ABORT_IF_FALSE(mElementState == STATE_POSTACTIVE,
- "Expected to be in post-active state after performing double delete");
+ MOZ_ASSERT(mElementState == STATE_POSTACTIVE,
+ "Expected to be in post-active state after performing double "
+ "delete");
return;
}
// Check that we aren't stuck in infinite recursion updating some syncbase
// dependencies. Generally such situations should be detected in advance and
// the chain broken in a sensible and predictable manner, so if we're hitting
// this assertion we need to work out how to detect the case that's causing
// it. In release builds, just bail out before we overflow the stack.
AutoRestore<uint8_t> depthRestorer(mUpdateIntervalRecursionDepth);
if (++mUpdateIntervalRecursionDepth > sMaxUpdateIntervalRecursionDepth) {
- NS_ABORT_IF_FALSE(false,
- "Update current interval recursion depth exceeded threshold");
+ MOZ_ASSERT(false,
+ "Update current interval recursion depth exceeded threshold");
return;
}
// If the interval is active the begin time is fixed.
const nsSMILInstanceTime* beginTime = mElementState == STATE_ACTIVE
? mCurrentInterval->Begin()
: nullptr;
nsSMILInterval updatedInterval;
if (GetNextInterval(GetPreviousInterval(), mCurrentInterval,
beginTime, updatedInterval)) {
if (mElementState == STATE_POSTACTIVE) {
- NS_ABORT_IF_FALSE(!mCurrentInterval,
- "In postactive state but the interval has been set");
+ MOZ_ASSERT(!mCurrentInterval,
+ "In postactive state but the interval has been set");
mCurrentInterval = new nsSMILInterval(updatedInterval);
mElementState = STATE_WAITING;
NotifyNewInterval();
} else {
bool beginChanged = false;
bool endChanged = false;
@@ -2147,22 +2148,23 @@ nsSMILTimedElement::SampleFillValue()
{
if (mFillMode != FILL_FREEZE || !mClient)
return;
nsSMILTime activeTime;
if (mElementState == STATE_WAITING || mElementState == STATE_POSTACTIVE) {
const nsSMILInterval* prevInterval = GetPreviousInterval();
- NS_ABORT_IF_FALSE(prevInterval,
- "Attempting to sample fill value but there is no previous interval");
- NS_ABORT_IF_FALSE(prevInterval->End()->Time().IsDefinite() &&
- prevInterval->End()->IsFixedTime(),
- "Attempting to sample fill value but the endpoint of the previous "
- "interval is not resolved and fixed");
+ MOZ_ASSERT(prevInterval,
+ "Attempting to sample fill value but there is no previous "
+ "interval");
+ MOZ_ASSERT(prevInterval->End()->Time().IsDefinite() &&
+ prevInterval->End()->IsFixedTime(),
+ "Attempting to sample fill value but the endpoint of the "
+ "previous interval is not resolved and fixed");
activeTime = prevInterval->End()->Time().GetMillis() -
prevInterval->Begin()->Time().GetMillis();
// If the interval's repeat duration was shorter than its active duration,
// use the end of the repeat duration to determine the frozen animation's
// state.
nsSMILTimeValue repeatDuration = GetRepeatDuration();
@@ -2214,18 +2216,18 @@ nsSMILTimedElement::AddInstanceTimeFromC
}
void
nsSMILTimedElement::RegisterMilestone()
{
nsSMILTimeContainer* container = GetTimeContainer();
if (!container)
return;
- NS_ABORT_IF_FALSE(mAnimationElement,
- "Got a time container without an owning animation element");
+ MOZ_ASSERT(mAnimationElement,
+ "Got a time container without an owning animation element");
nsSMILMilestone nextMilestone;
if (!GetNextMilestone(nextMilestone))
return;
// This method is called every time we might possibly have updated our
// current interval, but since nsSMILTimeContainer makes no attempt to filter
// out redundant milestones we do some rudimentary filtering here. It's not
@@ -2260,18 +2262,18 @@ nsSMILTimedElement::GetNextMilestone(nsS
case STATE_STARTUP:
// All elements register for an initial end sample at t=0 where we resolve
// our initial interval.
aNextMilestone.mIsEnd = true; // Initial sample should be an end sample
aNextMilestone.mTime = 0;
return true;
case STATE_WAITING:
- NS_ABORT_IF_FALSE(mCurrentInterval,
- "In waiting state but the current interval has not been set");
+ MOZ_ASSERT(mCurrentInterval,
+ "In waiting state but the current interval has not been set");
aNextMilestone.mIsEnd = false;
aNextMilestone.mTime = mCurrentInterval->Begin()->Time().GetMillis();
return true;
case STATE_ACTIVE:
{
// Work out what comes next: the interval end or the next repeat iteration
nsSMILTimeValue nextRepeat;
@@ -2309,35 +2311,35 @@ nsSMILTimedElement::GetNextMilestone(nsS
return false;
}
MOZ_CRASH("Invalid element state");
}
void
nsSMILTimedElement::NotifyNewInterval()
{
- NS_ABORT_IF_FALSE(mCurrentInterval,
- "Attempting to notify dependents of a new interval but the interval "
- "is not set");
+ MOZ_ASSERT(mCurrentInterval,
+ "Attempting to notify dependents of a new interval but the "
+ "interval is not set");
nsSMILTimeContainer* container = GetTimeContainer();
if (container) {
container->SyncPauseTime();
}
NotifyTimeDependentsParams params = { this, container };
mTimeDependents.EnumerateEntries(NotifyNewIntervalCallback, ¶ms);
}
void
nsSMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
bool aBeginObjectChanged,
bool aEndObjectChanged)
{
- NS_ABORT_IF_FALSE(aInterval, "Null interval for change notification");
+ MOZ_ASSERT(aInterval, "Null interval for change notification");
nsSMILTimeContainer* container = GetTimeContainer();
if (container) {
container->SyncPauseTime();
}
// Copy the instance times list since notifying the instance times can result
// in a chain reaction whereby our own interval gets deleted along with its
@@ -2427,23 +2429,23 @@ nsSMILTimedElement::AreEndTimesDependent
//----------------------------------------------------------------------
// Hashtable callback functions
/* static */ PLDHashOperator
nsSMILTimedElement::NotifyNewIntervalCallback(TimeValueSpecPtrKey* aKey,
void* aData)
{
- NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table");
- NS_ABORT_IF_FALSE(aKey->GetKey(),
- "null nsSMILTimeValueSpec in set of time dependents");
+ MOZ_ASSERT(aKey, "Null hash key for time container hash table");
+ MOZ_ASSERT(aKey->GetKey(),
+ "null nsSMILTimeValueSpec in set of time dependents");
NotifyTimeDependentsParams* params =
static_cast<NotifyTimeDependentsParams*>(aData);
- NS_ABORT_IF_FALSE(params, "null data ptr while enumerating hashtable");
+ MOZ_ASSERT(params, "null data ptr while enumerating hashtable");
nsSMILInterval* interval = params->mTimedElement->mCurrentInterval;
// It's possible that in notifying one new time dependent of a new interval
// that a chain reaction is triggered which results in the original interval
// disappearing. If that's the case we can skip sending further notifications.
if (!interval)
return PL_DHASH_STOP;
nsSMILTimeValueSpec* spec = aKey->GetKey();
--- a/dom/smil/nsSMILValue.cpp
+++ b/dom/smil/nsSMILValue.cpp
@@ -119,26 +119,27 @@ nsSMILValue::Interpolate(const nsSMILVal
//----------------------------------------------------------------------
// Helper methods
// Wrappers for nsISMILType::Init & ::Destroy that verify their postconditions
void
nsSMILValue::InitAndCheckPostcondition(const nsISMILType* aNewType)
{
aNewType->Init(*this);
- NS_ABORT_IF_FALSE(mType == aNewType,
- "Post-condition of Init failed. nsSMILValue is invalid");
+ MOZ_ASSERT(mType == aNewType,
+ "Post-condition of Init failed. nsSMILValue is invalid");
}
void
nsSMILValue::DestroyAndCheckPostcondition()
{
mType->Destroy(*this);
- NS_ABORT_IF_FALSE(IsNull(), "Post-condition of Destroy failed. "
- "nsSMILValue not null after destroying");
+ MOZ_ASSERT(IsNull(),
+ "Post-condition of Destroy failed. "
+ "nsSMILValue not null after destroying");
}
void
nsSMILValue::DestroyAndReinit(const nsISMILType* aNewType)
{
DestroyAndCheckPostcondition();
InitAndCheckPostcondition(aNewType);
}
--- a/dom/speakermanager/SpeakerManager.cpp
+++ b/dom/speakermanager/SpeakerManager.cpp
@@ -73,17 +73,17 @@ SpeakerManager::SetForcespeaker(bool aEn
service->ForceSpeaker(aEnable, mVisible);
mForcespeaker = aEnable;
}
void
SpeakerManager::DispatchSimpleEvent(const nsAString& aStr)
{
- NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
nsCOMPtr<nsIDOMEvent> event;
rv = NS_NewDOMEvent(getter_AddRefs(event), this, nullptr, nullptr);
if (NS_FAILED(rv)) {
--- a/dom/storage/DOMStorageIPC.cpp
+++ b/dom/storage/DOMStorageIPC.cpp
@@ -37,25 +37,25 @@ NS_IMETHODIMP_(MozExternalRefCountType)
return 0;
}
return count;
}
void
DOMStorageDBChild::AddIPDLReference()
{
- NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references");
+ MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
mIPCOpen = true;
AddRef();
}
void
DOMStorageDBChild::ReleaseIPDLReference()
{
- NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference");
+ MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
mIPCOpen = false;
Release();
}
DOMStorageDBChild::DOMStorageDBChild(DOMLocalStorageManager* aManager)
: mManager(aManager)
, mStatus(NS_OK)
, mIPCOpen(false)
@@ -270,25 +270,25 @@ DOMStorageDBChild::RecvError(const nsres
// ----------------------------------------------------------------------------
NS_IMPL_ADDREF(DOMStorageDBParent)
NS_IMPL_RELEASE(DOMStorageDBParent)
void
DOMStorageDBParent::AddIPDLReference()
{
- NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references");
+ MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
mIPCOpen = true;
AddRef();
}
void
DOMStorageDBParent::ReleaseIPDLReference()
{
- NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference");
+ MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
mIPCOpen = false;
Release();
}
namespace { // anon
class SendInitialChildDataRunnable : public nsRunnable
{
--- a/dom/svg/DOMSVGLength.cpp
+++ b/dom/svg/DOMSVGLength.cpp
@@ -102,21 +102,22 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthL
, mListIndex(aListIndex)
, mAttrEnum(aAttrEnum)
, mIsAnimValItem(aIsAnimValItem)
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
, mValue(0.0f)
, mVal(nullptr)
{
// These shifts are in sync with the members in the header.
- NS_ABORT_IF_FALSE(aList &&
- aAttrEnum < (1 << 4) &&
- aListIndex <= MaxListIndex(), "bad arg");
+ MOZ_ASSERT(aList &&
+ aAttrEnum < (1 << 4) &&
+ aListIndex <= MaxListIndex(),
+ "bad arg");
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!");
}
DOMSVGLength::DOMSVGLength()
: mList(nullptr)
, mListIndex(0)
, mAttrEnum(0)
, mIsAnimValItem(false)
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
@@ -530,17 +531,17 @@ DOMSVGLength::InsertingIntoList(DOMSVGLe
{
NS_ASSERTION(!HasOwner(), "Inserting item that is already in a list");
mList = aList;
mAttrEnum = aAttrEnum;
mListIndex = aListIndex;
mIsAnimValItem = aIsAnimValItem;
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGLength!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGLength!");
}
void
DOMSVGLength::RemovingFromList()
{
mValue = InternalItem().GetValueInCurrentUnits();
mUnit = InternalItem().GetUnit();
mList = nullptr;
--- a/dom/svg/DOMSVGLengthList.cpp
+++ b/dom/svg/DOMSVGLengthList.cpp
@@ -362,49 +362,49 @@ DOMSVGLengthList::GetItemAt(uint32_t aIn
}
nsRefPtr<DOMSVGLength> result = mItems[aIndex];
return result.forget();
}
void
DOMSVGLengthList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
DOMSVGLengthList* animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, static_cast<DOMSVGLength*>(nullptr));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
void
DOMSVGLengthList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGLengthList> animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
if (animVal->mItems[aIndex]) {
animVal->mItems[aIndex]->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
--- a/dom/svg/DOMSVGLengthList.h
+++ b/dom/svg/DOMSVGLengthList.h
@@ -76,19 +76,19 @@ public:
return static_cast<nsIContent*>(Element());
}
/**
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t LengthNoFlush() const {
- NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
- mItems.Length() == InternalList().Length(),
- "DOM wrapper's list length is out of sync");
+ MOZ_ASSERT(mItems.Length() == 0 ||
+ mItems.Length() == InternalList().Length(),
+ "DOM wrapper's list length is out of sync");
return mItems.Length();
}
/// Called to notify us to syncronize our length and detach excess items.
void InternalListLengthWillChange(uint32_t aNewLength);
/**
* Returns true if our attribute is animating (in which case our animVal is
@@ -141,18 +141,18 @@ private:
}
uint8_t Axis() const {
return mAList->mAxis;
}
/// Used to determine if this list is the baseVal or animVal list.
bool IsAnimValList() const {
- NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal,
- "Calling IsAnimValList() too early?!");
+ MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal,
+ "Calling IsAnimValList() too early?!");
return this == mAList->mAnimVal;
}
/**
* Get a reference to this object's corresponding internal SVGLengthList.
*
* To simplify the code we just have this one method for obtaining both
* baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/DOMSVGNumber.cpp
+++ b/dom/svg/DOMSVGNumber.cpp
@@ -88,21 +88,22 @@ DOMSVGNumber::DOMSVGNumber(DOMSVGNumberL
: mList(aList)
, mParent(aList)
, mListIndex(aListIndex)
, mAttrEnum(aAttrEnum)
, mIsAnimValItem(aIsAnimValItem)
, mValue(0.0f)
{
// These shifts are in sync with the members in the header.
- NS_ABORT_IF_FALSE(aList &&
- aAttrEnum < (1 << 4) &&
- aListIndex <= MaxListIndex(), "bad arg");
+ MOZ_ASSERT(aList &&
+ aAttrEnum < (1 << 4) &&
+ aListIndex <= MaxListIndex(),
+ "bad arg");
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!");
}
DOMSVGNumber::DOMSVGNumber(nsISupports* aParent)
: mList(nullptr)
, mParent(aParent)
, mListIndex(0)
, mAttrEnum(0)
, mIsAnimValItem(false)
@@ -175,17 +176,17 @@ DOMSVGNumber::InsertingIntoList(DOMSVGNu
{
NS_ASSERTION(!HasOwner(), "Inserting item that is already in a list");
mList = aList;
mAttrEnum = aAttrEnum;
mListIndex = aListIndex;
mIsAnimValItem = aIsAnimValItem;
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!");
}
void
DOMSVGNumber::RemovingFromList()
{
mValue = InternalItem();
mList = nullptr;
mIsAnimValItem = false;
--- a/dom/svg/DOMSVGNumberList.cpp
+++ b/dom/svg/DOMSVGNumberList.cpp
@@ -341,49 +341,49 @@ DOMSVGNumberList::GetItemAt(uint32_t aIn
}
nsRefPtr<DOMSVGNumber> result = mItems[aIndex];
return result.forget();
}
void
DOMSVGNumberList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
DOMSVGNumberList* animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, static_cast<DOMSVGNumber*>(nullptr));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
void
DOMSVGNumberList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGNumberList> animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
if (animVal->mItems[aIndex]) {
animVal->mItems[aIndex]->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
--- a/dom/svg/DOMSVGNumberList.h
+++ b/dom/svg/DOMSVGNumberList.h
@@ -76,19 +76,19 @@ public:
return static_cast<nsIContent*>(Element());
}
/**
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t LengthNoFlush() const {
- NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
- mItems.Length() == InternalList().Length(),
- "DOM wrapper's list length is out of sync");
+ MOZ_ASSERT(mItems.Length() == 0 ||
+ mItems.Length() == InternalList().Length(),
+ "DOM wrapper's list length is out of sync");
return mItems.Length();
}
/// Called to notify us to syncronize our length and detach excess items.
void InternalListLengthWillChange(uint32_t aNewLength);
/**
* Returns true if our attribute is animating (in which case our animVal is
@@ -134,18 +134,18 @@ private:
}
uint8_t AttrEnum() const {
return mAList->mAttrEnum;
}
/// Used to determine if this list is the baseVal or animVal list.
bool IsAnimValList() const {
- NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal,
- "Calling IsAnimValList() too early?!");
+ MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal,
+ "Calling IsAnimValList() too early?!");
return this == mAList->mAnimVal;
}
/**
* Get a reference to this object's corresponding internal SVGNumberList.
*
* To simplify the code we just have this one method for obtaining both
* baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/DOMSVGPathSeg.cpp
+++ b/dom/svg/DOMSVGPathSeg.cpp
@@ -75,57 +75,56 @@ private:
DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList *aList,
uint32_t aListIndex,
bool aIsAnimValItem)
: mList(aList)
, mListIndex(aListIndex)
, mIsAnimValItem(aIsAnimValItem)
{
// These shifts are in sync with the members in the header.
- NS_ABORT_IF_FALSE(aList &&
- aListIndex <= MaxListIndex(), "bad arg");
+ MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg");
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
}
DOMSVGPathSeg::DOMSVGPathSeg()
: mList(nullptr)
, mListIndex(0)
, mIsAnimValItem(false)
{
}
void
DOMSVGPathSeg::InsertingIntoList(DOMSVGPathSegList *aList,
uint32_t aListIndex,
bool aIsAnimValItem)
{
- NS_ABORT_IF_FALSE(!HasOwner(), "Inserting item that is already in a list");
+ MOZ_ASSERT(!HasOwner(), "Inserting item that is already in a list");
mList = aList;
mListIndex = aListIndex;
mIsAnimValItem = aIsAnimValItem;
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
}
void
DOMSVGPathSeg::RemovingFromList()
{
uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type());
// InternalItem() + 1, because the args come after the encoded seg type
memcpy(PtrToMemberArgs(), InternalItem() + 1, argCount * sizeof(float));
mList = nullptr;
mIsAnimValItem = false;
}
void
DOMSVGPathSeg::ToSVGPathSegEncodedData(float* aRaw)
{
- NS_ABORT_IF_FALSE(aRaw, "null pointer");
+ MOZ_ASSERT(aRaw, "null pointer");
uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type());
if (IsInList()) {
// 1 + argCount, because we're copying the encoded seg type and args
memcpy(aRaw, InternalItem(), (1 + argCount) * sizeof(float));
} else {
aRaw[0] = SVGPathSegUtils::EncodeType(Type());
// aRaw + 1, because the args go after the encoded seg type
memcpy(aRaw + 1, PtrToMemberArgs(), argCount * sizeof(float));
--- a/dom/svg/DOMSVGPathSeg.h
+++ b/dom/svg/DOMSVGPathSeg.h
@@ -15,20 +15,20 @@
class nsSVGElement;
#define MOZ_SVG_LIST_INDEX_BIT_COUNT 31
namespace mozilla {
#define CHECK_ARG_COUNT_IN_SYNC(segType) \
- NS_ABORT_IF_FALSE(ArrayLength(mArgs) == \
- SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \
- uint32_t(segType) == PATHSEG_CLOSEPATH, \
- "Arg count/array size out of sync")
+ MOZ_ASSERT(ArrayLength(mArgs) == \
+ SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \
+ uint32_t(segType) == PATHSEG_CLOSEPATH, \
+ "Arg count/array size out of sync")
#define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \
explicit DOMSVGPathSeg##segName(const float *aArgs) \
: DOMSVGPathSeg() \
{ \
CHECK_ARG_COUNT_IN_SYNC(segType); \
memcpy(mArgs, aArgs, \
SVGPathSegUtils::ArgCountForType(uint32_t(segType)) * sizeof(float)); \
--- a/dom/svg/DOMSVGPathSegList.cpp
+++ b/dom/svg/DOMSVGPathSegList.cpp
@@ -185,19 +185,19 @@ DOMSVGPathSegList::InternalListWillChang
ItemAt(index) = nullptr;
}
// Only after the RemovingFromList() can we touch mInternalDataIndex!
mItems[index].mInternalDataIndex = dataIndex;
++index;
dataIndex += 1 + SVGPathSegUtils::ArgCountForType(newSegType);
}
- NS_ABORT_IF_FALSE((index == length && dataIndex <= dataLength) ||
- (index <= length && dataIndex == dataLength),
- "very bad - list corruption?");
+ MOZ_ASSERT((index == length && dataIndex <= dataLength) ||
+ (index <= length && dataIndex == dataLength),
+ "very bad - list corruption?");
if (index < length) {
// aNewValue has fewer items than our previous internal counterpart
uint32_t newLength = index;
// Remove excess items from the list:
for (; index < length; ++index) {
@@ -227,18 +227,18 @@ DOMSVGPathSegList::InternalListWillChang
Clear(rv);
MOZ_ASSERT(!rv.Failed());
return;
}
dataIndex += 1 + SVGPathSegUtils::ArgCountForType(SVGPathSegUtils::DecodeType(aNewValue.mData[dataIndex]));
}
}
- NS_ABORT_IF_FALSE(dataIndex == dataLength, "Serious processing error");
- NS_ABORT_IF_FALSE(index == length, "Serious counting error");
+ MOZ_ASSERT(dataIndex == dataLength, "Serious processing error");
+ MOZ_ASSERT(index == length, "Serious counting error");
}
bool
DOMSVGPathSegList::AttrIsAnimating() const
{
return InternalAList().IsAnimating();
}
@@ -247,17 +247,17 @@ DOMSVGPathSegList::InternalList() const
{
SVGAnimatedPathSegList *alist = mElement->GetAnimPathSegList();
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
}
SVGAnimatedPathSegList&
DOMSVGPathSegList::InternalAList() const
{
- NS_ABORT_IF_FALSE(mElement->GetAnimPathSegList(), "Internal error");
+ MOZ_ASSERT(mElement->GetAnimPathSegList(), "Internal error");
return *mElement->GetAnimPathSegList();
}
// ----------------------------------------------------------------------------
// nsIDOMSVGPathSegList implementation:
void
DOMSVGPathSegList::Clear(ErrorResult& aError)
@@ -513,62 +513,62 @@ DOMSVGPathSegList::GetItemAt(uint32_t aI
}
void
DOMSVGPathSegList::
MaybeInsertNullInAnimValListAt(uint32_t aIndex,
uint32_t aInternalIndex,
uint32_t aArgCountForItem)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// The anim val list is in sync with the base val list
DOMSVGPathSegList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, ItemProxy(nullptr, aInternalIndex));
animVal->UpdateListIndicesFromIndex(aIndex + 1, 1 + aArgCountForItem);
}
void
DOMSVGPathSegList::
MaybeRemoveItemFromAnimValListAt(uint32_t aIndex,
int32_t aArgCountForItem)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGPathSegList> animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
if (animVal->ItemAt(aIndex)) {
animVal->ItemAt(aIndex)->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
animVal->UpdateListIndicesFromIndex(aIndex, -(1 + aArgCountForItem));
}
--- a/dom/svg/DOMSVGPathSegList.h
+++ b/dom/svg/DOMSVGPathSegList.h
@@ -93,19 +93,19 @@ public:
static DOMSVGPathSegList*
GetDOMWrapperIfExists(void *aList);
/**
* This will normally be the same as InternalList().CountItems(), except if
* we've hit OOM, in which case our length will be zero.
*/
uint32_t LengthNoFlush() const {
- NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
- mItems.Length() == InternalList().CountItems(),
- "DOM wrapper's list length is out of sync");
+ MOZ_ASSERT(mItems.Length() == 0 ||
+ mItems.Length() == InternalList().CountItems(),
+ "DOM wrapper's list length is out of sync");
return mItems.Length();
}
/**
* WATCH OUT! If you add code to call this on a baseVal wrapper, then you
* must also call it on the animVal wrapper too if necessary!! See other
* callers!
*
--- a/dom/svg/DOMSVGPoint.h
+++ b/dom/svg/DOMSVGPoint.h
@@ -52,20 +52,19 @@ public:
bool aIsAnimValItem)
: nsISVGPoint()
{
mList = aList;
mListIndex = aListIndex;
mIsAnimValItem = aIsAnimValItem;
// These shifts are in sync with the members.
- NS_ABORT_IF_FALSE(aList &&
- aListIndex <= MaxListIndex(), "bad arg");
+ MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg");
- NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPoint!");
+ MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPoint!");
}
explicit DOMSVGPoint(const DOMSVGPoint *aPt = nullptr)
: nsISVGPoint()
{
if (aPt) {
mPt = aPt->ToSVGPoint();
}
--- a/dom/svg/DOMSVGPointList.cpp
+++ b/dom/svg/DOMSVGPointList.cpp
@@ -189,17 +189,17 @@ DOMSVGPointList::InternalList() const
{
SVGAnimatedPointList *alist = mElement->GetAnimatedPointList();
return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal;
}
SVGAnimatedPointList&
DOMSVGPointList::InternalAList() const
{
- NS_ABORT_IF_FALSE(mElement->GetAnimatedPointList(), "Internal error");
+ MOZ_ASSERT(mElement->GetAnimatedPointList(), "Internal error");
return *mElement->GetAnimatedPointList();
}
// ----------------------------------------------------------------------------
// nsIDOMSVGPointList implementation:
void
DOMSVGPointList::Clear(ErrorResult& aError)
@@ -409,60 +409,60 @@ DOMSVGPointList::GetItemAt(uint32_t aInd
}
nsRefPtr<nsISVGPoint> result = mItems[aIndex];
return result.forget();
}
void
DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// The anim val list is in sync with the base val list
DOMSVGPointList *animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex, static_cast<nsISVGPoint*>(nullptr));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
void
DOMSVGPointList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
if (AttrIsAnimating()) {
// animVal not a clone of baseVal
return;
}
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGPointList> animVal =
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
if (!animVal) {
// No animVal list wrapper
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
if (animVal->mItems[aIndex]) {
animVal->mItems[aIndex]->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
--- a/dom/svg/DOMSVGPointList.h
+++ b/dom/svg/DOMSVGPointList.h
@@ -95,19 +95,19 @@ public:
static DOMSVGPointList*
GetDOMWrapperIfExists(void *aList);
/**
* This will normally be the same as InternalList().Length(), except if
* we've hit OOM, in which case our length will be zero.
*/
uint32_t LengthNoFlush() const {
- NS_ABORT_IF_FALSE(mItems.Length() == 0 ||
- mItems.Length() == InternalList().Length(),
- "DOM wrapper's list length is out of sync");
+ MOZ_ASSERT(mItems.Length() == 0 ||
+ mItems.Length() == InternalList().Length(),
+ "DOM wrapper's list length is out of sync");
return mItems.Length();
}
/**
* WATCH OUT! If you add code to call this on a baseVal wrapper, then you
* must also call it on the animVal wrapper too if necessary!! See other
* callers!
*
--- a/dom/svg/DOMSVGTransformList.cpp
+++ b/dom/svg/DOMSVGTransformList.cpp
@@ -388,50 +388,50 @@ DOMSVGTransformList::GetItemAt(uint32_t
}
nsRefPtr<SVGTransform> result = mItems[aIndex];
return result.forget();
}
void
DOMSVGTransformList::MaybeInsertNullInAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
DOMSVGTransformList* animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
animVal->mItems.InsertElementAt(aIndex,
static_cast<SVGTransform*>(nullptr));
UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1);
}
void
DOMSVGTransformList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex)
{
- NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal");
+ MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal");
// This needs to be a strong reference; otherwise, the RemovingFromList call
// below might drop the last reference to animVal before we're done with it.
nsRefPtr<DOMSVGTransformList> animVal = mAList->mAnimVal;
if (!animVal || mAList->IsAnimating()) {
// No animVal list wrapper, or animVal not a clone of baseVal
return;
}
- NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(),
- "animVal list not in sync!");
+ MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(),
+ "animVal list not in sync!");
if (animVal->mItems[aIndex]) {
animVal->mItems[aIndex]->RemovingFromList();
}
animVal->mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
--- a/dom/svg/DOMSVGTransformList.h
+++ b/dom/svg/DOMSVGTransformList.h
@@ -71,19 +71,18 @@ public:
return static_cast<nsIContent*>(Element());
}
/**
* This will normally be the same as InternalList().Length(), except if we've
* hit OOM in which case our length will be zero.
*/
uint32_t LengthNoFlush() const {
- NS_ABORT_IF_FALSE(mItems.IsEmpty() ||
- mItems.Length() == InternalList().Length(),
- "DOM wrapper's list length is out of sync");
+ MOZ_ASSERT(mItems.IsEmpty() || mItems.Length() == InternalList().Length(),
+ "DOM wrapper's list length is out of sync");
return mItems.Length();
}
/// Called to notify us to synchronize our length and detach excess items.
void InternalListLengthWillChange(uint32_t aNewLength);
/**
* Returns true if our attribute is animating (in which case our animVal is
@@ -130,18 +129,18 @@ public:
private:
nsSVGElement* Element() const {
return mAList->mElement;
}
/// Used to determine if this list is the baseVal or animVal list.
bool IsAnimValList() const {
- NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal,
- "Calling IsAnimValList() too early?!");
+ MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal,
+ "Calling IsAnimValList() too early?!");
return this == mAList->mAnimVal;
}
/**
* Get a reference to this object's corresponding internal SVGTransformList.
*
* To simplify the code we just have this one method for obtaining both
* baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -77,19 +77,19 @@ SVGAnimationElement::HasAnimAttr(nsIAtom
}
Element*
SVGAnimationElement::GetTargetElementContent()
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
return mHrefTarget.get();
}
- NS_ABORT_IF_FALSE(!mHrefTarget.get(),
- "We shouldn't have an xlink:href target "
- "if we don't have an xlink:href attribute");
+ MOZ_ASSERT(!mHrefTarget.get(),
+ "We shouldn't have an xlink:href target "
+ "if we don't have an xlink:href attribute");
// No "xlink:href" attribute --> I should target my parent.
nsIContent* parent = GetFlattenedTreeParent();
return parent && parent->IsElement() ? parent->AsElement() : nullptr;
}
bool
SVGAnimationElement::GetTargetAttributeName(int32_t *aNamespaceID,
@@ -186,19 +186,18 @@ SVGAnimationElement::GetSimpleDuration(E
// nsIContent methods
nsresult
SVGAnimationElement::BindToTree(nsIDocument* aDocument,
nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
- NS_ABORT_IF_FALSE(!mHrefTarget.get(),
- "Shouldn't have href-target yet "
- "(or it should've been cleared)");
+ MOZ_ASSERT(!mHrefTarget.get(),
+ "Shouldn't have href-target yet (or it should've been cleared)");
nsresult rv = SVGAnimationElementBase::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv,rv);
// XXXdholbert is GetCtx (as a check for SVG parent) still needed here?
if (!GetCtx()) {
// No use proceeding. We don't have an SVG parent (yet) so we won't be able
@@ -309,18 +308,18 @@ SVGAnimationElement::AfterSetAttr(int32_
if (aNamespaceID != kNameSpaceID_XLink || aName != nsGkAtoms::href)
return rv;
if (!aValue) {
mHrefTarget.Unlink();
AnimationTargetChanged();
} else if (IsInDoc()) {
- NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
- "Expected href attribute to be string type");
+ MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
+ "Expected href attribute to be string type");
UpdateHrefTarget(this, aValue->GetStringValue());
} // else: we're not yet in a document -- we'll update the target on
// next BindToTree call.
return rv;
}
nsresult
--- a/dom/svg/SVGContentUtils.cpp
+++ b/dom/svg/SVGContentUtils.cpp
@@ -51,18 +51,18 @@ SVGContentUtils::GetOuterSVGElement(nsSV
return static_cast<SVGSVGElement*>(element);
}
return nullptr;
}
void
SVGContentUtils::ActivateByHyperlink(nsIContent *aContent)
{
- NS_ABORT_IF_FALSE(aContent->IsNodeOfType(nsINode::eANIMATION),
- "Expecting an animation element");
+ MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eANIMATION),
+ "Expecting an animation element");
static_cast<SVGAnimationElement*>(aContent)->ActivateByHyperlink();
}
enum DashState {
eDashedStroke,
eContinuousStroke, //< all dashes, no gaps
eNoStroke //< all gaps, no dashes
@@ -277,27 +277,27 @@ SVGContentUtils::GetFontSize(Element *aE
}
return GetFontSize(styleContext);
}
float
SVGContentUtils::GetFontSize(nsIFrame *aFrame)
{
- NS_ABORT_IF_FALSE(aFrame, "NULL frame in GetFontSize");
+ MOZ_ASSERT(aFrame, "NULL frame in GetFontSize");
return GetFontSize(aFrame->StyleContext());
}
float
SVGContentUtils::GetFontSize(nsStyleContext *aStyleContext)
{
- NS_ABORT_IF_FALSE(aStyleContext, "NULL style context in GetFontSize");
+ MOZ_ASSERT(aStyleContext, "NULL style context in GetFontSize");
nsPresContext *presContext = aStyleContext->PresContext();
- NS_ABORT_IF_FALSE(presContext, "NULL pres context in GetFontSize");
+ MOZ_ASSERT(presContext, "NULL pres context in GetFontSize");
nscoord fontSize = aStyleContext->StyleFont()->mSize;
return nsPresContext::AppUnitsToFloatCSSPixels(fontSize) /
presContext->TextZoom();
}
float
SVGContentUtils::GetFontXHeight(Element *aElement)
@@ -315,27 +315,27 @@ SVGContentUtils::GetFontXHeight(Element
}
return GetFontXHeight(styleContext);
}
float
SVGContentUtils::GetFontXHeight(nsIFrame *aFrame)
{
- NS_ABORT_IF_FALSE(aFrame, "NULL frame in GetFontXHeight");
+ MOZ_ASSERT(aFrame, "NULL frame in GetFontXHeight");
return GetFontXHeight(aFrame->StyleContext());
}
float
SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext)
{
- NS_ABORT_IF_FALSE(aStyleContext, "NULL style context in GetFontXHeight");
+ MOZ_ASSERT(aStyleContext, "NULL style context in GetFontXHeight");
nsPresContext *presContext = aStyleContext->PresContext();
- NS_ABORT_IF_FALSE(presContext, "NULL pres context in GetFontXHeight");
+ MOZ_ASSERT(presContext, "NULL pres context in GetFontXHeight");
nsRefPtr<nsFontMetrics> fontMetrics;
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
getter_AddRefs(fontMetrics));
if (!fontMetrics) {
// ReportToConsole
NS_WARNING("no FontMetrics in GetFontXHeight()");
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -329,17 +329,17 @@ NS_IMETHODIMP
SVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
{
nsresult rv = nsImageLoadingContent::Notify(aRequest, aType, aData);
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
// Request a decode
nsCOMPtr<imgIContainer> container;
aRequest->GetImage(getter_AddRefs(container));
- NS_ABORT_IF_FALSE(container, "who sent the notification then?");
+ MOZ_ASSERT(container, "who sent the notification then?");
container->StartDecoding();
}
if (aType == imgINotificationObserver::LOAD_COMPLETE ||
aType == imgINotificationObserver::FRAME_UPDATE ||
aType == imgINotificationObserver::SIZE_AVAILABLE) {
Invalidate();
}
--- a/dom/svg/SVGForeignObjectElement.cpp
+++ b/dom/svg/SVGForeignObjectElement.cpp
@@ -84,17 +84,17 @@ SVGForeignObjectElement::PrependLocalTra
// our 'x' and 'y' attributes:
float x, y;
const_cast<SVGForeignObjectElement*>(this)->
GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
if (aWhich == eChildToUserSpace) {
return toUserSpace * aMatrix;
}
- NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes");
+ MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes");
return toUserSpace * fromUserSpace;
}
/* virtual */ bool
SVGForeignObjectElement::HasValidDimensions() const
{
return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() &&
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
--- a/dom/svg/SVGFragmentIdentifier.cpp
+++ b/dom/svg/SVGFragmentIdentifier.cpp
@@ -233,18 +233,18 @@ SVGFragmentIdentifier::ProcessSVGViewSpe
return true;
}
bool
SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument* aDocument,
const nsAString& aAnchorName)
{
- NS_ABORT_IF_FALSE(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg),
- "expecting an SVG root element");
+ MOZ_ASSERT(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg),
+ "expecting an SVG root element");
dom::SVGSVGElement* rootElement =
static_cast<dom::SVGSVGElement*>(aDocument->GetRootElement());
if (!rootElement->mUseCurrentView) {
SaveOldViewBox(rootElement);
SaveOldPreserveAspectRatio(rootElement);
SaveOldZoomAndPan(rootElement);
--- a/dom/svg/SVGIFrameElement.cpp
+++ b/dom/svg/SVGIFrameElement.cpp
@@ -73,17 +73,17 @@ SVGIFrameElement::PrependLocalTransforms
// our 'x' and 'y' attributes:
float x, y;
const_cast<SVGIFrameElement*>(this)->
GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
if (aWhich == eChildToUserSpace) {
return toUserSpace;
}
- NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes");
+ MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes");
return toUserSpace * fromUserSpace;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
nsresult
--- a/dom/svg/SVGIntegerPairSMILType.cpp
+++ b/dom/svg/SVGIntegerPairSMILType.cpp
@@ -8,17 +8,17 @@
#include "nsMathUtils.h"
#include "nsDebug.h"
namespace mozilla {
void
SVGIntegerPairSMILType::Init(nsSMILValue& aValue) const
{
- NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type");
+ MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mIntPair[0] = 0;
aValue.mU.mIntPair[1] = 0;
aValue.mType = this;
}
void
SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
--- a/dom/svg/SVGLength.cpp
+++ b/dom/svg/SVGLength.cpp
@@ -72,18 +72,18 @@ IsAbsoluteUnit(uint8_t aUnit)
*
* Example usage: to find out how many centimeters there are per inch:
*
* GetAbsUnitsPerAbsUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_CM,
* nsIDOMSVGLength::SVG_LENGTHTYPE_IN)
*/
inline static float GetAbsUnitsPerAbsUnit(uint8_t aUnits, uint8_t aPerUnit)
{
- NS_ABORT_IF_FALSE(IsAbsoluteUnit(aUnits), "Not a CSS absolute unit");
- NS_ABORT_IF_FALSE(IsAbsoluteUnit(aPerUnit), "Not a CSS absolute unit");
+ MOZ_ASSERT(IsAbsoluteUnit(aUnits), "Not a CSS absolute unit");
+ MOZ_ASSERT(IsAbsoluteUnit(aPerUnit), "Not a CSS absolute unit");
float CSSAbsoluteUnitConversionFactors[5][5] = { // columns: cm, mm, in, pt, pc
// cm per...:
{ 1.0f, 0.1f, 2.54f, 0.035277777777777778f, 0.42333333333333333f },
// mm per...:
{ 10.0f, 1.0f, 25.4f, 0.35277777777777778f, 4.2333333333333333f },
// in per...:
{ 0.39370078740157481f, 0.039370078740157481f, 1.0f, 0.013888888888888889f, 0.16666666666666667f },
--- a/dom/svg/SVGLengthList.h
+++ b/dom/svg/SVGLengthList.h
@@ -105,24 +105,24 @@ private:
}
bool InsertItem(uint32_t aIndex, const SVGLength &aLength) {
if (aIndex >= mLengths.Length()) aIndex = mLengths.Length();
return !!mLengths.InsertElementAt(aIndex, aLength);
}
void ReplaceItem(uint32_t aIndex, const SVGLength &aLength) {
- NS_ABORT_IF_FALSE(aIndex < mLengths.Length(),
- "DOM wrapper caller should have raised INDEX_SIZE_ERR");
+ MOZ_ASSERT(aIndex < mLengths.Length(),
+ "DOM wrapper caller should have raised INDEX_SIZE_ERR");
mLengths[aIndex] = aLength;
}
void RemoveItem(uint32_t aIndex) {
- NS_ABORT_IF_FALSE(aIndex < mLengths.Length(),
- "DOM wrapper caller should have raised INDEX_SIZE_ERR");
+ MOZ_ASSERT(aIndex < mLengths.Length(),
+ "DOM wrapper caller should have raised INDEX_SIZE_ERR");
mLengths.RemoveElementAt(aIndex);
}
bool AppendItem(SVGLength aLength) {
return !!mLengths.AppendElement(aLength);
}
protected:
@@ -198,24 +198,24 @@ public:
/**
* Returns true if this object is an "identity" value, from the perspective
* of SMIL. In other words, returns true until the initial value set up in
* SVGLengthListSMILType::Init() has been changed with a SetInfo() call.
*/
bool IsIdentity() const {
if (!mElement) {
- NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure");
+ MOZ_ASSERT(IsEmpty(), "target element propagation failure");
return true;
}
return false;
}
uint8_t Axis() const {
- NS_ABORT_IF_FALSE(mElement, "Axis() isn't valid");
+ MOZ_ASSERT(mElement, "Axis() isn't valid");
return mAxis;
}
/**
* The value returned by this function depends on which attribute this object
* is for. If appending a list of zeros to the attribute's list would have no
* effect on rendering (e.g. the attributes 'dx' and 'dy' on <text>), then
* this method will return true. If appending a list of zeros to the
--- a/dom/svg/SVGLengthListSMILType.cpp
+++ b/dom/svg/SVGLengthListSMILType.cpp
@@ -16,17 +16,17 @@ namespace mozilla {
/*static*/ SVGLengthListSMILType SVGLengthListSMILType::sSingleton;
//----------------------------------------------------------------------
// nsISMILType implementation
void
SVGLengthListSMILType::Init(nsSMILValue &aValue) const
{
- NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type");
+ MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
SVGLengthListAndInfo* lengthList = new SVGLengthListAndInfo();
// See the comment documenting Init() in our header file:
lengthList->SetCanZeroPadList(true);
aValue.mU.mPtr = lengthList;
aValue.mType = this;
@@ -105,28 +105,28 @@ SVGLengthListSMILType::Add(nsSMILValue&
for (uint32_t i = 0; i < dest.Length(); ++i) {
dest[i].SetValueAndUnit(valueToAdd[i].GetValueInCurrentUnits() * aCount,
valueToAdd[i].GetUnit());
}
dest.SetInfo(valueToAdd.Element(), valueToAdd.Axis(),
valueToAdd.CanZeroPadList()); // propagate target element info!
return NS_OK;
}
- NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(),
- "adding values from different elements...?");
+ MOZ_ASSERT(dest.Element() == valueToAdd.Element(),
+ "adding values from different elements...?");
// Zero-pad our |dest| list, if necessary.
if (dest.Length() < valueToAdd.Length()) {
if (!dest.CanZeroPadList()) {
// SVGContentUtils::ReportToConsole
return NS_ERROR_FAILURE;
}
- NS_ABORT_IF_FALSE(valueToAdd.CanZeroPadList(),
- "values disagree about attribute's zero-paddibility");
+ MOZ_ASSERT(valueToAdd.CanZeroPadList(),
+ "values disagree about attribute's zero-paddibility");
uint32_t i = dest.Length();
if (!dest.SetLength(valueToAdd.Length())) {
return NS_ERROR_OUT_OF_MEMORY;
}
for (; i < valueToAdd.Length(); ++i) {
dest[i].SetValueAndUnit(0.0f, valueToAdd[i].GetUnit());
}
--- a/dom/svg/SVGMPathElement.cpp
+++ b/dom/svg/SVGMPathElement.cpp
@@ -81,19 +81,18 @@ SVGMPathElement::Href()
// nsIContent methods
nsresult
SVGMPathElement::BindToTree(nsIDocument* aDocument,
nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
- NS_ABORT_IF_FALSE(!mHrefTarget.get(),
- "Shouldn't have href-target yet "
- "(or it should've been cleared)");
+ MOZ_ASSERT(!mHrefTarget.get(),
+ "Shouldn't have href-target yet (or it should've been cleared)");
nsresult rv = SVGMPathElementBase::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv,rv);
if (aDocument) {
const nsAttrValue* hrefAttrValue =
mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
@@ -176,19 +175,19 @@ SVGMPathElement::AttributeChanged(nsIDoc
//----------------------------------------------------------------------
// Public helper methods
SVGPathElement*
SVGMPathElement::GetReferencedPath()
{
if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
- NS_ABORT_IF_FALSE(!mHrefTarget.get(),
- "We shouldn't have an xlink:href target "
- "if we don't have an xlink:href attribute");
+ MOZ_ASSERT(!mHrefTarget.get(),
+ "We shouldn't have an xlink:href target "
+ "if we don't have an xlink:href attribute");
return nullptr;
}
nsIContent* genericTarget = mHrefTarget.get();
if (genericTarget && genericTarget->IsSVG(nsGkAtoms::path)) {
return static_cast<SVGPathElement*>(genericTarget);
}
return nullptr;
--- a/dom/svg/SVGMarkerElement.cpp
+++ b/dom/svg/SVGMarkerElement.cpp
@@ -341,18 +341,18 @@ SVGMarkerElement::GetViewBoxTransform()
if (!mViewBoxToViewportTransform) {
float viewportWidth =
mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx);
float viewportHeight =
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx);
nsSVGViewBoxRect viewbox = GetViewBoxRect();
- NS_ABORT_IF_FALSE(viewbox.width > 0.0f && viewbox.height > 0.0f,
- "Rendering should be disabled");
+ MOZ_ASSERT(viewbox.width > 0.0f && viewbox.height > 0.0f,
+ "Rendering should be disabled");
gfx::Matrix viewBoxTM =
SVGContentUtils::GetViewBoxTransform(viewportWidth, viewportHeight,
viewbox.x, viewbox.y,
viewbox.width, viewbox.height,
mPreserveAspectRatio);
float refX = mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
--- a/dom/svg/SVGMotionSMILAnimationFunction.cpp
+++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp
@@ -141,21 +141,21 @@ GetFirstMPathChild(nsIContent* aElem)
return nullptr;
}
void
SVGMotionSMILAnimationFunction::
RebuildPathAndVerticesFromBasicAttrs(const nsIContent* aContextElem)
{
- NS_ABORT_IF_FALSE(!HasAttr(nsGkAtoms::path),
- "Should be using |path| attr if we have it");
- NS_ABORT_IF_FALSE(!mPath, "regenerating when we aleady have path");
- NS_ABORT_IF_FALSE(mPathVertices.IsEmpty(),
- "regenerating when we already have vertices");
+ MOZ_ASSERT(!HasAttr(nsGkAtoms::path),
+ "Should be using |path| attr if we have it");
+ MOZ_ASSERT(!mPath, "regenerating when we aleady have path");
+ MOZ_ASSERT(mPathVertices.IsEmpty(),
+ "regenerating when we already have vertices");
if (!aContextElem->IsSVG()) {
NS_ERROR("Uh oh, SVG animateMotion element targeting a non-SVG node");
return;
}
SVGMotionSMILPathUtils::PathGenerator
pathGenerator(static_cast<const nsSVGElement*>(aContextElem));
@@ -259,17 +259,17 @@ SVGMotionSMILAnimationFunction::RebuildP
}
}
// Helper to regenerate our path representation & its list of vertices
void
SVGMotionSMILAnimationFunction::
RebuildPathAndVertices(const nsIContent* aTargetElement)
{
- NS_ABORT_IF_FALSE(mIsPathStale, "rebuilding path when it isn't stale");
+ MOZ_ASSERT(mIsPathStale, "rebuilding path when it isn't stale");
// Clear stale data
mPath = nullptr;
mPathVertices.Clear();
mPathSourceType = ePathSourceType_None;
// Do we have a mpath child? if so, it trumps everything. Otherwise, we look
// through our list of path-defining attributes, in order of priority.
@@ -292,17 +292,17 @@ SVGMotionSMILAnimationFunction::
bool
SVGMotionSMILAnimationFunction::
GenerateValuesForPathAndPoints(Path* aPath,
bool aIsKeyPoints,
FallibleTArray<double>& aPointDistances,
nsSMILValueArray& aResult)
{
- NS_ABORT_IF_FALSE(aResult.IsEmpty(), "outparam is non-empty");
+ MOZ_ASSERT(aResult.IsEmpty(), "outparam is non-empty");
// If we're using "keyPoints" as our list of input distances, then we need
// to de-normalize from the [0, 1] scale to the [0, totalPathLen] scale.
double distanceMultiplier = aIsKeyPoints ? aPath->ComputeLength() : 1.0;
const uint32_t numPoints = aPointDistances.Length();
for (uint32_t i = 0; i < numPoints; ++i) {
double curDist = aPointDistances[i] * distanceMultiplier;
if (!aResult.AppendElement(
@@ -316,24 +316,24 @@ SVGMotionSMILAnimationFunction::
nsresult
SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
nsSMILValueArray& aResult)
{
if (mIsPathStale) {
RebuildPathAndVertices(aSMILAttr.GetTargetNode());
}
- NS_ABORT_IF_FALSE(!mIsPathStale, "Forgot to clear 'is path stale' state");
+ MOZ_ASSERT(!mIsPathStale, "Forgot to clear 'is path stale' state");
if (!mPath) {
// This could be due to e.g. a parse error.
- NS_ABORT_IF_FALSE(mPathVertices.IsEmpty(), "have vertices but no path");
+ MOZ_ASSERT(mPathVertices.IsEmpty(), "have vertices but no path");
return NS_ERROR_FAILURE;
}
- NS_ABORT_IF_FALSE(!mPathVertices.IsEmpty(), "have a path but no vertices");
+ MOZ_ASSERT(!mPathVertices.IsEmpty(), "have a path but no vertices");
// Now: Make the actual list of nsSMILValues (using keyPoints, if set)
bool isUsingKeyPoints = !mKeyPoints.IsEmpty();
bool success = GenerateValuesForPathAndPoints(mPath, isUsingKeyPoints,
isUsingKeyPoints ?
mKeyPoints : mPathVertices,
aResult);
if (!success) {
--- a/dom/svg/SVGMotionSMILPathUtils.cpp
+++ b/dom/svg/SVGMotionSMILPathUtils.cpp
@@ -17,29 +17,29 @@ namespace mozilla {
//----------------------------------------------------------------------
// PathGenerator methods
// For the dummy 'from' value used in pure by-animation & to-animation
void
SVGMotionSMILPathUtils::PathGenerator::
MoveToOrigin()
{
- NS_ABORT_IF_FALSE(!mHaveReceivedCommands,
- "Not expecting requests for mid-path MoveTo commands");
+ MOZ_ASSERT(!mHaveReceivedCommands,
+ "Not expecting requests for mid-path MoveTo commands");
mHaveReceivedCommands = true;
mPathBuilder->MoveTo(Point(0, 0));
}
// For 'from' and the first entry in 'values'.
bool
SVGMotionSMILPathUtils::PathGenerator::
MoveToAbsolute(const nsAString& aCoordPairStr)
{
- NS_ABORT_IF_FALSE(!mHaveReceivedCommands,
- "Not expecting requests for mid-path MoveTo commands");
+ MOZ_ASSERT(!mHaveReceivedCommands,
+ "Not expecting requests for mid-path MoveTo commands");
mHaveReceivedCommands = true;
float xVal, yVal;
if (!ParseCoordinatePair(aCoordPairStr, xVal, yVal)) {
return false;
}
mPathBuilder->MoveTo(Point(xVal, yVal));
return true;
--- a/dom/svg/SVGMotionSMILPathUtils.h
+++ b/dom/svg/SVGMotionSMILPathUtils.h
@@ -81,18 +81,18 @@ public:
{
public:
MotionValueParser(PathGenerator* aPathGenerator,
FallibleTArray<double>* aPointDistances)
: mPathGenerator(aPathGenerator),
mPointDistances(aPointDistances),
mDistanceSoFar(0.0)
{