mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Merge m-c to f-t
This commit is contained in:
commit
d2d401d355
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1422484744000">
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1423263875000">
|
||||
<emItems>
|
||||
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
@ -629,6 +629,14 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i844" id=" e9d197d59f2f45f382b1aa5c14d82@8706aaed9b904554b5cb7984e9.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
<pref>browser.startup.homepage</pref>
|
||||
<pref>browser.search.defaultenginename</pref>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i770" id="{8dc5c42e-9204-2a64-8b97-fa94ff8a241f}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
@ -979,6 +987,12 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i700" id="2bbadf1f-a5af-499f-9642-9942fcdb7c76@f05a14cc-8842-4eee-be17-744677a917ed.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i696" id="/^({fa95f577-07cb-4470-ac90-e843f5f83c52}|ffxtlbr@speedial\.com)$/">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
@ -1029,6 +1043,12 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i836" id="hansin@topvest.id">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i82" id="{8f42fb8b-b6f6-45de-81c0-d6d39f54f971}">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
@ -1504,6 +1524,14 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i846" id="PDVDZDW52397720@XDDWJXW57740856.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
<pref>browser.startup.homepage</pref>
|
||||
<pref>browser.search.defaultenginename</pref>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i354" id="{c0c2693d-2ee8-47b4-9df7-b67a0ee31988}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
@ -1797,7 +1825,7 @@
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i70" id="psid-vhvxQHMZBOzUZA@jetpack">
|
||||
<emItem blockID="i543" id="{badea1ae-72ed-4f6a-8c37-4db9a4ac7bc9}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
@ -1808,6 +1836,12 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i840" id="{4889ddce-7a83-45e6-afc9-1e4f1149fff4}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i532" id="249911bc-d1bd-4d66-8c17-df533609e6d8@c76f3de9-939e-4922-b73c-5d7a3139375d.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
@ -1911,6 +1945,12 @@
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i842" id="{746505DC-0E21-4667-97F8-72EA6BCF5EEF}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i552" id="jid0-O6MIff3eO5dIGf5Tcv8RsJDKxrs@jetpack">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
@ -2030,8 +2070,8 @@
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i700" id="2bbadf1f-a5af-499f-9642-9942fcdb7c76@f05a14cc-8842-4eee-be17-744677a917ed.com">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
<emItem blockID="i838" id="{87b5a11e-3b54-42d2-9102-0a7cb1f79ebf}">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
</prefs>
|
||||
@ -2252,7 +2292,7 @@
|
||||
<prefs>
|
||||
</prefs>
|
||||
</emItem>
|
||||
<emItem blockID="i543" id="{badea1ae-72ed-4f6a-8c37-4db9a4ac7bc9}">
|
||||
<emItem blockID="i70" id="psid-vhvxQHMZBOzUZA@jetpack">
|
||||
<versionRange minVersion="0" maxVersion="*" severity="1">
|
||||
</versionRange>
|
||||
<prefs>
|
||||
@ -2810,6 +2850,18 @@
|
||||
<match name="filename" exp="(NPSWF32.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="15.0.0.243" maxVersion="16.0.0.287" severity="0" vulnerabilitystatus="1"></versionRange>
|
||||
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
|
||||
</pluginItem>
|
||||
<pluginItem os="Linux" blockID="p830">
|
||||
<match name="filename" exp="libflashplayer\.so" /> <versionRange minVersion="11.2.202.439" maxVersion="11.2.202.441" severity="0" vulnerabilitystatus="1"></versionRange>
|
||||
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p832">
|
||||
<match name="filename" exp="(NPSWF32.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="16.0.0.295" maxVersion="16.0.0.304" severity="0" vulnerabilitystatus="1"></versionRange>
|
||||
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
|
||||
</pluginItem>
|
||||
<pluginItem blockID="p834">
|
||||
<match name="filename" exp="(NPSWF32.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="13.0.0.263" maxVersion="13.0.0.268" severity="0" vulnerabilitystatus="1"></versionRange>
|
||||
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
|
||||
<gfxItems>
|
||||
|
@ -1249,7 +1249,12 @@ nsContextMenu.prototype = {
|
||||
// set up a channel to do the saving
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var channel = ioService.newChannelFromURI(makeURI(linkURL));
|
||||
var channel = ioService.newChannelFromURI2(makeURI(linkURL),
|
||||
doc,
|
||||
null, // aLoadingPrincipal
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
if (channel instanceof Ci.nsIPrivateBrowsingChannel) {
|
||||
let docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView);
|
||||
channel.setPrivate(docIsPrivate);
|
||||
|
@ -5,7 +5,14 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
function test() {
|
||||
var file = new File([new Blob(['test'], {type: 'text/plain'})], "test-name");
|
||||
var url = URL.createObjectURL(file);
|
||||
var channel = NetUtil.newChannel(url);
|
||||
var channel = NetUtil.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
is(channel.contentDispositionFilename, 'test-name', "filename matches");
|
||||
}
|
||||
|
@ -203,9 +203,11 @@ function fakeLoopAboutModule() {
|
||||
|
||||
fakeLoopAboutModule.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
||||
newChannel: function (aURI) {
|
||||
newChannel: function (aURI, aLoadInfo) {
|
||||
let rootDir = getRootDirectory(gTestPath);
|
||||
let chan = Services.io.newChannel(rootDir + "get_user_media.html", null, null);
|
||||
let uri = Services.io.newURI(rootDir + "get_user_media.html", null, null);
|
||||
let chan = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
|
||||
|
||||
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
return chan;
|
||||
},
|
||||
|
@ -51,25 +51,28 @@ Object.keys(requiredSize).forEach(prop => {
|
||||
gBrowser.contentWindow[prop] = requiredSize[prop];
|
||||
}
|
||||
});
|
||||
let (screenHeight = {}, screenWidth = {}) {
|
||||
Cc["@mozilla.org/gfx/screenmanager;1"].
|
||||
getService(Ci.nsIScreenManager).
|
||||
primaryScreen.
|
||||
GetAvailRectDisplayPix({}, {}, screenWidth, screenHeight);
|
||||
screenHeight = screenHeight.value;
|
||||
screenWidth = screenWidth.value;
|
||||
if (screenHeight < gBrowser.contentWindow.outerHeight) {
|
||||
info("Warning: Browser outer height is now " +
|
||||
gBrowser.contentWindow.outerHeight + ", which is larger than the " +
|
||||
"available screen height, " + screenHeight +
|
||||
". That may cause problems.");
|
||||
}
|
||||
if (screenWidth < gBrowser.contentWindow.outerWidth) {
|
||||
info("Warning: Browser outer width is now " +
|
||||
gBrowser.contentWindow.outerWidth + ", which is larger than the " +
|
||||
"available screen width, " + screenWidth +
|
||||
". That may cause problems.");
|
||||
}
|
||||
|
||||
let screenHeight = {};
|
||||
let screenWidth = {};
|
||||
Cc["@mozilla.org/gfx/screenmanager;1"].
|
||||
getService(Ci.nsIScreenManager).
|
||||
primaryScreen.
|
||||
GetAvailRectDisplayPix({}, {}, screenWidth, screenHeight);
|
||||
screenHeight = screenHeight.value;
|
||||
screenWidth = screenWidth.value;
|
||||
|
||||
if (screenHeight < gBrowser.contentWindow.outerHeight) {
|
||||
info("Warning: Browser outer height is now " +
|
||||
gBrowser.contentWindow.outerHeight + ", which is larger than the " +
|
||||
"available screen height, " + screenHeight +
|
||||
". That may cause problems.");
|
||||
}
|
||||
|
||||
if (screenWidth < gBrowser.contentWindow.outerWidth) {
|
||||
info("Warning: Browser outer width is now " +
|
||||
gBrowser.contentWindow.outerWidth + ", which is larger than the " +
|
||||
"available screen width, " + screenWidth +
|
||||
". That may cause problems.");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
|
@ -100,7 +100,14 @@ function registerPlayPreview(mimeType, targetUrl) {
|
||||
|
||||
// Create a new channel that is viewer loaded as a resource.
|
||||
var ioService = Services.io;
|
||||
var channel = ioService.newChannel(targetUrl, null, null);
|
||||
var channel = ioService.newChannel2(targetUrl,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(this.listener, aContext);
|
||||
},
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function run_test() {
|
||||
var feedFeedURI = ios.newURI("feed://example.com/feed.xml", null, null);
|
||||
var httpFeedURI = ios.newURI("feed:http://example.com/feed.xml", null, null);
|
||||
@ -7,9 +10,24 @@ function run_test() {
|
||||
ios.newURI("feed:https://example.com/feed.xml", null, null);
|
||||
var httpsURI = ios.newURI("https://example.com/feed.xml", null, null);
|
||||
|
||||
var feedChannel = ios.newChannelFromURI(feedFeedURI, null);
|
||||
var httpChannel = ios.newChannelFromURI(httpFeedURI, null);
|
||||
var httpsChannel = ios.newChannelFromURI(httpsFeedURI, null);
|
||||
var feedChannel = ios.newChannelFromURI2(feedFeedURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChannel = ios.newChannelFromURI2(httpFeedURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpsChannel = ios.newChannelFromURI2(httpsFeedURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// not setting .originalURI to the original URI is naughty
|
||||
do_check_true(feedFeedURI.equals(feedChannel.originalURI));
|
||||
|
@ -189,7 +189,7 @@ function GetBookmarksResource(aProfileFolder) {
|
||||
type: MigrationUtils.resourceTypes.BOOKMARKS,
|
||||
|
||||
migrate: function(aCallback) {
|
||||
NetUtil.asyncFetch(bookmarksFile, MigrationUtils.wrapMigrateFunction(
|
||||
NetUtil.asyncFetch2(bookmarksFile, MigrationUtils.wrapMigrateFunction(
|
||||
function(aInputStream, aResultCode) {
|
||||
if (!Components.isSuccessCode(aResultCode))
|
||||
throw new Error("Could not read Bookmarks file");
|
||||
@ -225,7 +225,12 @@ function GetBookmarksResource(aProfileFolder) {
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
}, aCallback));
|
||||
}, aCallback),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils",
|
||||
let gProfD = do_get_profile();
|
||||
|
||||
// Create a fake XULAppInfo to satisfy the eventual needs of the migrators.
|
||||
let (XULAppInfo = {
|
||||
let XULAppInfo = {
|
||||
// nsIXUlAppInfo
|
||||
get vendor() "Mozilla",
|
||||
get name() "XPCShell",
|
||||
@ -48,17 +48,17 @@ let (XULAppInfo = {
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
}) {
|
||||
const CONTRACT_ID = "@mozilla.org/xre/app-info;1";
|
||||
const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
|
||||
};
|
||||
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, {
|
||||
createInstance: function (aOuter, aIID) {
|
||||
if (aOuter != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return XULAppInfo.QueryInterface(aIID);
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory)
|
||||
});
|
||||
}
|
||||
const CONTRACT_ID = "@mozilla.org/xre/app-info;1";
|
||||
const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
|
||||
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, {
|
||||
createInstance: function (aOuter, aIID) {
|
||||
if (aOuter != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return XULAppInfo.QueryInterface(aIID);
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory)
|
||||
});
|
||||
|
@ -11,16 +11,16 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
|
||||
// We need to cache this before test runs...
|
||||
let cachedLeftPaneFolderIdGetter;
|
||||
let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) {
|
||||
if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function")
|
||||
cachedLeftPaneFolderIdGetter = getter;
|
||||
let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
|
||||
if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function") {
|
||||
cachedLeftPaneFolderIdGetter = getter;
|
||||
}
|
||||
|
||||
// ...And restore it when test ends.
|
||||
registerCleanupFunction(function(){
|
||||
let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) {
|
||||
if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function")
|
||||
PlacesUIUtils.__defineGetter__("leftPaneFolderId",
|
||||
cachedLeftPaneFolderIdGetter);
|
||||
let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
|
||||
if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function") {
|
||||
PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -28,7 +28,7 @@ XPCOMUtils.defineLazyGetter(this, "PlacesUIUtils", function() {
|
||||
const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder";
|
||||
const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery";
|
||||
|
||||
// Needed by some test that relies on having an app registered.
|
||||
// Needed by some test that relies on having an app registered.
|
||||
let XULAppInfo = {
|
||||
vendor: "Mozilla",
|
||||
name: "PlacesTest",
|
||||
|
@ -1841,10 +1841,9 @@ var gApplicationsPane = {
|
||||
return this._getIconURLForSystemDefault(aHandlerInfo);
|
||||
|
||||
case Ci.nsIHandlerInfo.useHelperApp:
|
||||
let (preferredApp = aHandlerInfo.preferredApplicationHandler) {
|
||||
if (this.isValidHandlerApp(preferredApp))
|
||||
return this._getIconURLForHandlerApp(preferredApp);
|
||||
}
|
||||
let preferredApp = aHandlerInfo.preferredApplicationHandler;
|
||||
if (this.isValidHandlerApp(preferredApp))
|
||||
return this._getIconURLForHandlerApp(preferredApp);
|
||||
break;
|
||||
|
||||
// This should never happen, but if preferredAction is set to some weird
|
||||
|
@ -26,11 +26,10 @@ function test() {
|
||||
}
|
||||
|
||||
// delete existing sessionstore.js, to make sure we're not reading
|
||||
// the mtime of an old one initialy
|
||||
let (sessionStoreJS = getSessionstoreFile()) {
|
||||
if (sessionStoreJS.exists())
|
||||
sessionStoreJS.remove(false);
|
||||
}
|
||||
// the mtime of an old one initially.
|
||||
let sessionStoreJS = getSessionstoreFile();
|
||||
if (sessionStoreJS.exists())
|
||||
sessionStoreJS.remove(false);
|
||||
|
||||
// test content URL
|
||||
const TEST_URL = "data:text/html;charset=utf-8,"
|
||||
|
@ -13,7 +13,7 @@ let Paths;
|
||||
let SessionFile;
|
||||
|
||||
// We need a XULAppInfo to initialize SessionFile
|
||||
let (XULAppInfo = {
|
||||
let XULAppInfo = {
|
||||
vendor: "Mozilla",
|
||||
name: "SessionRestoreTest",
|
||||
ID: "{230de50e-4cd1-11dc-8314-0800200c9a66}",
|
||||
@ -30,20 +30,20 @@ let (XULAppInfo = {
|
||||
Ci.nsIXULAppInfo,
|
||||
Ci.nsIXULRuntime,
|
||||
])
|
||||
}) {
|
||||
let XULAppInfoFactory = {
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return XULAppInfo.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
|
||||
"XULAppInfo", "@mozilla.org/xre/app-info;1",
|
||||
XULAppInfoFactory);
|
||||
};
|
||||
|
||||
let XULAppInfoFactory = {
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return XULAppInfo.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
|
||||
"XULAppInfo", "@mozilla.org/xre/app-info;1",
|
||||
XULAppInfoFactory);
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ let gWebconsoleTests = [
|
||||
warning: ["SSL 3.0"], nowarning: ["SHA-1", "RC4"]},
|
||||
{url: "https://rc4.example.com" + TEST_URI_PATH,
|
||||
name: "RC4 warning displayed successfully",
|
||||
pref: [["security.tls.insecure_fallback_hosts", "rc4.example.com"]],
|
||||
warning: ["RC4"], nowarning: ["SHA-1", "SSL 3.0"]},
|
||||
{url: "https://ssl3rc4.example.com" + TEST_URI_PATH,
|
||||
name: "SSL3 and RC4 warning displayed successfully",
|
||||
pref: [["security.tls.version.min", 0]],
|
||||
pref: [["security.tls.version.min", 0],
|
||||
["security.tls.insecure_fallback_hosts", "ssl3rc4.example.com"]],
|
||||
warning: ["SSL 3.0", "RC4"], nowarning: ["SHA-1"]},
|
||||
{url: "https://sha256ee.example.com" + TEST_URI_PATH,
|
||||
name: "SSL warnings appropriately not present",
|
||||
|
@ -73,15 +73,20 @@ XPCOMUtils.defineLazyServiceGetter(this, "faviconSvc",
|
||||
"nsIFaviconService");
|
||||
|
||||
// nsIURI -> imgIContainer
|
||||
function _imageFromURI(uri, privateMode, callback) {
|
||||
let channel = ioSvc.newChannelFromURI(uri);
|
||||
function _imageFromURI(doc, uri, privateMode, callback) {
|
||||
let channel = ioSvc.newChannelFromURI2(uri,
|
||||
doc,
|
||||
null, // aLoadingPrincipal
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
try {
|
||||
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
|
||||
channel.setPrivate(privateMode);
|
||||
} catch (e) {
|
||||
// Ignore channels which do not support nsIPrivateBrowsingChannel
|
||||
}
|
||||
NetUtil.asyncFetch(channel, function(inputStream, resultCode) {
|
||||
NetUtil.asyncFetch2(channel, function(inputStream, resultCode) {
|
||||
if (!Components.isSuccessCode(resultCode))
|
||||
return;
|
||||
try {
|
||||
@ -99,11 +104,11 @@ function _imageFromURI(uri, privateMode, callback) {
|
||||
}
|
||||
|
||||
// string? -> imgIContainer
|
||||
function getFaviconAsImage(iconurl, privateMode, callback) {
|
||||
function getFaviconAsImage(doc, iconurl, privateMode, callback) {
|
||||
if (iconurl)
|
||||
_imageFromURI(NetUtil.newURI(iconurl), privateMode, callback);
|
||||
_imageFromURI(doc, NetUtil.newURI(iconurl), privateMode, callback);
|
||||
else
|
||||
_imageFromURI(faviconSvc.defaultFavicon, privateMode, callback);
|
||||
_imageFromURI(doc, faviconSvc.defaultFavicon, privateMode, callback);
|
||||
}
|
||||
|
||||
// Snaps the given rectangle to be pixel-aligned at the given scale
|
||||
@ -497,13 +502,16 @@ TabWindow.prototype = {
|
||||
preview.visible = AeroPeek.enabled;
|
||||
preview.active = this.tabbrowser.selectedTab == controller.tab;
|
||||
// Grab the default favicon
|
||||
getFaviconAsImage(null, PrivateBrowsingUtils.isWindowPrivate(this.win), function (img) {
|
||||
// It is possible that we've already gotten the real favicon, so make sure
|
||||
// we have not set one before setting this default one.
|
||||
if (!preview.icon)
|
||||
preview.icon = img;
|
||||
});
|
||||
|
||||
getFaviconAsImage(
|
||||
controller.linkedBrowser.contentWindow.document,
|
||||
null,
|
||||
PrivateBrowsingUtils.isWindowPrivate(this.win),
|
||||
function (img) {
|
||||
// It is possible that we've already gotten the real favicon, so make sure
|
||||
// we have not set one before setting this default one.
|
||||
if (!preview.icon)
|
||||
preview.icon = img;
|
||||
});
|
||||
return preview;
|
||||
},
|
||||
|
||||
@ -588,14 +596,17 @@ TabWindow.prototype = {
|
||||
//// Browser progress listener
|
||||
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
||||
let self = this;
|
||||
getFaviconAsImage(aIconURL, PrivateBrowsingUtils.isWindowPrivate(this.win), function (img) {
|
||||
let index = self.tabbrowser.browsers.indexOf(aBrowser);
|
||||
// Only add it if we've found the index. The tab could have closed!
|
||||
if (index != -1) {
|
||||
let tab = self.tabbrowser.tabs[index];
|
||||
self.previews.get(tab).icon = img;
|
||||
}
|
||||
});
|
||||
getFaviconAsImage(
|
||||
aBrowser.contentWindow.document,
|
||||
aIconURL,PrivateBrowsingUtils.isWindowPrivate(this.win),
|
||||
function (img) {
|
||||
let index = self.tabbrowser.browsers.indexOf(aBrowser);
|
||||
// Only add it if we've found the index. The tab could have closed!
|
||||
if (index != -1) {
|
||||
let tab = self.tabbrowser.tabs[index];
|
||||
self.previews.get(tab).icon = img;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ nsChromeRegistryContent::RegisterRemoteChrome(
|
||||
const nsACString& aLocale,
|
||||
bool aReset)
|
||||
{
|
||||
MOZ_ASSERT(aReset || mLocale.IsEmpty(),
|
||||
"RegisterChrome twice?");
|
||||
NS_ABORT_IF_FALSE(aReset || mLocale.IsEmpty(),
|
||||
"RegisterChrome twice?");
|
||||
|
||||
if (aReset) {
|
||||
mPackagesHash.Clear();
|
||||
|
@ -27,7 +27,7 @@ ComputedTimingFunction::Init(const nsTimingFunction &aFunction)
|
||||
static inline double
|
||||
StepEnd(uint32_t aSteps, double aPortion)
|
||||
{
|
||||
MOZ_ASSERT(0.0 <= aPortion && aPortion <= 1.0, "out of range");
|
||||
NS_ABORT_IF_FALSE(0.0 <= aPortion && aPortion <= 1.0, "out of range");
|
||||
uint32_t step = uint32_t(aPortion * aSteps); // floor
|
||||
return double(step) / double(aSteps);
|
||||
}
|
||||
@ -47,7 +47,7 @@ ComputedTimingFunction::GetValue(double aPortion) const
|
||||
// really meant it.
|
||||
return 1.0 - StepEnd(mSteps, 1.0 - aPortion);
|
||||
default:
|
||||
MOZ_ASSERT(false, "bad type");
|
||||
NS_ABORT_IF_FALSE(false, "bad type");
|
||||
// fall through
|
||||
case nsTimingFunction::StepEnd:
|
||||
return StepEnd(mSteps, aPortion);
|
||||
|
@ -42,7 +42,7 @@ private: //data
|
||||
NS_IMETHODIMP
|
||||
ArchiveRequestEvent::Run()
|
||||
{
|
||||
MOZ_ASSERT(mRequest, "the request is not longer valid");
|
||||
NS_ABORT_IF_FALSE(mRequest, "the request is not longer valid");
|
||||
mRequest->Run();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ Attr::Attr(nsDOMAttributeMap *aAttrMap,
|
||||
const nsAString &aValue, bool aNsAware)
|
||||
: nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!");
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
|
||||
"Wrong nodeType");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
|
||||
NS_ABORT_IF_FALSE(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.
|
||||
|
@ -19,8 +19,8 @@ class Comment MOZ_FINAL : public nsGenericDOMDataNode,
|
||||
private:
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
|
||||
virtual ~Comment();
|
||||
|
@ -56,7 +56,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
|
||||
JS::MutableHandle<JSObject*> aRetval,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Called on the wrong thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Called on the wrong thread");
|
||||
|
||||
JS::Rooted<JSObject*> view(aCx, aArray.Obj());
|
||||
|
||||
|
@ -27,10 +27,11 @@ class DocumentFragment : public FragmentOrElement,
|
||||
private:
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
|
||||
mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
|
||||
kNameSpaceID_None),
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() ==
|
||||
nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
|
||||
mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
|
||||
kNameSpaceID_None),
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -74,8 +74,8 @@ DocumentType::DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
mSystemId(aSystemId),
|
||||
mInternalSubset(aInternalSubset)
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
|
||||
DocumentType::~DocumentType()
|
||||
|
@ -204,9 +204,9 @@ Element::NotifyStateChange(EventStates aStates)
|
||||
void
|
||||
Element::UpdateLinkState(EventStates aState)
|
||||
{
|
||||
MOZ_ASSERT(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED |
|
||||
NS_EVENT_STATE_UNVISITED)),
|
||||
"Unexpected link state bits");
|
||||
NS_ABORT_IF_FALSE(!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;
|
||||
|
@ -152,8 +152,8 @@ public:
|
||||
FragmentOrElement(aNodeInfo),
|
||||
mState(NS_EVENT_STATE_MOZ_READONLY)
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
SetIsElement();
|
||||
}
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
|
@ -580,9 +580,9 @@ EventSource::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
||||
nsresult
|
||||
EventSource::OnRedirectVerifyCallback(nsresult aResult)
|
||||
{
|
||||
MOZ_ASSERT(mRedirectCallback, "mRedirectCallback not set in callback");
|
||||
MOZ_ASSERT(mNewRedirectChannel,
|
||||
"mNewRedirectChannel not set in callback");
|
||||
NS_ABORT_IF_FALSE(mRedirectCallback, "mRedirectCallback not set in callback");
|
||||
NS_ABORT_IF_FALSE(mNewRedirectChannel,
|
||||
"mNewRedirectChannel not set in callback");
|
||||
|
||||
NS_ENSURE_SUCCESS(aResult, aResult);
|
||||
|
||||
|
@ -29,7 +29,7 @@ Link::Link(Element *aElement)
|
||||
, mNeedsRegistration(false)
|
||||
, mRegistered(false)
|
||||
{
|
||||
MOZ_ASSERT(mElement, "Must have an element");
|
||||
NS_ABORT_IF_FALSE(mElement, "Must have an element");
|
||||
}
|
||||
|
||||
Link::~Link()
|
||||
@ -58,9 +58,9 @@ Link::SetLinkState(nsLinkState aState)
|
||||
// Per IHistory interface documentation, we are no longer registered.
|
||||
mRegistered = false;
|
||||
|
||||
MOZ_ASSERT(LinkState() == NS_EVENT_STATE_VISITED ||
|
||||
LinkState() == NS_EVENT_STATE_UNVISITED,
|
||||
"Unexpected state obtained from LinkState()!");
|
||||
NS_ABORT_IF_FALSE(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);
|
||||
|
@ -48,7 +48,7 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
|
||||
nsNodeInfoManager *aOwnerManager)
|
||||
{
|
||||
CheckValidNodeInfo(aNodeType, aName, aNamespaceID, aExtraName);
|
||||
MOZ_ASSERT(aOwnerManager, "Invalid aOwnerManager");
|
||||
NS_ABORT_IF_FALSE(aOwnerManager, "Invalid aOwnerManager");
|
||||
|
||||
// Initialize mInner
|
||||
NS_ADDREF(mInner.mName = aName);
|
||||
@ -104,7 +104,8 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
|
||||
SetDOMStringToNull(mLocalName);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(aNodeType == UINT16_MAX, "Unknown node type");
|
||||
NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX,
|
||||
"Unknown node type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,42 +75,42 @@ inline void
|
||||
CheckValidNodeInfo(uint16_t aNodeType, nsIAtom *aName, int32_t aNamespaceID,
|
||||
nsIAtom* aExtraName)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
}
|
||||
|
||||
#endif /* mozilla_dom_NodeInfoInlines_h___ */
|
@ -1482,7 +1482,7 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||
void
|
||||
WebSocketImpl::AsyncOpen(ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
nsCString asciiOrigin;
|
||||
aRv = nsContentUtils::GetASCIIOrigin(mPrincipal, asciiOrigin);
|
||||
@ -1527,7 +1527,7 @@ nsresult
|
||||
WebSocketImpl::InitializeConnection()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(!mChannel, "mChannel should be null");
|
||||
NS_ABORT_IF_FALSE(!mChannel, "mChannel should be null");
|
||||
|
||||
nsCOMPtr<nsIWebSocketChannel> wsChannel;
|
||||
nsAutoCloseWS autoClose(this);
|
||||
|
@ -1032,7 +1032,8 @@ nsAttrValue::Equals(const nsAttrValue& aOther) const
|
||||
// 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.
|
||||
MOZ_ASSERT(false, "Comparing nsAttrValues that point to SVG data");
|
||||
NS_ABORT_IF_FALSE(false, "Comparing nsAttrValues that point to SVG "
|
||||
"data");
|
||||
return false;
|
||||
}
|
||||
NS_NOTREACHED("unknown type stored in MiscContainer");
|
||||
@ -1753,7 +1754,7 @@ nsAttrValue::ResetMiscAtomOrString()
|
||||
void
|
||||
nsAttrValue::SetSVGType(ValueType aType, const void* aValue,
|
||||
const nsAString* aSerialized) {
|
||||
MOZ_ASSERT(IsSVGType(aType), "Not an SVG type");
|
||||
NS_ABORT_IF_FALSE(IsSVGType(aType), "Not an SVG type");
|
||||
|
||||
MiscContainer* cont = EnsureEmptyMiscContainer();
|
||||
// All SVG types are just pointers to classes so just setting any of them
|
||||
|
@ -242,6 +242,7 @@ bool nsContentUtils::sTrustedFullScreenOnly = true;
|
||||
bool nsContentUtils::sFullscreenApiIsContentOnly = false;
|
||||
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsResourceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
|
||||
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
|
||||
bool nsContentUtils::sEncodeDecodeURLHash = false;
|
||||
|
||||
@ -515,6 +516,9 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
|
||||
"dom.enable_resource_timing", true);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
|
||||
"dom.performance.enable_user_timing_logging", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsExperimentalAutocompleteEnabled,
|
||||
"dom.forms.autocomplete.experimental", false);
|
||||
|
||||
@ -4273,7 +4277,7 @@ nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer,
|
||||
// sXMLFragmentSink now owns the sink
|
||||
}
|
||||
nsCOMPtr<nsIContentSink> contentsink = do_QueryInterface(sXMLFragmentSink);
|
||||
MOZ_ASSERT(contentsink, "Sink doesn't QI to nsIContentSink!");
|
||||
NS_ABORT_IF_FALSE(contentsink, "Sink doesn't QI to nsIContentSink!");
|
||||
sXMLFragmentParser->SetContentSink(contentsink);
|
||||
|
||||
sXMLFragmentSink->SetTargetDocument(aDocument);
|
||||
|
@ -1880,6 +1880,14 @@ public:
|
||||
return sIsPerformanceTimingEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if user timing API should print to console.
|
||||
*/
|
||||
static bool IsUserTimingLoggingEnabled()
|
||||
{
|
||||
return sIsUserTimingLoggingEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the performance timing APIs are enabled.
|
||||
*/
|
||||
@ -2360,6 +2368,7 @@ private:
|
||||
static uint32_t sHandlingInputTimeout;
|
||||
static bool sIsPerformanceTimingEnabled;
|
||||
static bool sIsResourceTimingEnabled;
|
||||
static bool sIsUserTimingLoggingEnabled;
|
||||
static bool sIsExperimentalAutocompleteEnabled;
|
||||
static bool sEncodeDecodeURLHash;
|
||||
|
||||
|
@ -1765,7 +1765,7 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
|
||||
nsCOMPtr<nsIClassInfo> ci;
|
||||
if (aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
int32_t id = aNameStruct->mDOMClassInfoID;
|
||||
MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?");
|
||||
NS_ABORT_IF_FALSE(id >= 0, "Negative DOM classinfo?!?");
|
||||
|
||||
nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
|
||||
|
||||
|
@ -269,7 +269,7 @@ nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& aRv)
|
||||
void
|
||||
nsDOMDataChannel::Send(File& aData, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
nsresult rv = aData.GetInternalStream(getter_AddRefs(msgStream));
|
||||
@ -296,7 +296,7 @@ nsDOMDataChannel::Send(File& aData, ErrorResult& aRv)
|
||||
void
|
||||
nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
aData.ComputeLengthAndData();
|
||||
|
||||
@ -312,7 +312,7 @@ nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& aRv)
|
||||
void
|
||||
nsDOMDataChannel::Send(const ArrayBufferView& aData, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
aData.ComputeLengthAndData();
|
||||
|
||||
|
@ -182,7 +182,7 @@ void
|
||||
nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr,
|
||||
const nsTArray<nsString>& aTokens)
|
||||
{
|
||||
MOZ_ASSERT(aAttr, "Need an attribute");
|
||||
NS_ABORT_IF_FALSE(aAttr, "Need an attribute");
|
||||
|
||||
nsAutoString input;
|
||||
aAttr->ToString(input);
|
||||
@ -204,7 +204,7 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr,
|
||||
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.
|
||||
MOZ_ASSERT(!lastTokenRemoved, "How did this happen?");
|
||||
NS_ABORT_IF_FALSE(!lastTokenRemoved, "How did this happen?");
|
||||
|
||||
output.Append(Substring(copyStart, end));
|
||||
break;
|
||||
@ -227,8 +227,8 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr,
|
||||
} else {
|
||||
|
||||
if (lastTokenRemoved && !output.IsEmpty()) {
|
||||
MOZ_ASSERT(!nsContentUtils::IsHTMLWhitespace(output.Last()),
|
||||
"Invalid last output token");
|
||||
NS_ABORT_IF_FALSE(!nsContentUtils::IsHTMLWhitespace(
|
||||
output.Last()), "Invalid last output token");
|
||||
output.Append(char16_t(' '));
|
||||
}
|
||||
lastTokenRemoved = false;
|
||||
|
@ -1716,9 +1716,9 @@ CanvasToDataSourceSurface(nsIDOMHTMLCanvasElement* aCanvas)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(node->IsElement(),
|
||||
"An nsINode that implements nsIDOMHTMLCanvasElement should "
|
||||
"be an element.");
|
||||
NS_ABORT_IF_FALSE(node->IsElement(),
|
||||
"An nsINode that implements nsIDOMHTMLCanvasElement should "
|
||||
"be an element.");
|
||||
nsLayoutUtils::SurfaceFromElementResult result =
|
||||
nsLayoutUtils::SurfaceFromElement(node->AsElement());
|
||||
return result.mSourceSurface->GetDataSurface();
|
||||
@ -2309,7 +2309,7 @@ nsDOMWindowUtils::GetClassName(JS::Handle<JS::Value> aObject, JSContext* aCx,
|
||||
}
|
||||
|
||||
*aName = NS_strdup(JS_GetClass(aObject.toObjectOrNull())->name);
|
||||
MOZ_ASSERT(*aName, "NS_strdup should be infallible.");
|
||||
NS_ABORT_IF_FALSE(*aName, "NS_strdup should be infallible.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2698,9 +2698,9 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
|
||||
property = eCSSProperty_UNKNOWN;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(property == eCSSProperty_UNKNOWN ||
|
||||
!nsCSSProps::IsShorthand(property),
|
||||
"should not have shorthand");
|
||||
NS_ABORT_IF_FALSE(property == eCSSProperty_UNKNOWN ||
|
||||
!nsCSSProps::IsShorthand(property),
|
||||
"should not have shorthand");
|
||||
|
||||
StyleAnimationValue v1, v2;
|
||||
if (property == eCSSProperty_UNKNOWN ||
|
||||
|
@ -1056,8 +1056,8 @@ void
|
||||
TransferZoomLevels(nsIDocument* aFromDoc,
|
||||
nsIDocument* aToDoc)
|
||||
{
|
||||
MOZ_ASSERT(aFromDoc && aToDoc,
|
||||
"transferring zoom levels from/to null doc");
|
||||
NS_ABORT_IF_FALSE(aFromDoc && aToDoc,
|
||||
"transferring zoom levels from/to null doc");
|
||||
|
||||
nsIPresShell* fromShell = aFromDoc->GetShell();
|
||||
if (!fromShell)
|
||||
@ -1083,8 +1083,8 @@ TransferZoomLevels(nsIDocument* aFromDoc,
|
||||
void
|
||||
TransferShowingState(nsIDocument* aFromDoc, nsIDocument* aToDoc)
|
||||
{
|
||||
MOZ_ASSERT(aFromDoc && aToDoc,
|
||||
"transferring showing state from/to null doc");
|
||||
NS_ABORT_IF_FALSE(aFromDoc && aToDoc,
|
||||
"transferring showing state from/to null doc");
|
||||
|
||||
if (aFromDoc->IsShowing()) {
|
||||
aToDoc->OnPageShow(true, nullptr);
|
||||
@ -1624,8 +1624,8 @@ ClearAllBoxObjects(nsIContent* aKey, nsPIBoxObject* aBoxObject, void* aUserArg)
|
||||
|
||||
nsIDocument::~nsIDocument()
|
||||
{
|
||||
MOZ_ASSERT(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists),
|
||||
"must not have media query lists left");
|
||||
NS_ABORT_IF_FALSE(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists),
|
||||
"must not have media query lists left");
|
||||
|
||||
if (mNodeInfoManager) {
|
||||
mNodeInfoManager->DropDocumentReference();
|
||||
@ -2211,8 +2211,8 @@ nsDocument::Init()
|
||||
// mNodeInfo keeps NodeInfoManager alive!
|
||||
mNodeInfo = mNodeInfoManager->GetDocumentNodeInfo();
|
||||
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
|
||||
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
|
||||
|
||||
@ -4672,11 +4672,11 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||
"Script global object must be an inner window!");
|
||||
}
|
||||
#endif
|
||||
MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
|
||||
mAnimationController->IsPausedByType(
|
||||
nsSMILTimeContainer::PAUSE_PAGEHIDE |
|
||||
nsSMILTimeContainer::PAUSE_BEGIN),
|
||||
"Clearing window pointer while animations are unpaused");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -10406,8 +10406,8 @@ nsDocument::RemoveImage(imgIRequest* aImage, uint32_t aFlags)
|
||||
// Get the old count. It should exist and be > 0.
|
||||
uint32_t count = 0;
|
||||
DebugOnly<bool> found = mImageTracker.Get(aImage, &count);
|
||||
MOZ_ASSERT(found, "Removing image that wasn't in the tracker!");
|
||||
MOZ_ASSERT(count > 0, "Entry in the cache tracker with count 0!");
|
||||
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!");
|
||||
|
||||
// We're removing, so decrement the count.
|
||||
count--;
|
||||
|
@ -42,23 +42,25 @@ using namespace mozilla::dom;
|
||||
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsIContent(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");
|
||||
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");
|
||||
}
|
||||
|
||||
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
||||
: nsIContent(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");
|
||||
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");
|
||||
}
|
||||
|
||||
nsGenericDOMDataNode::~nsGenericDOMDataNode()
|
||||
|
@ -1530,7 +1530,7 @@ nsGlobalWindow::CleanUp()
|
||||
}
|
||||
|
||||
if (mCleanMessageManager) {
|
||||
MOZ_ASSERT(mIsChrome, "only chrome should have msg manager cleaned");
|
||||
NS_ABORT_IF_FALSE(mIsChrome, "only chrome should have msg manager cleaned");
|
||||
nsGlobalChromeWindow *asChrome = static_cast<nsGlobalChromeWindow*>(this);
|
||||
if (asChrome->mMessageManager) {
|
||||
static_cast<nsFrameMessageManager*>(
|
||||
@ -8119,10 +8119,10 @@ PopulateMessagePortList(MessagePortBase* aKey, MessagePortBase* aValue, void* aC
|
||||
NS_IMETHODIMP
|
||||
PostMessageEvent::Run()
|
||||
{
|
||||
MOZ_ASSERT(mTargetWindow->IsOuterWindow(),
|
||||
"should have been passed an outer window!");
|
||||
MOZ_ASSERT(!mSource || mSource->IsOuterWindow(),
|
||||
"should have been passed an outer window!");
|
||||
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!");
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
@ -8137,8 +8137,8 @@ PostMessageEvent::Run()
|
||||
targetWindow->IsClosedOrClosing())
|
||||
return NS_OK;
|
||||
|
||||
MOZ_ASSERT(targetWindow->IsInnerWindow(),
|
||||
"we ordered an inner window!");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -8235,8 +8235,8 @@ nsGlobalWindow::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
nsRefPtr<nsGlobalWindow> callerInnerWin = CallerInnerWindow();
|
||||
nsIPrincipal* callerPrin;
|
||||
if (callerInnerWin) {
|
||||
MOZ_ASSERT(callerInnerWin->IsInnerWindow(),
|
||||
"should have gotten an inner window here");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
|
@ -1718,8 +1718,8 @@ protected:
|
||||
|
||||
~nsGlobalChromeWindow()
|
||||
{
|
||||
MOZ_ASSERT(mCleanMessageManager,
|
||||
"chrome windows may always disconnect the msg manager");
|
||||
NS_ABORT_IF_FALSE(mCleanMessageManager,
|
||||
"chrome windows may always disconnect the msg manager");
|
||||
|
||||
mGroupMessageManagers.EnumerateRead(DisconnectGroupMessageManager, nullptr);
|
||||
mGroupMessageManagers.Clear();
|
||||
|
@ -94,7 +94,8 @@ nsHostObjectURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode,
|
||||
#ifdef DEBUG
|
||||
nsRefPtr<nsHostObjectURI> uriCheck;
|
||||
rv = simpleClone->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(uriCheck));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv) && uriCheck);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) && uriCheck,
|
||||
"Unexpected!");
|
||||
#endif
|
||||
|
||||
nsHostObjectURI* u = static_cast<nsHostObjectURI*>(simpleClone.get());
|
||||
|
@ -1062,7 +1062,7 @@ nsINode::IsEqualNode(nsINode* aOther)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unknown node type");
|
||||
NS_ABORT_IF_FALSE(false, "Unknown node type");
|
||||
}
|
||||
|
||||
nsINode* nextNode = node1->GetFirstChild();
|
||||
@ -1357,7 +1357,7 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||
// return early.
|
||||
nsIContent* parent = tmp->GetParent();
|
||||
if (parent && !parent->UnoptimizableCCNode() && parent->IsBlack()) {
|
||||
MOZ_ASSERT(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
|
||||
NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2584,7 +2584,7 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
|
||||
struct ElementHolder {
|
||||
ElementHolder() : mElement(nullptr) {}
|
||||
void AppendElement(Element* aElement) {
|
||||
MOZ_ASSERT(!mElement, "Should only get one element");
|
||||
NS_ABORT_IF_FALSE(!mElement, "Should only get one element");
|
||||
mElement = aElement;
|
||||
}
|
||||
void SetCapacity(uint32_t aCapacity) { MOZ_CRASH("Don't call me!"); }
|
||||
|
@ -136,7 +136,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
|
||||
|
||||
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
||||
// We should definitely have a request here
|
||||
MOZ_ASSERT(aRequest, "no request?");
|
||||
NS_ABORT_IF_FALSE(aRequest, "no request?");
|
||||
|
||||
NS_PRECONDITION(aRequest == mCurrentRequest || aRequest == mPendingRequest,
|
||||
"Unknown request");
|
||||
@ -227,8 +227,8 @@ nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||
if (aRequest == mPendingRequest) {
|
||||
MakePendingRequestCurrent();
|
||||
}
|
||||
MOZ_ASSERT(aRequest == mCurrentRequest,
|
||||
"One way or another, we should be current by now");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -890,9 +890,9 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
|
||||
// time. It should always be the same as the principal of this node.
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
MOZ_ASSERT(thisContent &&
|
||||
thisContent->NodePrincipal() == aDocument->NodePrincipal(),
|
||||
"Principal mismatch?");
|
||||
NS_ABORT_IF_FALSE(thisContent &&
|
||||
thisContent->NodePrincipal() == aDocument->NodePrincipal(),
|
||||
"Principal mismatch?");
|
||||
#endif
|
||||
|
||||
// Are we blocked?
|
||||
@ -1219,7 +1219,7 @@ void
|
||||
nsImageLoadingContent::SetBlockedRequest(nsIURI* aURI, int16_t aContentDecision)
|
||||
{
|
||||
// Sanity
|
||||
MOZ_ASSERT(!NS_CP_ACCEPTED(aContentDecision), "Blocked but not?");
|
||||
NS_ABORT_IF_FALSE(!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
|
||||
@ -1347,8 +1347,8 @@ nsImageLoadingContent::ClearCurrentRequest(nsresult aReason,
|
||||
mCurrentRequestFlags = 0;
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(!mCurrentURI,
|
||||
"Shouldn't have both mCurrentRequest and mCurrentURI!");
|
||||
NS_ABORT_IF_FALSE(!mCurrentURI,
|
||||
"Shouldn't have both mCurrentRequest and mCurrentURI!");
|
||||
|
||||
// Deregister this image from the refresh driver so it no longer receives
|
||||
// notifications.
|
||||
|
@ -22,8 +22,15 @@
|
||||
#include "mozilla/dom/PerformanceBinding.h"
|
||||
#include "mozilla/dom/PerformanceTimingBinding.h"
|
||||
#include "mozilla/dom/PerformanceNavigationBinding.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#define PERFLOG(msg, ...) __android_log_print(ANDROID_LOG_INFO, "PerformanceTiming", msg, ##__VA_ARGS__)
|
||||
#else
|
||||
#define PERFLOG(msg, ...) printf_stderr(msg, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -589,7 +596,7 @@ nsPerformance::AddEntry(nsIHttpChannel* channel,
|
||||
initiatorType = NS_LITERAL_STRING("other");
|
||||
}
|
||||
performanceEntry->SetInitiatorType(initiatorType);
|
||||
InsertPerformanceEntry(performanceEntry);
|
||||
InsertPerformanceEntry(performanceEntry, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,8 +605,8 @@ nsPerformance::PerformanceEntryComparator::Equals(
|
||||
const PerformanceEntry* aElem1,
|
||||
const PerformanceEntry* aElem2) const
|
||||
{
|
||||
MOZ_ASSERT(aElem1 && aElem2,
|
||||
"Trying to compare null performance entries");
|
||||
NS_ABORT_IF_FALSE(aElem1 && aElem2,
|
||||
"Trying to compare null performance entries");
|
||||
return aElem1->StartTime() == aElem2->StartTime();
|
||||
}
|
||||
|
||||
@ -608,13 +615,14 @@ nsPerformance::PerformanceEntryComparator::LessThan(
|
||||
const PerformanceEntry* aElem1,
|
||||
const PerformanceEntry* aElem2) const
|
||||
{
|
||||
MOZ_ASSERT(aElem1 && aElem2,
|
||||
"Trying to compare null performance entries");
|
||||
NS_ABORT_IF_FALSE(aElem1 && aElem2,
|
||||
"Trying to compare null performance entries");
|
||||
return aElem1->StartTime() < aElem2->StartTime();
|
||||
}
|
||||
|
||||
void
|
||||
nsPerformance::InsertPerformanceEntry(PerformanceEntry* aEntry)
|
||||
nsPerformance::InsertPerformanceEntry(PerformanceEntry* aEntry,
|
||||
bool aShouldPrint)
|
||||
{
|
||||
MOZ_ASSERT(aEntry);
|
||||
MOZ_ASSERT(mEntries.Length() < mPrimaryBufferSize);
|
||||
@ -622,6 +630,21 @@ nsPerformance::InsertPerformanceEntry(PerformanceEntry* aEntry)
|
||||
NS_WARNING("Performance Entry buffer size maximum reached!");
|
||||
return;
|
||||
}
|
||||
if (aShouldPrint && nsContentUtils::IsUserTimingLoggingEnabled()) {
|
||||
nsAutoCString uri;
|
||||
nsresult rv = mWindow->GetDocumentURI()->GetHost(uri);
|
||||
if(NS_FAILED(rv)) {
|
||||
// If we have no URI, just put in "none".
|
||||
uri.AssignLiteral("none");
|
||||
}
|
||||
PERFLOG("Performance Entry: %s|%s|%s|%f|%f|%" PRIu64 "\n",
|
||||
uri.get(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetEntryType()).get(),
|
||||
NS_ConvertUTF16toUTF8(aEntry->GetName()).get(),
|
||||
aEntry->StartTime(),
|
||||
aEntry->Duration(),
|
||||
static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC));
|
||||
}
|
||||
mEntries.InsertElementSorted(aEntry,
|
||||
PerformanceEntryComparator());
|
||||
if (mEntries.Length() == mPrimaryBufferSize) {
|
||||
@ -645,7 +668,7 @@ nsPerformance::Mark(const nsAString& aName, ErrorResult& aRv)
|
||||
}
|
||||
nsRefPtr<PerformanceMark> performanceMark =
|
||||
new PerformanceMark(this, aName);
|
||||
InsertPerformanceEntry(performanceMark);
|
||||
InsertPerformanceEntry(performanceMark, true);
|
||||
}
|
||||
|
||||
void
|
||||
@ -722,7 +745,7 @@ nsPerformance::Measure(const nsAString& aName,
|
||||
}
|
||||
nsRefPtr<PerformanceMeasure> performanceMeasure =
|
||||
new PerformanceMeasure(this, aName, startTime, endTime);
|
||||
InsertPerformanceEntry(performanceMeasure);
|
||||
InsertPerformanceEntry(performanceMeasure, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -353,7 +353,7 @@ private:
|
||||
DOMTimeMilliSec GetPerformanceTimingFromString(const nsAString& aTimingName);
|
||||
DOMHighResTimeStamp ConvertDOMMilliSecToHighRes(const DOMTimeMilliSec aTime);
|
||||
void DispatchBufferFullEvent();
|
||||
void InsertPerformanceEntry(PerformanceEntry* aEntry);
|
||||
void InsertPerformanceEntry(PerformanceEntry* aEntry, bool aShouldPrint);
|
||||
void ClearEntries(const mozilla::dom::Optional<nsAString>& aEntryName,
|
||||
const nsAString& aEntryType);
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
|
@ -18,7 +18,7 @@ void
|
||||
nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
|
||||
bool aWatch, bool aReferenceImage)
|
||||
{
|
||||
MOZ_ASSERT(aFromContent, "Reset() expects non-null content pointer");
|
||||
NS_ABORT_IF_FALSE(aFromContent, "Reset() expects non-null content pointer");
|
||||
|
||||
Unlink();
|
||||
|
||||
|
@ -26,8 +26,8 @@ class nsTextNode : public mozilla::dom::Text,
|
||||
private:
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -1103,8 +1103,8 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
||||
aDocument->NodePrincipal(), 0, false);
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
// Mark the sheet as complete.
|
||||
MOZ_ASSERT(!sheet->IsModified(),
|
||||
"should not get marked modified during parsing");
|
||||
NS_ABORT_IF_FALSE(!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();
|
||||
|
@ -321,7 +321,7 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
|
||||
Abort();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang");
|
||||
NS_ABORT_IF_FALSE(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang");
|
||||
mState &= ~XML_HTTP_REQUEST_SYNCLOOPING;
|
||||
|
||||
mResultJSON.setUndefined();
|
||||
@ -1915,7 +1915,7 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(inStr);
|
||||
|
||||
MOZ_ASSERT(mContext.get() == ctxt,"start context different from OnDataAvailable context");
|
||||
NS_ABORT_IF_FALSE(mContext.get() == ctxt,"start context different from OnDataAvailable context");
|
||||
|
||||
mProgressSinceLastProgressEvent = true;
|
||||
|
||||
@ -3236,8 +3236,8 @@ nsXMLHttpRequest::SetTimeout(uint32_t aTimeout, ErrorResult& aRv)
|
||||
void
|
||||
nsXMLHttpRequest::StartTimeoutTimer()
|
||||
{
|
||||
MOZ_ASSERT(mRequestSentTime,
|
||||
"StartTimeoutTimer mustn't be called before the request was sent!");
|
||||
NS_ABORT_IF_FALSE(mRequestSentTime,
|
||||
"StartTimeoutTimer mustn't be called before the request was sent!");
|
||||
if (mState & XML_HTTP_REQUEST_DONE) {
|
||||
// do nothing!
|
||||
return;
|
||||
|
@ -251,8 +251,9 @@ static uint32_t CountNewlinesInXPLength(nsIContent* aContent,
|
||||
return 0;
|
||||
}
|
||||
// For automated tests, we should abort on debug build.
|
||||
MOZ_ASSERT(aXPLength == UINT32_MAX || aXPLength <= text->GetLength(),
|
||||
"aXPLength is out-of-bounds");
|
||||
NS_ABORT_IF_FALSE(
|
||||
(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) {
|
||||
@ -282,7 +283,7 @@ static uint32_t CountNewlinesInNativeLength(nsIContent* aContent,
|
||||
i < xpLength && nativeOffset < aNativeLength;
|
||||
++i, ++nativeOffset) {
|
||||
// For automated tests, we should abort on debug build.
|
||||
MOZ_ASSERT(i < text->GetLength(), "i is out-of-bounds");
|
||||
NS_ABORT_IF_FALSE(i < text->GetLength(), "i is out-of-bounds");
|
||||
if (text->CharAt(i) == '\n') {
|
||||
++newlines;
|
||||
++nativeOffset;
|
||||
|
@ -401,8 +401,8 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
(aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
|
||||
aValue && !aValue->IsEmptyString()) {
|
||||
// add the image to the hashtable as needed
|
||||
MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom,
|
||||
"Expected atom value for name/id");
|
||||
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
|
||||
"Expected atom value for name/id");
|
||||
mForm->AddImageElementToTable(this,
|
||||
nsDependentAtomString(aValue->GetAtomValue()));
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public:
|
||||
: mElement(aElement),
|
||||
mLoadID(aElement->GetCurrentLoadID())
|
||||
{
|
||||
MOZ_ASSERT(mElement, "Must pass an element to call back");
|
||||
NS_ABORT_IF_FALSE(mElement, "Must pass an element to call back");
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -712,8 +712,8 @@ nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (IsEventAttributeName(aName) && aValue) {
|
||||
MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
|
||||
"Expected string value for script body");
|
||||
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
|
||||
"Expected string value for script body");
|
||||
nsresult rv = SetEventHandler(aName, aValue->GetStringValue());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -2152,8 +2152,8 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
|
||||
if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
|
||||
aValue && !aValue->IsEmptyString()) {
|
||||
MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom,
|
||||
"Expected atom value for name/id");
|
||||
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
|
||||
"Expected atom value for name/id");
|
||||
mForm->AddElementToTable(this,
|
||||
nsDependentAtomString(aValue->GetAtomValue()));
|
||||
}
|
||||
|
@ -1899,8 +1899,8 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
|
||||
if (NS_FAILED(rv) || !mParser) {
|
||||
return rv;
|
||||
}
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx),
|
||||
"Open() succeeded but JS exception is pending");
|
||||
NS_ABORT_IF_FALSE(!JS_IsExceptionPending(cx),
|
||||
"Open() succeeded but JS exception is pending");
|
||||
}
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(new_line, "\n");
|
||||
@ -2773,7 +2773,7 @@ nsHTMLDocument::EditingStateChanged()
|
||||
// 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);
|
||||
MOZ_ASSERT(htmlEditor, "If we have an editor, it must be an HTML editor");
|
||||
NS_ABORT_IF_FALSE(htmlEditor, "If we have an editor, it must be an HTML editor");
|
||||
uint32_t flags = 0;
|
||||
existingEditor->GetFlags(&flags);
|
||||
if (flags & nsIPlaintextEditor::eEditorMailMask) {
|
||||
|
@ -2107,7 +2107,7 @@ nsTextEditorState::UpdatePlaceholderVisibility(bool aNotify)
|
||||
void
|
||||
nsTextEditorState::HideSelectionIfBlurred()
|
||||
{
|
||||
MOZ_ASSERT(mSelCon, "Should have a selection controller if we have a frame!");
|
||||
NS_ABORT_IF_FALSE(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);
|
||||
|
@ -97,9 +97,9 @@ 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)
|
||||
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
@ -520,6 +520,7 @@ IDBDatabase::CreateObjectStore(
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction->Database() != this ||
|
||||
transaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
@ -595,6 +596,7 @@ IDBDatabase::DeleteObjectStore(const nsAString& aName, ErrorResult& aRv)
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction->Database() != this ||
|
||||
transaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return;
|
||||
|
@ -55,9 +55,9 @@
|
||||
#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)
|
||||
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define PRIVATE_REMOTE_INPUT_STREAM_IID \
|
||||
|
@ -1956,8 +1956,8 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission)
|
||||
services::GetPermissionManager();
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
MOZ_ASSERT(permissionManager,
|
||||
"We have no permissionManager in the Content process !");
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
"We have no permissionManager in the Content process !");
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host));
|
||||
|
@ -2425,12 +2425,12 @@ ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissio
|
||||
services::GetPermissionManager();
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
MOZ_ASSERT(permissionManager,
|
||||
"We have no permissionManager in the Chrome process !");
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
"We have no permissionManager in the Chrome process !");
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
DebugOnly<nsresult> rv = permissionManager->GetEnumerator(getter_AddRefs(enumerator));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "Could not get enumerator!");
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not get enumerator!");
|
||||
while(1) {
|
||||
bool hasMore;
|
||||
enumerator->HasMoreElements(&hasMore);
|
||||
@ -4425,8 +4425,8 @@ ContentParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
|
||||
#ifndef MOZ_X11
|
||||
NS_RUNTIMEABORT("This message only makes sense on X11 platforms");
|
||||
#else
|
||||
MOZ_ASSERT(0 > mChildXSocketFdDup.get(),
|
||||
"Already backed up X resources??");
|
||||
NS_ABORT_IF_FALSE(0 > mChildXSocketFdDup.get(),
|
||||
"Already backed up X resources??");
|
||||
mChildXSocketFdDup.forget();
|
||||
if (aXSocketFd.IsValid()) {
|
||||
mChildXSocketFdDup.reset(aXSocketFd.PlatformHandle());
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
// 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)
|
||||
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
@ -78,7 +78,7 @@ ContentProcessManager::AddGrandchildProcess(const ContentParentId& aParentCpId,
|
||||
|
||||
auto iter = mContentParentMap.find(aParentCpId);
|
||||
if (NS_WARN_IF(iter == mContentParentMap.end())) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
ASSERT_UNLESS_FUZZING("Parent process should be already in map!");
|
||||
return false;
|
||||
}
|
||||
iter->second.mChildrenCpId.insert(aChildCpId);
|
||||
@ -155,7 +155,7 @@ ContentProcessManager::AllocateTabId(const TabId& aOpenerTabId,
|
||||
if (appBrowser.type() == IPCTabAppBrowserContext::TPopupIPCTabContext) {
|
||||
auto remoteFrameIter = iter->second.mRemoteFrames.find(aOpenerTabId);
|
||||
if (remoteFrameIter == iter->second.mRemoteFrames.end()) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
ASSERT_UNLESS_FUZZING("Failed to find parent frame's opener id.");
|
||||
return TabId(0);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ ContentProcessManager::AllocateTabId(const TabId& aOpenerTabId,
|
||||
|
||||
remoteFrameIter = iter->second.mRemoteFrames.find(ipcContext.opener().get_TabId());
|
||||
if (remoteFrameIter == iter->second.mRemoteFrames.end()) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
ASSERT_UNLESS_FUZZING("Failed to find tab id.");
|
||||
return TabId(0);
|
||||
}
|
||||
|
||||
|
@ -3172,8 +3172,8 @@ TabChild::InitRenderingState(const ScrollingBehavior& aScrolling,
|
||||
ShadowLayerForwarder* lf =
|
||||
mWidget->GetLayerManager(shadowManager, mTextureFactoryIdentifier.mParentBackend)
|
||||
->AsShadowForwarder();
|
||||
MOZ_ASSERT(lf && lf->HasShadowManager(),
|
||||
"PuppetWidget should have shadow manager");
|
||||
NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
|
||||
"PuppetWidget should have shadow manager");
|
||||
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
|
||||
|
||||
|
@ -1153,9 +1153,7 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, nullptr, nullptr);
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
!MapEventCoordinatesForChildProcess(&event)) {
|
||||
if (!MapEventCoordinatesForChildProcess(&event)) {
|
||||
return false;
|
||||
}
|
||||
return PBrowserParent::SendRealMouseEvent(event);
|
||||
@ -1224,10 +1222,8 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
|
||||
|
||||
ScrollableLayerGuid guid;
|
||||
uint64_t blockId;
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, &guid, &blockId);
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
!MapEventCoordinatesForChildProcess(&event))
|
||||
{
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId);
|
||||
if (!MapEventCoordinatesForChildProcess(&event)) {
|
||||
return false;
|
||||
}
|
||||
return PBrowserParent::SendMouseWheelEvent(event, guid, blockId);
|
||||
@ -1279,7 +1275,6 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
MaybeForwardEventToRenderFrame(event, nullptr, nullptr);
|
||||
if (!MapEventCoordinatesForChildProcess(&event)) {
|
||||
return false;
|
||||
}
|
||||
@ -1348,9 +1343,9 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
||||
|
||||
ScrollableLayerGuid guid;
|
||||
uint64_t blockId;
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, &guid, &blockId);
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId);
|
||||
|
||||
if (status == nsEventStatus_eConsumeNoDefault || mIsDestroyed) {
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2186,8 +2181,8 @@ TabParent::RecvGetDPI(float* aValue)
|
||||
{
|
||||
TryCacheDPIAndScale();
|
||||
|
||||
MOZ_ASSERT(mDPI > 0,
|
||||
"Must not ask for DPI before OwnerElement is received!");
|
||||
NS_ABORT_IF_FALSE(mDPI > 0,
|
||||
"Must not ask for DPI before OwnerElement is received!");
|
||||
*aValue = mDPI;
|
||||
return true;
|
||||
}
|
||||
@ -2197,8 +2192,8 @@ TabParent::RecvGetDefaultScale(double* aValue)
|
||||
{
|
||||
TryCacheDPIAndScale();
|
||||
|
||||
MOZ_ASSERT(mDefaultScale.scale > 0,
|
||||
"Must not ask for scale before OwnerElement is received!");
|
||||
NS_ABORT_IF_FALSE(mDefaultScale.scale > 0,
|
||||
"Must not ask for scale before OwnerElement is received!");
|
||||
*aValue = mDefaultScale.scale;
|
||||
return true;
|
||||
}
|
||||
@ -2403,20 +2398,11 @@ TabParent::UseAsyncPanZoom()
|
||||
GetScrollingBehavior() == ASYNC_PAN_ZOOM);
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
TabParent::MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
void
|
||||
TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
if (aEvent.mClass == eWheelEventClass
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|| aEvent.mClass == eTouchEventClass
|
||||
#endif
|
||||
) {
|
||||
// Wheel events must be sent to APZ directly from the widget. New APZ-
|
||||
// aware events should follow suit and move there as well. However, we
|
||||
// do need to inform the child process of the correct target and block
|
||||
// id.
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (aOutTargetGuid) {
|
||||
*aOutTargetGuid = InputAPZContext::GetTargetLayerGuid();
|
||||
|
||||
@ -2438,14 +2424,7 @@ TabParent::MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
// Let the widget know that the event will be sent to the child process,
|
||||
// which will (hopefully) send a confirmation notice back to APZ.
|
||||
InputAPZContext::SetRoutedToChildProcess();
|
||||
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
if (RenderFrameParent* rfp = GetRenderFrame()) {
|
||||
return rfp->NotifyInputEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -445,19 +445,15 @@ private:
|
||||
// When true, we create a pan/zoom controller for our frame and
|
||||
// notify it of input events targeting us.
|
||||
bool UseAsyncPanZoom();
|
||||
// If we have a render frame currently, notify it that we're about
|
||||
// to dispatch |aEvent| to our child. If there's a relevant
|
||||
// transform in place, |aEvent| will be transformed in-place so that
|
||||
// it is ready to be dispatched to content.
|
||||
// Update state prior to routing an APZ-aware event to the child process.
|
||||
// |aOutTargetGuid| will contain the identifier
|
||||
// of the APZC instance that handled the event. aOutTargetGuid may be
|
||||
// null.
|
||||
// |aOutInputBlockId| will contain the identifier of the input block
|
||||
// that this event was added to, if there was one. aOutInputBlockId may
|
||||
// be null.
|
||||
nsEventStatus MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
void ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
// The offset for the child process which is sampled at touch start. This
|
||||
// means that the touch events are relative to where the frame was at the
|
||||
// start of the touch. We need to look for a better solution to this
|
||||
|
@ -26,9 +26,9 @@ 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)
|
||||
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
@ -77,19 +77,19 @@ nsIContentParent::CanOpenBrowser(const IPCTabContext& aContext)
|
||||
// (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();
|
||||
ASSERT_UNLESS_FUZZING("Unexpected IPCTabContext type. Aborting AllocPBrowserParent.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const PopupIPCTabContext& popupContext = appBrowser.get_PopupIPCTabContext();
|
||||
if (popupContext.opener().type() != PBrowserOrId::TPBrowserParent) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
ASSERT_UNLESS_FUZZING("Unexpected PopupIPCTabContext type. Aborting AllocPBrowserParent.");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
|
||||
if (!opener) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
ASSERT_UNLESS_FUZZING("Got null opener from child; aborting AllocPBrowserParent.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ nsIContentParent::CanOpenBrowser(const IPCTabContext& aContext)
|
||||
// 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();
|
||||
ASSERT_UNLESS_FUZZING("Child trying to escalate privileges! Aborting AllocPBrowserParent.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ nsJSONListener::ConsumeConverted(const char* aBuffer, uint32_t aByteLength)
|
||||
rv = mDecoder->Convert(aBuffer, &srcLen, endelems, &unicharLength);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
MOZ_ASSERT(preLength >= unicharLength, "GetMaxLength lied");
|
||||
NS_ABORT_IF_FALSE(preLength >= unicharLength, "GetMaxLength lied");
|
||||
if (preLength > unicharLength)
|
||||
mBufferedChars.TruncateLength(mBufferedChars.Length() - (preLength - unicharLength));
|
||||
return NS_OK;
|
||||
|
@ -371,7 +371,7 @@ AudioStream::Init(int32_t aNumChannels, int32_t aRate,
|
||||
// selected based on the observed behaviour of the existing AudioStream
|
||||
// implementations.
|
||||
uint32_t bufferLimit = FramesToBytes(aRate);
|
||||
MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
|
||||
NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
|
||||
mBuffer.SetCapacity(bufferLimit);
|
||||
|
||||
if (aLatencyRequest == LowLatency) {
|
||||
@ -632,8 +632,8 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim
|
||||
|
||||
while (bytesToCopy > 0) {
|
||||
uint32_t available = std::min(bytesToCopy, mBuffer.Available());
|
||||
MOZ_ASSERT(available % mBytesPerFrame == 0,
|
||||
"Must copy complete frames.");
|
||||
NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0,
|
||||
"Must copy complete frames.");
|
||||
|
||||
mBuffer.AppendElements(src, available);
|
||||
src += available;
|
||||
@ -678,14 +678,14 @@ uint32_t
|
||||
AudioStream::Available()
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated.");
|
||||
NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated.");
|
||||
return BytesToFrames(mBuffer.Available());
|
||||
}
|
||||
|
||||
void
|
||||
AudioStream::SetVolume(double aVolume)
|
||||
{
|
||||
MOZ_ASSERT(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume");
|
||||
NS_ABORT_IF_FALSE(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.");
|
||||
@ -1035,7 +1035,7 @@ AudioStream::Reset()
|
||||
// selected based on the observed behaviour of the existing AudioStream
|
||||
// implementations.
|
||||
uint32_t bufferLimit = FramesToBytes(mInRate);
|
||||
MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
|
||||
NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
|
||||
mBuffer.Reset();
|
||||
mBuffer.SetCapacity(bufferLimit);
|
||||
|
||||
@ -1054,7 +1054,7 @@ 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());
|
||||
MOZ_ASSERT(available % mBytesPerFrame == 0, "Must copy complete frames");
|
||||
NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0, "Must copy complete frames");
|
||||
AudioDataValue* output = reinterpret_cast<AudioDataValue*>(aBuffer);
|
||||
uint32_t underrunFrames = 0;
|
||||
uint32_t servicedFrames = 0;
|
||||
@ -1113,7 +1113,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames)
|
||||
servicedFrames = GetTimeStretched(output, aFrames, insertTime);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames");
|
||||
NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames");
|
||||
|
||||
// Notify any blocked Write() call that more space is available in mBuffer.
|
||||
mon.NotifyAll();
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
// Set the capacity of the buffer in bytes. Must be called before any
|
||||
// call to append or pop elements.
|
||||
void SetCapacity(uint32_t aCapacity) {
|
||||
MOZ_ASSERT(!mBuffer, "Buffer allocated.");
|
||||
NS_ABORT_IF_FALSE(!mBuffer, "Buffer allocated.");
|
||||
mCapacity = aCapacity;
|
||||
mBuffer = new uint8_t[mCapacity];
|
||||
}
|
||||
@ -108,8 +108,8 @@ public:
|
||||
// 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) {
|
||||
MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
MOZ_ASSERT(aLength <= Available(), "Buffer full.");
|
||||
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
NS_ABORT_IF_FALSE(aLength <= Available(), "Buffer full.");
|
||||
|
||||
uint32_t end = (mStart + mCount) % mCapacity;
|
||||
|
||||
@ -124,8 +124,8 @@ public:
|
||||
// must not specify an aSize larger than Length().
|
||||
void PopElements(uint32_t aSize, void** aData1, uint32_t* aSize1,
|
||||
void** aData2, uint32_t* aSize2) {
|
||||
MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
MOZ_ASSERT(aSize <= Length(), "Request too large.");
|
||||
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
NS_ABORT_IF_FALSE(aSize <= Length(), "Request too large.");
|
||||
|
||||
*aData1 = &mBuffer[mStart];
|
||||
*aSize1 = std::min(mCapacity - mStart, aSize);
|
||||
@ -139,7 +139,7 @@ public:
|
||||
// Throw away all but aSize bytes from the buffer. Returns new size, which
|
||||
// may be less than aSize
|
||||
uint32_t ContractTo(uint32_t aSize) {
|
||||
MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
|
||||
if (aSize >= mCount) {
|
||||
return mCount;
|
||||
}
|
||||
|
@ -212,9 +212,8 @@ nsresult FileBlockCache::Run()
|
||||
// mDataMonitor to take mFileMonitor.
|
||||
int32_t blockIndex = mChangeIndexList.PopFront();
|
||||
nsRefPtr<BlockChange> change = mBlockChanges[blockIndex];
|
||||
MOZ_ASSERT(change,
|
||||
"Change index list should only contain entries for blocks "
|
||||
"with changes");
|
||||
NS_ABORT_IF_FALSE(change,
|
||||
"Change index list should only contain entries for blocks with changes");
|
||||
{
|
||||
MonitorAutoUnlock unlock(mDataMonitor);
|
||||
MonitorAutoLock lock(mFileMonitor);
|
||||
|
@ -2264,7 +2264,7 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
|
||||
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));
|
||||
MOZ_ASSERT(bytes >= 0 && bytes <= aCount, "Bytes out of range.");
|
||||
NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= aCount, "Bytes out of range.");
|
||||
memcpy(aBuffer,
|
||||
reinterpret_cast<char*>(streamWithPartialBlock->mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes);
|
||||
if (mCurrentMode == MODE_METADATA) {
|
||||
@ -2289,7 +2289,7 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
|
||||
|
||||
int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
|
||||
int32_t bytes;
|
||||
MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range.");
|
||||
NS_ABORT_IF_FALSE(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)
|
||||
@ -2361,7 +2361,7 @@ MediaCacheStream::ReadFromCache(char* aBuffer, int64_t aOffset, int64_t aCount)
|
||||
// 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));
|
||||
MOZ_ASSERT(bytes >= 0 && bytes <= toCopy, "Bytes out of range.");
|
||||
NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= toCopy, "Bytes out of range.");
|
||||
memcpy(aBuffer + count,
|
||||
reinterpret_cast<char*>(mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes);
|
||||
} else {
|
||||
@ -2370,7 +2370,7 @@ MediaCacheStream::ReadFromCache(char* aBuffer, int64_t aOffset, int64_t aCount)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
|
||||
MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range.");
|
||||
NS_ABORT_IF_FALSE(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;
|
||||
|
@ -718,7 +718,7 @@ nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType)
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
UpdateDormantState(false /* aDormantTimeout */, true /* aActivity */);
|
||||
|
||||
MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value.");
|
||||
NS_ABORT_IF_FALSE(aTime >= 0.0, "Cannot seek to a negative value.");
|
||||
|
||||
int64_t timeUsecs = 0;
|
||||
nsresult rv = SecondsToUsecs(aTime, timeUsecs);
|
||||
|
@ -979,7 +979,7 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
||||
nsresult
|
||||
MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
if (!CheckPrincipal()) {
|
||||
// Media is not same-origin, don't allow the data out.
|
||||
nsRefPtr<nsIDOMBlob> blob = aBlob;
|
||||
@ -1003,7 +1003,7 @@ MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob)
|
||||
void
|
||||
MediaRecorder::DispatchSimpleEvent(const nsAString & aStr)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
@ -1034,7 +1034,7 @@ MediaRecorder::DispatchSimpleEvent(const nsAString & aStr)
|
||||
void
|
||||
MediaRecorder::NotifyError(nsresult aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
@ -1070,7 +1070,7 @@ MediaRecorder::NotifyError(nsresult aRv)
|
||||
|
||||
bool MediaRecorder::CheckPrincipal()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
if (!mDOMStream && !mAudioNode) {
|
||||
return false;
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ GMPProcessChild::Init()
|
||||
// (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();
|
||||
MOZ_ASSERT(values.size() >= 3, "not enough args");
|
||||
NS_ABORT_IF_FALSE(values.size() >= 3, "not enough args");
|
||||
pluginFilename = values[1];
|
||||
voucherFilename = values[2];
|
||||
#elif defined(OS_WIN)
|
||||
std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues();
|
||||
MOZ_ASSERT(values.size() >= 2, "not enough loose args");
|
||||
NS_ABORT_IF_FALSE(values.size() >= 2, "not enough loose args");
|
||||
pluginFilename = WideToUTF8(values[0]);
|
||||
voucherFilename = WideToUTF8(values[1]);
|
||||
#else
|
||||
|
@ -338,8 +338,8 @@ WaveReader::LoadRIFFChunk()
|
||||
char riffHeader[RIFF_INITIAL_SIZE];
|
||||
const char* p = riffHeader;
|
||||
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() == 0,
|
||||
"LoadRIFFChunk called when resource in invalid state");
|
||||
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() == 0,
|
||||
"LoadRIFFChunk called when resource in invalid state");
|
||||
|
||||
if (!ReadAll(riffHeader, sizeof(riffHeader))) {
|
||||
return false;
|
||||
@ -371,8 +371,8 @@ WaveReader::LoadFormatChunk(uint32_t aChunkSize)
|
||||
const char* p = waveFormat;
|
||||
|
||||
// RIFF chunks are always word (two byte) aligned.
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadFormatChunk called with unaligned resource");
|
||||
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadFormatChunk called with unaligned resource");
|
||||
|
||||
if (!ReadAll(waveFormat, sizeof(waveFormat))) {
|
||||
return false;
|
||||
@ -433,8 +433,8 @@ WaveReader::LoadFormatChunk(uint32_t aChunkSize)
|
||||
}
|
||||
|
||||
// RIFF chunks are always word (two byte) aligned.
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadFormatChunk left resource unaligned");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -467,8 +467,8 @@ bool
|
||||
WaveReader::FindDataOffset(uint32_t aChunkSize)
|
||||
{
|
||||
// RIFF chunks are always word (two byte) aligned.
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"FindDataOffset called with unaligned resource");
|
||||
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"FindDataOffset called with unaligned resource");
|
||||
|
||||
int64_t offset = mDecoder->GetResource()->Tell();
|
||||
if (offset <= 0 || offset > UINT32_MAX) {
|
||||
@ -485,21 +485,21 @@ WaveReader::FindDataOffset(uint32_t aChunkSize)
|
||||
double
|
||||
WaveReader::BytesToTime(int64_t aBytes) const
|
||||
{
|
||||
MOZ_ASSERT(aBytes >= 0, "Must be >= 0");
|
||||
NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0");
|
||||
return float(aBytes) / mSampleRate / mFrameSize;
|
||||
}
|
||||
|
||||
int64_t
|
||||
WaveReader::TimeToBytes(double aTime) const
|
||||
{
|
||||
MOZ_ASSERT(aTime >= 0.0f, "Must be >= 0");
|
||||
NS_ABORT_IF_FALSE(aTime >= 0.0f, "Must be >= 0");
|
||||
return RoundDownToFrame(int64_t(aTime * mSampleRate * mFrameSize));
|
||||
}
|
||||
|
||||
int64_t
|
||||
WaveReader::RoundDownToFrame(int64_t aBytes) const
|
||||
{
|
||||
MOZ_ASSERT(aBytes >= 0, "Must be >= 0");
|
||||
NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0");
|
||||
return aBytes - (aBytes % mFrameSize);
|
||||
}
|
||||
|
||||
@ -527,10 +527,10 @@ WaveReader::GetPosition()
|
||||
bool
|
||||
WaveReader::GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize)
|
||||
{
|
||||
MOZ_ASSERT(aChunk, "Must have aChunk");
|
||||
MOZ_ASSERT(aChunkSize, "Must have aChunkSize");
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"GetNextChunk called with unaligned resource");
|
||||
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");
|
||||
|
||||
char chunkHeader[CHUNK_HEADER_SIZE];
|
||||
const char* p = chunkHeader;
|
||||
@ -552,8 +552,8 @@ WaveReader::LoadListChunk(uint32_t aChunkSize,
|
||||
nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags)
|
||||
{
|
||||
// List chunks are always word (two byte) aligned.
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadListChunk called with unaligned resource");
|
||||
NS_ABORT_IF_FALSE(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),
|
||||
@ -628,8 +628,8 @@ bool
|
||||
WaveReader::LoadAllChunks(nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags)
|
||||
{
|
||||
// Chunks are always word (two byte) aligned.
|
||||
MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadAllChunks called with unaligned resource");
|
||||
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
|
||||
"LoadAllChunks called with unaligned resource");
|
||||
|
||||
bool loadFormatChunk = false;
|
||||
bool findDataOffset = false;
|
||||
|
@ -1508,9 +1508,8 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
||||
}
|
||||
|
||||
obj = JS_ObjectToInnerObject(cx, obj);
|
||||
MOZ_ASSERT(obj,
|
||||
"JS_ObjectToInnerObject should never return null with non-null "
|
||||
"input.");
|
||||
NS_ABORT_IF_FALSE(obj,
|
||||
"JS_ObjectToInnerObject should never return null with non-null input.");
|
||||
|
||||
if (result) {
|
||||
// Initialize the out param to void
|
||||
|
@ -2669,8 +2669,8 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
||||
bool
|
||||
PluginInstanceChild::CreateOptSurface(void)
|
||||
{
|
||||
MOZ_ASSERT(mSurfaceType != gfxSurfaceType::Max,
|
||||
"Need a valid surface type here");
|
||||
NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceType::Max,
|
||||
"Need a valid surface type here");
|
||||
NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync.");
|
||||
|
||||
nsRefPtr<gfxASurface> retsurf;
|
||||
@ -3099,8 +3099,8 @@ void
|
||||
PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||
gfxASurface* aSurface)
|
||||
{
|
||||
MOZ_ASSERT(aSurface->GetContentType() == gfxContentType::COLOR_ALPHA,
|
||||
"Refusing to pointlessly recover alpha");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -3179,7 +3179,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||
PaintRectToSurface(rect, blackImage, gfxRGBA(0.0, 0.0, 0.0));
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(whiteImage && blackImage, "Didn't paint enough!");
|
||||
NS_ABORT_IF_FALSE(whiteImage && blackImage, "Didn't paint enough!");
|
||||
|
||||
// Extract alpha from black and white image and store to black
|
||||
// image
|
||||
@ -3543,7 +3543,7 @@ bool
|
||||
PluginInstanceChild::RecvUpdateBackground(const SurfaceDescriptor& aBackground,
|
||||
const nsIntRect& aRect)
|
||||
{
|
||||
MOZ_ASSERT(mIsTransparent, "Only transparent plugins use backgrounds");
|
||||
NS_ABORT_IF_FALSE(mIsTransparent, "Only transparent plugins use backgrounds");
|
||||
|
||||
if (!mBackground) {
|
||||
// XXX refactor me
|
||||
|
@ -745,7 +745,7 @@ PluginInstanceParent::SetBackgroundUnknown()
|
||||
|
||||
if (mBackground) {
|
||||
DestroyBackground();
|
||||
MOZ_ASSERT(!mBackground, "Background not destroyed");
|
||||
NS_ABORT_IF_FALSE(!mBackground, "Background not destroyed");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -764,8 +764,8 @@ PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect,
|
||||
// update, there's no guarantee that later updates will be for
|
||||
// the entire background area until successful. We might want
|
||||
// to fix that eventually.
|
||||
MOZ_ASSERT(aRect.TopLeft() == nsIntPoint(0, 0),
|
||||
"Expecting rect for whole frame");
|
||||
NS_ABORT_IF_FALSE(aRect.TopLeft() == nsIntPoint(0, 0),
|
||||
"Expecting rect for whole frame");
|
||||
if (!CreateBackground(aRect.Size())) {
|
||||
*aCtx = nullptr;
|
||||
return NS_OK;
|
||||
@ -774,8 +774,8 @@ PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect,
|
||||
|
||||
gfxIntSize sz = mBackground->GetSize();
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect),
|
||||
"Update outside of background area");
|
||||
NS_ABORT_IF_FALSE(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect),
|
||||
"Update outside of background area");
|
||||
#endif
|
||||
|
||||
RefPtr<gfx::DrawTarget> dt = gfxPlatform::GetPlatform()->
|
||||
@ -821,7 +821,7 @@ PluginInstanceParent::GetAsyncSurrogate()
|
||||
bool
|
||||
PluginInstanceParent::CreateBackground(const nsIntSize& aSize)
|
||||
{
|
||||
MOZ_ASSERT(!mBackground, "Already have a background");
|
||||
NS_ABORT_IF_FALSE(!mBackground, "Already have a background");
|
||||
|
||||
// XXX refactor me
|
||||
|
||||
@ -866,7 +866,7 @@ PluginInstanceParent::DestroyBackground()
|
||||
mozilla::plugins::SurfaceDescriptor
|
||||
PluginInstanceParent::BackgroundDescriptor()
|
||||
{
|
||||
MOZ_ASSERT(mBackground, "Need a background here");
|
||||
NS_ABORT_IF_FALSE(mBackground, "Need a background here");
|
||||
|
||||
// XXX refactor me
|
||||
|
||||
@ -876,8 +876,8 @@ PluginInstanceParent::BackgroundDescriptor()
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
MOZ_ASSERT(gfxSharedImageSurface::IsSharedImage(mBackground),
|
||||
"Expected shared image surface");
|
||||
NS_ABORT_IF_FALSE(gfxSharedImageSurface::IsSharedImage(mBackground),
|
||||
"Expected shared image surface");
|
||||
gfxSharedImageSurface* shmem =
|
||||
static_cast<gfxSharedImageSurface*>(mBackground.get());
|
||||
return shmem->GetShmem();
|
||||
|
@ -516,10 +516,10 @@ PluginModuleChild::DetectNestedEventLoop(gpointer data)
|
||||
{
|
||||
PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
|
||||
|
||||
MOZ_ASSERT(0 != pmc->mNestedLoopTimerId,
|
||||
"callback after descheduling");
|
||||
MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
|
||||
"not canceled before returning to main event loop!");
|
||||
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!");
|
||||
|
||||
PLUGIN_LOG_DEBUG(("Detected nested glib event loop"));
|
||||
|
||||
@ -542,8 +542,8 @@ PluginModuleChild::ProcessBrowserEvents(gpointer data)
|
||||
{
|
||||
PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
|
||||
|
||||
MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(),
|
||||
"not canceled before returning to main event loop!");
|
||||
NS_ABORT_IF_FALSE(pmc->mTopLoopDepth < g_main_depth(),
|
||||
"not canceled before returning to main event loop!");
|
||||
|
||||
pmc->CallProcessSomeEvents();
|
||||
|
||||
@ -553,8 +553,8 @@ PluginModuleChild::ProcessBrowserEvents(gpointer data)
|
||||
void
|
||||
PluginModuleChild::EnteredCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(0 == mNestedLoopTimerId,
|
||||
"previous timer not descheduled");
|
||||
NS_ABORT_IF_FALSE(0 == mNestedLoopTimerId,
|
||||
"previous timer not descheduled");
|
||||
|
||||
mNestedLoopTimerId =
|
||||
g_timeout_add_full(kNestedLoopDetectorPriority,
|
||||
@ -571,8 +571,8 @@ PluginModuleChild::EnteredCxxStack()
|
||||
void
|
||||
PluginModuleChild::ExitedCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(0 < mNestedLoopTimerId,
|
||||
"nested loop timeout not scheduled");
|
||||
NS_ABORT_IF_FALSE(0 < mNestedLoopTimerId,
|
||||
"nested loop timeout not scheduled");
|
||||
|
||||
g_source_remove(mNestedLoopTimerId);
|
||||
mNestedLoopTimerId = 0;
|
||||
@ -582,8 +582,8 @@ PluginModuleChild::ExitedCxxStack()
|
||||
void
|
||||
PluginModuleChild::EnteredCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject == nullptr,
|
||||
"previous timer not descheduled");
|
||||
NS_ABORT_IF_FALSE(mNestedLoopTimerObject == nullptr,
|
||||
"previous timer not descheduled");
|
||||
mNestedLoopTimerObject = new NestedLoopTimer(this);
|
||||
QTimer::singleShot(kNestedLoopDetectorIntervalMs,
|
||||
mNestedLoopTimerObject, SLOT(timeOut()));
|
||||
@ -592,8 +592,8 @@ PluginModuleChild::EnteredCxxStack()
|
||||
void
|
||||
PluginModuleChild::ExitedCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject != nullptr,
|
||||
"nested loop timeout not scheduled");
|
||||
NS_ABORT_IF_FALSE(mNestedLoopTimerObject != nullptr,
|
||||
"nested loop timeout not scheduled");
|
||||
delete mNestedLoopTimerObject;
|
||||
mNestedLoopTimerObject = nullptr;
|
||||
}
|
||||
@ -636,8 +636,8 @@ PluginModuleChild::InitGraphics()
|
||||
// called. (Toggle references wouldn't detect if the reference count
|
||||
// might be higher.)
|
||||
GObjectDisposeFn* dispose = &G_OBJECT_CLASS(gtk_plug_class)->dispose;
|
||||
MOZ_ASSERT(*dispose != wrap_gtk_plug_dispose,
|
||||
"InitGraphics called twice");
|
||||
NS_ABORT_IF_FALSE(*dispose != wrap_gtk_plug_dispose,
|
||||
"InitGraphics called twice");
|
||||
real_gtk_plug_dispose = *dispose;
|
||||
*dispose = wrap_gtk_plug_dispose;
|
||||
|
||||
@ -1088,7 +1088,7 @@ const NPNetscapeFuncs PluginModuleChild::sBrowserFuncs = {
|
||||
PluginInstanceChild*
|
||||
InstCast(NPP aNPP)
|
||||
{
|
||||
MOZ_ASSERT(!!(aNPP->ndata), "nil instance");
|
||||
NS_ABORT_IF_FALSE(!!(aNPP->ndata), "nil instance");
|
||||
return static_cast<PluginInstanceChild*>(aNPP->ndata);
|
||||
}
|
||||
|
||||
|
@ -1512,8 +1512,8 @@ PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
|
||||
#ifndef MOZ_X11
|
||||
NS_RUNTIMEABORT("This message only makes sense on X11 platforms");
|
||||
#else
|
||||
MOZ_ASSERT(0 > mPluginXSocketFdDup.get(),
|
||||
"Already backed up X resources??");
|
||||
NS_ABORT_IF_FALSE(0 > mPluginXSocketFdDup.get(),
|
||||
"Already backed up X resources??");
|
||||
mPluginXSocketFdDup.forget();
|
||||
if (aXSocketFd.IsValid()) {
|
||||
mPluginXSocketFdDup.reset(aXSocketFd.PlatformHandle());
|
||||
|
@ -109,14 +109,14 @@ PluginProcessChild::Init()
|
||||
// (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();
|
||||
MOZ_ASSERT(values.size() >= 2, "not enough args");
|
||||
NS_ABORT_IF_FALSE(values.size() >= 2, "not enough args");
|
||||
|
||||
pluginFilename = UnmungePluginDsoPath(values[1]);
|
||||
|
||||
#elif defined(OS_WIN)
|
||||
std::vector<std::wstring> values =
|
||||
CommandLine::ForCurrentProcess()->GetLooseValues();
|
||||
MOZ_ASSERT(values.size() >= 1, "not enough loose args");
|
||||
NS_ABORT_IF_FALSE(values.size() >= 1, "not enough loose args");
|
||||
|
||||
if (ShouldProtectPluginCurrentDirectory(values[0].c_str())) {
|
||||
SanitizeEnvironmentVariables();
|
||||
|
@ -13,7 +13,7 @@ namespace mozilla {
|
||||
void
|
||||
SMILIntegerType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
|
||||
NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type");
|
||||
aValue.mU.mInt = 0;
|
||||
aValue.mType = this;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
|
||||
mRegisteredWithRefreshDriver(false),
|
||||
mDocument(aDoc)
|
||||
{
|
||||
MOZ_ASSERT(aDoc, "need a non-null document");
|
||||
NS_ABORT_IF_FALSE(aDoc, "need a non-null document");
|
||||
|
||||
nsRefreshDriver* refreshDriver = GetRefreshDriver();
|
||||
if (refreshDriver) {
|
||||
@ -57,9 +57,9 @@ nsSMILAnimationController::~nsSMILAnimationController()
|
||||
void
|
||||
nsSMILAnimationController::Disconnect()
|
||||
{
|
||||
MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?");
|
||||
MOZ_ASSERT(mRefCnt.get() == 1,
|
||||
"Expecting to disconnect when doc is sole remaining owner");
|
||||
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");
|
||||
NS_ASSERTION(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE,
|
||||
"Expecting to be paused for pagehide before disconnect");
|
||||
|
||||
@ -170,9 +170,9 @@ nsSMILAnimationController::RegisterAnimationElement(
|
||||
mDeferredStartSampling = false;
|
||||
if (mChildContainerTable.Count()) {
|
||||
// mAnimationElementTable was empty, but now we've added its 1st element
|
||||
MOZ_ASSERT(mAnimationElementTable.Count() == 1,
|
||||
"we shouldn't have deferred sampling if we already had "
|
||||
"animations registered");
|
||||
NS_ABORT_IF_FALSE(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)
|
||||
@ -265,8 +265,9 @@ nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver)
|
||||
if (aRefreshDriver) {
|
||||
MOZ_ASSERT(!mRegisteredWithRefreshDriver,
|
||||
"Redundantly registering with refresh driver");
|
||||
MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
|
||||
"Starting sampling with wrong refresh driver");
|
||||
NS_ABORT_IF_FALSE(!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();
|
||||
@ -281,8 +282,9 @@ 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.
|
||||
MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
|
||||
"Stopping sampling with wrong refresh driver");
|
||||
NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
|
||||
aRefreshDriver == GetRefreshDriver(),
|
||||
"Stopping sampling with wrong refresh driver");
|
||||
aRefreshDriver->RemoveRefreshObserver(this, Flush_Style);
|
||||
mRegisteredWithRefreshDriver = false;
|
||||
}
|
||||
@ -480,8 +482,8 @@ nsSMILAnimationController::RewindElements()
|
||||
nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
MOZ_ASSERT(aData,
|
||||
"Null data pointer during time container enumeration");
|
||||
NS_ABORT_IF_FALSE(aData,
|
||||
"Null data pointer during time container enumeration");
|
||||
bool* rewindNeeded = static_cast<bool*>(aData);
|
||||
|
||||
nsSMILTimeContainer* container = aKey->GetKey();
|
||||
@ -567,7 +569,7 @@ nsSMILAnimationController::DoMilestoneSamples()
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
SVGAnimationElement* elem = params.mElements[i].get();
|
||||
MOZ_ASSERT(elem, "nullptr animation element in list");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -595,10 +597,10 @@ nsSMILAnimationController::DoMilestoneSamples()
|
||||
nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
nsSMILMilestone* nextMilestone = static_cast<nsSMILMilestone*>(aData);
|
||||
|
||||
@ -620,10 +622,10 @@ nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey,
|
||||
nsSMILAnimationController::GetMilestoneElements(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
GetMilestoneElementsParams* params =
|
||||
static_cast<GetMilestoneElementsParams*>(aData);
|
||||
@ -700,8 +702,8 @@ nsSMILAnimationController::SampleTimedElement(
|
||||
|
||||
nsSMILTime containerTime = timeContainer->GetCurrentTime();
|
||||
|
||||
MOZ_ASSERT(!timeContainer->IsSeeking(),
|
||||
"Doing a regular sample but the time container is still seeking");
|
||||
NS_ABORT_IF_FALSE(!timeContainer->IsSeeking(),
|
||||
"Doing a regular sample but the time container is still seeking");
|
||||
aElement->TimedElement().SampleAt(containerTime);
|
||||
}
|
||||
|
||||
|
@ -220,10 +220,10 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
|
||||
return;
|
||||
|
||||
// If this interval is active, we must have a non-negative mSampleTime
|
||||
MOZ_ASSERT(mSampleTime >= 0 || !mIsActive,
|
||||
"Negative sample time for active animation");
|
||||
MOZ_ASSERT(mSimpleDuration.IsResolved() || mLastValue,
|
||||
"Unresolved simple duration for active or frozen animation");
|
||||
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");
|
||||
|
||||
// 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
|
||||
@ -303,8 +303,8 @@ nsSMILAnimationFunction::CompareTo(const nsSMILAnimationFunction* aOther) const
|
||||
|
||||
// Animations that appear later in the document sort after those earlier in
|
||||
// the document
|
||||
MOZ_ASSERT(mAnimationElement != aOther->mAnimationElement,
|
||||
"Two animations cannot have the same animation content element!");
|
||||
NS_ABORT_IF_FALSE(mAnimationElement != aOther->mAnimationElement,
|
||||
"Two animations cannot have the same animation content element!");
|
||||
|
||||
return (nsContentUtils::PositionIsBefore(mAnimationElement, aOther->mAnimationElement))
|
||||
? -1 : 1;
|
||||
@ -368,8 +368,8 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
|
||||
if (mSimpleDuration.IsDefinite()) {
|
||||
nsSMILTime dur = mSimpleDuration.GetMillis();
|
||||
|
||||
MOZ_ASSERT(dur >= 0, "Simple duration should not be negative");
|
||||
MOZ_ASSERT(mSampleTime >= 0, "Sample time should not be negative");
|
||||
NS_ABORT_IF_FALSE(dur >= 0, "Simple duration should not be negative");
|
||||
NS_ABORT_IF_FALSE(mSampleTime >= 0, "Sample time should not be negative");
|
||||
|
||||
if (mSampleTime >= dur || mSampleTime < 0) {
|
||||
NS_ERROR("Animation sampled outside interval");
|
||||
@ -388,7 +388,7 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
|
||||
const nsSMILValue* from = nullptr;
|
||||
const nsSMILValue* to = nullptr;
|
||||
// Init to -1 to make sure that if we ever forget to set this, the
|
||||
// MOZ_ASSERT that tests that intervalProgress is in range will fail.
|
||||
// NS_ABORT_IF_FALSE that tests that intervalProgress is in range will fail.
|
||||
double intervalProgress = -1.f;
|
||||
if (IsToAnimation()) {
|
||||
from = &aBaseValue;
|
||||
@ -421,10 +421,10 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
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)");
|
||||
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)");
|
||||
rv = from->Interpolate(*to, intervalProgress, aResult);
|
||||
}
|
||||
}
|
||||
@ -502,7 +502,7 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues,
|
||||
"aSimpleProgress is out of bounds");
|
||||
NS_ASSERTION(GetCalcMode() == CALC_PACED,
|
||||
"Calling paced-specific function, but not in paced mode");
|
||||
MOZ_ASSERT(aValues.Length() >= 2, "Unexpected number of values");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -548,9 +548,9 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues,
|
||||
nsresult rv =
|
||||
#endif
|
||||
aValues[i].ComputeDistance(aValues[i+1], curIntervalDist);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv),
|
||||
"If we got through ComputePacedTotalDistance, we should "
|
||||
"be able to recompute each sub-distance without errors");
|
||||
NS_ABORT_IF_FALSE(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.
|
||||
@ -604,7 +604,7 @@ nsSMILAnimationFunction::ComputePacedTotalDistance(
|
||||
|
||||
// Clamp distance value to 0, just in case we have an evil ComputeDistance
|
||||
// implementation somewhere
|
||||
MOZ_ASSERT(tmpDist >= 0.0f, "distance values must be non-negative");
|
||||
NS_ABORT_IF_FALSE(tmpDist >= 0.0f, "distance values must be non-negative");
|
||||
tmpDist = std::max(tmpDist, 0.0);
|
||||
|
||||
totalDistance += tmpDist;
|
||||
@ -634,9 +634,9 @@ nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
|
||||
// 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]) {
|
||||
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.");
|
||||
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.");
|
||||
++i;
|
||||
}
|
||||
return (double)i / numTimes;
|
||||
@ -663,8 +663,8 @@ nsSMILAnimationFunction::ScaleIntervalProgress(double aProgress,
|
||||
if (!HasAttr(nsGkAtoms::keySplines))
|
||||
return aProgress;
|
||||
|
||||
MOZ_ASSERT(aIntervalIndex < mKeySplines.Length(),
|
||||
"Invalid interval index");
|
||||
NS_ABORT_IF_FALSE(aIntervalIndex < mKeySplines.Length(),
|
||||
"Invalid interval index");
|
||||
|
||||
nsSMILKeySpline const &spline = mKeySplines[aIntervalIndex];
|
||||
return spline.GetSplineValue(aProgress);
|
||||
|
@ -206,10 +206,10 @@ public:
|
||||
*/
|
||||
void ClearHasChanged()
|
||||
{
|
||||
MOZ_ASSERT(HasChanged(),
|
||||
"clearing mHasChanged flag, when it's already false");
|
||||
MOZ_ASSERT(!IsActiveOrFrozen(),
|
||||
"clearing mHasChanged flag for active animation");
|
||||
NS_ABORT_IF_FALSE(HasChanged(),
|
||||
"clearing mHasChanged flag, when it's already false");
|
||||
NS_ABORT_IF_FALSE(!IsActiveOrFrozen(),
|
||||
"clearing mHasChanged flag for active animation");
|
||||
mHasChanged = false;
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,10 @@ GetCSSComputedValue(Element* aElem,
|
||||
nsCSSProperty aPropID,
|
||||
nsAString& aResult)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
nsIDocument* doc = aElem->GetCurrentDoc();
|
||||
if (!doc) {
|
||||
@ -53,9 +53,9 @@ nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID,
|
||||
Element* aElement)
|
||||
: mPropID(aPropID), mElement(aElement)
|
||||
{
|
||||
MOZ_ASSERT(IsPropertyAnimatable(mPropID),
|
||||
"Creating a nsSMILCSSProperty for a property "
|
||||
"that's not supported for animation");
|
||||
NS_ABORT_IF_FALSE(IsPropertyAnimatable(mPropID),
|
||||
"Creating a nsSMILCSSProperty for a property "
|
||||
"that's not supported for animation");
|
||||
}
|
||||
|
||||
nsSMILValue
|
||||
|
@ -45,8 +45,8 @@ GetZeroValueForUnit(StyleAnimationValue::Unit aUnit)
|
||||
static const StyleAnimationValue
|
||||
sZeroColor(NS_RGB(0,0,0), StyleAnimationValue::ColorConstructor);
|
||||
|
||||
MOZ_ASSERT(aUnit != StyleAnimationValue::eUnit_Null,
|
||||
"Need non-null unit for a zero value");
|
||||
NS_ABORT_IF_FALSE(aUnit != StyleAnimationValue::eUnit_Null,
|
||||
"Need non-null unit for a zero value");
|
||||
switch (aUnit) {
|
||||
case StyleAnimationValue::eUnit_Coord:
|
||||
return &sZeroCoord;
|
||||
@ -75,8 +75,8 @@ static const bool
|
||||
FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
|
||||
const StyleAnimationValue*& aValue2)
|
||||
{
|
||||
MOZ_ASSERT(aValue1 || aValue2,
|
||||
"expecting at least one non-null value");
|
||||
NS_ABORT_IF_FALSE(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) {
|
||||
@ -142,7 +142,7 @@ ExtractValueWrapper(const nsSMILValue& aValue)
|
||||
void
|
||||
nsSMILCSSValueType::Init(nsSMILValue& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(aValue.IsNull(), "Unexpected SMIL value type");
|
||||
NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected SMIL value type");
|
||||
|
||||
aValue.mU.mPtr = nullptr;
|
||||
aValue.mType = this;
|
||||
@ -151,7 +151,7 @@ nsSMILCSSValueType::Init(nsSMILValue& aValue) const
|
||||
void
|
||||
nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
|
||||
NS_ABORT_IF_FALSE(aValue.mType == this, "Unexpected SMIL value type");
|
||||
delete static_cast<ValueWrapper*>(aValue.mU.mPtr);
|
||||
aValue.mType = nsSMILNullType::Singleton();
|
||||
}
|
||||
@ -159,8 +159,8 @@ nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const
|
||||
nsresult
|
||||
nsSMILCSSValueType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
|
||||
{
|
||||
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
|
||||
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value type");
|
||||
NS_ABORT_IF_FALSE(aDest.mType == aSrc.mType, "Incompatible SMIL types");
|
||||
NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL value type");
|
||||
const ValueWrapper* srcWrapper = ExtractValueWrapper(aSrc);
|
||||
ValueWrapper* destWrapper = ExtractValueWrapper(aDest);
|
||||
|
||||
@ -185,8 +185,8 @@ bool
|
||||
nsSMILCSSValueType::IsEqual(const nsSMILValue& aLeft,
|
||||
const nsSMILValue& aRight) const
|
||||
{
|
||||
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
|
||||
MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL value");
|
||||
NS_ABORT_IF_FALSE(aLeft.mType == aRight.mType, "Incompatible SMIL types");
|
||||
NS_ABORT_IF_FALSE(aLeft.mType == this, "Unexpected SMIL value");
|
||||
const ValueWrapper* leftWrapper = ExtractValueWrapper(aLeft);
|
||||
const ValueWrapper* rightWrapper = ExtractValueWrapper(aRight);
|
||||
|
||||
@ -213,14 +213,14 @@ nsresult
|
||||
nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
||||
uint32_t aCount) const
|
||||
{
|
||||
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
|
||||
"Trying to add invalid types");
|
||||
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
|
||||
NS_ABORT_IF_FALSE(aValueToAdd.mType == aDest.mType,
|
||||
"Trying to add invalid types");
|
||||
NS_ABORT_IF_FALSE(aValueToAdd.mType == this, "Unexpected source type");
|
||||
|
||||
ValueWrapper* destWrapper = ExtractValueWrapper(aDest);
|
||||
const ValueWrapper* valueToAddWrapper = ExtractValueWrapper(aValueToAdd);
|
||||
MOZ_ASSERT(destWrapper || valueToAddWrapper,
|
||||
"need at least one fully-initialized value");
|
||||
NS_ABORT_IF_FALSE(destWrapper || valueToAddWrapper,
|
||||
"need at least one fully-initialized value");
|
||||
|
||||
nsCSSProperty property = (valueToAddWrapper ? valueToAddWrapper->mPropID :
|
||||
destWrapper->mPropID);
|
||||
@ -260,13 +260,13 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
||||
const nsSMILValue& aTo,
|
||||
double& aDistance) const
|
||||
{
|
||||
MOZ_ASSERT(aFrom.mType == aTo.mType,
|
||||
"Trying to compare different types");
|
||||
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
|
||||
NS_ABORT_IF_FALSE(aFrom.mType == aTo.mType,
|
||||
"Trying to compare different types");
|
||||
NS_ABORT_IF_FALSE(aFrom.mType == this, "Unexpected source type");
|
||||
|
||||
const ValueWrapper* fromWrapper = ExtractValueWrapper(aFrom);
|
||||
const ValueWrapper* toWrapper = ExtractValueWrapper(aTo);
|
||||
MOZ_ASSERT(toWrapper, "expecting non-null endpoint");
|
||||
NS_ABORT_IF_FALSE(toWrapper, "expecting non-null endpoint");
|
||||
|
||||
const StyleAnimationValue* fromCSSValue = fromWrapper ?
|
||||
&fromWrapper->mCSSValue : nullptr;
|
||||
@ -287,18 +287,18 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
|
||||
double aUnitDistance,
|
||||
nsSMILValue& aResult) const
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
const ValueWrapper* startWrapper = ExtractValueWrapper(aStartVal);
|
||||
const ValueWrapper* endWrapper = ExtractValueWrapper(aEndVal);
|
||||
MOZ_ASSERT(endWrapper, "expecting non-null endpoint");
|
||||
NS_ABORT_IF_FALSE(endWrapper, "expecting non-null endpoint");
|
||||
|
||||
const StyleAnimationValue* startCSSValue = startWrapper ?
|
||||
&startWrapper->mCSSValue : nullptr;
|
||||
@ -370,8 +370,9 @@ ValueFromStringHelper(nsCSSProperty aPropID,
|
||||
|
||||
if (aPropID == eCSSProperty_font_size) {
|
||||
// Divide out text-zoom, since SVG is supposed to ignore it
|
||||
MOZ_ASSERT(aStyleAnimValue.GetUnit() == StyleAnimationValue::eUnit_Coord,
|
||||
"'font-size' value with unexpected style unit");
|
||||
NS_ABORT_IF_FALSE(aStyleAnimValue.GetUnit() ==
|
||||
StyleAnimationValue::eUnit_Coord,
|
||||
"'font-size' value with unexpected style unit");
|
||||
aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() /
|
||||
aPresContext->TextZoom());
|
||||
}
|
||||
@ -386,7 +387,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
|
||||
nsSMILValue& aValue,
|
||||
bool* aIsContextSensitive)
|
||||
{
|
||||
MOZ_ASSERT(aValue.IsNull(), "Outparam should be null-typed");
|
||||
NS_ABORT_IF_FALSE(aValue.IsNull(), "Outparam should be null-typed");
|
||||
nsPresContext* presContext = GetPresContextForElement(aTargetElement);
|
||||
if (!presContext) {
|
||||
NS_WARNING("Not parsing animation value; unable to get PresContext");
|
||||
@ -414,8 +415,8 @@ bool
|
||||
nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
|
||||
nsAString& aString)
|
||||
{
|
||||
MOZ_ASSERT(aValue.mType == &nsSMILCSSValueType::sSingleton,
|
||||
"Unexpected SMIL value type");
|
||||
NS_ABORT_IF_FALSE(aValue.mType == &nsSMILCSSValueType::sSingleton,
|
||||
"Unexpected SMIL value type");
|
||||
const ValueWrapper* wrapper = ExtractValueWrapper(aValue);
|
||||
return !wrapper ||
|
||||
StyleAnimationValue::UncomputeValue(wrapper->mPropID,
|
||||
|
@ -47,11 +47,11 @@ nsSMILInstanceTime::nsSMILInstanceTime(const nsSMILTimeValue& aTime,
|
||||
|
||||
nsSMILInstanceTime::~nsSMILInstanceTime()
|
||||
{
|
||||
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");
|
||||
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");
|
||||
}
|
||||
|
||||
void
|
||||
@ -78,7 +78,7 @@ nsSMILInstanceTime::HandleChangedInterval(
|
||||
if (!mBaseInterval)
|
||||
return;
|
||||
|
||||
MOZ_ASSERT(mCreator, "Base interval is set but creator is not.");
|
||||
NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not.");
|
||||
|
||||
if (mVisited) {
|
||||
// Break the cycle here
|
||||
@ -100,10 +100,9 @@ nsSMILInstanceTime::HandleChangedInterval(
|
||||
void
|
||||
nsSMILInstanceTime::HandleDeletedInterval()
|
||||
{
|
||||
MOZ_ASSERT(mBaseInterval,
|
||||
"Got call to HandleDeletedInterval on an independent instance "
|
||||
"time");
|
||||
MOZ_ASSERT(mCreator, "Base interval is set but creator is not");
|
||||
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");
|
||||
|
||||
mBaseInterval = nullptr;
|
||||
mFlags &= ~kMayUpdate; // Can't update without a base interval
|
||||
@ -116,9 +115,8 @@ nsSMILInstanceTime::HandleDeletedInterval()
|
||||
void
|
||||
nsSMILInstanceTime::HandleFilteredInterval()
|
||||
{
|
||||
MOZ_ASSERT(mBaseInterval,
|
||||
"Got call to HandleFilteredInterval on an independent instance "
|
||||
"time");
|
||||
NS_ABORT_IF_FALSE(mBaseInterval,
|
||||
"Got call to HandleFilteredInterval on an independent instance time");
|
||||
|
||||
mBaseInterval = nullptr;
|
||||
mFlags &= ~kMayUpdate; // Can't update without a base interval
|
||||
@ -140,8 +138,8 @@ nsSMILInstanceTime::UnmarkShouldPreserve()
|
||||
void
|
||||
nsSMILInstanceTime::AddRefFixedEndpoint()
|
||||
{
|
||||
MOZ_ASSERT(mFixedEndpointRefCnt < UINT16_MAX,
|
||||
"Fixed endpoint reference count upper limit reached");
|
||||
NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < UINT16_MAX,
|
||||
"Fixed endpoint reference count upper limit reached");
|
||||
++mFixedEndpointRefCnt;
|
||||
mFlags &= ~kMayUpdate; // Once fixed, always fixed
|
||||
}
|
||||
@ -149,7 +147,7 @@ nsSMILInstanceTime::AddRefFixedEndpoint()
|
||||
void
|
||||
nsSMILInstanceTime::ReleaseFixedEndpoint()
|
||||
{
|
||||
MOZ_ASSERT(mFixedEndpointRefCnt > 0, "Duplicate release");
|
||||
NS_ABORT_IF_FALSE(mFixedEndpointRefCnt > 0, "Duplicate release");
|
||||
--mFixedEndpointRefCnt;
|
||||
if (mFixedEndpointRefCnt == 0 && IsDynamic()) {
|
||||
mFlags |= kWasDynamicEndpoint;
|
||||
@ -181,7 +179,7 @@ nsSMILInstanceTime::GetBaseTime() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mCreator, "Base interval is set but there is no creator.");
|
||||
NS_ABORT_IF_FALSE(mCreator, "Base interval is set but there is no creator.");
|
||||
if (!mCreator) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -193,14 +191,13 @@ nsSMILInstanceTime::GetBaseTime() const
|
||||
void
|
||||
nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval)
|
||||
{
|
||||
MOZ_ASSERT(!mBaseInterval,
|
||||
"Attempting to reassociate an instance time with a different "
|
||||
"interval.");
|
||||
NS_ABORT_IF_FALSE(!mBaseInterval,
|
||||
"Attempting to reassociate an instance time with a different interval.");
|
||||
|
||||
if (aBaseInterval) {
|
||||
MOZ_ASSERT(mCreator,
|
||||
"Attempting to create a dependent instance time without "
|
||||
"reference to the creating nsSMILTimeValueSpec object.");
|
||||
NS_ABORT_IF_FALSE(mCreator,
|
||||
"Attempting to create a dependent instance time without reference "
|
||||
"to the creating nsSMILTimeValueSpec object.");
|
||||
if (!mCreator)
|
||||
return;
|
||||
|
||||
|
@ -77,8 +77,8 @@ public:
|
||||
|
||||
void DependentUpdate(const nsSMILTimeValue& aNewTime)
|
||||
{
|
||||
MOZ_ASSERT(!IsFixedTime(),
|
||||
"Updating an instance time that is not expected to be updated");
|
||||
NS_ABORT_IF_FALSE(!IsFixedTime(),
|
||||
"Updating an instance time that is not expected to be updated");
|
||||
mTime = aNewTime;
|
||||
}
|
||||
|
||||
|
@ -19,23 +19,23 @@ nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther)
|
||||
mBeginFixed(false),
|
||||
mEndFixed(false)
|
||||
{
|
||||
MOZ_ASSERT(aOther.mDependentTimes.IsEmpty(),
|
||||
"Attempt to copy-construct an interval with dependent times; this "
|
||||
"will lead to instance times being shared between intervals.");
|
||||
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.");
|
||||
|
||||
// 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.
|
||||
MOZ_ASSERT(!aOther.mBeginFixed && !aOther.mEndFixed,
|
||||
"Attempt to copy-construct an interval with fixed endpoints");
|
||||
NS_ABORT_IF_FALSE(!aOther.mBeginFixed && !aOther.mEndFixed,
|
||||
"Attempting to copy-construct an interval with fixed endpoints");
|
||||
}
|
||||
|
||||
nsSMILInterval::~nsSMILInterval()
|
||||
{
|
||||
MOZ_ASSERT(mDependentTimes.IsEmpty(),
|
||||
"Destroying interval without disassociating dependent instance "
|
||||
"times. Unlink was not called");
|
||||
NS_ABORT_IF_FALSE(mDependentTimes.IsEmpty(),
|
||||
"Destroying interval without disassociating dependent instance times. "
|
||||
"Unlink was not called");
|
||||
}
|
||||
|
||||
void
|
||||
@ -62,31 +62,31 @@ nsSMILInterval::Unlink(bool aFiltered)
|
||||
nsSMILInstanceTime*
|
||||
nsSMILInterval::Begin()
|
||||
{
|
||||
MOZ_ASSERT(mBegin && mEnd,
|
||||
"Requesting Begin() on un-initialized interval.");
|
||||
NS_ABORT_IF_FALSE(mBegin && mEnd,
|
||||
"Requesting Begin() on un-initialized interval.");
|
||||
return mBegin;
|
||||
}
|
||||
|
||||
nsSMILInstanceTime*
|
||||
nsSMILInterval::End()
|
||||
{
|
||||
MOZ_ASSERT(mBegin && mEnd,
|
||||
"Requesting End() on un-initialized interval.");
|
||||
NS_ABORT_IF_FALSE(mBegin && mEnd,
|
||||
"Requesting End() on un-initialized interval.");
|
||||
return mEnd;
|
||||
}
|
||||
|
||||
void
|
||||
nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
// 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.
|
||||
MOZ_ASSERT(!mBegin || aBegin.GetBaseTime() != mBegin,
|
||||
"Attempt to make self-dependent instance time");
|
||||
NS_ABORT_IF_FALSE(!mBegin || aBegin.GetBaseTime() != mBegin,
|
||||
"Attempting to make self-dependent instance time");
|
||||
|
||||
mBegin = &aBegin;
|
||||
}
|
||||
@ -94,12 +94,12 @@ nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin)
|
||||
void
|
||||
nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd)
|
||||
{
|
||||
MOZ_ASSERT(!mEndFixed,
|
||||
"Attempt to set end time but the end point is fixed");
|
||||
NS_ABORT_IF_FALSE(!mEndFixed,
|
||||
"Attempting to set end time but the end point is fixed");
|
||||
// As with SetBegin, check we're not making an instance time dependent on
|
||||
// itself.
|
||||
MOZ_ASSERT(!mEnd || aEnd.GetBaseTime() != mEnd,
|
||||
"Attempting to make self-dependent instance time");
|
||||
NS_ABORT_IF_FALSE(!mEnd || aEnd.GetBaseTime() != mEnd,
|
||||
"Attempting to make self-dependent instance time");
|
||||
|
||||
mEnd = &aEnd;
|
||||
}
|
||||
@ -107,9 +107,9 @@ nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd)
|
||||
void
|
||||
nsSMILInterval::FixBegin()
|
||||
{
|
||||
MOZ_ASSERT(mBegin && mEnd,
|
||||
"Fixing begin point on un-initialized interval");
|
||||
MOZ_ASSERT(!mBeginFixed, "Duplicate calls to FixBegin()");
|
||||
NS_ABORT_IF_FALSE(mBegin && mEnd,
|
||||
"Fixing begin point on un-initialized interval");
|
||||
NS_ABORT_IF_FALSE(!mBeginFixed, "Duplicate calls to FixBegin()");
|
||||
mBeginFixed = true;
|
||||
mBegin->AddRefFixedEndpoint();
|
||||
}
|
||||
@ -117,11 +117,11 @@ nsSMILInterval::FixBegin()
|
||||
void
|
||||
nsSMILInterval::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()");
|
||||
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()");
|
||||
mEndFixed = true;
|
||||
mEnd->AddRefFixedEndpoint();
|
||||
}
|
||||
@ -143,7 +143,7 @@ nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime)
|
||||
bool found =
|
||||
#endif
|
||||
mDependentTimes.RemoveElementSorted(&aTime);
|
||||
MOZ_ASSERT(found, "Couldn't find instance time to delete.");
|
||||
NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete.");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -28,16 +28,16 @@ public:
|
||||
|
||||
const nsSMILInstanceTime* Begin() const
|
||||
{
|
||||
MOZ_ASSERT(mBegin && mEnd,
|
||||
"Requesting Begin() on un-initialized instance time");
|
||||
NS_ABORT_IF_FALSE(mBegin && mEnd,
|
||||
"Requesting Begin() on un-initialized instance time");
|
||||
return mBegin;
|
||||
}
|
||||
nsSMILInstanceTime* Begin();
|
||||
|
||||
const nsSMILInstanceTime* End() const
|
||||
{
|
||||
MOZ_ASSERT(mBegin && mEnd,
|
||||
"Requesting End() on un-initialized instance time");
|
||||
NS_ABORT_IF_FALSE(mBegin && mEnd,
|
||||
"Requesting End() on un-initialized instance time");
|
||||
return mEnd;
|
||||
}
|
||||
nsSMILInstanceTime* End();
|
||||
|
@ -271,15 +271,16 @@ ParseOptionalOffset(RangedPtr<const char16_t>& aIter,
|
||||
bool
|
||||
ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult)
|
||||
{
|
||||
MOZ_ASSERT(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) ||
|
||||
StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC),
|
||||
"Calling ParseAccessKey on non-accesskey-type spec");
|
||||
NS_ABORT_IF_FALSE(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) ||
|
||||
StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC),
|
||||
"Calling ParseAccessKey on non-accesskey-type spec");
|
||||
|
||||
nsSMILTimeValueSpecParams result;
|
||||
result.mType = nsSMILTimeValueSpecParams::ACCESSKEY;
|
||||
|
||||
MOZ_ASSERT(ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(),
|
||||
"Case variations for accesskey prefix differ in length");
|
||||
NS_ABORT_IF_FALSE(
|
||||
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));
|
||||
@ -370,7 +371,7 @@ ConvertTokenToAtom(const nsAString& aToken,
|
||||
bool escape = false;
|
||||
|
||||
while (read != end) {
|
||||
MOZ_ASSERT(write <= read, "Writing past where we've read");
|
||||
NS_ABORT_IF_FALSE(write <= read, "Writing past where we've read");
|
||||
if (!escape && *read == '\\') {
|
||||
escape = true;
|
||||
++read;
|
||||
|
@ -254,9 +254,9 @@ nsSMILTimeContainer::PopMilestoneElementsAtMilestone(
|
||||
nsSMILMilestone containerMilestone(containerTime.GetMillis(),
|
||||
aMilestone.mIsEnd);
|
||||
|
||||
MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone,
|
||||
"Trying to pop off earliest times but we have earlier ones that "
|
||||
"were overlooked");
|
||||
NS_ABORT_IF_FALSE(mMilestoneEntries.Top().mMilestone >= containerMilestone,
|
||||
"Trying to pop off earliest times but we have earlier ones that were "
|
||||
"overlooked");
|
||||
|
||||
bool gotOne = false;
|
||||
while (!mMilestoneEntries.IsEmpty() &&
|
||||
@ -291,7 +291,7 @@ nsSMILTimeContainer::UpdateCurrentTime()
|
||||
{
|
||||
nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime();
|
||||
mCurrentTime = now - mParentOffset;
|
||||
MOZ_ASSERT(mCurrentTime >= 0, "Container has negative time");
|
||||
NS_ABORT_IF_FALSE(mCurrentTime >= 0, "Container has negative time");
|
||||
}
|
||||
|
||||
void
|
||||
@ -313,9 +313,9 @@ nsSMILTimeContainer::NotifyTimeChange()
|
||||
while (p < mMilestoneEntries.Elements() + mMilestoneEntries.Length()) {
|
||||
mozilla::dom::SVGAnimationElement* elem = p->mTimebase.get();
|
||||
elem->TimedElement().HandleContainerTimeChange();
|
||||
MOZ_ASSERT(queueLength == mMilestoneEntries.Length(),
|
||||
"Call to HandleContainerTimeChange resulted in a change to the "
|
||||
"queue of milestones");
|
||||
NS_ABORT_IF_FALSE(queueLength == mMilestoneEntries.Length(),
|
||||
"Call to HandleContainerTimeChange resulted in a change to the "
|
||||
"queue of milestones");
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ public:
|
||||
bool IsDefinite() const { return mState == STATE_DEFINITE; }
|
||||
nsSMILTime GetMillis() const
|
||||
{
|
||||
MOZ_ASSERT(mState == STATE_DEFINITE,
|
||||
"GetMillis() called for unresolved or indefinite time");
|
||||
NS_ABORT_IF_FALSE(mState == STATE_DEFINITE,
|
||||
"GetMillis() called for unresolved or indefinite time");
|
||||
|
||||
return mState == STATE_DEFINITE ? mMilliseconds : kUnresolvedMillis;
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode)
|
||||
if (mParams.mType != nsSMILTimeValueSpecParams::SYNCBASE && !IsEventBased())
|
||||
return;
|
||||
|
||||
MOZ_ASSERT(aContextNode,
|
||||
"null context node for resolving timing references against");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -113,10 +113,10 @@ nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode)
|
||||
mReferencedElement.ResetWithElement(target);
|
||||
} else if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) {
|
||||
nsIDocument* doc = aContextNode->GetCurrentDoc();
|
||||
MOZ_ASSERT(doc, "We are in the document but current doc is null");
|
||||
NS_ABORT_IF_FALSE(doc, "We are in the document but current doc is null");
|
||||
mReferencedElement.ResetWithElement(doc->GetRootElement());
|
||||
} else {
|
||||
MOZ_ASSERT(false, "Syncbase or repeat spec without ID");
|
||||
NS_ABORT_IF_FALSE(false, "Syncbase or repeat spec without ID");
|
||||
}
|
||||
UpdateReferencedElement(oldReferencedElement, mReferencedElement.get());
|
||||
}
|
||||
@ -297,12 +297,11 @@ nsSMILTimeValueSpec::IsWhitelistedEvent()
|
||||
void
|
||||
nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
if (!aTarget)
|
||||
return;
|
||||
@ -344,7 +343,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
|
||||
EventListenerManager*
|
||||
nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget)
|
||||
{
|
||||
MOZ_ASSERT(aTarget, "null target; can't get EventListenerManager");
|
||||
NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager");
|
||||
|
||||
nsCOMPtr<EventTarget> target;
|
||||
|
||||
@ -368,10 +367,10 @@ nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget)
|
||||
void
|
||||
nsSMILTimeValueSpec::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
MOZ_ASSERT(mEventListener, "Got event without an event listener");
|
||||
MOZ_ASSERT(IsEventBased(),
|
||||
"Got event for non-event nsSMILTimeValueSpec");
|
||||
MOZ_ASSERT(aEvent, "No event supplied");
|
||||
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");
|
||||
|
||||
// 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
|
||||
@ -510,8 +509,8 @@ nsSMILTimeValueSpec::ConvertBetweenTimeContainers(
|
||||
// time. Just return the indefinite time.
|
||||
return docTime;
|
||||
|
||||
MOZ_ASSERT(docTime.IsDefinite(),
|
||||
"ContainerToParentTime gave us an unresolved or indefinite time");
|
||||
NS_ABORT_IF_FALSE(docTime.IsDefinite(),
|
||||
"ContainerToParentTime gave us an unresolved or indefinite time");
|
||||
|
||||
return dstContainer->ParentToContainerTime(docTime.GetMillis());
|
||||
}
|
||||
|
@ -48,12 +48,12 @@ nsSMILTimedElement::InstanceTimeComparator::Equals(
|
||||
const nsSMILInstanceTime* aElem1,
|
||||
const nsSMILInstanceTime* aElem2) const
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
return aElem1->Serial() == aElem2->Serial();
|
||||
}
|
||||
@ -63,10 +63,10 @@ nsSMILTimedElement::InstanceTimeComparator::LessThan(
|
||||
const nsSMILInstanceTime* aElem1,
|
||||
const nsSMILInstanceTime* aElem2) const
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
||||
int8_t cmp = aElem1->Time().CompareTo(aElem2->Time());
|
||||
return cmp == 0 ? aElem1->Serial() < aElem2->Serial() : cmp < 0;
|
||||
@ -195,8 +195,9 @@ nsSMILTimedElement::RemoveInstanceTimes(InstanceTimeList& aArray,
|
||||
// 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.
|
||||
MOZ_ASSERT(!GetPreviousInterval() || item != GetPreviousInterval()->End(),
|
||||
"Removing end instance time of previous interval");
|
||||
NS_ABORT_IF_FALSE(!GetPreviousInterval() ||
|
||||
item != GetPreviousInterval()->End(),
|
||||
"Removing end instance time of previous interval");
|
||||
item->Unlink();
|
||||
} else {
|
||||
newArray.AppendElement(item);
|
||||
@ -281,19 +282,19 @@ nsSMILTimedElement::~nsSMILTimedElement()
|
||||
// correct behavior) but also because AutoIntervalUpdateBatcher holds pointers
|
||||
// to class so if they fail there's the possibility we might have dangling
|
||||
// pointers.
|
||||
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");
|
||||
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");
|
||||
}
|
||||
|
||||
void
|
||||
nsSMILTimedElement::SetAnimationElement(SVGAnimationElement* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement, "NULL owner element");
|
||||
MOZ_ASSERT(!mAnimationElement, "Re-setting owner");
|
||||
NS_ABORT_IF_FALSE(aElement, "NULL owner element");
|
||||
NS_ABORT_IF_FALSE(!mAnimationElement, "Re-setting owner");
|
||||
mAnimationElement = aElement;
|
||||
}
|
||||
|
||||
@ -384,7 +385,7 @@ void
|
||||
nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
bool aIsBegin)
|
||||
{
|
||||
MOZ_ASSERT(aInstanceTime, "Attempting to add null instance time");
|
||||
NS_ABORT_IF_FALSE(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.
|
||||
@ -393,9 +394,9 @@ nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
{
|
||||
// No need to call Unlink here--dynamic instance times shouldn't be linked
|
||||
// to anything that's going to miss them
|
||||
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");
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -416,7 +417,7 @@ nsSMILTimedElement::UpdateInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
nsSMILTimeValue& aUpdatedTime,
|
||||
bool aIsBegin)
|
||||
{
|
||||
MOZ_ASSERT(aInstanceTime, "Attempting to update null instance time");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -448,7 +449,7 @@ void
|
||||
nsSMILTimedElement::RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
bool aIsBegin)
|
||||
{
|
||||
MOZ_ASSERT(aInstanceTime, "Attempting to remove null instance time");
|
||||
NS_ABORT_IF_FALSE(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.
|
||||
@ -460,7 +461,7 @@ nsSMILTimedElement::RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances;
|
||||
mozilla::DebugOnly<bool> found =
|
||||
instanceList.RemoveElementSorted(aInstanceTime, InstanceTimeComparator());
|
||||
MOZ_ASSERT(found, "Couldn't find instance time to delete");
|
||||
NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete");
|
||||
|
||||
UpdateCurrentInterval();
|
||||
}
|
||||
@ -497,7 +498,7 @@ void
|
||||
nsSMILTimedElement::RemoveInstanceTimesForCreator(
|
||||
const nsSMILTimeValueSpec* aCreator, bool aIsBegin)
|
||||
{
|
||||
MOZ_ASSERT(aCreator, "Creator not set");
|
||||
NS_ABORT_IF_FALSE(aCreator, "Creator not set");
|
||||
|
||||
InstanceTimeList& instances = aIsBegin ? mBeginInstances : mEndInstances;
|
||||
RemoveByCreator removeByCreator(aCreator);
|
||||
@ -559,10 +560,10 @@ nsSMILTimedElement::SampleEndAt(nsSMILTime aContainerTime)
|
||||
void
|
||||
nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly)
|
||||
{
|
||||
MOZ_ASSERT(mAnimationElement,
|
||||
"Got sample before being registered with an animation element");
|
||||
MOZ_ASSERT(GetTimeContainer(),
|
||||
"Got sample without being registered with a time container");
|
||||
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");
|
||||
|
||||
// This could probably happen if we later implement externalResourcesRequired
|
||||
// (bug 277955) and whilst waiting for those resources (and the animation to
|
||||
@ -603,12 +604,11 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly)
|
||||
#ifdef DEBUG
|
||||
// Check invariant
|
||||
if (mElementState == STATE_STARTUP || mElementState == STATE_POSTACTIVE) {
|
||||
MOZ_ASSERT(!mCurrentInterval,
|
||||
"Shouldn't have current interval in startup or postactive "
|
||||
"states");
|
||||
NS_ABORT_IF_FALSE(!mCurrentInterval,
|
||||
"Shouldn't have current interval in startup or postactive states");
|
||||
} else {
|
||||
MOZ_ASSERT(mCurrentInterval,
|
||||
"Should have current interval in waiting and active states");
|
||||
NS_ABORT_IF_FALSE(mCurrentInterval,
|
||||
"Should have current interval in waiting and active states");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -694,8 +694,8 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly)
|
||||
FilterHistory();
|
||||
stateChanged = true;
|
||||
} else {
|
||||
MOZ_ASSERT(!didApplyEarlyEnd,
|
||||
"We got an early end, but didn't end");
|
||||
NS_ABORT_IF_FALSE(!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");
|
||||
@ -771,8 +771,9 @@ namespace
|
||||
// Generally dynamically-generated instance times (DOM calls, event-based
|
||||
// times) are not associated with their creator nsSMILTimeValueSpec since
|
||||
// they may outlive them.
|
||||
MOZ_ASSERT(!aInstanceTime->IsDynamic() || !aInstanceTime->GetCreator(),
|
||||
"Dynamic instance time should be unlinked from its creator");
|
||||
NS_ABORT_IF_FALSE(!aInstanceTime->IsDynamic() ||
|
||||
!aInstanceTime->GetCreator(),
|
||||
"Dynamic instance time should be unlinked from its creator");
|
||||
return !aInstanceTime->IsDynamic() && !aInstanceTime->ShouldPreserve();
|
||||
}
|
||||
}
|
||||
@ -780,9 +781,8 @@ namespace
|
||||
void
|
||||
nsSMILTimedElement::Rewind()
|
||||
{
|
||||
MOZ_ASSERT(mAnimationElement,
|
||||
"Got rewind request before being attached to an animation "
|
||||
"element");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -799,15 +799,15 @@ nsSMILTimedElement::Rewind()
|
||||
SEEK_BACKWARD_FROM_ACTIVE :
|
||||
SEEK_BACKWARD_FROM_INACTIVE;
|
||||
}
|
||||
MOZ_ASSERT(mSeekState == SEEK_BACKWARD_FROM_INACTIVE ||
|
||||
mSeekState == SEEK_BACKWARD_FROM_ACTIVE,
|
||||
"Rewind in the middle of a forwards seek?");
|
||||
NS_ABORT_IF_FALSE(mSeekState == SEEK_BACKWARD_FROM_INACTIVE ||
|
||||
mSeekState == SEEK_BACKWARD_FROM_ACTIVE,
|
||||
"Rewind in the middle of a forwards seek?");
|
||||
|
||||
ClearTimingState(RemoveNonDynamic);
|
||||
RebuildTimingState(RemoveNonDynamic);
|
||||
|
||||
MOZ_ASSERT(!mCurrentInterval,
|
||||
"Current interval is set at end of rewind");
|
||||
NS_ABORT_IF_FALSE(!mCurrentInterval,
|
||||
"Current interval is set at end of rewind");
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -972,8 +972,8 @@ nsSMILTimedElement::SetSimpleDuration(const nsAString& aDurSpec)
|
||||
}
|
||||
// mSimpleDur should never be unresolved. ParseClockValue will either set
|
||||
// duration to resolved or will return false.
|
||||
MOZ_ASSERT(duration.IsResolved(),
|
||||
"Setting unresolved simple duration");
|
||||
NS_ABORT_IF_FALSE(duration.IsResolved(),
|
||||
"Setting unresolved simple duration");
|
||||
|
||||
mSimpleDur = duration;
|
||||
|
||||
@ -1005,7 +1005,7 @@ nsSMILTimedElement::SetMin(const nsAString& aMinSpec)
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(duration.GetMillis() >= 0L, "Invalid duration");
|
||||
NS_ABORT_IF_FALSE(duration.GetMillis() >= 0L, "Invalid duration");
|
||||
|
||||
mMin = duration;
|
||||
|
||||
@ -1036,7 +1036,7 @@ nsSMILTimedElement::SetMax(const nsAString& aMaxSpec)
|
||||
mMax.SetIndefinite();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
MOZ_ASSERT(duration.GetMillis() > 0L, "Invalid duration");
|
||||
NS_ABORT_IF_FALSE(duration.GetMillis() > 0L, "Invalid duration");
|
||||
}
|
||||
|
||||
mMax = duration;
|
||||
@ -1162,8 +1162,8 @@ 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.
|
||||
MOZ_ASSERT(!mTimeDependents.GetEntry(&aDependent),
|
||||
"nsSMILTimeValueSpec is already registered as a dependency");
|
||||
NS_ABORT_IF_FALSE(!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
|
||||
@ -1251,15 +1251,15 @@ nsSMILTimedElement::Traverse(nsCycleCollectionTraversalCallback* aCallback)
|
||||
uint32_t count = mBeginSpecs.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i];
|
||||
MOZ_ASSERT(beginSpec,
|
||||
"null nsSMILTimeValueSpec in list of begin specs");
|
||||
NS_ABORT_IF_FALSE(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];
|
||||
MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs");
|
||||
NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs");
|
||||
endSpec->Traverse(aCallback);
|
||||
}
|
||||
}
|
||||
@ -1273,15 +1273,15 @@ nsSMILTimedElement::Unlink()
|
||||
uint32_t count = mBeginSpecs.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i];
|
||||
MOZ_ASSERT(beginSpec,
|
||||
"null nsSMILTimeValueSpec in list of begin specs");
|
||||
NS_ABORT_IF_FALSE(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];
|
||||
MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs");
|
||||
NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs");
|
||||
endSpec->Unlink();
|
||||
}
|
||||
|
||||
@ -1386,8 +1386,8 @@ bool
|
||||
nsSMILTimedElement::ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime)
|
||||
{
|
||||
// This should only be called within DoSampleAt as a helper function
|
||||
MOZ_ASSERT(mElementState == STATE_ACTIVE,
|
||||
"Unexpected state to try to apply an early end");
|
||||
NS_ABORT_IF_FALSE(mElementState == STATE_ACTIVE,
|
||||
"Unexpected state to try to apply an early end");
|
||||
|
||||
bool updated = false;
|
||||
|
||||
@ -1697,8 +1697,8 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval,
|
||||
const nsSMILInstanceTime* aFixedBeginTime,
|
||||
nsSMILInterval& aResult) const
|
||||
{
|
||||
MOZ_ASSERT(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(),
|
||||
"Unresolved or indefinite begin time given for interval start");
|
||||
NS_ABORT_IF_FALSE(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(),
|
||||
"Unresolved or indefinite begin time specified for interval start");
|
||||
static const nsSMILTimeValue zeroTime(0L);
|
||||
|
||||
if (mRestartMode == RESTART_NEVER && aPrevInterval)
|
||||
@ -1746,9 +1746,9 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval,
|
||||
} while (aReplacedInterval &&
|
||||
tempBegin->GetBaseTime() == aReplacedInterval->Begin());
|
||||
}
|
||||
MOZ_ASSERT(tempBegin && tempBegin->Time().IsDefinite() &&
|
||||
tempBegin->Time() >= beginAfter,
|
||||
"Got a bad begin time while fetching next interval");
|
||||
NS_ABORT_IF_FALSE(tempBegin && tempBegin->Time().IsDefinite() &&
|
||||
tempBegin->Time() >= beginAfter,
|
||||
"Got a bad begin time while fetching next interval");
|
||||
|
||||
// Calculate end time
|
||||
{
|
||||
@ -1811,7 +1811,7 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval,
|
||||
tempEnd = new nsSMILInstanceTime(activeEnd);
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(tempEnd, "Failed to get end point for next interval");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
@ -1869,7 +1869,7 @@ nsSMILTimedElement::GetNextGreaterOrEqual(const InstanceTimeList& aList,
|
||||
|
||||
for (; aPosition < count && !result; ++aPosition) {
|
||||
nsSMILInstanceTime* val = aList[aPosition].get();
|
||||
MOZ_ASSERT(val, "NULL instance time in list");
|
||||
NS_ABORT_IF_FALSE(val, "NULL instance time in list");
|
||||
if (val->Time() >= aBase) {
|
||||
result = val;
|
||||
}
|
||||
@ -1887,10 +1887,10 @@ nsSMILTimedElement::CalcActiveEnd(const nsSMILTimeValue& aBegin,
|
||||
{
|
||||
nsSMILTimeValue result;
|
||||
|
||||
MOZ_ASSERT(mSimpleDur.IsResolved(),
|
||||
"Unresolved simple duration in CalcActiveEnd");
|
||||
MOZ_ASSERT(aBegin.IsDefinite(),
|
||||
"Indefinite or unresolved begin time in CalcActiveEnd");
|
||||
NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(),
|
||||
"Unresolved simple duration in CalcActiveEnd");
|
||||
NS_ABORT_IF_FALSE(aBegin.IsDefinite(),
|
||||
"Indefinite or unresolved begin time in CalcActiveEnd");
|
||||
|
||||
result = GetRepeatDuration();
|
||||
|
||||
@ -1968,9 +1968,9 @@ nsSMILTimedElement::ActiveTimeToSimpleTime(nsSMILTime aActiveTime,
|
||||
{
|
||||
nsSMILTime result;
|
||||
|
||||
MOZ_ASSERT(mSimpleDur.IsResolved(),
|
||||
"Unresolved simple duration in ActiveTimeToSimpleTime");
|
||||
MOZ_ASSERT(aActiveTime >= 0, "Expecting non-negative active time");
|
||||
NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(),
|
||||
"Unresolved simple duration in ActiveTimeToSimpleTime");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
|
||||
@ -2001,8 +2001,8 @@ nsSMILInstanceTime*
|
||||
nsSMILTimedElement::CheckForEarlyEnd(
|
||||
const nsSMILTimeValue& aContainerTime) const
|
||||
{
|
||||
MOZ_ASSERT(mCurrentInterval,
|
||||
"Checking for an early end but the current interval is not set");
|
||||
NS_ABORT_IF_FALSE(mCurrentInterval,
|
||||
"Checking for an early end but the current interval is not set");
|
||||
if (mRestartMode != RESTART_ALWAYS)
|
||||
return nullptr;
|
||||
|
||||
@ -2052,9 +2052,8 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice)
|
||||
// if we're not post active here then something other than
|
||||
// UpdateCurrentInterval has updated the element state in between and all
|
||||
// bets are off.
|
||||
MOZ_ASSERT(mElementState == STATE_POSTACTIVE,
|
||||
"Expected to be in post-active state after performing double "
|
||||
"delete");
|
||||
NS_ABORT_IF_FALSE(mElementState == STATE_POSTACTIVE,
|
||||
"Expected to be in post-active state after performing double delete");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2065,8 +2064,8 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice)
|
||||
// it. In release builds, just bail out before we overflow the stack.
|
||||
AutoRestore<uint8_t> depthRestorer(mUpdateIntervalRecursionDepth);
|
||||
if (++mUpdateIntervalRecursionDepth > sMaxUpdateIntervalRecursionDepth) {
|
||||
MOZ_ASSERT(false,
|
||||
"Update current interval recursion depth exceeded threshold");
|
||||
NS_ABORT_IF_FALSE(false,
|
||||
"Update current interval recursion depth exceeded threshold");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2080,8 +2079,8 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice)
|
||||
|
||||
if (mElementState == STATE_POSTACTIVE) {
|
||||
|
||||
MOZ_ASSERT(!mCurrentInterval,
|
||||
"In postactive state but the interval has been set");
|
||||
NS_ABORT_IF_FALSE(!mCurrentInterval,
|
||||
"In postactive state but the interval has been set");
|
||||
mCurrentInterval = new nsSMILInterval(updatedInterval);
|
||||
mElementState = STATE_WAITING;
|
||||
NotifyNewInterval();
|
||||
@ -2153,13 +2152,12 @@ nsSMILTimedElement::SampleFillValue()
|
||||
|
||||
if (mElementState == STATE_WAITING || mElementState == STATE_POSTACTIVE) {
|
||||
const nsSMILInterval* prevInterval = GetPreviousInterval();
|
||||
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");
|
||||
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");
|
||||
|
||||
activeTime = prevInterval->End()->Time().GetMillis() -
|
||||
prevInterval->Begin()->Time().GetMillis();
|
||||
@ -2221,8 +2219,8 @@ nsSMILTimedElement::RegisterMilestone()
|
||||
nsSMILTimeContainer* container = GetTimeContainer();
|
||||
if (!container)
|
||||
return;
|
||||
MOZ_ASSERT(mAnimationElement,
|
||||
"Got a time container without an owning animation element");
|
||||
NS_ABORT_IF_FALSE(mAnimationElement,
|
||||
"Got a time container without an owning animation element");
|
||||
|
||||
nsSMILMilestone nextMilestone;
|
||||
if (!GetNextMilestone(nextMilestone))
|
||||
@ -2267,8 +2265,8 @@ nsSMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const
|
||||
return true;
|
||||
|
||||
case STATE_WAITING:
|
||||
MOZ_ASSERT(mCurrentInterval,
|
||||
"In waiting state but the current interval has not been set");
|
||||
NS_ABORT_IF_FALSE(mCurrentInterval,
|
||||
"In waiting state but the current interval has not been set");
|
||||
aNextMilestone.mIsEnd = false;
|
||||
aNextMilestone.mTime = mCurrentInterval->Begin()->Time().GetMillis();
|
||||
return true;
|
||||
@ -2316,9 +2314,9 @@ nsSMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const
|
||||
void
|
||||
nsSMILTimedElement::NotifyNewInterval()
|
||||
{
|
||||
MOZ_ASSERT(mCurrentInterval,
|
||||
"Attempting to notify dependents of a new interval but the "
|
||||
"interval is not set");
|
||||
NS_ABORT_IF_FALSE(mCurrentInterval,
|
||||
"Attempting to notify dependents of a new interval but the interval "
|
||||
"is not set");
|
||||
|
||||
nsSMILTimeContainer* container = GetTimeContainer();
|
||||
if (container) {
|
||||
@ -2334,7 +2332,7 @@ nsSMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
|
||||
bool aBeginObjectChanged,
|
||||
bool aEndObjectChanged)
|
||||
{
|
||||
MOZ_ASSERT(aInterval, "Null interval for change notification");
|
||||
NS_ABORT_IF_FALSE(aInterval, "Null interval for change notification");
|
||||
|
||||
nsSMILTimeContainer* container = GetTimeContainer();
|
||||
if (container) {
|
||||
@ -2434,13 +2432,13 @@ nsSMILTimedElement::AreEndTimesDependentOn(
|
||||
nsSMILTimedElement::NotifyNewIntervalCallback(TimeValueSpecPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
MOZ_ASSERT(aKey, "Null hash key for time container hash table");
|
||||
MOZ_ASSERT(aKey->GetKey(),
|
||||
"null nsSMILTimeValueSpec in set of time dependents");
|
||||
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");
|
||||
|
||||
NotifyTimeDependentsParams* params =
|
||||
static_cast<NotifyTimeDependentsParams*>(aData);
|
||||
MOZ_ASSERT(params, "null data ptr while enumerating hashtable");
|
||||
NS_ABORT_IF_FALSE(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
|
||||
|
@ -124,17 +124,16 @@ void
|
||||
nsSMILValue::InitAndCheckPostcondition(const nsISMILType* aNewType)
|
||||
{
|
||||
aNewType->Init(*this);
|
||||
MOZ_ASSERT(mType == aNewType,
|
||||
"Post-condition of Init failed. nsSMILValue is invalid");
|
||||
NS_ABORT_IF_FALSE(mType == aNewType,
|
||||
"Post-condition of Init failed. nsSMILValue is invalid");
|
||||
}
|
||||
|
||||
void
|
||||
nsSMILValue::DestroyAndCheckPostcondition()
|
||||
{
|
||||
mType->Destroy(*this);
|
||||
MOZ_ASSERT(IsNull(),
|
||||
"Post-condition of Destroy failed. "
|
||||
"nsSMILValue not null after destroying");
|
||||
NS_ABORT_IF_FALSE(IsNull(), "Post-condition of Destroy failed. "
|
||||
"nsSMILValue not null after destroying");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -78,7 +78,7 @@ SpeakerManager::SetForcespeaker(bool aEnable)
|
||||
void
|
||||
SpeakerManager::DispatchSimpleEvent(const nsAString& aStr)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
|
@ -42,7 +42,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) DOMStorageDBChild::Release(void)
|
||||
void
|
||||
DOMStorageDBChild::AddIPDLReference()
|
||||
{
|
||||
MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
|
||||
NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references");
|
||||
mIPCOpen = true;
|
||||
AddRef();
|
||||
}
|
||||
@ -50,7 +50,7 @@ DOMStorageDBChild::AddIPDLReference()
|
||||
void
|
||||
DOMStorageDBChild::ReleaseIPDLReference()
|
||||
{
|
||||
MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
|
||||
NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference");
|
||||
mIPCOpen = false;
|
||||
Release();
|
||||
}
|
||||
@ -275,7 +275,7 @@ NS_IMPL_RELEASE(DOMStorageDBParent)
|
||||
void
|
||||
DOMStorageDBParent::AddIPDLReference()
|
||||
{
|
||||
MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
|
||||
NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references");
|
||||
mIPCOpen = true;
|
||||
AddRef();
|
||||
}
|
||||
@ -283,7 +283,7 @@ DOMStorageDBParent::AddIPDLReference()
|
||||
void
|
||||
DOMStorageDBParent::ReleaseIPDLReference()
|
||||
{
|
||||
MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
|
||||
NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference");
|
||||
mIPCOpen = false;
|
||||
Release();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user