diff --git a/accessible/src/generic/BaseAccessibles.cpp b/accessible/src/generic/BaseAccessibles.cpp index 0a42d9e6112..e7aa3341e3d 100644 --- a/accessible/src/generic/BaseAccessibles.cpp +++ b/accessible/src/generic/BaseAccessibles.cpp @@ -14,7 +14,6 @@ #include "States.h" #include "nsGUIEvent.h" -#include "nsILink.h" #include "nsINameSpaceManager.h" #include "nsIURI.h" diff --git a/accessible/src/generic/ImageAccessible.cpp b/accessible/src/generic/ImageAccessible.cpp index d5cead3dda1..ec5f085dc1d 100644 --- a/accessible/src/generic/ImageAccessible.cpp +++ b/accessible/src/generic/ImageAccessible.cpp @@ -15,7 +15,6 @@ #include "nsGenericHTMLElement.h" #include "nsIDocument.h" #include "nsIImageLoadingContent.h" -#include "nsILink.h" #include "nsIPresShell.h" #include "nsIServiceManager.h" #include "nsIDOMHTMLImageElement.h" diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 2a143c12d6a..f19d33bda7b 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -624,6 +624,9 @@ pref("network.protocol-handler.expose.news", false); pref("network.protocol-handler.expose.snews", false); pref("network.protocol-handler.expose.nntp", false); +// Warning for about:networking page +pref("network.warnOnAboutNetworking", true); + pref("accessibility.typeaheadfind", false); pref("accessibility.typeaheadfind.timeout", 5000); pref("accessibility.typeaheadfind.linksonly", false); diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index d0003675f3f..1557205137b 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -9,7 +9,7 @@ searchbar { -moz-binding: url("chrome://browser/content/search/search.xml#searchbar"); } -browser[remote="true"] { +.browserStack > browser[remote="true"] { -moz-binding: url("chrome://global/content/bindings/remote-browser.xml#remote-browser"); } diff --git a/browser/base/content/content.js b/browser/base/content/content.js index c95ff003099..ed8262cd56f 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -38,7 +38,11 @@ addMessageListener("Browser:HideSessionRestoreButton", function (message) { } }); -if (!Services.prefs.getBoolPref("browser.tabs.remote")) { +if (Services.prefs.getBoolPref("browser.tabs.remote")) { + addEventListener("contextmenu", function (event) { + sendAsyncMessage("contextmenu", {}, { event: event }); + }, false); +} else { addEventListener("DOMContentLoaded", function(event) { LoginManagerContent.onContentLoaded(event); }); diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 9838b011c30..2a332cd51bf 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -4,6 +4,8 @@ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); +var gContextMenuContentData = null; + function nsContextMenu(aXulMenu, aIsShift) { this.shouldDisplay = true; this.initMenu(aXulMenu, aIsShift); @@ -39,6 +41,7 @@ nsContextMenu.prototype = { }, hiding: function CM_hiding() { + gContextMenuContentData = null; InlineSpellCheckerUI.clearSuggestionsFromMenu(); InlineSpellCheckerUI.clearDictionaryListFromMenu(); InlineSpellCheckerUI.uninit(); @@ -500,6 +503,15 @@ nsContextMenu.prototype = { // Set various context menu attributes based on the state of the world. setTarget: function (aNode, aRangeParent, aRangeOffset) { + // If gContextMenuContentData is not null, this event was forwarded from a + // child process, so use that information instead. + if (gContextMenuContentData) { + this.isRemote = true; + aNode = gContextMenuContentData.event.target; + } else { + this.isRemote = false; + } + const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; if (aNode.namespaceURI == xulNS || aNode.nodeType == Node.DOCUMENT_NODE || @@ -539,11 +551,17 @@ nsContextMenu.prototype = { // Remember the node that was clicked. this.target = aNode; - this.browser = this.target.ownerDocument.defaultView - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShell) - .chromeEventHandler; + // If this is a remote context menu event, use the information from + // gContextMenuContentData instead. + if (this.isRemote) { + this.browser = gContextMenuContentData.browser; + } else { + this.browser = this.target.ownerDocument.defaultView + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler; + } this.onSocial = !!this.browser.getAttribute("origin"); // Check if we are in a synthetic document (stand alone image, video, etc.). @@ -772,10 +790,22 @@ nsContextMenu.prototype = { this.linkProtocol == "snews" ); }, + _unremotePrincipal: function(aRemotePrincipal) { + if (this.isRemote) { + return Cc["@mozilla.org/scriptsecuritymanager;1"] + .getService(Ci.nsIScriptSecurityManager) + .getAppCodebasePrincipal(aRemotePrincipal.URI, + aRemotePrincipal.appId, + aRemotePrincipal.isInBrowserElement); + } + + return aRemotePrincipal; + }, + // Open linked-to URL in a new window. openLink : function () { var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); + urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal)); openLinkIn(this.linkURL, "window", { charset: doc.characterSet, referrerURI: doc.documentURIObject }); @@ -784,7 +814,7 @@ nsContextMenu.prototype = { // Open linked-to URL in a new private window. openLinkInPrivateWindow : function () { var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); + urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal)); openLinkIn(this.linkURL, "window", { charset: doc.characterSet, referrerURI: doc.documentURIObject, @@ -794,7 +824,7 @@ nsContextMenu.prototype = { // Open linked-to URL in a new tab. openLinkInTab: function() { var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); + urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal)); openLinkIn(this.linkURL, "tab", { charset: doc.characterSet, referrerURI: doc.documentURIObject }); @@ -803,7 +833,7 @@ nsContextMenu.prototype = { // open URL in current tab openLinkInCurrent: function() { var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); + urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal)); openLinkIn(this.linkURL, "current", { charset: doc.characterSet, referrerURI: doc.documentURIObject }); @@ -839,7 +869,8 @@ nsContextMenu.prototype = { var doc = this.target.ownerDocument; var frameURL = doc.location.href; - urlSecurityCheck(frameURL, this.browser.contentPrincipal, + urlSecurityCheck(frameURL, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); var referrer = doc.referrer; openUILinkIn(frameURL, "current", { disallowInheritPrincipal: true, @@ -902,7 +933,8 @@ nsContextMenu.prototype = { viewImageDesc: function(e) { var doc = this.target.ownerDocument; - urlSecurityCheck(this.imageDescURL, this.browser.contentPrincipal, + urlSecurityCheck(this.imageDescURL, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); openUILink(this.imageDescURL, e, { disallowInheritPrincipal: true, referrerURI: doc.documentURIObject }); @@ -914,7 +946,7 @@ nsContextMenu.prototype = { reloadImage: function(e) { urlSecurityCheck(this.mediaURL, - this.browser.contentPrincipal, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); if (this.target instanceof Ci.nsIImageLoadingContent) @@ -930,7 +962,7 @@ nsContextMenu.prototype = { else { viewURL = this.mediaURL; urlSecurityCheck(viewURL, - this.browser.contentPrincipal, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); } @@ -940,7 +972,8 @@ nsContextMenu.prototype = { }, saveVideoFrameAsImage: function () { - urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal, + urlSecurityCheck(this.mediaURL, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); let name = ""; try { @@ -973,7 +1006,7 @@ nsContextMenu.prototype = { // Change current window to the URL of the background image. viewBGImage: function(e) { urlSecurityCheck(this.bgImageURL, - this.browser.contentPrincipal, + this._unremotePrincipal(this.browser.contentPrincipal), Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); var doc = this.target.ownerDocument; openUILink(this.bgImageURL, e, { disallowInheritPrincipal: true, @@ -1007,8 +1040,9 @@ nsContextMenu.prototype = { if (this.disableSetDesktopBackground()) return; + var doc = this.target.ownerDocument; urlSecurityCheck(this.target.currentURI.spec, - this.target.ownerDocument.nodePrincipal); + this._unremotePrincipal(doc.nodePrincipal)); // Confirm since it's annoying if you hit this accidentally. const kDesktopBackgroundURL = @@ -1185,7 +1219,7 @@ nsContextMenu.prototype = { linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim(); else linkText = this.linkText(); - urlSecurityCheck(this.linkURL, doc.nodePrincipal); + urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal)); this.saveHelper(this.linkURL, linkText, null, true, doc); }, @@ -1205,12 +1239,14 @@ nsContextMenu.prototype = { true, false, doc.documentURIObject, doc); } else if (this.onImage) { - urlSecurityCheck(this.mediaURL, doc.nodePrincipal); + urlSecurityCheck(this.mediaURL, + this._unremotePrincipal(doc.nodePrincipal)); saveImageURL(this.mediaURL, null, "SaveImageTitle", false, false, doc.documentURIObject, doc); } else if (this.onVideo || this.onAudio) { - urlSecurityCheck(this.mediaURL, doc.nodePrincipal); + urlSecurityCheck(this.mediaURL, + this._unremotePrincipal(doc.nodePrincipal)); var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; this.saveHelper(this.mediaURL, null, dialogTitle, false, doc); } diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index abe689cc58b..ab04ed15904 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -2645,6 +2645,7 @@ } catch (e) { let url = this.mCurrentBrowser.currentURI.spec; this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url)); + throw e; } #endif ]]> @@ -2669,6 +2670,7 @@ } catch (e) { let url = this.mCurrentBrowser.currentURI.spec; this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url)); + throw e; } #endif ]]> @@ -2908,6 +2910,16 @@ let titleChanged = this.setTabTitle(tab); if (titleChanged && !tab.selected && !tab.hasAttribute("busy")) tab.setAttribute("titlechanged", "true"); + break; + case "contextmenu": + gContextMenuContentData = { event: aMessage.objects.event, + browser: browser }; + let popup = browser.ownerDocument.getElementById("contentAreaContextMenu"); + popup.openPopup(browser, "overlap", + gContextMenuContentData.event.clientX, + gContextMenuContentData.event.clientY, + true, false, null); + break; } ]]> @@ -2916,12 +2928,6 @@ @@ -2993,8 +3001,10 @@ document.removeEventListener("keypress", this, false); window.removeEventListener("sizemodechange", this, false); - if (Services.prefs.getBoolPref("browser.tabs.remote")) + if (Services.prefs.getBoolPref("browser.tabs.remote")) { messageManager.removeMessageListener("DOMTitleChanged", this); + messageManager.removeMessageListener("contextmenu", this); + } ]]> diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index ad31ad7ac98..094ce74a8d1 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -465,9 +465,11 @@ function synthesizeNativeMouseEvent(aElement, aMsg, aOffsetX = 0, aOffsetY = 0) let x = aOffsetX + win.mozInnerScreenX + rect.left + rect.width / 2; let y = aOffsetY + win.mozInnerScreenY + rect.top + rect.height / 2; - win.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils) - .sendNativeMouseEvent(x, y, aMsg, 0, null); + let utils = win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + + let scale = utils.screenPixelsPerCSSPixel; + utils.sendNativeMouseEvent(x * scale, y * scale, aMsg, 0, null); } /** diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm index 288ee38b04b..54d6263e518 100644 --- a/browser/components/sessionstore/src/SessionStore.jsm +++ b/browser/components/sessionstore/src/SessionStore.jsm @@ -3007,6 +3007,10 @@ let SessionStoreInternal = { delete this._statesToRestore[aWindow.__SS_restoreID]; delete aWindow.__SS_restoreID; delete this._windows[aWindow.__SSi]._restoring; + + // It's important to set the window state to dirty so that + // we collect their data for the first time when saving state. + this._dirtyWindows[aWindow.__SSi] = true; } if (aTabs.length == 0) { diff --git a/browser/components/sessionstore/test/Makefile.in b/browser/components/sessionstore/test/Makefile.in index 1b744b26b7b..70651b8c2d7 100644 --- a/browser/components/sessionstore/test/Makefile.in +++ b/browser/components/sessionstore/test/Makefile.in @@ -122,6 +122,8 @@ MOCHITEST_BROWSER_FILES = \ browser_628270.js \ browser_635418.js \ browser_636279.js \ + browser_637020.js \ + browser_637020_slow.sjs \ browser_644409-scratchpads.js \ browser_645428.js \ browser_659591.js \ diff --git a/browser/components/sessionstore/test/browser_637020.js b/browser/components/sessionstore/test/browser_637020.js new file mode 100644 index 00000000000..67283759db1 --- /dev/null +++ b/browser/components/sessionstore/test/browser_637020.js @@ -0,0 +1,65 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const TEST_URL = "http://mochi.test:8888/browser/browser/components/" + + "sessionstore/test/browser_637020_slow.sjs"; + +const TEST_STATE = { + windows: [{ + tabs: [ + { entries: [{ url: "about:mozilla" }] }, + { entries: [{ url: "about:robots" }] } + ] + }, { + tabs: [ + { entries: [{ url: TEST_URL }] }, + { entries: [{ url: TEST_URL }] } + ] + }] +}; + +function test() { + TestRunner.run(); +} + +/** + * This test ensures that windows that have just been restored will be marked + * as dirty, otherwise _getCurrentState() might ignore them when collecting + * state for the first time and we'd just save them as empty objects. + * + * The dirty state acts as a cache to not collect data from all windows all the + * time, so at the beginning, each window must be dirty so that we collect + * their state at least once. + */ + +function runTests() { + let win; + + // Wait until the new window has been opened. + Services.obs.addObserver(function onOpened(subject) { + Services.obs.removeObserver(onOpened, "domwindowopened"); + win = subject; + executeSoon(next); + }, "domwindowopened", false); + + // Set the new browser state that will + // restore a window with two slowly loading tabs. + yield SessionStore.setBrowserState(JSON.stringify(TEST_STATE)); + + // The window has now been opened. Check the state that is returned, + // this should come from the cache while the window isn't restored, yet. + info("the window has been opened"); + checkWindows(); + + // The history has now been restored and the tabs are loading. The data must + // now come from the window, if it's correctly been marked as dirty before. + yield whenDelayedStartupFinished(win, next); + info("the delayed startup has finished"); + checkWindows(); +} + +function checkWindows() { + let state = JSON.parse(SessionStore.getBrowserState()); + is(state.windows[0].tabs.length, 2, "first window has two tabs"); + is(state.windows[1].tabs.length, 2, "second window has two tabs"); +} diff --git a/browser/components/sessionstore/test/browser_637020_slow.sjs b/browser/components/sessionstore/test/browser_637020_slow.sjs new file mode 100644 index 00000000000..41da3c2ad9a --- /dev/null +++ b/browser/components/sessionstore/test/browser_637020_slow.sjs @@ -0,0 +1,21 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +const Cc = Components.classes; +const Ci = Components.interfaces; + +const DELAY_MS = "2000"; + +let timer; + +function handleRequest(req, resp) { + resp.processAsync(); + resp.setHeader("Cache-Control", "no-cache", false); + resp.setHeader("Content-Type", "text/html;charset=utf-8", false); + + timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.init(() => { + resp.write("hi"); + resp.finish(); + }, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT); +} diff --git a/browser/metro/base/content/appbar.js b/browser/metro/base/content/appbar.js index db1f4508762..57ff45be3b4 100644 --- a/browser/metro/base/content/appbar.js +++ b/browser/metro/base/content/appbar.js @@ -70,8 +70,8 @@ var Appbar = { }, onDownloadButton: function() { - // TODO: Bug 883962: Toggle the downloads infobar when the - // download button is clicked + let notificationBox = Browser.getNotificationBox(); + notificationBox.notificationsHidden = !notificationBox.notificationsHidden; ContextUI.dismiss(); }, diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index f37dbae47de..f06d5f01427 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -858,15 +858,6 @@ - - - diff --git a/browser/metro/base/content/downloads.js b/browser/metro/base/content/downloads.js index 6c66bcc36c1..730529031c2 100644 --- a/browser/metro/base/content/downloads.js +++ b/browser/metro/base/content/downloads.js @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const URI_GENERIC_ICON_DOWNLOAD = "chrome://browser/skin/images/alert-downloads-30.png"; +const TOAST_URI_GENERIC_ICON_DOWNLOAD = "ms-appx:///metro/chrome/chrome/skin/images/alert-downloads-30.png" var Downloads = { /** @@ -154,29 +155,21 @@ var Downloads = { BrowserUI.newTab(uri, Browser.selectedTab); }, - showAlert: function dh_showAlert(aName, aMessage, aTitle, aIcon) { + showAlert: function dh_showAlert(aName, aMessage, aTitle, aIcon, aObserver) { var notifier = Cc["@mozilla.org/alerts-service;1"] .getService(Ci.nsIAlertsService); - // Callback for tapping on the alert popup - let observer = { - observe: function (aSubject, aTopic, aData) { - if (aTopic == "alertclickcallback") { - // TODO: Bug 783232 turns this alert into a native toast. - } - } - }; - if (!aTitle) aTitle = Strings.browser.GetStringFromName("alertDownloads"); if (!aIcon) - aIcon = URI_GENERIC_ICON_DOWNLOAD; + aIcon = TOAST_URI_GENERIC_ICON_DOWNLOAD; - notifier.showAlertNotification(aIcon, aTitle, aMessage, true, "", observer, aName); + notifier.showAlertNotification(aIcon, aTitle, aMessage, true, "", aObserver, aName); }, showNotification: function dh_showNotification(title, msg, buttons, priority) { + this._notificationBox.notificationsHidden = false; return this._notificationBox.appendNotification(msg, title, URI_GENERIC_ICON_DOWNLOAD, @@ -257,6 +250,53 @@ var Downloads = { this._notificationBox.PRIORITY_WARNING_MEDIUM); }, + _showDownloadCompleteToast: function (aDownload) { + let name = "DownloadComplete"; + let msg = ""; + let title = ""; + let observer = null; + if (this._downloadCount > 1) { + title = PluralForm.get(this._downloadCount, + Strings.browser.GetStringFromName("alertMultipleDownloadsComplete")) + .replace("#1", this._downloadCount) + msg = PluralForm.get(2, Strings.browser.GetStringFromName("downloadShowInFiles")); + + observer = { + observe: function (aSubject, aTopic, aData) { + switch (aTopic) { + case "alertclickcallback": + let fileURI = aDownload.target; + let file = Downloads._getLocalFile(fileURI); + file.reveal(); + + let downloadCompleteNotification = + Downloads._notificationBox.getNotificationWithValue("download-complete"); + Downloads._notificationBox.removeNotification(downloadCompleteNotification); + break; + } + } + } + } else { + title = Strings.browser.formatStringFromName("alertDownloadsDone", + [aDownload.displayName], 1); + msg = Strings.browser.GetStringFromName("downloadRunNow"); + observer = { + observe: function (aSubject, aTopic, aData) { + switch (aTopic) { + case "alertclickcallback": + Downloads.openDownload(aDownload); + + let downloadCompleteNotification = + Downloads._notificationBox.getNotificationWithValue("download-complete"); + Downloads._notificationBox.removeNotification(downloadCompleteNotification); + break; + } + } + } + } + this.showAlert(name, msg, title, null, observer); + }, + _updateCircularProgressMeter: function dv_updateCircularProgressMeter() { if (!this._progressNotificationInfo) { return; @@ -391,6 +431,7 @@ var Downloads = { this._runDownloadBooleanMap.delete(download.targetFile.path); if (this._downloadsInProgress == 0) { if (this._downloadCount > 1 || !runAfterDownload) { + this._showDownloadCompleteToast(download); this._showDownloadCompleteNotification(download); } this._progressNotificationInfo.clear(); diff --git a/browser/metro/base/content/helperui/AlertsHelper.js b/browser/metro/base/content/helperui/AlertsHelper.js index 9e101b35148..6095a5d9b37 100644 --- a/browser/metro/base/content/helperui/AlertsHelper.js +++ b/browser/metro/base/content/helperui/AlertsHelper.js @@ -3,80 +3,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var AlertsHelper = { - _timeoutID: -1, _listener: null, _cookie: "", - _clickable: false, - get container() { - delete this.container; - let container = document.getElementById("alerts-container"); - - let self = this; - container.addEventListener("transitionend", function() { - self.alertTransitionOver(); - }, true); - - return this.container = container; - }, showAlertNotification: function ah_show(aImageURL, aTitle, aText, aTextClickable, aCookie, aListener) { - this._clickable = aTextClickable || false; - this._listener = aListener || null; - this._cookie = aCookie || ""; + Services.obs.addObserver(this, "metro_native_toast_clicked", false); + this._listener = aListener; + this._cookie = aCookie; - // Reset the container settings from the last time so layout can happen naturally - let container = this.container; - container.removeAttribute("width"); - let alertText = document.getElementById("alerts-text"); - alertText.style.whiteSpace = ""; - - document.getElementById("alerts-image").setAttribute("src", aImageURL); - document.getElementById("alerts-title").value = aTitle; - alertText.textContent = aText; - - container.hidden = false; - let bcr = container.getBoundingClientRect(); - if (bcr.width > window.innerWidth - 50) { - // If the window isn't wide enough, we need to re-layout - container.setAttribute("width", window.innerWidth - 50); // force a max width - alertText.style.whiteSpace = "pre-wrap"; // wrap text as needed - bcr = container.getBoundingClientRect(); // recalculate the bcr - } - container.setAttribute("width", bcr.width); // redundant but cheap - container.setAttribute("height", bcr.height); - - container.classList.add("showing"); - - let timeout = Services.prefs.getIntPref("alerts.totalOpenTime"); - let self = this; - if (this._timeoutID) - clearTimeout(this._timeoutID); - this._timeoutID = setTimeout(function() { self._timeoutAlert(); }, timeout); + MetroUtils.showNativeToast(aTitle, aText, aImageURL); }, - _timeoutAlert: function ah__timeoutAlert() { - this._timeoutID = -1; - - this.container.classList.remove("showing"); - if (this._listener) - this._listener.observe(null, "alertfinished", this._cookie); - }, - - alertTransitionOver: function ah_alertTransitionOver() { - let container = this.container; - if (!container.classList.contains("showing")) { - container.height = 0; - container.hidden = true; - } - }, - - click: function ah_click(aEvent) { - if (this._clickable && this._listener) - this._listener.observe(null, "alertclickcallback", this._cookie); - - if (this._timeoutID != -1) { - clearTimeout(this._timeoutID); - this._timeoutAlert(); + observe: function(aSubject, aTopic, aData) { + switch (aTopic) { + case "metro_native_toast_clicked": + Services.obs.removeObserver(this, "metro_native_toast_clicked"); + this._listener.observe(null, "alertclickcallback", this._cookie); + break; } } }; diff --git a/browser/metro/components/AlertsService.js b/browser/metro/components/AlertsService.js index e07e38f5f6a..436ad842cd3 100644 --- a/browser/metro/components/AlertsService.js +++ b/browser/metro/components/AlertsService.js @@ -20,7 +20,28 @@ AlertsService.prototype = { showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener, aName) { let browser = Services.wm.getMostRecentWindow("navigator:browser"); - browser.AlertsHelper.showAlertNotification(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener); + try { + browser.AlertsHelper.showAlertNotification(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener); + } catch (ex) { + let chromeWin = this._getChromeWindow(browser).wrappedJSObject; + let notificationBox = chromeWin.Browser.getNotificationBox(); + notificationBox.appendNotification(aTitle, + aText, + aImageUrl, + notificationBox.PRIORITY_WARNING_MEDIUM, + null); + } + }, + + _getChromeWindow: function (aWindow) { + let chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem) + .rootTreeItem + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindow) + .QueryInterface(Ci.nsIDOMChromeWindow); + return chromeWin; } }; diff --git a/browser/metro/components/HelperAppDialog.js b/browser/metro/components/HelperAppDialog.js index b24a4ae2906..2eb8918d554 100644 --- a/browser/metro/components/HelperAppDialog.js +++ b/browser/metro/components/HelperAppDialog.js @@ -101,6 +101,7 @@ HelperAppLauncherDialog.prototype = { .replace("#2", downloadSize) .replace("#3", aLauncher.source.host); + notificationBox.notificationsHidden = false; let newBar = notificationBox.appendNotification(msg, "save-download", URI_GENERIC_ICON_DOWNLOAD, diff --git a/browser/metro/locales/en-US/chrome/browser.properties b/browser/metro/locales/en-US/chrome/browser.properties index 702e673a043..d919c1b2fab 100644 --- a/browser/metro/locales/en-US/chrome/browser.properties +++ b/browser/metro/locales/en-US/chrome/browser.properties @@ -61,6 +61,7 @@ downloadRun=Run downloadSave=Save downloadCancel=Cancel downloadTryAgain=Try Again +downloadRunNow=Run it now # LOCALIZATION NOTE (downloadShowInFiles): 'Files' refers to the Windows 8 file explorer downloadShowInFiles=Show in Files diff --git a/browser/metro/theme/browser.css b/browser/metro/theme/browser.css index 96a91288e22..74fb2efea2e 100644 --- a/browser/metro/theme/browser.css +++ b/browser/metro/theme/browser.css @@ -1245,37 +1245,4 @@ setting[type="radio"] > vbox { #clear-notification-done { font-weight: bold; -} - -/* Alert Popup ============================================================= */ - -#alerts-container { - color: white; - background-color: #5e6166; - border: @border_width_small@ solid #767973; - border-radius: @border_radius_normal@; - box-shadow: black 0 @border_radius_tiny@ @border_radius_tiny@; - padding: @padding_normal@; /* core spacing on top/bottom */ - margin-bottom: @margin_large@; - transition-property: opacity; - transition-duration: 0.5s; - opacity: 0; -} - -#alerts-container.showing { - opacity: 1; -} - -#alerts-title { - font-size: @font_small@ !important; -} - -#alerts-text { - font-size: @font_xsmall@ !important; - white-space: pre; -} - -#alerts-container { - -moz-margin-end: @margin_large@; -} - +} \ No newline at end of file diff --git a/browser/themes/linux/devtools/debugger.css b/browser/themes/linux/devtools/debugger.css index 569619878e5..2c61091b06b 100644 --- a/browser/themes/linux/devtools/debugger.css +++ b/browser/themes/linux/devtools/debugger.css @@ -50,6 +50,10 @@ background-position: 0 0; } +.side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents { + color: #888; +} + .side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents > .dbg-breakpoint { display: none; } diff --git a/browser/themes/osx/devtools/debugger.css b/browser/themes/osx/devtools/debugger.css index 2daac8f51b6..63469ed16aa 100644 --- a/browser/themes/osx/devtools/debugger.css +++ b/browser/themes/osx/devtools/debugger.css @@ -52,6 +52,10 @@ background-position: 0 0; } +.side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents { + color: #888; +} + .side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents > .dbg-breakpoint { display: none; } diff --git a/browser/themes/windows/devtools/debugger.css b/browser/themes/windows/devtools/debugger.css index becede062dc..cad6aac1952 100644 --- a/browser/themes/windows/devtools/debugger.css +++ b/browser/themes/windows/devtools/debugger.css @@ -50,6 +50,10 @@ background-position: 0 0; } +.side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents { + color: #888; +} + .side-menu-widget-item-checkbox:not([checked]) ~ .side-menu-widget-item-contents > .dbg-breakpoint { display: none; } diff --git a/build/ConfigStatus.py b/build/ConfigStatus.py index d424f31c1c9..b4fad204a13 100644 --- a/build/ConfigStatus.py +++ b/build/ConfigStatus.py @@ -19,8 +19,7 @@ from mozbuild.backend.configenvironment import ConfigEnvironment from mozbuild.backend.recursivemake import RecursiveMakeBackend from mozbuild.frontend.emitter import TreeMetadataEmitter from mozbuild.frontend.reader import BuildReader - -from Preprocessor import Preprocessor +from mozbuild.mozinfo import write_mozinfo log_manager = LoggingManager() @@ -87,6 +86,11 @@ def config_status(topobjdir = '.', topsrcdir = '.', env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines, non_global_defines=non_global_defines, substs=substs) + # mozinfo.json only needs written if configure changes and configure always + # passes this environment variable. + if 'WRITE_MOZINFO' in os.environ: + write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ) + reader = BuildReader(env) emitter = TreeMetadataEmitter(env) backend = RecursiveMakeBackend(env) diff --git a/build/automation.py.in b/build/automation.py.in index 343a69885f3..fdab1b34f4d 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -518,9 +518,18 @@ class Automation(object): # Only 2 GB RAM or less available? Use custom ASan options to reduce # the amount of resources required to do the tests. Standard options # will otherwise lead to OOM conditions on the current test slaves. + # + # If we have more than 2 GB or RAM but still less than 4 GB, we need + # another set of options to prevent OOM in some memory-intensive + # tests. if totalMemory <= 1024 * 1024 * 2: self.log.info("INFO | automation.py | ASan running in low-memory configuration") env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64" + elif totalMemory <= 1024 * 1024 * 4: + self.log.info("INFO | automation.py | ASan running in mid-memory configuration") + env["ASAN_OPTIONS"] = "quarantine_size=100663296:redzone=64" + else: + self.log.info("INFO | automation.py | ASan running in default memory configuration") except OSError,err: self.log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror) except: diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 6abb80143ee..d621bd8e4c0 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -432,17 +432,17 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx) NS_ASSERTION(ssm, "Failed to get security manager service"); if (!ssm) - return JS_FALSE; + return false; nsresult rv; nsIPrincipal* subjectPrincipal = ssm->GetSubjectPrincipal(cx, &rv); NS_ASSERTION(NS_SUCCEEDED(rv), "CSP: Failed to get nsIPrincipal from js context"); if (NS_FAILED(rv)) - return JS_FALSE; // Not just absence of principal, but failure. + return false; // Not just absence of principal, but failure. if (!subjectPrincipal) - return JS_TRUE; + return true; nsCOMPtr csp; rv = subjectPrincipal->GetCsp(getter_AddRefs(csp)); @@ -450,7 +450,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx) // don't do anything unless there's a CSP if (!csp) - return JS_TRUE; + return true; bool evalOK = true; bool reportViolation = false; @@ -459,7 +459,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx) if (NS_FAILED(rv)) { NS_WARNING("CSP: failed to get allowsEval"); - return JS_TRUE; // fail open to not break sites. + return true; // fail open to not break sites. } if (reportViolation) { @@ -494,7 +494,7 @@ nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle NS_WARN_IF_FALSE(ssm, "Failed to get security manager service"); if (!ssm) - return JS_FALSE; + return false; // Get the object being accessed. We protect these cases: // 1. The Function.prototype.caller property's value, which might lead @@ -515,9 +515,9 @@ nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle (int32_t)nsIXPCSecurityManager::ACCESS_GET_PROPERTY); if (NS_FAILED(rv)) - return JS_FALSE; // Security check failed (XXX was an error reported?) + return false; // Security check failed (XXX was an error reported?) - return JS_TRUE; + return true; } NS_IMETHODIMP diff --git a/config/tests/unit-writemozinfo.py b/config/tests/unit-writemozinfo.py deleted file mode 100755 index e527fb08880..00000000000 --- a/config/tests/unit-writemozinfo.py +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python -import unittest -import json, os, sys, time, tempfile -from StringIO import StringIO -import mozunit - -from writemozinfo import build_dict, write_json - -class TestBuildDict(unittest.TestCase): - def testMissing(self): - """ - Test that missing required values raises. - """ - self.assertRaises(Exception, build_dict, {'OS_TARGET':'foo'}) - self.assertRaises(Exception, build_dict, {'TARGET_CPU':'foo'}) - self.assertRaises(Exception, build_dict, {'MOZ_WIDGET_TOOLKIT':'foo'}) - - def testWin(self): - d = build_dict({'OS_TARGET':'WINNT', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'windows'}) - self.assertEqual('win', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('windows', d['toolkit']) - self.assertEqual(32, d['bits']) - - def testLinux(self): - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual('linux', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('gtk2', d['toolkit']) - self.assertEqual(32, d['bits']) - - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'x86_64', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual('linux', d['os']) - self.assertEqual('x86_64', d['processor']) - self.assertEqual('gtk2', d['toolkit']) - self.assertEqual(64, d['bits']) - - def testMac(self): - d = build_dict({'OS_TARGET':'Darwin', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'cocoa'}) - self.assertEqual('mac', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('cocoa', d['toolkit']) - self.assertEqual(32, d['bits']) - - d = build_dict({'OS_TARGET':'Darwin', - 'TARGET_CPU':'x86_64', - 'MOZ_WIDGET_TOOLKIT':'cocoa'}) - self.assertEqual('mac', d['os']) - self.assertEqual('x86_64', d['processor']) - self.assertEqual('cocoa', d['toolkit']) - self.assertEqual(64, d['bits']) - - def testMacUniversal(self): - d = build_dict({'OS_TARGET':'Darwin', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'cocoa', - 'UNIVERSAL_BINARY': '1'}) - self.assertEqual('mac', d['os']) - self.assertEqual('universal-x86-x86_64', d['processor']) - self.assertEqual('cocoa', d['toolkit']) - self.assertFalse('bits' in d) - - d = build_dict({'OS_TARGET':'Darwin', - 'TARGET_CPU':'x86_64', - 'MOZ_WIDGET_TOOLKIT':'cocoa', - 'UNIVERSAL_BINARY': '1'}) - self.assertEqual('mac', d['os']) - self.assertEqual('universal-x86-x86_64', d['processor']) - self.assertEqual('cocoa', d['toolkit']) - self.assertFalse('bits' in d) - - def testAndroid(self): - d = build_dict({'OS_TARGET':'Android', - 'TARGET_CPU':'arm', - 'MOZ_WIDGET_TOOLKIT':'android'}) - self.assertEqual('android', d['os']) - self.assertEqual('arm', d['processor']) - self.assertEqual('android', d['toolkit']) - self.assertEqual(32, d['bits']) - - def testX86(self): - """ - Test that various i?86 values => x86. - """ - d = build_dict({'OS_TARGET':'WINNT', - 'TARGET_CPU':'i486', - 'MOZ_WIDGET_TOOLKIT':'windows'}) - self.assertEqual('x86', d['processor']) - - d = build_dict({'OS_TARGET':'WINNT', - 'TARGET_CPU':'i686', - 'MOZ_WIDGET_TOOLKIT':'windows'}) - self.assertEqual('x86', d['processor']) - - def testARM(self): - """ - Test that all arm CPU architectures => arm. - """ - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'arm', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual('arm', d['processor']) - - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'armv7', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual('arm', d['processor']) - - def testUnknown(self): - """ - Test that unknown values pass through okay. - """ - d = build_dict({'OS_TARGET':'RandOS', - 'TARGET_CPU':'cptwo', - 'MOZ_WIDGET_TOOLKIT':'foobar'}) - self.assertEqual("randos", d["os"]) - self.assertEqual("cptwo", d["processor"]) - self.assertEqual("foobar", d["toolkit"]) - # unknown CPUs should not get a bits value - self.assertFalse("bits" in d) - - def testDebug(self): - """ - Test that debug values are properly detected. - """ - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual(False, d['debug']) - - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'gtk2', - 'MOZ_DEBUG':'1'}) - self.assertEqual(True, d['debug']) - - def testCrashreporter(self): - """ - Test that crashreporter values are properly detected. - """ - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'gtk2'}) - self.assertEqual(False, d['crashreporter']) - - d = build_dict({'OS_TARGET':'Linux', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'gtk2', - 'MOZ_CRASHREPORTER':'1'}) - self.assertEqual(True, d['crashreporter']) - -class TestWriteJson(unittest.TestCase): - """ - Test the write_json function. - """ - def setUp(self): - fd, self.f = tempfile.mkstemp() - os.close(fd) - - def tearDown(self): - os.unlink(self.f) - - def testBasic(self): - """ - Test that writing to a file produces correct output. - """ - write_json(self.f, env={'OS_TARGET':'WINNT', - 'TARGET_CPU':'i386', - 'TOPSRCDIR':'/tmp', - 'MOZCONFIG':'foo', - 'MOZ_WIDGET_TOOLKIT':'windows'}) - with open(self.f) as f: - d = json.load(f) - self.assertEqual('win', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('windows', d['toolkit']) - self.assertEqual('/tmp', d['topsrcdir']) - self.assertEqual(os.path.normpath('/tmp/foo'), d['mozconfig']) - self.assertEqual(32, d['bits']) - - def testFileObj(self): - """ - Test that writing to a file-like object produces correct output. - """ - s = StringIO() - write_json(s, env={'OS_TARGET':'WINNT', - 'TARGET_CPU':'i386', - 'MOZ_WIDGET_TOOLKIT':'windows'}) - d = json.loads(s.getvalue()) - self.assertEqual('win', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('windows', d['toolkit']) - self.assertEqual(32, d['bits']) - -if __name__ == '__main__': - mozunit.main() diff --git a/configure.in b/configure.in index 35444551012..c39516f33b0 100644 --- a/configure.in +++ b/configure.in @@ -9054,7 +9054,9 @@ xpcom/xpcom-private.h AC_SUBST(STLPORT_LIBS) +export WRITE_MOZINFO=1 AC_OUTPUT([mozilla-config.h]) +unset WRITE_MOZINFO # Hack around an Apple bug that affects the egrep that comes with OS X 10.7. # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit @@ -9201,24 +9203,6 @@ dnl so that regeneration via dependencies works correctly fi fi -# Generate a JSON config file for unittest harnesses etc to read -# build configuration details from in a standardized way. -OS_TARGET=${OS_TARGET} \ -TARGET_CPU=${TARGET_CPU} \ -MOZ_DEBUG=${MOZ_DEBUG} \ -MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \ -UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \ -MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \ -MOZ_APP_NAME=${MOZ_APP_NAME} \ -TOPSRCDIR=${_topsrcdir} \ -MOZ_ASAN=${MOZ_ASAN} \ - $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp -if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then - rm ./mozinfo.json.tmp -else - mv -f ./mozinfo.json.tmp ./mozinfo.json -fi - # Run jemalloc configure script if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then diff --git a/content/base/public/DirectionalityUtils.h b/content/base/public/DirectionalityUtils.h index 54a78682e34..85a7e78031b 100644 --- a/content/base/public/DirectionalityUtils.h +++ b/content/base/public/DirectionalityUtils.h @@ -95,8 +95,12 @@ void SetDirectionFromNewTextNode(nsIContent* aTextNode); /** * When a text node is removed from a document, find any ancestors whose * directionality it determined and redetermine their directionality + * + * @param aTextNode the text node + * @param aNullParent whether the the parent is also being removed + * (passed from UnbindFromTree) */ -void ResetDirectionSetByTextNode(nsTextNode* aTextNode); +void ResetDirectionSetByTextNode(nsTextNode* aTextNode, bool aNullParent); /** * Set the directionality of an element according to the directionality of the diff --git a/content/base/public/Element.h b/content/base/public/Element.h index 4cef125dfd4..10ee69a8c77 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -133,6 +133,8 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID) + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + /** * Method to get the full state of this element. See nsEventStates.h for * the possible bits that could be set here. diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 1e01d5bb56d..495b8a18f69 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -172,12 +172,6 @@ public: NS_DECL_SIZEOF_EXCLUDING_THIS - /** - * Called during QueryInterface to give the binding manager a chance to - * get an interface for this element. - */ - nsresult PostQueryInterface(REFNSIID aIID, void** aInstancePtr); - // nsINode interface methods virtual uint32_t GetChildCount() const MOZ_OVERRIDE; virtual nsIContent *GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE; @@ -402,16 +396,4 @@ protected: rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr); \ NS_INTERFACE_TABLE_TO_MAP_SEGUE -#define NS_ELEMENT_INTERFACE_MAP_END \ - { \ - return PostQueryInterface(aIID, aInstancePtr); \ - } \ - \ - NS_ADDREF(foundInterface); \ - \ - *aInstancePtr = foundInterface; \ - \ - return NS_OK; \ - } - #endif /* FragmentOrElement_h___ */ diff --git a/content/base/public/nsCopySupport.h b/content/base/public/nsCopySupport.h index 28905ae5a2d..cc4200c2db7 100644 --- a/content/base/public/nsCopySupport.h +++ b/content/base/public/nsCopySupport.h @@ -80,11 +80,14 @@ class nsCopySupport * responsible for removing the content during a cut operation if true is * returned. * + * aClipboardType specifies which clipboard to use, from nsIClipboard. + * * If the event is cancelled or an error occurs, false will be returned. */ static bool FireClipboardEvent(int32_t aType, - nsIPresShell* aPresShell, - nsISelection* aSelection); + int32_t aClipboardType, + nsIPresShell* aPresShell, + nsISelection* aSelection); }; #endif diff --git a/content/base/src/DirectionalityUtils.cpp b/content/base/src/DirectionalityUtils.cpp index ccf6e926537..82df7e011cf 100644 --- a/content/base/src/DirectionalityUtils.cpp +++ b/content/base/src/DirectionalityUtils.cpp @@ -502,7 +502,7 @@ private: nsINode* oldTextNode = static_cast(aData); Element* rootNode = aEntry->GetKey(); nsINode* newTextNode = nullptr; - if (rootNode->HasDirAuto()) { + if (oldTextNode && rootNode->HasDirAuto()) { newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true, oldTextNode); } @@ -529,6 +529,11 @@ public: mElements.EnumerateEntries(SetNodeDirection, &aDir); } + void ClearAutoDirection() + { + mElements.EnumerateEntries(ResetNodeDirection, nullptr); + } + void ResetAutoDirection(nsINode* aTextNode) { mElements.EnumerateEntries(ResetNodeDirection, aTextNode); @@ -565,6 +570,13 @@ public: GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir); } + static void ClearTextNodeDirection(nsINode* aTextNode) + { + MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(), + "Map missing in ResetTextNodeDirection"); + GetDirectionalityMap(aTextNode)->ClearAutoDirection(); + } + static void ResetTextNodeDirection(nsINode* aTextNode) { MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(), @@ -871,7 +883,7 @@ SetDirectionFromNewTextNode(nsIContent* aTextNode) } void -ResetDirectionSetByTextNode(nsTextNode* aTextNode) +ResetDirectionSetByTextNode(nsTextNode* aTextNode, bool aNullParent) { if (!NodeAffectsDirAutoAncestor(aTextNode)) { nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode); @@ -880,7 +892,11 @@ ResetDirectionSetByTextNode(nsTextNode* aTextNode) Directionality dir = GetDirectionFromText(aTextNode->GetText()); if (dir != eDir_NotSet && aTextNode->HasTextNodeDirectionalityMap()) { - nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode); + if (aNullParent) { + nsTextNodeDirectionalityMap::ClearTextNodeDirection(aTextNode); + } else { + nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode); + } } } diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index def276fd859..6e52fe6e41c 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -127,11 +127,27 @@ #include "nsXBLService.h" #include "nsContentCID.h" #include "nsITextControlElement.h" +#include "nsISupportsImpl.h" #include "mozilla/dom/DocumentFragment.h" using namespace mozilla; using namespace mozilla::dom; +NS_IMETHODIMP +Element::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_ASSERTION(aInstancePtr, + "QueryInterface requires a non-NULL destination!"); + nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr); + if (NS_SUCCEEDED(rv)) { + return NS_OK; + } + + // Give the binding manager a chance to get an interface for this element. + return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID, + aInstancePtr); +} + nsEventStates Element::IntrinsicState() const { diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index d668ab61afa..53dd89a6457 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -106,7 +106,6 @@ #include "nsIXULDocument.h" #endif /* MOZ_XUL */ -#include "nsCycleCollectionParticipant.h" #include "nsCCUncollectableMarker.h" #include "mozAutoDocUpdate.h" @@ -1750,13 +1749,6 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(FragmentOrElement) NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(FragmentOrElement, nsNodeUtils::LastRelease(this)) -nsresult -FragmentOrElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID, - aInstancePtr); -} - //---------------------------------------------------------------------- nsresult diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 86763a14a9a..25a8fcf5a34 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -52,6 +52,9 @@ #include "imgIRequest.h" #include "nsDOMDataTransfer.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLAreaElement.h" + +using mozilla::dom::HTMLAreaElement; class MOZ_STACK_CLASS DragDataProducer { @@ -505,10 +508,11 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer, if (area) { // use the alt text (or, if missing, the href) as the title - area->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString); + HTMLAreaElement* areaElem = static_cast(area.get()); + areaElem->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString); if (mTitleString.IsEmpty()) { // this can be a relative link - area->GetAttribute(NS_LITERAL_STRING("href"), mTitleString); + areaElem->GetAttribute(NS_LITERAL_STRING("href"), mTitleString); } // we'll generate HTML like alt text diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 235652f3852..7db0f1561ba 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -4960,7 +4960,7 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent) // means, for instance calling the drag service directly, or a drag // from another application. In either case, a new dataTransfer should // be created that reflects the data. - initialDataTransfer = new nsDOMDataTransfer(aDragEvent->message, true); + initialDataTransfer = new nsDOMDataTransfer(aDragEvent->message, true, -1); NS_ENSURE_TRUE(initialDataTransfer, NS_ERROR_OUT_OF_MEMORY); diff --git a/content/base/src/nsCopySupport.cpp b/content/base/src/nsCopySupport.cpp index 6f249da5629..796fff3e51c 100644 --- a/content/base/src/nsCopySupport.cpp +++ b/content/base/src/nsCopySupport.cpp @@ -573,7 +573,7 @@ nsCopySupport::CanCopy(nsIDocument* aDocument) } bool -nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISelection* aSelection) +nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPresShell* aPresShell, nsISelection* aSelection) { NS_ASSERTION(aType == NS_CUT || aType == NS_COPY || aType == NS_PASTE, "Invalid clipboard event type"); @@ -633,7 +633,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe bool doDefault = true; nsRefPtr clipboardData; if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) { - clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE); + clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE, aClipboardType); nsEventStatus status = nsEventStatus_eIgnore; nsClipboardEvent evt(true, aType); @@ -675,7 +675,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe return false; } // call the copy code - rv = HTMLCopy(sel, doc, nsIClipboard::kGlobalClipboard); + rv = HTMLCopy(sel, doc, aClipboardType); if (NS_FAILED(rv)) { return false; } @@ -692,7 +692,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe NS_ENSURE_TRUE(transferable, false); // put the transferable on the clipboard - rv = clipboard->SetData(transferable, nullptr, nsIClipboard::kGlobalClipboard); + rv = clipboard->SetData(transferable, nullptr, aClipboardType); if (NS_FAILED(rv)) { return false; } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 49140402c9b..d56e2cdd73c 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -112,7 +112,6 @@ #include "nsHTMLDocument.h" #include "nsIDOMHTMLFormElement.h" #include "nsIRequest.h" -#include "nsILink.h" #include "nsHostObjectProtocolHandler.h" #include "nsCharsetAlias.h" @@ -149,6 +148,7 @@ #include "nsObjectLoadingContent.h" #include "nsHtml5TreeOpExecutor.h" #include "nsIDOMElementReplaceEvent.h" +#include "mozilla/dom/HTMLLinkElement.h" #include "mozilla/dom/HTMLMediaElement.h" #ifdef MOZ_WEBRTC #include "IPeerConnection.h" @@ -194,6 +194,7 @@ #include "mozilla/dom/DocumentFragment.h" #include "mozilla/dom/WebComponentsBinding.h" #include "mozilla/dom/HTMLBodyElement.h" +#include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/NodeFilterBinding.h" #include "mozilla/dom/UndoManager.h" #include "nsFrame.h" @@ -7590,7 +7591,7 @@ nsDocument::Sanitize() for (uint32_t i = 0; i < length; ++i) { NS_ASSERTION(nodes->Item(i), "null item in node list!"); - nsCOMPtr input = do_QueryInterface(nodes->Item(i)); + nsRefPtr input = HTMLInputElement::FromContentOrNull(nodes->Item(i)); if (!input) continue; @@ -7606,8 +7607,7 @@ nsDocument::Sanitize() } if (resetValue) { - nsCOMPtr fc = do_QueryInterface(input); - fc->Reset(); + input->Reset(); } } @@ -7622,7 +7622,8 @@ nsDocument::Sanitize() if (!form) continue; - form->GetAttribute(NS_LITERAL_STRING("autocomplete"), value); + nodes->Item(i)->AsElement()->GetAttr(kNameSpaceID_None, + nsGkAtoms::autocomplete, value); if (value.LowerCaseEqualsLiteral("off")) form->Reset(); } @@ -8066,15 +8067,12 @@ nsDocument::OnPageShow(bool aPersisted, if (aPersisted && root) { // Send out notifications that our elements are attached. nsRefPtr links = NS_GetContentList(root, - kNameSpaceID_Unknown, + kNameSpaceID_XHTML, NS_LITERAL_STRING("link")); uint32_t linkCount = links->Length(true); for (uint32_t i = 0; i < linkCount; ++i) { - nsCOMPtr link = do_QueryInterface(links->Item(i, false)); - if (link) { - link->LinkAdded(); - } + static_cast(links->Item(i, false))->LinkAdded(); } } @@ -8130,15 +8128,12 @@ nsDocument::OnPageHide(bool aPersisted, Element* root = GetRootElement(); if (aPersisted && root) { nsRefPtr links = NS_GetContentList(root, - kNameSpaceID_Unknown, + kNameSpaceID_XHTML, NS_LITERAL_STRING("link")); uint32_t linkCount = links->Length(true); for (uint32_t i = 0; i < linkCount; ++i) { - nsCOMPtr link = do_QueryInterface(links->Item(i, false)); - if (link) { - link->LinkRemoved(); - } + static_cast(links->Item(i, false))->LinkRemoved(); } } diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 11937f1cafb..d13a1daf536 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -1479,10 +1479,10 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI) } if (domapplet || domobject) { if (domapplet) { - parent = domapplet; + parent = do_QueryInterface(domapplet); } else { - parent = domobject; + parent = do_QueryInterface(domobject); } nsCOMPtr mydomNode = do_QueryInterface(mydomElement); if (parent == mydomNode) { diff --git a/content/base/src/nsTextNode.cpp b/content/base/src/nsTextNode.cpp index 1af16a61ad4..41e345c66af 100644 --- a/content/base/src/nsTextNode.cpp +++ b/content/base/src/nsTextNode.cpp @@ -147,7 +147,7 @@ nsTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent, void nsTextNode::UnbindFromTree(bool aDeep, bool aNullParent) { - ResetDirectionSetByTextNode(this); + ResetDirectionSetByTextNode(this, aNullParent); nsGenericDOMDataNode::UnbindFromTree(aDeep, aNullParent); } diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index ce97bb786e9..aba5a595458 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -755,6 +755,7 @@ void CanvasRenderingContext2D::Demote() RefPtr snapshot = mTarget->Snapshot(); RefPtr oldTarget = mTarget; mTarget = nullptr; + mResetLayer = true; mForceSoftware = true; // Recreate target, now demoted to software only @@ -3039,6 +3040,24 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image RedrawUser(gfxRect(dx, dy, dw, dh)); } +#ifdef USE_SKIA_GPU +static bool +IsStandardCompositeOp(CompositionOp op) +{ + return (op == OP_SOURCE || + op == OP_ATOP || + op == OP_IN || + op == OP_OUT || + op == OP_OVER || + op == OP_DEST_IN || + op == OP_DEST_OUT || + op == OP_DEST_OVER || + op == OP_DEST_ATOP || + op == OP_ADD || + op == OP_XOR); +} +#endif + void CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op, ErrorResult& error) @@ -3078,6 +3097,12 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op, // XXX ERRMSG we need to report an error to developers here! (bug 329026) else return; +#ifdef USE_SKIA_GPU + if (!IsStandardCompositeOp(comp_op)) { + Demote(); + } +#endif + #undef CANVAS_OP_TO_GFX_OP CurrentState().op = comp_op; } @@ -3122,6 +3147,12 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op, error.Throw(NS_ERROR_FAILURE); } +#ifdef USE_SKIA_GPU + if (!IsStandardCompositeOp(comp_op)) { + Demote(); + } +#endif + #undef CANVAS_OP_TO_GFX_OP } diff --git a/content/canvas/test/Makefile.in b/content/canvas/test/Makefile.in index d8aad5d5cb1..3df57447e1f 100644 --- a/content/canvas/test/Makefile.in +++ b/content/canvas/test/Makefile.in @@ -89,9 +89,6 @@ MOCHITEST_FILES = \ test_windingRuleUndefined.html \ $(NULL) -ifneq ($(MOZ_WIDGET_TOOLKIT), android) -ifneq ($(MOZ_WIDGET_TOOLKIT), gonk) - # SkiaGL on Android/Gonk does not implement these composite ops yet MOCHITEST_FILES += \ @@ -123,9 +120,6 @@ MOCHITEST_FILES += \ test_2d.composite.solid.soft-light.html \ $(NULL) -endif -endif - ifneq (1_Linux,$(MOZ_SUITE)_$(OS_ARCH)) # This test fails in Suite on Linux for some reason, disable it there MOCHITEST_FILES += test_2d.composite.uncovered.image.destination-atop.html diff --git a/content/events/src/nsDOMClipboardEvent.cpp b/content/events/src/nsDOMClipboardEvent.cpp index baf1025422c..7ebde924e2a 100644 --- a/content/events/src/nsDOMClipboardEvent.cpp +++ b/content/events/src/nsDOMClipboardEvent.cpp @@ -7,6 +7,7 @@ #include "nsContentUtils.h" #include "nsClientRect.h" #include "nsDOMDataTransfer.h" +#include "nsIClipboard.h" nsDOMClipboardEvent::nsDOMClipboardEvent(mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, @@ -68,7 +69,7 @@ nsDOMClipboardEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, // Always create a clipboardData for the copy event. If this is changed to // support other types of events, make sure that read/write privileges are // checked properly within nsDOMDataTransfer. - clipboardData = new nsDOMDataTransfer(NS_COPY, false); + clipboardData = new nsDOMDataTransfer(NS_COPY, false, -1); clipboardData->SetData(aParam.mDataType, aParam.mData); } } @@ -93,10 +94,10 @@ nsDOMClipboardEvent::GetClipboardData() if (!event->clipboardData) { if (mEventIsInternal) { - event->clipboardData = new nsDOMDataTransfer(NS_COPY, false); + event->clipboardData = new nsDOMDataTransfer(NS_COPY, false, -1); } else { event->clipboardData = - new nsDOMDataTransfer(event->message, event->message == NS_PASTE); + new nsDOMDataTransfer(event->message, event->message == NS_PASTE, nsIClipboard::kGlobalClipboard); } } diff --git a/content/events/src/nsDOMDataTransfer.cpp b/content/events/src/nsDOMDataTransfer.cpp index 7e84fd5649c..577a50d5b34 100644 --- a/content/events/src/nsDOMDataTransfer.cpp +++ b/content/events/src/nsDOMDataTransfer.cpp @@ -63,7 +63,7 @@ const char nsDOMDataTransfer::sEffects[8][9] = { "none", "copy", "move", "copyMove", "link", "copyLink", "linkMove", "all" }; -nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal) +nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal, int32_t aClipboardType) : mEventType(aEventType), mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE), mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED), @@ -72,6 +72,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal) mIsExternal(aIsExternal), mUserCancelled(false), mIsCrossDomainSubFrameDrop(false), + mClipboardType(aClipboardType), mDragImageX(0), mDragImageY(0) { @@ -98,6 +99,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal, bool aUserCancelled, bool aIsCrossDomainSubFrameDrop, + int32_t aClipboardType, nsTArray >& aItems, nsIDOMElement* aDragImage, uint32_t aDragImageX, @@ -110,6 +112,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, mIsExternal(aIsExternal), mUserCancelled(aUserCancelled), mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop), + mClipboardType(aClipboardType), mItems(aItems), mDragImage(aDragImage), mDragImageX(aDragImageX), @@ -653,7 +656,7 @@ nsDOMDataTransfer::Clone(uint32_t aEventType, bool aUserCancelled, nsDOMDataTransfer* newDataTransfer = new nsDOMDataTransfer(aEventType, mEffectAllowed, mCursorState, mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop, - mItems, mDragImage, mDragImageX, mDragImageY); + mClipboardType, mItems, mDragImage, mDragImageX, mDragImageY); NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_OUT_OF_MEMORY); *aNewDataTransfer = newDataTransfer; @@ -979,7 +982,7 @@ nsDOMDataTransfer::CacheExternalClipboardFormats() // data will only be retrieved when needed. nsCOMPtr clipboard = do_GetService("@mozilla.org/widget/clipboard;1"); - if (!clipboard) { + if (!clipboard || mClipboardType < 0) { return; } @@ -994,8 +997,7 @@ nsDOMDataTransfer::CacheExternalClipboardFormats() for (uint32_t f = 0; f < mozilla::ArrayLength(formats); ++f) { // check each format one at a time bool supported; - clipboard->HasDataMatchingFlavors(&(formats[f]), 1, - nsIClipboard::kGlobalClipboard, &supported); + clipboard->HasDataMatchingFlavors(&(formats[f]), 1, mClipboardType, &supported); // if the format is supported, add an item to the array with null as // the data. When retrieved, GetRealData will read the data. if (supported) { @@ -1036,11 +1038,11 @@ nsDOMDataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex) MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0"); nsCOMPtr clipboard = do_GetService("@mozilla.org/widget/clipboard;1"); - if (!clipboard) { + if (!clipboard || mClipboardType < 0) { return; } - clipboard->GetData(trans, nsIClipboard::kGlobalClipboard); + clipboard->GetData(trans, mClipboardType); } else { nsCOMPtr dragSession = nsContentUtils::GetDragSession(); if (!dragSession) { diff --git a/content/events/src/nsDOMDataTransfer.h b/content/events/src/nsDOMDataTransfer.h index bf82a3c44d1..7e9e50f4193 100644 --- a/content/events/src/nsDOMDataTransfer.h +++ b/content/events/src/nsDOMDataTransfer.h @@ -58,6 +58,7 @@ protected: bool aIsExternal, bool aUserCancelled, bool aIsCrossDomainSubFrameDrop, + int32_t aClipboardType, nsTArray >& aItems, nsIDOMElement* aDragImage, uint32_t aDragImageX, @@ -82,8 +83,10 @@ public: // paste or a drag that was started without using a data transfer. The // latter will occur when an external drag occurs, that is, a drag where the // source is another application, or a drag is started by calling the drag - // service directly. - nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal); + // service directly. For clipboard operations, aClipboardType indicates + // which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations, + // or if access to the system clipboard should not be allowed. + nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal, int32_t aClipboardType); void GetDragTarget(nsIDOMElement** aDragTarget) { @@ -178,6 +181,10 @@ protected: // data should be prevented bool mIsCrossDomainSubFrameDrop; + // Indicates which clipboard type to use for clipboard operations. Ignored for + // drag and drop. + int32_t mClipboardType; + // array of items, each containing an array of format->data pairs nsTArray > mItems; diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index eaa1093017d..3f4703b0db3 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -54,61 +54,27 @@ class nsEventTargetChainItem private: nsEventTargetChainItem(EventTarget* aTarget, nsEventTargetChainItem* aChild = nullptr); - - // This is the ETCI recycle pool, which is used to avoid some malloc/free - // churn. It's implemented as a linked list. - static nsEventTargetChainItem* sEtciRecyclePool; - static uint32_t sNumRecycledEtcis; - static const uint32_t kMaxNumRecycledEtcis = 128; - public: - static nsEventTargetChainItem* Create(EventTarget* aTarget, + nsEventTargetChainItem() + : mChild(nullptr), mParent(nullptr), mFlags(0), mItemFlags(0) + { + } + + static nsEventTargetChainItem* Create(nsTArray& aPool, + EventTarget* aTarget, nsEventTargetChainItem* aChild = nullptr) { - // Allocate from the ETCI recycle pool if possible. - void* place = nullptr; - if (sNumRecycledEtcis > 0) { - MOZ_ASSERT(sEtciRecyclePool); - place = sEtciRecyclePool; - sEtciRecyclePool = sEtciRecyclePool->mNext; - --sNumRecycledEtcis; - } else { - place = malloc(sizeof(nsEventTargetChainItem)); - } - return place - ? ::new (place) nsEventTargetChainItem(aTarget, aChild) - : nullptr; + + return new (aPool.AppendElement()) nsEventTargetChainItem(aTarget, aChild); } static void Destroy(nsEventTargetChainItem* aItem) { - // ::Destroy deletes ancestor chain. - nsEventTargetChainItem* item = aItem; - if (item->mChild) { - item->mChild->mParent = nullptr; - item->mChild = nullptr; - } - // Put destroyed ETCIs into the recycle pool if it's not already full. - while (item) { - nsEventTargetChainItem* parent = item->mParent; - item->~nsEventTargetChainItem(); - if (sNumRecycledEtcis < kMaxNumRecycledEtcis) { - item->mNext = sEtciRecyclePool; - sEtciRecyclePool = item; - ++sNumRecycledEtcis; - } else { - free(item); - } - item = parent; - } - } - - static void ShutdownRecyclePool() - { - while (sEtciRecyclePool) { - nsEventTargetChainItem* tmp = sEtciRecyclePool; - sEtciRecyclePool = sEtciRecyclePool->mNext; - free(tmp); + // nsEventTargetChainItem objects are deleted when the pool goes out of + // the scope. + if (aItem->mChild) { + aItem->mChild->mParent = nullptr; + aItem->mChild = nullptr; } } @@ -233,21 +199,9 @@ public: nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor, nsCxPusher* aPusher); - static uint32_t MaxEtciCount() { return sMaxEtciCount; } - - static void ResetMaxEtciCount() - { - MOZ_ASSERT(!sCurrentEtciCount, "Wrong time to call ResetMaxEtciCount()!"); - sMaxEtciCount = 0; - } - nsCOMPtr mTarget; nsEventTargetChainItem* mChild; - union { - nsEventTargetChainItem* mParent; - // This is used only when recycling ETCIs. - nsEventTargetChainItem* mNext; - }; + nsEventTargetChainItem* mParent; uint16_t mFlags; uint16_t mItemFlags; nsCOMPtr mItemData; @@ -255,14 +209,8 @@ public: nsCOMPtr mNewTarget; // Cache mTarget's event listener manager. nsRefPtr mManager; - - static uint32_t sMaxEtciCount; - static uint32_t sCurrentEtciCount; }; -nsEventTargetChainItem* nsEventTargetChainItem::sEtciRecyclePool = nullptr; -uint32_t nsEventTargetChainItem::sNumRecycledEtcis = 0; - nsEventTargetChainItem::nsEventTargetChainItem(EventTarget* aTarget, nsEventTargetChainItem* aChild) : mTarget(aTarget), mChild(aChild), mParent(nullptr), mFlags(0), mItemFlags(0) @@ -405,13 +353,9 @@ nsEventTargetChainItem::HandleEventTargetChain( return NS_OK; } -void NS_ShutdownEventTargetChainItemRecyclePool() -{ - nsEventTargetChainItem::ShutdownRecyclePool(); -} - nsEventTargetChainItem* -EventTargetChainItemForChromeTarget(nsINode* aNode, +EventTargetChainItemForChromeTarget(nsTArray& aPool, + nsINode* aNode, nsEventTargetChainItem* aChild = nullptr) { if (!aNode->IsInDoc()) { @@ -422,9 +366,9 @@ EventTargetChainItemForChromeTarget(nsINode* aNode, NS_ENSURE_TRUE(piTarget, nullptr); nsEventTargetChainItem* etci = - nsEventTargetChainItem::Create(piTarget->GetTargetForEventTargetChain(), + nsEventTargetChainItem::Create(aPool, + piTarget->GetTargetForEventTargetChain(), aChild); - NS_ENSURE_TRUE(etci, nullptr); if (!etci->IsValid()) { nsEventTargetChainItem::Destroy(etci); return nullptr; @@ -522,10 +466,12 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, // event dispatching is finished. nsRefPtr kungFuDeathGrip(aPresContext); + // Try to limit malloc/free churn by using an array as a pool. + nsTArray pool(128); + // Create the event target chain item for the event target. nsEventTargetChainItem* targetEtci = - nsEventTargetChainItem::Create(target->GetTargetForEventTargetChain()); - NS_ENSURE_TRUE(targetEtci, NS_ERROR_OUT_OF_MEMORY); + nsEventTargetChainItem::Create(pool, target->GetTargetForEventTargetChain()); if (!targetEtci->IsValid()) { nsEventTargetChainItem::Destroy(targetEtci); return NS_ERROR_FAILURE; @@ -571,7 +517,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, if (!preVisitor.mCanHandle && preVisitor.mAutomaticChromeDispatch && content) { // Event target couldn't handle the event. Try to propagate to chrome. nsEventTargetChainItem::Destroy(targetEtci); - targetEtci = EventTargetChainItemForChromeTarget(content); + targetEtci = EventTargetChainItemForChromeTarget(pool, content); NS_ENSURE_STATE(targetEtci); targetEtci->PreHandleEvent(preVisitor); } @@ -584,11 +530,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, while (preVisitor.mParentTarget) { EventTarget* parentTarget = preVisitor.mParentTarget; nsEventTargetChainItem* parentEtci = - nsEventTargetChainItem::Create(preVisitor.mParentTarget, topEtci); - if (!parentEtci) { - rv = NS_ERROR_OUT_OF_MEMORY; - break; - } + nsEventTargetChainItem::Create(pool, preVisitor.mParentTarget, topEtci); if (!parentEtci->IsValid()) { rv = NS_ERROR_FAILURE; break; @@ -613,7 +555,8 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, // propagate to chrome. nsCOMPtr disabledTarget = do_QueryInterface(parentTarget); if (disabledTarget) { - parentEtci = EventTargetChainItemForChromeTarget(disabledTarget, + parentEtci = EventTargetChainItemForChromeTarget(pool, + disabledTarget, topEtci); if (parentEtci) { parentEtci->PreHandleEvent(preVisitor); diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index e4cf4fce269..228b7d826ca 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -1585,6 +1585,7 @@ CrossProcessSafeEvent(const nsEvent& aEvent) case NS_MOUSE_BUTTON_DOWN: case NS_MOUSE_BUTTON_UP: case NS_MOUSE_MOVE: + case NS_CONTEXTMENU: return true; default: return false; @@ -2027,7 +2028,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, } nsRefPtr dataTransfer = - new nsDOMDataTransfer(NS_DRAGDROP_START, false); + new nsDOMDataTransfer(NS_DRAGDROP_START, false, -1); if (!dataTransfer) return; diff --git a/content/html/content/public/HTMLAudioElement.h b/content/html/content/public/HTMLAudioElement.h index 5434242be91..0d345cd3d8b 100644 --- a/content/html/content/public/HTMLAudioElement.h +++ b/content/html/content/public/HTMLAudioElement.h @@ -29,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMediaElement using HTMLMediaElement::GetPaused; NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::) diff --git a/content/html/content/public/HTMLCanvasElement.h b/content/html/content/public/HTMLCanvasElement.h index d9dde0dba99..9a650363849 100644 --- a/content/html/content/public/HTMLCanvasElement.h +++ b/content/html/content/public/HTMLCanvasElement.h @@ -54,15 +54,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLCanvasElement NS_DECL_NSIDOMHTMLCANVASELEMENT @@ -224,8 +215,6 @@ public: nsresult GetContext(const nsAString& aContextId, nsISupports** aContext); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/public/HTMLVideoElement.h b/content/html/content/public/HTMLVideoElement.h index 95047106d39..921ce609ffa 100644 --- a/content/html/content/public/HTMLVideoElement.h +++ b/content/html/content/public/HTMLVideoElement.h @@ -28,15 +28,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMediaElement using HTMLMediaElement::GetPaused; NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::) @@ -62,8 +53,6 @@ public: virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL uint32_t Width() const diff --git a/content/html/content/public/moz.build b/content/html/content/public/moz.build index 0ca5f3d1bd8..268e6fdf800 100644 --- a/content/html/content/public/moz.build +++ b/content/html/content/public/moz.build @@ -22,7 +22,6 @@ EXPORTS += [ 'nsIFormControl.h', 'nsIFormProcessor.h', 'nsIHTMLCollection.h', - 'nsILink.h', 'nsIRadioGroupContainer.h', 'nsIRadioVisitor.h', 'nsITextControlElement.h', diff --git a/content/html/content/public/nsILink.h b/content/html/content/public/nsILink.h deleted file mode 100644 index 704a53f780a..00000000000 --- a/content/html/content/public/nsILink.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsILink_h___ -#define nsILink_h___ - -#include "nsISupports.h" -#include "nsILinkHandler.h" // definition of nsLinkState - -class nsIURI; - -// IID for the nsILink interface -#define NS_ILINK_IID \ -{ 0x6f374a11, 0x212d, 0x47d6, \ - { 0x94, 0xd1, 0xe6, 0x7c, 0x23, 0x4d, 0x34, 0x99 } } - -/** - * This interface allows SelectorMatches to get the canonical - * URL pointed to by an element representing a link and allows - * it to store the visited state of a link element in the link. - * It is needed for performance reasons (to prevent copying of - * strings and excessive calls to history). - */ -class nsILink : public nsISupports { -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINK_IID) - - /** - * SetLinkState/GetHrefURI were moved to nsIContent. - * @see nsIContent - */ - - /** - * Dispatch a LinkAdded event to the chrome event handler for this document. - * This is used to notify the chrome listeners when restoring a page - * presentation. Currently, this only applies to HTML elements. - */ - NS_IMETHOD LinkAdded() = 0; - - /** - * Dispatch a LinkRemoved event to the chrome event handler for this - * document. This is used to notify the chrome listeners when saving a page - * presentation (since the document is not torn down). Currently, this only - * applies to HTML elements. - */ - NS_IMETHOD LinkRemoved() = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsILink, NS_ILINK_IID) - -#endif /* nsILink_h___ */ diff --git a/content/html/content/src/HTMLAnchorElement.cpp b/content/html/content/src/HTMLAnchorElement.cpp index ae4e18ae211..488018c3461 100644 --- a/content/html/content/src/HTMLAnchorElement.cpp +++ b/content/html/content/src/HTMLAnchorElement.cpp @@ -40,19 +40,8 @@ HTMLAnchorElement::~HTMLAnchorElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLAnchorElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLAnchorElement, Element) - -// QueryInterface implementation for HTMLAnchorElement -NS_INTERFACE_TABLE_HEAD(HTMLAnchorElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED3(HTMLAnchorElement, - nsIDOMHTMLAnchorElement, - nsILink, - Link) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED2(HTMLAnchorElement, nsGenericHTMLElement, + nsIDOMHTMLAnchorElement, Link) NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement) diff --git a/content/html/content/src/HTMLAnchorElement.h b/content/html/content/src/HTMLAnchorElement.h index 4ce3f4330f1..106066fa5c0 100644 --- a/content/html/content/src/HTMLAnchorElement.h +++ b/content/html/content/src/HTMLAnchorElement.h @@ -11,14 +11,12 @@ #include "mozilla/dom/Link.h" #include "nsGenericHTMLElement.h" #include "nsIDOMHTMLAnchorElement.h" -#include "nsILink.h" namespace mozilla { namespace dom { class HTMLAnchorElement MOZ_FINAL : public nsGenericHTMLElement, public nsIDOMHTMLAnchorElement, - public nsILink, public Link { public: @@ -35,15 +33,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; virtual bool Draggable() const MOZ_OVERRIDE; @@ -53,10 +42,6 @@ public: // DOM memory reporter participant NS_DECL_SIZEOF_EXCLUDING_THIS - // nsILink - NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; } - NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; } - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, bool aCompileEventHandlers) MOZ_OVERRIDE; @@ -89,8 +74,6 @@ public: virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - virtual void OnDNSPrefetchDeferred(); virtual void OnDNSPrefetchRequested(); virtual bool HasDeferredDNSPrefetchRequest(); diff --git a/content/html/content/src/HTMLAreaElement.cpp b/content/html/content/src/HTMLAreaElement.cpp index 041570b8299..d7ebcbd088c 100644 --- a/content/html/content/src/HTMLAreaElement.cpp +++ b/content/html/content/src/HTMLAreaElement.cpp @@ -25,19 +25,8 @@ HTMLAreaElement::~HTMLAreaElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLAreaElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLAreaElement, Element) - -// QueryInterface implementation for HTMLAreaElement -NS_INTERFACE_TABLE_HEAD(HTMLAreaElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED3(HTMLAreaElement, - nsIDOMHTMLAreaElement, - nsILink, - Link) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED2(HTMLAreaElement, nsGenericHTMLElement, + nsIDOMHTMLAreaElement, Link) NS_IMPL_ELEMENT_CLONE(HTMLAreaElement) diff --git a/content/html/content/src/HTMLAreaElement.h b/content/html/content/src/HTMLAreaElement.h index 106de38ba1d..83b398a7985 100644 --- a/content/html/content/src/HTMLAreaElement.h +++ b/content/html/content/src/HTMLAreaElement.h @@ -12,7 +12,6 @@ #include "nsGenericHTMLElement.h" #include "nsGkAtoms.h" #include "nsIDOMHTMLAreaElement.h" -#include "nsILink.h" #include "nsIURL.h" class nsIDocument; @@ -22,7 +21,6 @@ namespace dom { class HTMLAreaElement MOZ_FINAL : public nsGenericHTMLElement, public nsIDOMHTMLAreaElement, - public nsILink, public Link { public: @@ -35,24 +33,11 @@ public: // DOM memory reporter participant NS_DECL_SIZEOF_EXCLUDING_THIS - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; // nsIDOMHTMLAreaElement NS_DECL_NSIDOMHTMLAREAELEMENT - // nsILink - NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; } - NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; } - virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE; virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE; virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE; @@ -79,8 +64,6 @@ public: virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL // The XPCOM GetAlt is OK for us diff --git a/content/html/content/src/HTMLAudioElement.cpp b/content/html/content/src/HTMLAudioElement.cpp index 30647a7aa79..d4ccd7757b5 100644 --- a/content/html/content/src/HTMLAudioElement.cpp +++ b/content/html/content/src/HTMLAudioElement.cpp @@ -30,16 +30,9 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Audio) namespace mozilla { namespace dom { -NS_IMPL_ADDREF_INHERITED(HTMLAudioElement, HTMLMediaElement) -NS_IMPL_RELEASE_INHERITED(HTMLAudioElement, HTMLMediaElement) - -NS_INTERFACE_TABLE_HEAD(HTMLAudioElement) - NS_HTML_CONTENT_INTERFACES(HTMLMediaElement) - NS_INTERFACE_TABLE_INHERITED4(HTMLAudioElement, nsIDOMHTMLMediaElement, - nsIDOMHTMLAudioElement, nsITimerCallback, - nsIAudioChannelAgentCallback) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED4(HTMLAudioElement, HTMLMediaElement, + nsIDOMHTMLMediaElement, nsIDOMHTMLAudioElement, + nsITimerCallback, nsIAudioChannelAgentCallback) NS_IMPL_ELEMENT_CLONE(HTMLAudioElement) diff --git a/content/html/content/src/HTMLBRElement.cpp b/content/html/content/src/HTMLBRElement.cpp index eac0ebbfd2e..0bdfe5ef6cb 100644 --- a/content/html/content/src/HTMLBRElement.cpp +++ b/content/html/content/src/HTMLBRElement.cpp @@ -27,17 +27,8 @@ HTMLBRElement::~HTMLBRElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLBRElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLBRElement, Element) - - -// QueryInterface implementation for HTMLBRElement -NS_INTERFACE_TABLE_HEAD(HTMLBRElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLBRElement, nsIDOMHTMLBRElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLBRElement, nsGenericHTMLElement, + nsIDOMHTMLBRElement) NS_IMPL_ELEMENT_CLONE(HTMLBRElement) diff --git a/content/html/content/src/HTMLBRElement.h b/content/html/content/src/HTMLBRElement.h index c7b2c6534d7..8cf718ff8b2 100644 --- a/content/html/content/src/HTMLBRElement.h +++ b/content/html/content/src/HTMLBRElement.h @@ -24,15 +24,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLBRElement NS_DECL_NSIDOMHTMLBRELEMENT @@ -43,7 +34,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } bool Clear() { diff --git a/content/html/content/src/HTMLBodyElement.cpp b/content/html/content/src/HTMLBodyElement.cpp index 8d2867d73a6..7e4ee379660 100644 --- a/content/html/content/src/HTMLBodyElement.cpp +++ b/content/html/content/src/HTMLBodyElement.cpp @@ -199,15 +199,8 @@ HTMLBodyElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLBodyElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLBodyElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLBodyElement, Element) - -// QueryInterface implementation for HTMLBodyElement -NS_INTERFACE_TABLE_HEAD(HTMLBodyElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLBodyElement, nsIDOMHTMLBodyElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLBodyElement, nsGenericHTMLElement, + nsIDOMHTMLBodyElement) NS_IMPL_ELEMENT_CLONE(HTMLBodyElement) diff --git a/content/html/content/src/HTMLBodyElement.h b/content/html/content/src/HTMLBodyElement.h index c2d7a3c0556..5db7abfd091 100644 --- a/content/html/content/src/HTMLBodyElement.h +++ b/content/html/content/src/HTMLBodyElement.h @@ -49,15 +49,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLBodyElement NS_DECL_NSIDOMHTMLBODYELEMENT @@ -141,7 +132,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual already_AddRefed GetAssociatedEditor() MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLButtonElement.cpp b/content/html/content/src/HTMLButtonElement.cpp index 9195c896c59..0257cd63478 100644 --- a/content/html/content/src/HTMLButtonElement.cpp +++ b/content/html/content/src/HTMLButtonElement.cpp @@ -83,12 +83,10 @@ NS_IMPL_RELEASE_INHERITED(HTMLButtonElement, Element) // QueryInterface implementation for HTMLButtonElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLButtonElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState) NS_INTERFACE_TABLE_INHERITED2(HTMLButtonElement, nsIDOMHTMLButtonElement, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState) // nsIConstraintValidation NS_IMPL_NSICONSTRAINTVALIDATION(HTMLButtonElement) diff --git a/content/html/content/src/HTMLButtonElement.h b/content/html/content/src/HTMLButtonElement.h index 438e038edd8..6d10734783d 100644 --- a/content/html/content/src/HTMLButtonElement.h +++ b/content/html/content/src/HTMLButtonElement.h @@ -31,17 +31,10 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; + NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLButtonElement, button) + // nsIDOMHTMLButtonElement NS_DECL_NSIDOMHTMLBUTTONELEMENT @@ -59,7 +52,6 @@ public: // nsINode virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual JSObject* WrapNode(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp index 28a4d30994b..a95cf2ab026 100644 --- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -164,12 +164,10 @@ NS_IMPL_ADDREF_INHERITED(HTMLCanvasElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLCanvasElement, Element) NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLCanvasElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED2(HTMLCanvasElement, nsIDOMHTMLCanvasElement, nsICanvasElementExternal) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLCanvasElement) diff --git a/content/html/content/src/HTMLDataElement.cpp b/content/html/content/src/HTMLDataElement.cpp index ac9612b8a3c..7490db37e7f 100644 --- a/content/html/content/src/HTMLDataElement.cpp +++ b/content/html/content/src/HTMLDataElement.cpp @@ -21,13 +21,6 @@ HTMLDataElement::~HTMLDataElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLDataElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLDataElement, Element) - -NS_INTERFACE_MAP_BEGIN(HTMLDataElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLDataElement) JSObject* diff --git a/content/html/content/src/HTMLDataElement.h b/content/html/content/src/HTMLDataElement.h index 8a5f356b850..87e76933022 100644 --- a/content/html/content/src/HTMLDataElement.h +++ b/content/html/content/src/HTMLDataElement.h @@ -14,25 +14,12 @@ namespace mozilla { namespace dom { -class HTMLDataElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLDataElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLDataElement(already_AddRefed aNodeInfo); virtual ~HTMLDataElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // HTMLDataElement WebIDL void GetValue(nsAString& aValue) { @@ -47,7 +34,6 @@ public: virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE; virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext* aCx, diff --git a/content/html/content/src/HTMLDataListElement.cpp b/content/html/content/src/HTMLDataListElement.cpp index 2d136191c25..3b722c35999 100644 --- a/content/html/content/src/HTMLDataListElement.cpp +++ b/content/html/content/src/HTMLDataListElement.cpp @@ -28,8 +28,7 @@ NS_IMPL_ADDREF_INHERITED(HTMLDataListElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLDataListElement, Element) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLDataListElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLDataListElement) diff --git a/content/html/content/src/HTMLDataListElement.h b/content/html/content/src/HTMLDataListElement.h index a38c1942f0e..8924f935efc 100644 --- a/content/html/content/src/HTMLDataListElement.h +++ b/content/html/content/src/HTMLDataListElement.h @@ -12,8 +12,7 @@ namespace mozilla { namespace dom { -class HTMLDataListElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLDataListElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLDataListElement(already_AddRefed aNodeInfo) @@ -25,15 +24,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - nsContentList* Options() { if (!mOptions) { @@ -52,8 +42,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLDataListElement, nsGenericHTMLElement) - - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLDivElement.cpp b/content/html/content/src/HTMLDivElement.cpp index 4204a5acb47..1477cd53d9b 100644 --- a/content/html/content/src/HTMLDivElement.cpp +++ b/content/html/content/src/HTMLDivElement.cpp @@ -20,15 +20,8 @@ HTMLDivElement::~HTMLDivElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLDivElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLDivElement, Element) - -// QueryInterface implementation for HTMLDivElement -NS_INTERFACE_TABLE_HEAD(HTMLDivElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLDivElement, nsIDOMHTMLDivElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLDivElement, nsGenericHTMLElement, + nsIDOMHTMLDivElement) NS_IMPL_ELEMENT_CLONE(HTMLDivElement) diff --git a/content/html/content/src/HTMLDivElement.h b/content/html/content/src/HTMLDivElement.h index 5e994a1c5ec..6e3fbbbdf9a 100644 --- a/content/html/content/src/HTMLDivElement.h +++ b/content/html/content/src/HTMLDivElement.h @@ -25,15 +25,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLDivElement NS_IMETHOD GetAlign(nsAString& aAlign) MOZ_OVERRIDE { @@ -66,8 +57,6 @@ public: virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLElement.cpp b/content/html/content/src/HTMLElement.cpp index 35b5ecbc303..f6c675dc3bc 100644 --- a/content/html/content/src/HTMLElement.cpp +++ b/content/html/content/src/HTMLElement.cpp @@ -10,33 +10,19 @@ namespace mozilla { namespace dom { -class HTMLElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLElement(already_AddRefed aNodeInfo); virtual ~HTMLElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - + using nsGenericHTMLElement::GetInnerHTML; virtual void GetInnerHTML(nsAString& aInnerHTML, mozilla::ErrorResult& aError) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; @@ -51,13 +37,6 @@ HTMLElement::~HTMLElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLElement, Element) - -NS_INTERFACE_MAP_BEGIN(HTMLElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLElement) void diff --git a/content/html/content/src/HTMLFieldSetElement.cpp b/content/html/content/src/HTMLFieldSetElement.cpp index 0798efd3f39..a1dcf7aaa7d 100644 --- a/content/html/content/src/HTMLFieldSetElement.cpp +++ b/content/html/content/src/HTMLFieldSetElement.cpp @@ -43,12 +43,10 @@ NS_IMPL_RELEASE_INHERITED(HTMLFieldSetElement, Element) // QueryInterface implementation for HTMLFieldSetElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement) NS_INTERFACE_TABLE_INHERITED2(HTMLFieldSetElement, nsIDOMHTMLFieldSetElement, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement) NS_IMPL_ELEMENT_CLONE(HTMLFieldSetElement) diff --git a/content/html/content/src/HTMLFieldSetElement.h b/content/html/content/src/HTMLFieldSetElement.h index c484d4d4e85..5d90b802334 100644 --- a/content/html/content/src/HTMLFieldSetElement.h +++ b/content/html/content/src/HTMLFieldSetElement.h @@ -34,15 +34,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLFieldSetElement NS_DECL_NSIDOMHTMLFIELDSETELEMENT @@ -61,7 +52,6 @@ public: NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) MOZ_OVERRIDE; virtual bool IsDisabledForEvents(uint32_t aMessage) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } const nsIContent* GetFirstLegend() const { return mFirstLegend; } diff --git a/content/html/content/src/HTMLFontElement.cpp b/content/html/content/src/HTMLFontElement.cpp index 31eba84d3a8..dd104d14b5f 100644 --- a/content/html/content/src/HTMLFontElement.cpp +++ b/content/html/content/src/HTMLFontElement.cpp @@ -27,15 +27,6 @@ HTMLFontElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLFontElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLFontElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLFontElement, Element) - -// QueryInterface implementation for HTMLFontElement -NS_INTERFACE_MAP_BEGIN(HTMLFontElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - - NS_IMPL_ELEMENT_CLONE(HTMLFontElement) bool diff --git a/content/html/content/src/HTMLFontElement.h b/content/html/content/src/HTMLFontElement.h index 0bb6a50a386..814448efdfb 100644 --- a/content/html/content/src/HTMLFontElement.h +++ b/content/html/content/src/HTMLFontElement.h @@ -11,8 +11,7 @@ namespace mozilla { namespace dom { -class HTMLFontElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLFontElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLFontElement(already_AddRefed aNodeInfo) @@ -21,18 +20,6 @@ public: } virtual ~HTMLFontElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - void GetColor(nsString& aColor) { GetHTMLAttr(nsGkAtoms::color, aColor); @@ -65,7 +52,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext *aCx, diff --git a/content/html/content/src/HTMLFormElement.cpp b/content/html/content/src/HTMLFormElement.cpp index 06d28af04ff..5360c6eb0ff 100644 --- a/content/html/content/src/HTMLFormElement.cpp +++ b/content/html/content/src/HTMLFormElement.cpp @@ -328,14 +328,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLFormElement, Element) // QueryInterface implementation for HTMLFormElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFormElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED4(HTMLFormElement, nsIDOMHTMLFormElement, nsIForm, nsIWebProgressListener, nsIRadioGroupContainer) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) // nsIDOMHTMLFormElement @@ -1860,12 +1858,11 @@ HTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const // Hold a reference to the elements so they can't be deleted while calling // the invalid events. for (uint32_t i = 0; i < len; ++i) { - static_cast(sortedControls[i])->AddRef(); + sortedControls[i]->AddRef(); } for (uint32_t i = 0; i < len; ++i) { - nsCOMPtr cvElmt = - do_QueryInterface((nsGenericHTMLElement*)sortedControls[i]); + nsCOMPtr cvElmt = do_QueryObject(sortedControls[i]); if (cvElmt && cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) { ret = false; @@ -1878,7 +1875,7 @@ HTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const // Add all unhandled invalid controls to aInvalidElements if the caller // requested them. if (defaultAction && aInvalidElements) { - aInvalidElements->AppendElement((nsGenericHTMLElement*)sortedControls[i], + aInvalidElements->AppendElement(ToSupports(sortedControls[i]), false); } } diff --git a/content/html/content/src/HTMLFormElement.h b/content/html/content/src/HTMLFormElement.h index 913a89a8d10..867530c3722 100644 --- a/content/html/content/src/HTMLFormElement.h +++ b/content/html/content/src/HTMLFormElement.h @@ -52,15 +52,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLFormElement NS_DECL_NSIDOMHTMLFORMELEMENT @@ -282,8 +273,6 @@ public: */ bool CheckValidFormSubmission(); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - /** * Walk over the form elements and call SubmitNamesValues() on them to get * their data pumped into the FormSubmitter. diff --git a/content/html/content/src/HTMLFrameElement.cpp b/content/html/content/src/HTMLFrameElement.cpp index cbc9f461bc7..6b29f90cc27 100644 --- a/content/html/content/src/HTMLFrameElement.cpp +++ b/content/html/content/src/HTMLFrameElement.cpp @@ -25,17 +25,8 @@ HTMLFrameElement::~HTMLFrameElement() } -NS_IMPL_ADDREF_INHERITED(HTMLFrameElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLFrameElement, Element) - - -// QueryInterface implementation for HTMLFrameElement -NS_INTERFACE_TABLE_HEAD(HTMLFrameElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFrameElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLFrameElement, nsIDOMHTMLFrameElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLFrameElement, nsGenericHTMLFrameElement, + nsIDOMHTMLFrameElement) NS_IMPL_ELEMENT_CLONE(HTMLFrameElement) diff --git a/content/html/content/src/HTMLFrameElement.h b/content/html/content/src/HTMLFrameElement.h index da06b9bf009..ef2dfeebd6e 100644 --- a/content/html/content/src/HTMLFrameElement.h +++ b/content/html/content/src/HTMLFrameElement.h @@ -29,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLFrameElement NS_DECL_NSIDOMHTMLFRAMEELEMENT @@ -49,7 +40,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // WebIDL API // The XPCOM GetFrameBorder is OK for us diff --git a/content/html/content/src/HTMLFrameSetElement.cpp b/content/html/content/src/HTMLFrameSetElement.cpp index abf4e25d32b..c7840dcb891 100644 --- a/content/html/content/src/HTMLFrameSetElement.cpp +++ b/content/html/content/src/HTMLFrameSetElement.cpp @@ -23,17 +23,8 @@ HTMLFrameSetElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLFrameSetElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLFrameSetElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLFrameSetElement, Element) - -// QueryInterface implementation for HTMLFrameSetElement -NS_INTERFACE_TABLE_HEAD(HTMLFrameSetElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLFrameSetElement, - nsIDOMHTMLFrameSetElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLFrameSetElement, nsGenericHTMLElement, + nsIDOMHTMLFrameSetElement) NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement) diff --git a/content/html/content/src/HTMLFrameSetElement.h b/content/html/content/src/HTMLFrameSetElement.h index 2a82c82e702..c1fe9c77d32 100644 --- a/content/html/content/src/HTMLFrameSetElement.h +++ b/content/html/content/src/HTMLFrameSetElement.h @@ -60,15 +60,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLFrameSetElement NS_DECL_NSIDOMHTMLFRAMESETELEMENT @@ -148,7 +139,6 @@ public: int32_t aModType) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext *aCx, diff --git a/content/html/content/src/HTMLHRElement.cpp b/content/html/content/src/HTMLHRElement.cpp index b35108408eb..5dfa46b30fb 100644 --- a/content/html/content/src/HTMLHRElement.cpp +++ b/content/html/content/src/HTMLHRElement.cpp @@ -20,17 +20,8 @@ HTMLHRElement::~HTMLHRElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLHRElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLHRElement, Element) - -// QueryInterface implementation for HTMLHRElement -NS_INTERFACE_TABLE_HEAD(HTMLHRElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLHRElement, - nsIDOMHTMLHRElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLHRElement, nsGenericHTMLElement, + nsIDOMHTMLHRElement) NS_IMPL_ELEMENT_CLONE(HTMLHRElement) diff --git a/content/html/content/src/HTMLHRElement.h b/content/html/content/src/HTMLHRElement.h index 7c3a5d0b13f..948a23ae7de 100644 --- a/content/html/content/src/HTMLHRElement.h +++ b/content/html/content/src/HTMLHRElement.h @@ -26,15 +26,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLHRElement NS_DECL_NSIDOMHTMLHRELEMENT @@ -45,7 +36,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // WebIDL API void SetAlign(const nsAString& aAlign, ErrorResult& aError) diff --git a/content/html/content/src/HTMLHeadingElement.cpp b/content/html/content/src/HTMLHeadingElement.cpp index d5982bbc486..09c56998cf0 100644 --- a/content/html/content/src/HTMLHeadingElement.cpp +++ b/content/html/content/src/HTMLHeadingElement.cpp @@ -22,17 +22,8 @@ HTMLHeadingElement::~HTMLHeadingElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLHeadingElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLHeadingElement, Element) - -// QueryInterface implementation for HTMLHeadingElement -NS_INTERFACE_TABLE_HEAD(HTMLHeadingElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLHeadingElement, - nsIDOMHTMLHeadingElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLHeadingElement, nsGenericHTMLElement, + nsIDOMHTMLHeadingElement) NS_IMPL_ELEMENT_CLONE(HTMLHeadingElement) diff --git a/content/html/content/src/HTMLHeadingElement.h b/content/html/content/src/HTMLHeadingElement.h index 74ba22b9347..1915b52b3b9 100644 --- a/content/html/content/src/HTMLHeadingElement.h +++ b/content/html/content/src/HTMLHeadingElement.h @@ -26,15 +26,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLHeadingElement NS_DECL_NSIDOMHTMLHEADINGELEMENT @@ -45,7 +36,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // The XPCOM versions of GetAlign and SetAlign are fine for us for // use from WebIDL. diff --git a/content/html/content/src/HTMLIFrameElement.cpp b/content/html/content/src/HTMLIFrameElement.cpp index c78d375678d..a116f5c394c 100644 --- a/content/html/content/src/HTMLIFrameElement.cpp +++ b/content/html/content/src/HTMLIFrameElement.cpp @@ -29,16 +29,8 @@ HTMLIFrameElement::~HTMLIFrameElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLIFrameElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLIFrameElement, Element) - -// QueryInterface implementation for HTMLIFrameElement -NS_INTERFACE_TABLE_HEAD(HTMLIFrameElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFrameElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLIFrameElement, - nsIDOMHTMLIFrameElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLIFrameElement, nsGenericHTMLFrameElement, + nsIDOMHTMLIFrameElement) NS_IMPL_ELEMENT_CLONE(HTMLIFrameElement) diff --git a/content/html/content/src/HTMLIFrameElement.h b/content/html/content/src/HTMLIFrameElement.h index 8300a9d7928..e9450379aaf 100644 --- a/content/html/content/src/HTMLIFrameElement.h +++ b/content/html/content/src/HTMLIFrameElement.h @@ -26,15 +26,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLIFrameElement NS_DECL_NSIDOMHTMLIFRAMEELEMENT @@ -47,7 +38,6 @@ public: virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAString& aValue, bool aNotify) diff --git a/content/html/content/src/HTMLImageElement.cpp b/content/html/content/src/HTMLImageElement.cpp index e94cbcf1af3..c426fd8838e 100644 --- a/content/html/content/src/HTMLImageElement.cpp +++ b/content/html/content/src/HTMLImageElement.cpp @@ -66,14 +66,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLImageElement, Element) // QueryInterface implementation for HTMLImageElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLImageElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED4(HTMLImageElement, nsIDOMHTMLImageElement, nsIImageLoadingContent, imgIOnloadBlocker, imgINotificationObserver) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLImageElement) diff --git a/content/html/content/src/HTMLImageElement.h b/content/html/content/src/HTMLImageElement.h index 1a859116210..f280085daa8 100644 --- a/content/html/content/src/HTMLImageElement.h +++ b/content/html/content/src/HTMLImageElement.h @@ -31,15 +31,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual bool Draggable() const MOZ_OVERRIDE; // nsIDOMHTMLImageElement @@ -86,7 +77,6 @@ public: nsresult CopyInnerTo(Element* aDest); void MaybeLoadImage(); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } bool IsMap() { diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp index 3df1ed570d1..a1dfbbccb2a 100644 --- a/content/html/content/src/HTMLInputElement.cpp +++ b/content/html/content/src/HTMLInputElement.cpp @@ -854,7 +854,6 @@ NS_IMPL_RELEASE_INHERITED(HTMLInputElement, Element) // QueryInterface implementation for HTMLInputElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLInputElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState) NS_INTERFACE_TABLE_INHERITED8(HTMLInputElement, nsIDOMHTMLInputElement, nsITextControlElement, @@ -864,8 +863,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLInputElement) imgIOnloadBlocker, nsIDOMNSEditableElement, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState) // nsIConstraintValidation NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLInputElement) @@ -3119,7 +3117,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) nsCOMPtr radioContent = do_QueryInterface(selectedRadioButton); if (radioContent) { - rv = selectedRadioButton->Focus(); + nsCOMPtr elem = do_QueryInterface(selectedRadioButton); + rv = elem->Focus(); if (NS_SUCCEEDED(rv)) { nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted, diff --git a/content/html/content/src/HTMLInputElement.h b/content/html/content/src/HTMLInputElement.h index eae3e805d5d..7468ac12593 100644 --- a/content/html/content/src/HTMLInputElement.h +++ b/content/html/content/src/HTMLInputElement.h @@ -101,15 +101,8 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC virtual int32_t TabIndexDefault() MOZ_OVERRIDE; + using nsGenericHTMLElement::Focus; virtual void Focus(ErrorResult& aError) MOZ_OVERRIDE; // nsIDOMHTMLInputElement @@ -233,8 +226,6 @@ public: void MaybeLoadImage(); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // nsIConstraintValidation bool IsTooLong(); bool IsValueMissing() const; diff --git a/content/html/content/src/HTMLLIElement.cpp b/content/html/content/src/HTMLLIElement.cpp index 7587fd4e660..5a064467917 100644 --- a/content/html/content/src/HTMLLIElement.cpp +++ b/content/html/content/src/HTMLLIElement.cpp @@ -21,16 +21,8 @@ HTMLLIElement::~HTMLLIElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLLIElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLLIElement, Element) - - -// QueryInterface implementation for nsHTMLLIElement -NS_INTERFACE_TABLE_HEAD(HTMLLIElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLLIElement, nsIDOMHTMLLIElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLLIElement, nsGenericHTMLElement, + nsIDOMHTMLLIElement) NS_IMPL_ELEMENT_CLONE(HTMLLIElement) diff --git a/content/html/content/src/HTMLLIElement.h b/content/html/content/src/HTMLLIElement.h index d26810d9b7f..582810a1dd1 100644 --- a/content/html/content/src/HTMLLIElement.h +++ b/content/html/content/src/HTMLLIElement.h @@ -27,15 +27,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLLIElement NS_DECL_NSIDOMHTMLLIELEMENT @@ -46,7 +37,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // WebIDL API void GetType(nsString& aType) diff --git a/content/html/content/src/HTMLLabelElement.cpp b/content/html/content/src/HTMLLabelElement.cpp index 2074c7021ce..be2ea171820 100644 --- a/content/html/content/src/HTMLLabelElement.cpp +++ b/content/html/content/src/HTMLLabelElement.cpp @@ -30,18 +30,8 @@ HTMLLabelElement::WrapNode(JSContext *aCx, JS::Handle aScope) // nsISupports - -NS_IMPL_ADDREF_INHERITED(HTMLLabelElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLLabelElement, Element) - -// QueryInterface implementation for HTMLLabelElement -NS_INTERFACE_TABLE_HEAD(HTMLLabelElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLLabelElement, - nsIDOMHTMLLabelElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLLabelElement, nsGenericHTMLFormElement, + nsIDOMHTMLLabelElement) // nsIDOMHTMLLabelElement @@ -56,7 +46,7 @@ HTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm) NS_IMETHODIMP HTMLLabelElement::GetControl(nsIDOMHTMLElement** aElement) { - nsCOMPtr element = do_QueryInterface(GetLabeledElement()); + nsCOMPtr element = do_QueryObject(GetLabeledElement()); element.forget(aElement); return NS_OK; } @@ -84,7 +74,7 @@ HTMLLabelElement::Focus(ErrorResult& aError) // retarget the focus method at the for content nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { - nsCOMPtr elem = do_QueryInterface(GetLabeledElement()); + nsCOMPtr elem = do_QueryObject(GetLabeledElement()); if (elem) fm->SetFocus(elem, 0); } diff --git a/content/html/content/src/HTMLLabelElement.h b/content/html/content/src/HTMLLabelElement.h index 00e6d65eea6..3bb5ff074b3 100644 --- a/content/html/content/src/HTMLLabelElement.h +++ b/content/html/content/src/HTMLLabelElement.h @@ -32,18 +32,9 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - // nsIDOMHTMLLabelElement NS_DECL_NSIDOMHTMLLABELELEMENT - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - using nsGenericHTMLFormElement::GetForm; void GetHtmlFor(nsString& aHtmlFor) { @@ -58,6 +49,7 @@ public: return GetLabeledElement(); } + using nsGenericHTMLElement::Focus; virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE; // nsIFormControl @@ -73,8 +65,6 @@ public: bool aIsTrustedEvent) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - nsGenericHTMLElement* GetLabeledElement() const; protected: virtual JSObject* WrapNode(JSContext *aCx, diff --git a/content/html/content/src/HTMLLegendElement.cpp b/content/html/content/src/HTMLLegendElement.cpp index 3381b8f6694..c40a01bf05f 100644 --- a/content/html/content/src/HTMLLegendElement.cpp +++ b/content/html/content/src/HTMLLegendElement.cpp @@ -19,17 +19,6 @@ HTMLLegendElement::~HTMLLegendElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLLegendElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLLegendElement, Element) - - -// QueryInterface implementation for HTMLLegendElement -NS_INTERFACE_MAP_BEGIN(HTMLLegendElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - - NS_IMPL_ELEMENT_CLONE(HTMLLegendElement) // this contains center, because IE4 does diff --git a/content/html/content/src/HTMLLegendElement.h b/content/html/content/src/HTMLLegendElement.h index 89a998aacf6..7fcfa8b87eb 100644 --- a/content/html/content/src/HTMLLegendElement.h +++ b/content/html/content/src/HTMLLegendElement.h @@ -13,8 +13,7 @@ namespace mozilla { namespace dom { -class HTMLLegendElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLLegendElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLLegendElement(already_AddRefed aNodeInfo) @@ -25,18 +24,7 @@ public: NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLegendElement, legend) - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - + using nsGenericHTMLElement::Focus; virtual void Focus(ErrorResult& aError) MOZ_OVERRIDE; virtual void PerformAccesskey(bool aKeyCausesActivation, @@ -74,8 +62,6 @@ public: return fieldsetControl ? fieldsetControl->GetFormElement() : nullptr; } - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - /** * WebIDL Interface */ diff --git a/content/html/content/src/HTMLLinkElement.cpp b/content/html/content/src/HTMLLinkElement.cpp index c492a37c552..a44b82e8f3d 100644 --- a/content/html/content/src/HTMLLinkElement.cpp +++ b/content/html/content/src/HTMLLinkElement.cpp @@ -15,7 +15,6 @@ #include "nsIDocument.h" #include "nsIDOMEvent.h" #include "nsIDOMStyleSheet.h" -#include "nsILink.h" #include "nsIStyleSheet.h" #include "nsIStyleSheetLinkingElement.h" #include "nsIURL.h" @@ -58,15 +57,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLLinkElement, Element) // QueryInterface implementation for HTMLLinkElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLLinkElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED5(HTMLLinkElement, + NS_INTERFACE_TABLE_INHERITED4(HTMLLinkElement, nsIDOMHTMLLinkElement, nsIDOMLinkStyle, - nsILink, nsIStyleSheetLinkingElement, Link) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLLinkElement) @@ -149,18 +145,16 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, return rv; } -NS_IMETHODIMP +void HTMLLinkElement::LinkAdded() { CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkAdded")); - return NS_OK; } -NS_IMETHODIMP +void HTMLLinkElement::LinkRemoved() { CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkRemoved")); - return NS_OK; } void diff --git a/content/html/content/src/HTMLLinkElement.h b/content/html/content/src/HTMLLinkElement.h index c7dc846fbaf..a74cd3ca140 100644 --- a/content/html/content/src/HTMLLinkElement.h +++ b/content/html/content/src/HTMLLinkElement.h @@ -10,7 +10,6 @@ #include "mozilla/dom/Link.h" #include "nsGenericHTMLElement.h" #include "nsIDOMHTMLLinkElement.h" -#include "nsILink.h" #include "nsStyleLinkElement.h" namespace mozilla { @@ -18,7 +17,6 @@ namespace dom { class HTMLLinkElement MOZ_FINAL : public nsGenericHTMLElement, public nsIDOMHTMLLinkElement, - public nsILink, public nsStyleLinkElement, public Link { @@ -33,24 +31,14 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLLinkElement, nsGenericHTMLElement) - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLLinkElement NS_DECL_NSIDOMHTMLLINKELEMENT // DOM memory reporter participant NS_DECL_SIZEOF_EXCLUDING_THIS - // nsILink - NS_IMETHOD LinkAdded() MOZ_OVERRIDE; - NS_IMETHOD LinkRemoved() MOZ_OVERRIDE; + void LinkAdded(); + void LinkRemoved(); // nsIDOMEventTarget virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE; @@ -58,7 +46,6 @@ public: // nsINode virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual JSObject* WrapNode(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLMapElement.cpp b/content/html/content/src/HTMLMapElement.cpp index e712b9b553f..ada938cc5b4 100644 --- a/content/html/content/src/HTMLMapElement.cpp +++ b/content/html/content/src/HTMLMapElement.cpp @@ -33,10 +33,8 @@ NS_IMPL_RELEASE_INHERITED(HTMLMapElement, Element) // QueryInterface implementation for HTMLMapElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLMapElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED1(HTMLMapElement, nsIDOMHTMLMapElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLMapElement) diff --git a/content/html/content/src/HTMLMapElement.h b/content/html/content/src/HTMLMapElement.h index 5c2c1892873..6b958299473 100644 --- a/content/html/content/src/HTMLMapElement.h +++ b/content/html/content/src/HTMLMapElement.h @@ -26,15 +26,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMapElement NS_DECL_NSIDOMHTMLMAPELEMENT @@ -43,8 +34,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLMapElement, nsGenericHTMLElement) - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // XPCOM GetName is fine. void SetName(const nsAString& aName, ErrorResult& aError) { diff --git a/content/html/content/src/HTMLMenuElement.cpp b/content/html/content/src/HTMLMenuElement.cpp index a9ed8e421db..32debef6fca 100644 --- a/content/html/content/src/HTMLMenuElement.cpp +++ b/content/html/content/src/HTMLMenuElement.cpp @@ -50,19 +50,8 @@ HTMLMenuElement::~HTMLMenuElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLMenuElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLMenuElement, Element) - - -// QueryInterface implementation for HTMLMenuElement -NS_INTERFACE_TABLE_HEAD(HTMLMenuElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED2(HTMLMenuElement, - nsIDOMHTMLMenuElement, - nsIHTMLMenu) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED2(HTMLMenuElement, nsGenericHTMLElement, + nsIDOMHTMLMenuElement, nsIHTMLMenu) NS_IMPL_ELEMENT_CLONE(HTMLMenuElement) diff --git a/content/html/content/src/HTMLMenuElement.h b/content/html/content/src/HTMLMenuElement.h index 8013a5e3c48..8e46d15e2bf 100644 --- a/content/html/content/src/HTMLMenuElement.h +++ b/content/html/content/src/HTMLMenuElement.h @@ -27,15 +27,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMenuElement NS_DECL_NSIDOMHTMLMENUELEMENT @@ -49,8 +40,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - uint8_t GetType() const { return mType; } // WebIDL diff --git a/content/html/content/src/HTMLMenuItemElement.cpp b/content/html/content/src/HTMLMenuItemElement.cpp index 8974123fc6c..ef4a2302113 100644 --- a/content/html/content/src/HTMLMenuItemElement.cpp +++ b/content/html/content/src/HTMLMenuItemElement.cpp @@ -169,17 +169,8 @@ HTMLMenuItemElement::~HTMLMenuItemElement() } -NS_IMPL_ADDREF_INHERITED(HTMLMenuItemElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLMenuItemElement, Element) - - -// QueryInterface implementation for HTMLMenuItemElement -NS_INTERFACE_TABLE_HEAD(HTMLMenuItemElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLMenuItemElement, - nsIDOMHTMLMenuItemElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLMenuItemElement, nsGenericHTMLElement, + nsIDOMHTMLMenuItemElement) //NS_IMPL_ELEMENT_CLONE(HTMLMenuItemElement) nsresult diff --git a/content/html/content/src/HTMLMenuItemElement.h b/content/html/content/src/HTMLMenuItemElement.h index 42df846a263..471876e3bf4 100644 --- a/content/html/content/src/HTMLMenuItemElement.h +++ b/content/html/content/src/HTMLMenuItemElement.h @@ -30,15 +30,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMenuItemElement NS_DECL_NSIDOMHTMLMENUITEMELEMENT @@ -58,8 +49,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - uint8_t GetType() const { return mType; } /** diff --git a/content/html/content/src/HTMLMetaElement.cpp b/content/html/content/src/HTMLMetaElement.cpp index 3e6de5cc9d0..137d4bd8bdd 100644 --- a/content/html/content/src/HTMLMetaElement.cpp +++ b/content/html/content/src/HTMLMetaElement.cpp @@ -24,17 +24,8 @@ HTMLMetaElement::~HTMLMetaElement() } -NS_IMPL_ADDREF_INHERITED(HTMLMetaElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLMetaElement, Element) - - -// QueryInterface implementation for HTMLMetaElement -NS_INTERFACE_TABLE_HEAD(HTMLMetaElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLMetaElement, nsIDOMHTMLMetaElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLMetaElement, nsGenericHTMLElement, + nsIDOMHTMLMetaElement) NS_IMPL_ELEMENT_CLONE(HTMLMetaElement) diff --git a/content/html/content/src/HTMLMetaElement.h b/content/html/content/src/HTMLMetaElement.h index 1411fe54bcc..5262eb58ec8 100644 --- a/content/html/content/src/HTMLMetaElement.h +++ b/content/html/content/src/HTMLMetaElement.h @@ -23,15 +23,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLMetaElement NS_DECL_NSIDOMHTMLMETAELEMENT @@ -44,8 +35,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // XPCOM GetName is fine. void SetName(const nsAString& aName, ErrorResult& aRv) { diff --git a/content/html/content/src/HTMLMeterElement.cpp b/content/html/content/src/HTMLMeterElement.cpp index ae67d8fff83..3c5aaae7971 100644 --- a/content/html/content/src/HTMLMeterElement.cpp +++ b/content/html/content/src/HTMLMeterElement.cpp @@ -25,17 +25,8 @@ HTMLMeterElement::~HTMLMeterElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLMeterElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLMeterElement, Element) - - -NS_INTERFACE_MAP_BEGIN(HTMLMeterElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLMeterElement) - nsEventStates HTMLMeterElement::IntrinsicState() const { diff --git a/content/html/content/src/HTMLMeterElement.h b/content/html/content/src/HTMLMeterElement.h index a4396abc041..38ccdf41fa0 100644 --- a/content/html/content/src/HTMLMeterElement.h +++ b/content/html/content/src/HTMLMeterElement.h @@ -17,25 +17,12 @@ namespace mozilla { namespace dom { -class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLMeterElement(already_AddRefed aNodeInfo); virtual ~HTMLMeterElement(); - /* nsISupports */ - NS_DECL_ISUPPORTS_INHERITED - - /* nsIDOMNode */ - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - /* nsIDOMElement */ - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - /* nsIDOMHTMLElement */ - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE; nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; @@ -43,8 +30,6 @@ public: bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL /* @return the value */ diff --git a/content/html/content/src/HTMLModElement.cpp b/content/html/content/src/HTMLModElement.cpp index 811e92dd244..af222edf4f5 100644 --- a/content/html/content/src/HTMLModElement.cpp +++ b/content/html/content/src/HTMLModElement.cpp @@ -21,16 +21,6 @@ HTMLModElement::~HTMLModElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLModElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLModElement, Element) - -// QueryInterface implementation for HTMLModElement -NS_INTERFACE_MAP_BEGIN(HTMLModElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - - NS_IMPL_ELEMENT_CLONE(HTMLModElement) JSObject* diff --git a/content/html/content/src/HTMLModElement.h b/content/html/content/src/HTMLModElement.h index 3ca9a9d7925..2b4832a158a 100644 --- a/content/html/content/src/HTMLModElement.h +++ b/content/html/content/src/HTMLModElement.h @@ -13,29 +13,14 @@ namespace mozilla { namespace dom { -class HTMLModElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLModElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLModElement(already_AddRefed aNodeInfo); virtual ~HTMLModElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - void GetCite(nsString& aCite) { GetHTMLURIAttr(nsGkAtoms::cite, aCite); diff --git a/content/html/content/src/HTMLObjectElement.cpp b/content/html/content/src/HTMLObjectElement.cpp index aa68b663cfc..038c747e930 100644 --- a/content/html/content/src/HTMLObjectElement.cpp +++ b/content/html/content/src/HTMLObjectElement.cpp @@ -80,7 +80,6 @@ NS_IMPL_ADDREF_INHERITED(HTMLObjectElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLObjectElement, Element) NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement) NS_INTERFACE_TABLE_INHERITED10(HTMLObjectElement, nsIDOMHTMLObjectElement, imgINotificationObserver, @@ -92,8 +91,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement) imgIOnloadBlocker, nsIChannelEventSink, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement) NS_IMPL_ELEMENT_CLONE(HTMLObjectElement) diff --git a/content/html/content/src/HTMLObjectElement.h b/content/html/content/src/HTMLObjectElement.h index fd12feb1b72..dfaae7711ce 100644 --- a/content/html/content/src/HTMLObjectElement.h +++ b/content/html/content/src/HTMLObjectElement.h @@ -29,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; // nsIDOMHTMLObjectElement @@ -92,8 +83,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLObjectElement, nsGenericHTMLFormElement) - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // Web IDL binding methods // XPCOM GetData is ok; note that it's a URI attribute with a weird base URI void SetData(const nsAString& aValue, ErrorResult& aRv) diff --git a/content/html/content/src/HTMLOptGroupElement.cpp b/content/html/content/src/HTMLOptGroupElement.cpp index fe7034a79cf..07d7511f4d2 100644 --- a/content/html/content/src/HTMLOptGroupElement.cpp +++ b/content/html/content/src/HTMLOptGroupElement.cpp @@ -37,19 +37,8 @@ HTMLOptGroupElement::~HTMLOptGroupElement() } -NS_IMPL_ADDREF_INHERITED(HTMLOptGroupElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLOptGroupElement, Element) - - - -// QueryInterface implementation for HTMLOptGroupElement -NS_INTERFACE_TABLE_HEAD(HTMLOptGroupElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLOptGroupElement, - nsIDOMHTMLOptGroupElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLOptGroupElement, nsGenericHTMLElement, + nsIDOMHTMLOptGroupElement) NS_IMPL_ELEMENT_CLONE(HTMLOptGroupElement) diff --git a/content/html/content/src/HTMLOptGroupElement.h b/content/html/content/src/HTMLOptGroupElement.h index e0043fa77dd..63a976e83b0 100644 --- a/content/html/content/src/HTMLOptGroupElement.h +++ b/content/html/content/src/HTMLOptGroupElement.h @@ -25,15 +25,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLOptGroupElement NS_DECL_NSIDOMHTMLOPTGROUPELEMENT diff --git a/content/html/content/src/HTMLOptionElement.cpp b/content/html/content/src/HTMLOptionElement.cpp index fe5309c6fad..56dce028384 100644 --- a/content/html/content/src/HTMLOptionElement.cpp +++ b/content/html/content/src/HTMLOptionElement.cpp @@ -51,21 +51,8 @@ HTMLOptionElement::~HTMLOptionElement() { } -// ISupports - - -NS_IMPL_ADDREF_INHERITED(HTMLOptionElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLOptionElement, Element) - - -// QueryInterface implementation for HTMLOptionElement -NS_INTERFACE_TABLE_HEAD(HTMLOptionElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLOptionElement, - nsIDOMHTMLOptionElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLOptionElement, nsGenericHTMLElement, + nsIDOMHTMLOptionElement) NS_IMPL_ELEMENT_CLONE(HTMLOptionElement) diff --git a/content/html/content/src/HTMLOptionElement.h b/content/html/content/src/HTMLOptionElement.h index 2631abb7e51..d9fc8f76246 100644 --- a/content/html/content/src/HTMLOptionElement.h +++ b/content/html/content/src/HTMLOptionElement.h @@ -36,15 +36,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLOptionElement using mozilla::dom::Element::SetText; using mozilla::dom::Element::GetText; @@ -75,8 +66,6 @@ public: nsresult CopyInnerTo(mozilla::dom::Element* aDest); - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - virtual bool IsDisabled() const MOZ_OVERRIDE { return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); } diff --git a/content/html/content/src/HTMLOptionsCollection.cpp b/content/html/content/src/HTMLOptionsCollection.cpp index b14bb19184d..fd4a89b905a 100644 --- a/content/html/content/src/HTMLOptionsCollection.cpp +++ b/content/html/content/src/HTMLOptionsCollection.cpp @@ -168,17 +168,20 @@ HTMLOptionsCollection::SetOption(uint32_t aIndex, nsCOMPtr ret; if (index == mElements.Length()) { - rv = mSelect->AppendChild(aOption, getter_AddRefs(ret)); + nsCOMPtr node = do_QueryInterface(aOption); + rv = mSelect->AppendChild(node, getter_AddRefs(ret)); } else { // Find the option they're talking about and replace it // hold a strong reference to follow COM rules. - nsCOMPtr refChild = ItemAsOption(index); + nsRefPtr refChild = ItemAsOption(index); NS_ENSURE_TRUE(refChild, NS_ERROR_UNEXPECTED); - nsCOMPtr parent; - refChild->GetParentNode(getter_AddRefs(parent)); + nsCOMPtr parent = refChild->GetParent(); if (parent) { - rv = parent->ReplaceChild(aOption, refChild, getter_AddRefs(ret)); + nsCOMPtr node = do_QueryInterface(aOption); + ErrorResult res; + parent->ReplaceChild(*node, *refChild, res); + rv = res.ErrorCode(); } } @@ -346,7 +349,8 @@ HTMLOptionsCollection::Add(nsIDOMHTMLOptionElement* aOption, return NS_ERROR_NOT_INITIALIZED; } - return mSelect->Add(aOption, aBefore); + nsCOMPtr elem = do_QueryInterface(aOption); + return mSelect->Add(elem, aBefore); } void diff --git a/content/html/content/src/HTMLOutputElement.cpp b/content/html/content/src/HTMLOutputElement.cpp index f88a928d9ab..cf5f4116aab 100644 --- a/content/html/content/src/HTMLOutputElement.cpp +++ b/content/html/content/src/HTMLOutputElement.cpp @@ -54,12 +54,10 @@ NS_IMPL_ADDREF_INHERITED(HTMLOutputElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLOutputElement, Element) NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLOutputElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement) NS_INTERFACE_TABLE_INHERITED2(HTMLOutputElement, nsIMutationObserver, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement) NS_IMPL_ELEMENT_CLONE(HTMLOutputElement) diff --git a/content/html/content/src/HTMLOutputElement.h b/content/html/content/src/HTMLOutputElement.h index 3e33d5ab3e9..fa7bb7e655b 100644 --- a/content/html/content/src/HTMLOutputElement.h +++ b/content/html/content/src/HTMLOutputElement.h @@ -15,7 +15,6 @@ namespace mozilla { namespace dom { class HTMLOutputElement MOZ_FINAL : public nsGenericHTMLFormElement, - public nsIDOMHTMLElement, public nsStubMutationObserver, public nsIConstraintValidation { @@ -28,15 +27,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIFormControl NS_IMETHOD_(uint32_t) GetType() const { return NS_FORM_OUTPUT; } NS_IMETHOD Reset() MOZ_OVERRIDE; @@ -68,7 +58,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLOutputElement, nsGenericHTMLFormElement) - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual JSObject* WrapNode(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLParagraphElement.cpp b/content/html/content/src/HTMLParagraphElement.cpp index e3776b6f4dd..9fe10c9c9fb 100644 --- a/content/html/content/src/HTMLParagraphElement.cpp +++ b/content/html/content/src/HTMLParagraphElement.cpp @@ -20,16 +20,8 @@ HTMLParagraphElement::~HTMLParagraphElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLParagraphElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLParagraphElement, Element) - -// QueryInterface implementation for nsHTMLParagraphElement -NS_INTERFACE_TABLE_HEAD(HTMLParagraphElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLParagraphElement, - nsIDOMHTMLParagraphElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLParagraphElement, nsGenericHTMLElement, + nsIDOMHTMLParagraphElement) NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement) diff --git a/content/html/content/src/HTMLParagraphElement.h b/content/html/content/src/HTMLParagraphElement.h index f421c694899..14a85e44a49 100644 --- a/content/html/content/src/HTMLParagraphElement.h +++ b/content/html/content/src/HTMLParagraphElement.h @@ -28,15 +28,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLParagraphElement NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT @@ -49,8 +40,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL API // The XPCOM GetAlign is fine for our purposes void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv) diff --git a/content/html/content/src/HTMLPreElement.cpp b/content/html/content/src/HTMLPreElement.cpp index 48c9cc0a78b..5cee51a3d78 100644 --- a/content/html/content/src/HTMLPreElement.cpp +++ b/content/html/content/src/HTMLPreElement.cpp @@ -21,15 +21,8 @@ HTMLPreElement::~HTMLPreElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLPreElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLPreElement, Element) - -// QueryInterface implementation for HTMLPreElement -NS_INTERFACE_TABLE_HEAD(HTMLPreElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLPreElement, nsIDOMHTMLPreElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLPreElement, nsGenericHTMLElement, + nsIDOMHTMLPreElement) NS_IMPL_ELEMENT_CLONE(HTMLPreElement) diff --git a/content/html/content/src/HTMLPreElement.h b/content/html/content/src/HTMLPreElement.h index 4eb2a036523..581026a2b67 100644 --- a/content/html/content/src/HTMLPreElement.h +++ b/content/html/content/src/HTMLPreElement.h @@ -28,15 +28,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLPreElement NS_IMETHOD GetWidth(int32_t* aWidth) MOZ_OVERRIDE; NS_IMETHOD SetWidth(int32_t aWidth) MOZ_OVERRIDE; @@ -50,8 +41,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL API int32_t Width() const { diff --git a/content/html/content/src/HTMLProgressElement.cpp b/content/html/content/src/HTMLProgressElement.cpp index 6549fae1bc7..a46adccfcab 100644 --- a/content/html/content/src/HTMLProgressElement.cpp +++ b/content/html/content/src/HTMLProgressElement.cpp @@ -27,14 +27,6 @@ HTMLProgressElement::~HTMLProgressElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLProgressElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLProgressElement, Element) - - -NS_INTERFACE_MAP_BEGIN(HTMLProgressElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLProgressElement) diff --git a/content/html/content/src/HTMLProgressElement.h b/content/html/content/src/HTMLProgressElement.h index 985a1c3fee5..a6fd91412f4 100644 --- a/content/html/content/src/HTMLProgressElement.h +++ b/content/html/content/src/HTMLProgressElement.h @@ -16,25 +16,12 @@ namespace mozilla { namespace dom { -class HTMLProgressElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLProgressElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLProgressElement(already_AddRefed aNodeInfo); virtual ~HTMLProgressElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - nsEventStates IntrinsicState() const MOZ_OVERRIDE; nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; @@ -42,8 +29,6 @@ public: bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL double Value() const; void SetValue(double aValue, ErrorResult& aRv) diff --git a/content/html/content/src/HTMLPropertiesCollection.h b/content/html/content/src/HTMLPropertiesCollection.h index 3a40e603ea3..e4087b71019 100644 --- a/content/html/content/src/HTMLPropertiesCollection.h +++ b/content/html/content/src/HTMLPropertiesCollection.h @@ -117,7 +117,7 @@ protected: nsRefPtrHashtable mNamedItemEntries; // The element this collection is rooted at - nsCOMPtr mRoot; + nsRefPtr mRoot; // The document mRoot is in, if any nsCOMPtr mDoc; diff --git a/content/html/content/src/HTMLScriptElement.cpp b/content/html/content/src/HTMLScriptElement.cpp index 75bca1ca8c6..3ecd7b2fb7c 100644 --- a/content/html/content/src/HTMLScriptElement.cpp +++ b/content/html/content/src/HTMLScriptElement.cpp @@ -20,6 +20,7 @@ #include "nsIArray.h" #include "nsTArray.h" #include "nsDOMJSUtils.h" +#include "nsISupportsImpl.h" #include "mozilla/dom/HTMLScriptElement.h" #include "mozilla/dom/HTMLScriptElementBinding.h" @@ -46,21 +47,11 @@ HTMLScriptElement::~HTMLScriptElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLScriptElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLScriptElement, Element) - -// QueryInterface implementation for HTMLScriptElement -NS_INTERFACE_TABLE_HEAD(HTMLScriptElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED4(HTMLScriptElement, - nsIDOMHTMLScriptElement, - nsIScriptLoaderObserver, - nsIScriptElement, - nsIMutationObserver) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED4(HTMLScriptElement, nsGenericHTMLElement, + nsIDOMHTMLScriptElement, + nsIScriptLoaderObserver, + nsIScriptElement, + nsIMutationObserver) nsresult HTMLScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, diff --git a/content/html/content/src/HTMLScriptElement.h b/content/html/content/src/HTMLScriptElement.h index 1eae035e7ab..20a8f468293 100644 --- a/content/html/content/src/HTMLScriptElement.h +++ b/content/html/content/src/HTMLScriptElement.h @@ -30,17 +30,10 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - + using nsGenericHTMLElement::GetInnerHTML; virtual void GetInnerHTML(nsAString& aInnerHTML, mozilla::ErrorResult& aError) MOZ_OVERRIDE; + using nsGenericHTMLElement::SetInnerHTML; virtual void SetInnerHTML(const nsAString& aInnerHTML, mozilla::ErrorResult& aError) MOZ_OVERRIDE; @@ -69,8 +62,6 @@ public: virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL void SetText(const nsAString& aValue, ErrorResult& rv); void SetCharset(const nsAString& aCharset, ErrorResult& rv); diff --git a/content/html/content/src/HTMLSelectElement.cpp b/content/html/content/src/HTMLSelectElement.cpp index 37a56cf646f..dbe1a91bf2d 100644 --- a/content/html/content/src/HTMLSelectElement.cpp +++ b/content/html/content/src/HTMLSelectElement.cpp @@ -150,12 +150,10 @@ NS_IMPL_RELEASE_INHERITED(HTMLSelectElement, Element) // QueryInterface implementation for HTMLSelectElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSelectElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState) NS_INTERFACE_TABLE_INHERITED2(HTMLSelectElement, nsIDOMHTMLSelectElement, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState) // nsIDOMHTMLSelectElement @@ -609,13 +607,13 @@ HTMLSelectElement::Add(nsGenericHTMLElement& aElement, ErrorResult& aError) { if (!aBefore) { - nsGenericHTMLElement::AppendChild(aElement, aError); + Element::AppendChild(aElement, aError); return; } // Just in case we're not the parent, get the parent of the reference // element - nsINode* parent = aBefore->GetParentNode(); + nsINode* parent = aBefore->Element::GetParentNode(); if (!parent || !nsContentUtils::ContentIsDescendantOf(parent, this)) { // NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT // element. diff --git a/content/html/content/src/HTMLSelectElement.h b/content/html/content/src/HTMLSelectElement.h index d61bfbb8098..80903020b55 100644 --- a/content/html/content/src/HTMLSelectElement.h +++ b/content/html/content/src/HTMLSelectElement.h @@ -119,15 +119,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; // nsIDOMHTMLSelectElement @@ -376,8 +367,6 @@ public: return mOptions; } - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // nsIConstraintValidation nsresult GetValidationMessage(nsAString& aValidationMessage, ValidityStateType aType) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLSharedElement.cpp b/content/html/content/src/HTMLSharedElement.cpp index 7b4c7bfc6cc..67d9f59f8b2 100644 --- a/content/html/content/src/HTMLSharedElement.cpp +++ b/content/html/content/src/HTMLSharedElement.cpp @@ -33,15 +33,13 @@ NS_IMPL_RELEASE_INHERITED(HTMLSharedElement, Element) // QueryInterface implementation for HTMLSharedElement NS_INTERFACE_MAP_BEGIN(HTMLSharedElement) - NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(nsGenericHTMLElement, - nsIDOMHTMLBaseElement) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLDirectoryElement, dir) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, q) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, blockquote) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLHeadElement, head) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLHtmlElement, html) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLSharedElement) diff --git a/content/html/content/src/HTMLSharedElement.h b/content/html/content/src/HTMLSharedElement.h index afdf25979a9..ac6987754f7 100644 --- a/content/html/content/src/HTMLSharedElement.h +++ b/content/html/content/src/HTMLSharedElement.h @@ -38,15 +38,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLBaseElement NS_DECL_NSIDOMHTMLBASEELEMENT @@ -88,11 +79,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE - { - return static_cast(this); - } - // WebIDL API // HTMLParamElement void GetName(DOMString& aValue) diff --git a/content/html/content/src/HTMLSharedListElement.cpp b/content/html/content/src/HTMLSharedListElement.cpp index 319557a31d4..a0ed1a74334 100644 --- a/content/html/content/src/HTMLSharedListElement.cpp +++ b/content/html/content/src/HTMLSharedListElement.cpp @@ -29,11 +29,9 @@ NS_IMPL_RELEASE_INHERITED(HTMLSharedListElement, Element) // QueryInterface implementation for nsHTMLSharedListElement NS_INTERFACE_MAP_BEGIN(HTMLSharedListElement) - NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(nsGenericHTMLElement, - nsIDOMHTMLOListElement) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLOListElement, ol) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLUListElement, ul) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLSharedListElement) diff --git a/content/html/content/src/HTMLSharedListElement.h b/content/html/content/src/HTMLSharedListElement.h index 60922653f59..5f2c872071e 100644 --- a/content/html/content/src/HTMLSharedListElement.h +++ b/content/html/content/src/HTMLSharedListElement.h @@ -29,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLOListElement NS_DECL_NSIDOMHTMLOLISTELEMENT @@ -52,11 +43,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE - { - return static_cast(this); - } - bool Reversed() const { return GetBoolAttr(nsGkAtoms::reversed); diff --git a/content/html/content/src/HTMLSharedObjectElement.cpp b/content/html/content/src/HTMLSharedObjectElement.cpp index 1bb5f664098..432f168fd34 100644 --- a/content/html/content/src/HTMLSharedObjectElement.cpp +++ b/content/html/content/src/HTMLSharedObjectElement.cpp @@ -91,8 +91,6 @@ NS_IMPL_ADDREF_INHERITED(HTMLSharedObjectElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLSharedObjectElement, Element) NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement) - NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(nsGenericHTMLElement, - nsIDOMHTMLAppletElement) NS_INTERFACE_TABLE_INHERITED8(HTMLSharedObjectElement, nsIRequestObserver, nsIStreamListener, @@ -105,7 +103,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement) NS_INTERFACE_TABLE_TO_MAP_SEGUE NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLAppletElement, applet) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLSharedObjectElement) diff --git a/content/html/content/src/HTMLSharedObjectElement.h b/content/html/content/src/HTMLSharedObjectElement.h index 07fc69b267e..0573e727433 100644 --- a/content/html/content/src/HTMLSharedObjectElement.h +++ b/content/html/content/src/HTMLSharedObjectElement.h @@ -31,15 +31,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; // nsIDOMHTMLAppletElement @@ -90,11 +81,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLSharedObjectElement, nsGenericHTMLElement) - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE - { - return static_cast(this); - } - // WebIDL API for void GetAlign(DOMString& aValue) { diff --git a/content/html/content/src/HTMLSourceElement.cpp b/content/html/content/src/HTMLSourceElement.cpp index 0ff6dd070b4..fa11b04684d 100644 --- a/content/html/content/src/HTMLSourceElement.cpp +++ b/content/html/content/src/HTMLSourceElement.cpp @@ -21,19 +21,8 @@ HTMLSourceElement::~HTMLSourceElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLSourceElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLSourceElement, Element) - - - -// QueryInterface implementation for HTMLSourceElement -NS_INTERFACE_TABLE_HEAD(HTMLSourceElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLSourceElement, nsIDOMHTMLSourceElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLSourceElement, nsGenericHTMLElement, + nsIDOMHTMLSourceElement) NS_IMPL_ELEMENT_CLONE(HTMLSourceElement) diff --git a/content/html/content/src/HTMLSourceElement.h b/content/html/content/src/HTMLSourceElement.h index eb7e1ec6b17..34d0c996cf8 100644 --- a/content/html/content/src/HTMLSourceElement.h +++ b/content/html/content/src/HTMLSourceElement.h @@ -25,15 +25,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLSourceElement NS_DECL_NSIDOMHTMLSOURCEELEMENT @@ -45,8 +36,6 @@ public: nsIContent* aBindingParent, bool aCompileEventHandlers) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // WebIDL void GetSrc(nsString& aSrc) { diff --git a/content/html/content/src/HTMLSpanElement.cpp b/content/html/content/src/HTMLSpanElement.cpp index 324b7a8c136..56132c5923d 100644 --- a/content/html/content/src/HTMLSpanElement.cpp +++ b/content/html/content/src/HTMLSpanElement.cpp @@ -20,15 +20,6 @@ HTMLSpanElement::~HTMLSpanElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLSpanElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLSpanElement, Element) - -// QueryInterface implementation for HTMLSpanElement -NS_INTERFACE_MAP_BEGIN(HTMLSpanElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - - NS_IMPL_ELEMENT_CLONE(HTMLSpanElement) JSObject* diff --git a/content/html/content/src/HTMLSpanElement.h b/content/html/content/src/HTMLSpanElement.h index c72489413ee..211f489d858 100644 --- a/content/html/content/src/HTMLSpanElement.h +++ b/content/html/content/src/HTMLSpanElement.h @@ -17,8 +17,7 @@ namespace mozilla { namespace dom { -class HTMLSpanElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLSpanElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLSpanElement(already_AddRefed aNodeInfo) @@ -27,22 +26,8 @@ public: } virtual ~HTMLSpanElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLStyleElement.cpp b/content/html/content/src/HTMLStyleElement.cpp index b6ea1b201db..03dca5d352d 100644 --- a/content/html/content/src/HTMLStyleElement.cpp +++ b/content/html/content/src/HTMLStyleElement.cpp @@ -49,14 +49,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLStyleElement, Element) // QueryInterface implementation for HTMLStyleElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLStyleElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED4(HTMLStyleElement, nsIDOMHTMLStyleElement, nsIDOMLinkStyle, nsIStyleSheetLinkingElement, nsIMutationObserver) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLStyleElement) diff --git a/content/html/content/src/HTMLStyleElement.h b/content/html/content/src/HTMLStyleElement.h index a1c8ca07467..cf981e027e7 100644 --- a/content/html/content/src/HTMLStyleElement.h +++ b/content/html/content/src/HTMLStyleElement.h @@ -33,17 +33,10 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement, nsGenericHTMLElement) - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - + using nsGenericHTMLElement::GetInnerHTML; virtual void GetInnerHTML(nsAString& aInnerHTML, mozilla::ErrorResult& aError) MOZ_OVERRIDE; + using nsGenericHTMLElement::SetInnerHTML; virtual void SetInnerHTML(const nsAString& aInnerHTML, mozilla::ErrorResult& aError) MOZ_OVERRIDE; @@ -96,7 +89,6 @@ public: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: already_AddRefed GetStyleSheetURL(bool* aIsInline) MOZ_OVERRIDE; void GetStyleSheetInfo(nsAString& aTitle, diff --git a/content/html/content/src/HTMLTableCaptionElement.cpp b/content/html/content/src/HTMLTableCaptionElement.cpp index 0649380fc31..78ebe7c919b 100644 --- a/content/html/content/src/HTMLTableCaptionElement.cpp +++ b/content/html/content/src/HTMLTableCaptionElement.cpp @@ -26,16 +26,8 @@ HTMLTableCaptionElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLTableCaptionElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLTableCaptionElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLTableCaptionElement, Element) - -// QueryInterface implementation for HTMLTableCaptionElement -NS_INTERFACE_TABLE_HEAD(HTMLTableCaptionElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLTableCaptionElement, - nsIDOMHTMLTableCaptionElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableCaptionElement, nsGenericHTMLElement, + nsIDOMHTMLTableCaptionElement) NS_IMPL_ELEMENT_CLONE(HTMLTableCaptionElement) diff --git a/content/html/content/src/HTMLTableCaptionElement.h b/content/html/content/src/HTMLTableCaptionElement.h index d2d8e5ef212..19bf63abded 100644 --- a/content/html/content/src/HTMLTableCaptionElement.h +++ b/content/html/content/src/HTMLTableCaptionElement.h @@ -25,15 +25,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLTableCaptionElement NS_DECL_NSIDOMHTMLTABLECAPTIONELEMENT @@ -55,8 +46,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLTableCellElement.cpp b/content/html/content/src/HTMLTableCellElement.cpp index 42e079bcedc..3cf8ec9f5f8 100644 --- a/content/html/content/src/HTMLTableCellElement.cpp +++ b/content/html/content/src/HTMLTableCellElement.cpp @@ -30,17 +30,8 @@ HTMLTableCellElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLTableCellElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLTableCellElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLTableCellElement, Element) - -// QueryInterface implementation for HTMLTableCellElement -NS_INTERFACE_TABLE_HEAD(HTMLTableCellElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLTableCellElement, - nsIDOMHTMLTableCellElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableCellElement, nsGenericHTMLElement, + nsIDOMHTMLTableCellElement) NS_IMPL_ELEMENT_CLONE(HTMLTableCellElement) diff --git a/content/html/content/src/HTMLTableCellElement.h b/content/html/content/src/HTMLTableCellElement.h index c1503911edb..062f9d907c6 100644 --- a/content/html/content/src/HTMLTableCellElement.h +++ b/content/html/content/src/HTMLTableCellElement.h @@ -29,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLTableCellElement NS_DECL_NSIDOMHTMLTABLECELLELEMENT @@ -164,7 +155,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLTableColElement.cpp b/content/html/content/src/HTMLTableColElement.cpp index a0c14e98da9..45fb6423eed 100644 --- a/content/html/content/src/HTMLTableColElement.cpp +++ b/content/html/content/src/HTMLTableColElement.cpp @@ -30,14 +30,6 @@ HTMLTableColElement::WrapNode(JSContext *aCx, JS::Handle aScope) return HTMLTableColElementBinding::Wrap(aCx, aScope, this); } -NS_IMPL_ADDREF_INHERITED(HTMLTableColElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLTableColElement, Element) - -// QueryInterface implementation for HTMLTableColElement -NS_INTERFACE_MAP_BEGIN(HTMLTableColElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLTableColElement) bool diff --git a/content/html/content/src/HTMLTableColElement.h b/content/html/content/src/HTMLTableColElement.h index 225511d8e5c..1cdae34e124 100644 --- a/content/html/content/src/HTMLTableColElement.h +++ b/content/html/content/src/HTMLTableColElement.h @@ -11,8 +11,7 @@ namespace mozilla { namespace dom { -class HTMLTableColElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTableColElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLTableColElement(already_AddRefed aNodeInfo) @@ -21,18 +20,6 @@ public: } virtual ~HTMLTableColElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - uint32_t Span() const { return GetIntAttr(nsGkAtoms::span, 1); @@ -92,8 +79,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLTableElement.cpp b/content/html/content/src/HTMLTableElement.cpp index 74be2047820..1b9dc1489b1 100644 --- a/content/html/content/src/HTMLTableElement.cpp +++ b/content/html/content/src/HTMLTableElement.cpp @@ -332,10 +332,8 @@ NS_IMPL_RELEASE_INHERITED(HTMLTableElement, Element) // QueryInterface implementation for HTMLTableElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLTableElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) NS_INTERFACE_TABLE_INHERITED1(HTMLTableElement, nsIDOMHTMLTableElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLTableElement) @@ -473,7 +471,7 @@ HTMLTableElement::CreateTBody() nsIDOMNode::ELEMENT_NODE); MOZ_ASSERT(nodeInfo); - nsCOMPtr newBody = + nsRefPtr newBody = NS_NewHTMLTableSectionElement(nodeInfo.forget()); MOZ_ASSERT(newBody); diff --git a/content/html/content/src/HTMLTableElement.h b/content/html/content/src/HTMLTableElement.h index 623c730374b..117e016611a 100644 --- a/content/html/content/src/HTMLTableElement.h +++ b/content/html/content/src/HTMLTableElement.h @@ -30,15 +30,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - HTMLTableCaptionElement* GetCaption() const { return static_cast(GetChild(nsGkAtoms::caption)); @@ -188,7 +179,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, bool aCompileEventHandlers) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLTableRowElement.cpp b/content/html/content/src/HTMLTableRowElement.cpp index f2b3a9717ef..574e7b4decb 100644 --- a/content/html/content/src/HTMLTableRowElement.cpp +++ b/content/html/content/src/HTMLTableRowElement.cpp @@ -38,8 +38,7 @@ NS_IMPL_RELEASE_INHERITED(HTMLTableRowElement, Element) // QueryInterface implementation for HTMLTableRowElement NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTableRowElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLTableRowElement) diff --git a/content/html/content/src/HTMLTableRowElement.h b/content/html/content/src/HTMLTableRowElement.h index 50c18885e48..ce55a77c7fc 100644 --- a/content/html/content/src/HTMLTableRowElement.h +++ b/content/html/content/src/HTMLTableRowElement.h @@ -16,8 +16,7 @@ namespace dom { class HTMLTableSectionElement; -class HTMLTableRowElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTableRowElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLTableRowElement(already_AddRefed aNodeInfo) @@ -30,15 +29,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - int32_t RowIndex() const; int32_t SectionRowIndex() const; nsIHTMLCollection* Cells(); @@ -96,8 +86,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLTableRowElement, nsGenericHTMLElement) diff --git a/content/html/content/src/HTMLTableSectionElement.cpp b/content/html/content/src/HTMLTableSectionElement.cpp index 636a52be5cc..39a5591c45e 100644 --- a/content/html/content/src/HTMLTableSectionElement.cpp +++ b/content/html/content/src/HTMLTableSectionElement.cpp @@ -38,8 +38,7 @@ NS_IMPL_RELEASE_INHERITED(HTMLTableSectionElement, Element) // QueryInterface implementation for HTMLTableSectionElement NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTableSectionElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE(HTMLTableSectionElement) diff --git a/content/html/content/src/HTMLTableSectionElement.h b/content/html/content/src/HTMLTableSectionElement.h index 7e97c5f60ef..089d56f5933 100644 --- a/content/html/content/src/HTMLTableSectionElement.h +++ b/content/html/content/src/HTMLTableSectionElement.h @@ -12,8 +12,7 @@ namespace mozilla { namespace dom { -class HTMLTableSectionElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTableSectionElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLTableSectionElement(already_AddRefed aNodeInfo) @@ -24,15 +23,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - nsIHTMLCollection* Rows(); already_AddRefed InsertRow(int32_t aIndex, ErrorResult& aError); @@ -82,8 +72,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLTableSectionElement, nsGenericHTMLElement) - - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLTemplateElement.cpp b/content/html/content/src/HTMLTemplateElement.cpp index 7022d97b9f9..eb48b4b0e9c 100644 --- a/content/html/content/src/HTMLTemplateElement.cpp +++ b/content/html/content/src/HTMLTemplateElement.cpp @@ -71,8 +71,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED_1(HTMLTemplateElement, // QueryInterface implementation for HTMLTemplateElement NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTemplateElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(HTMLTemplateElement) diff --git a/content/html/content/src/HTMLTemplateElement.h b/content/html/content/src/HTMLTemplateElement.h index eb2ceabac63..008929bd78c 100644 --- a/content/html/content/src/HTMLTemplateElement.h +++ b/content/html/content/src/HTMLTemplateElement.h @@ -14,8 +14,7 @@ namespace mozilla { namespace dom { -class HTMLTemplateElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTemplateElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLTemplateElement(already_AddRefed aNodeInfo); @@ -24,22 +23,11 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTemplateElement, nsGenericHTMLElement) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - nsresult Init(); DocumentFragment* Content() diff --git a/content/html/content/src/HTMLTextAreaElement.cpp b/content/html/content/src/HTMLTextAreaElement.cpp index 3db2eae7302..c41a4bb139d 100644 --- a/content/html/content/src/HTMLTextAreaElement.cpp +++ b/content/html/content/src/HTMLTextAreaElement.cpp @@ -85,15 +85,13 @@ NS_IMPL_RELEASE_INHERITED(HTMLTextAreaElement, Element) // QueryInterface implementation for HTMLTextAreaElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLTextAreaElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState) NS_INTERFACE_TABLE_INHERITED5(HTMLTextAreaElement, nsIDOMHTMLTextAreaElement, nsITextControlElement, nsIDOMNSEditableElement, nsIMutationObserver, nsIConstraintValidation) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState) // nsIDOMHTMLTextAreaElement diff --git a/content/html/content/src/HTMLTextAreaElement.h b/content/html/content/src/HTMLTextAreaElement.h index ffcf14426c4..0f1751755f3 100644 --- a/content/html/content/src/HTMLTextAreaElement.h +++ b/content/html/content/src/HTMLTextAreaElement.h @@ -46,15 +46,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual int32_t TabIndexDefault() MOZ_OVERRIDE; // nsIDOMHTMLTextAreaElement @@ -149,8 +140,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTextAreaElement, nsGenericHTMLFormElementWithState) - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - // nsIConstraintValidation bool IsTooLong(); bool IsValueMissing() const; diff --git a/content/html/content/src/HTMLTimeElement.cpp b/content/html/content/src/HTMLTimeElement.cpp index 659d6a16c87..e344d163375 100644 --- a/content/html/content/src/HTMLTimeElement.cpp +++ b/content/html/content/src/HTMLTimeElement.cpp @@ -24,13 +24,6 @@ HTMLTimeElement::~HTMLTimeElement() { } -NS_IMPL_ADDREF_INHERITED(HTMLTimeElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLTimeElement, Element) - -NS_INTERFACE_MAP_BEGIN(HTMLTimeElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLTimeElement) JSObject* diff --git a/content/html/content/src/HTMLTimeElement.h b/content/html/content/src/HTMLTimeElement.h index 53f42e08ff4..b9f477a87c7 100644 --- a/content/html/content/src/HTMLTimeElement.h +++ b/content/html/content/src/HTMLTimeElement.h @@ -14,25 +14,12 @@ namespace mozilla { namespace dom { -class HTMLTimeElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTimeElement MOZ_FINAL : public nsGenericHTMLElement { public: HTMLTimeElement(already_AddRefed aNodeInfo); virtual ~HTMLTimeElement(); - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // HTMLTimeElement WebIDL void GetDateTime(nsAString& aDateTime) { @@ -47,7 +34,6 @@ public: virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE; virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } protected: virtual JSObject* WrapNode(JSContext* aCx, diff --git a/content/html/content/src/HTMLTitleElement.cpp b/content/html/content/src/HTMLTitleElement.cpp index 1f62f809348..21fe33b4f6c 100644 --- a/content/html/content/src/HTMLTitleElement.cpp +++ b/content/html/content/src/HTMLTitleElement.cpp @@ -27,25 +27,8 @@ HTMLTitleElement::~HTMLTitleElement() { } - -NS_IMPL_ADDREF_INHERITED(HTMLTitleElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLTitleElement, Element) - -} // namespace dom -} // namespace mozilla - -namespace mozilla { -namespace dom { - -// QueryInterface implementation for HTMLTitleElement -NS_INTERFACE_TABLE_HEAD(HTMLTitleElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED2(HTMLTitleElement, - nsIDOMHTMLTitleElement, - nsIMutationObserver) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - +NS_IMPL_ISUPPORTS_INHERITED2(HTMLTitleElement, nsGenericHTMLElement, + nsIDOMHTMLTitleElement, nsIMutationObserver) NS_IMPL_ELEMENT_CLONE(HTMLTitleElement) diff --git a/content/html/content/src/HTMLTitleElement.h b/content/html/content/src/HTMLTitleElement.h index a23c68b3e75..57f0e2243bb 100644 --- a/content/html/content/src/HTMLTitleElement.h +++ b/content/html/content/src/HTMLTitleElement.h @@ -30,15 +30,6 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLTitleElement NS_DECL_NSIDOMHTMLTITLEELEMENT @@ -66,8 +57,6 @@ public: virtual void DoneAddingChildren(bool aHaveNotified) MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext* cx, JS::Handle scope) diff --git a/content/html/content/src/HTMLTrackElement.cpp b/content/html/content/src/HTMLTrackElement.cpp index 8fef6c05d5f..d0ff3b88c7a 100644 --- a/content/html/content/src/HTMLTrackElement.cpp +++ b/content/html/content/src/HTMLTrackElement.cpp @@ -88,8 +88,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED_4(HTMLTrackElement, nsGenericHTMLElement, mLoadListener) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTrackElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) void HTMLTrackElement::OnChannelRedirect(nsIChannel* aChannel, @@ -221,7 +220,7 @@ HTMLTrackElement::LoadResource() rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA, uri, NodePrincipal(), - static_cast(this), + static_cast(this), NS_LITERAL_CSTRING("text/vtt"), // mime type nullptr, // extra &shouldLoad, diff --git a/content/html/content/src/HTMLTrackElement.h b/content/html/content/src/HTMLTrackElement.h index f4186ea2047..60b73cba476 100644 --- a/content/html/content/src/HTMLTrackElement.h +++ b/content/html/content/src/HTMLTrackElement.h @@ -24,7 +24,6 @@ namespace dom { class WebVTTLoadListener; class HTMLTrackElement MOZ_FINAL : public nsGenericHTMLElement - , public nsIDOMHTMLElement { public: HTMLTrackElement(already_AddRefed aNodeInfo); @@ -35,15 +34,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTrackElement, nsGenericHTMLElement) - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // HTMLTrackElement WebIDL TextTrackKind Kind() const; void SetKind(TextTrackKind aKind, ErrorResult& aError); @@ -107,7 +97,6 @@ public: TextTrack* Track(); virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // For Track, ItemValue reflects the src attribute virtual void GetItemValueText(nsAString& aText) MOZ_OVERRIDE diff --git a/content/html/content/src/HTMLUnknownElement.cpp b/content/html/content/src/HTMLUnknownElement.cpp index c20d7aaff2a..5b8f1e9a600 100644 --- a/content/html/content/src/HTMLUnknownElement.cpp +++ b/content/html/content/src/HTMLUnknownElement.cpp @@ -12,9 +12,6 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown) namespace mozilla { namespace dom { -NS_IMPL_ADDREF_INHERITED(HTMLUnknownElement, Element) -NS_IMPL_RELEASE_INHERITED(HTMLUnknownElement, Element) - JSObject* HTMLUnknownElement::WrapNode(JSContext *aCx, JS::Handle aScope) { @@ -34,11 +31,6 @@ HTMLUnknownElement::WrapNode(JSContext *aCx, JS::Handle aScope) return obj; } -// QueryInterface implementation for HTMLUnknownElement -NS_INTERFACE_MAP_BEGIN(HTMLUnknownElement) - NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) -NS_ELEMENT_INTERFACE_MAP_END - NS_IMPL_ELEMENT_CLONE(HTMLUnknownElement) } // namespace dom diff --git a/content/html/content/src/HTMLUnknownElement.h b/content/html/content/src/HTMLUnknownElement.h index fa117c22edc..9249a5602ab 100644 --- a/content/html/content/src/HTMLUnknownElement.h +++ b/content/html/content/src/HTMLUnknownElement.h @@ -12,7 +12,6 @@ namespace mozilla { namespace dom { class HTMLUnknownElement MOZ_FINAL : public nsGenericHTMLElement - , public nsIDOMHTMLElement { public: HTMLUnknownElement(already_AddRefed aNodeInfo) @@ -23,22 +22,8 @@ public: } } - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_TO_NSINODE - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } - protected: virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/html/content/src/HTMLVideoElement.cpp b/content/html/content/src/HTMLVideoElement.cpp index 07d7fa47cfe..f12828de09b 100644 --- a/content/html/content/src/HTMLVideoElement.cpp +++ b/content/html/content/src/HTMLVideoElement.cpp @@ -42,14 +42,8 @@ namespace dom { static bool sVideoStatsEnabled; -NS_IMPL_ADDREF_INHERITED(HTMLVideoElement, HTMLMediaElement) -NS_IMPL_RELEASE_INHERITED(HTMLVideoElement, HTMLMediaElement) - -NS_INTERFACE_TABLE_HEAD(HTMLVideoElement) - NS_HTML_CONTENT_INTERFACES(HTMLMediaElement) - NS_INTERFACE_TABLE_INHERITED2(HTMLVideoElement, nsIDOMHTMLMediaElement, nsIDOMHTMLVideoElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED2(HTMLVideoElement, HTMLMediaElement, + nsIDOMHTMLMediaElement, nsIDOMHTMLVideoElement) NS_IMPL_ELEMENT_CLONE(HTMLVideoElement) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 326c9748e61..182ee53353a 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -28,7 +28,6 @@ #include "nsMappedAttributes.h" #include "nsHTMLStyleSheet.h" #include "nsIHTMLDocument.h" -#include "nsILink.h" #include "nsPIDOMWindow.h" #include "nsIStyleRule.h" #include "nsIURL.h" @@ -85,6 +84,7 @@ #include "nsDOMMutationObserver.h" #include "mozilla/Preferences.h" #include "mozilla/dom/FromParser.h" +#include "mozilla/dom/Link.h" #include "mozilla/dom/UndoManager.h" #include "mozilla/BloomFilter.h" @@ -254,26 +254,16 @@ NS_INTERFACE_TABLE_HEAD(nsGenericHTMLElementTearoff) NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLElementTearoff) NS_INTERFACE_MAP_END_AGGREGATED(mElement) -nsresult -nsGenericHTMLElement::DOMQueryInterface(nsIDOMHTMLElement *aElement, - REFNSIID aIID, void **aInstancePtr) -{ - NS_PRECONDITION(aInstancePtr, "null out param"); +NS_IMPL_ADDREF_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase) +NS_IMPL_RELEASE_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase) - nsresult rv = NS_ERROR_FAILURE; - - NS_INTERFACE_TABLE_BEGIN - NS_INTERFACE_TABLE_ENTRY(nsIDOMHTMLElement, nsIDOMNode) - NS_INTERFACE_TABLE_ENTRY(nsIDOMHTMLElement, nsIDOMElement) - NS_INTERFACE_TABLE_ENTRY(nsIDOMHTMLElement, nsIDOMHTMLElement) - NS_INTERFACE_TABLE_END_WITH_PTR(aElement) - - NS_INTERFACE_TABLE_TO_MAP_SEGUE +NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMNode) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMElementCSSInlineStyle, new nsGenericHTMLElementTearoff(this)) - NS_INTERFACE_MAP_END - -// No closing bracket, because NS_INTERFACE_MAP_END does that for us. +NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElementBase) nsresult nsGenericHTMLElement::CopyInnerTo(Element* aDst) @@ -325,7 +315,7 @@ nsGenericHTMLElement::Dataset() return ret.forget(); } -nsresult +NS_IMETHODIMP nsGenericHTMLElement::GetDataset(nsISupports** aDataset) { *aDataset = Dataset().get(); @@ -352,7 +342,7 @@ static const nsAttrValue::EnumTable kDirTable[] = { }; void -nsGenericHTMLElement::GetAccessKeyLabel(nsAString& aLabel) +nsGenericHTMLElement::GetAccessKeyLabel(nsString& aLabel) { nsPresContext *presContext = GetPresContext(); @@ -528,7 +518,7 @@ nsGenericHTMLElement::Spellcheck() } // Anything else that's not a form control is not spellchecked by default - nsCOMPtr formControl = do_QueryInterface(this); + nsCOMPtr formControl = do_QueryObject(this); if (!formControl) { return false; // Not spellchecked by default } @@ -704,8 +694,8 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm) bool nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor) { - NS_PRECONDITION(nsCOMPtr(do_QueryInterface(this)), - "should be called only when |this| implements |nsILink|"); + NS_PRECONDITION(nsCOMPtr(do_QueryObject(this)), + "should be called only when |this| implements |Link|"); if (!aVisitor.mPresContext) { // We need a pres context to do link stuff. Some events (e.g. mutation @@ -759,7 +749,7 @@ nsGenericHTMLElement::IsHTMLLink(nsIURI** aURI) const already_AddRefed nsGenericHTMLElement::GetHrefURIForAnchors() const { - // This is used by the three nsILink implementations and + // This is used by the three Link implementations and // nsHTMLStyleElement. // Get href= attribute (relative URI). @@ -1925,10 +1915,11 @@ nsGenericHTMLElement::GetContextMenu() const return nullptr; } -void -nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) const +NS_IMETHODIMP +nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) { NS_IF_ADDREF(*aContextMenu = GetContextMenu()); + return NS_OK; } bool @@ -2039,9 +2030,9 @@ nsGenericHTMLFormElement::~nsGenericHTMLFormElement() NS_ASSERTION(!mForm, "mForm should be null at this point!"); } -NS_IMPL_QUERY_INTERFACE_INHERITED1(nsGenericHTMLFormElement, - nsGenericHTMLElement, - nsIFormControl) +NS_IMPL_ISUPPORTS_INHERITED1(nsGenericHTMLFormElement, + nsGenericHTMLElement, + nsIFormControl) nsINode* nsGenericHTMLFormElement::GetParentObject() const @@ -2716,8 +2707,7 @@ nsGenericHTMLElement::Focus(ErrorResult& aError) { nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { - nsCOMPtr elem = do_QueryInterface(this); - aError = fm->SetFocus(elem, 0); + aError = fm->SetFocus(this, 0); } } @@ -2748,7 +2738,7 @@ nsGenericHTMLElement::Click() NS_MOUSE_CLICK, nullptr, nsMouseEvent::eReal); event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN; - nsEventDispatcher::Dispatch(this, context, &event); + nsEventDispatcher::Dispatch(static_cast(this), context, &event); ClearHandlingClick(); } @@ -2842,8 +2832,7 @@ nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation, // It's hard to say what HTML4 wants us to do in all cases. nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { - nsCOMPtr elem = do_QueryInterface(this); - fm->SetFocus(elem, nsIFocusManager::FLAG_BYKEY); + fm->SetFocus(this, nsIFocusManager::FLAG_BYKEY); } if (aKeyCausesActivation) { @@ -2855,7 +2844,7 @@ nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation, nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ? openAllowed : openAbused); - nsEventDispatcher::Dispatch(this, presContext, &event); + nsEventDispatcher::Dispatch(static_cast(this), presContext, &event); } } @@ -3188,7 +3177,7 @@ nsGenericHTMLElement::GetItemValue(nsIVariant** aValue) } if (ItemScope()) { - out->SetAsISupports(static_cast(this)); + out->SetAsISupports(static_cast(this)); } else { nsAutoString string; GetItemValueText(string); @@ -3312,10 +3301,11 @@ nsGenericHTMLElement::Properties() return properties; } -void +NS_IMETHODIMP nsGenericHTMLElement::GetProperties(nsISupports** aProperties) { NS_ADDREF(*aProperties = static_cast(Properties())); + return NS_OK; } nsSize diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 1f2f6ab25ee..2fb54caf44b 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -50,7 +50,8 @@ typedef nsMappedAttributeElement nsGenericHTMLElementBase; /** * A common superclass for HTML elements */ -class nsGenericHTMLElement : public nsGenericHTMLElementBase +class nsGenericHTMLElement : public nsGenericHTMLElementBase, + public nsIDOMHTMLElement { public: nsGenericHTMLElement(already_AddRefed aNodeInfo) @@ -62,39 +63,32 @@ public: SetFlags(NODE_HAS_DIRECTION_LTR); } - NS_IMPL_FROMCONTENT(nsGenericHTMLElement, kNameSpaceID_XHTML) + NS_DECL_ISUPPORTS_INHERITED - /** - * Handle QI for the standard DOM interfaces (DOMNode, DOMElement, - * DOMHTMLElement) and handles tearoffs for other standard interfaces. - * @param aElement the element as nsIDOMHTMLElement* - * @param aIID the IID to QI to - * @param aInstancePtr the QI'd method [OUT] - * @see nsGenericHTMLElementTearoff - */ - nsresult DOMQueryInterface(nsIDOMHTMLElement *aElement, REFNSIID aIID, - void **aInstancePtr); + NS_IMPL_FROMCONTENT(nsGenericHTMLElement, kNameSpaceID_XHTML) // From Element nsresult CopyInnerTo(mozilla::dom::Element* aDest); - void GetTitle(nsAString& aTitle) const + void GetTitle(nsString& aTitle) { GetHTMLAttr(nsGkAtoms::title, aTitle); } - void SetTitle(const nsAString& aTitle) + NS_IMETHODIMP SetTitle(const nsAString& aTitle) { SetHTMLAttr(nsGkAtoms::title, aTitle); + return NS_OK; } - void GetLang(nsAString& aLang) const + void GetLang(nsString& aLang) { GetHTMLAttr(nsGkAtoms::lang, aLang); } - void SetLang(const nsAString& aLang) + NS_IMETHODIMP SetLang(const nsAString& aLang) { SetHTMLAttr(nsGkAtoms::lang, aLang); + return NS_OK; } - void GetDir(nsAString& aDir) const + void GetDir(nsString& aDir) { GetHTMLEnumAttr(nsGkAtoms::dir, aDir); } @@ -115,7 +109,7 @@ public: { return GetTokenList(nsGkAtoms::itemtype); } - void GetItemId(nsAString& aItemId) const + void GetItemId(nsString& aItemId) { GetHTMLURIAttr(nsGkAtoms::itemid, aItemId); } @@ -163,7 +157,7 @@ public: } virtual void Focus(mozilla::ErrorResult& aError); void Blur(mozilla::ErrorResult& aError); - void GetAccessKey(nsAString& aAccessKey) const + void GetAccessKey(nsString& aAccessKey) { GetHTMLAttr(nsGkAtoms::accesskey, aAccessKey); } @@ -171,7 +165,7 @@ public: { SetHTMLAttr(nsGkAtoms::accesskey, aAccessKey, aError); } - void GetAccessKeyLabel(nsAString& aAccessKeyLabel); + void GetAccessKeyLabel(nsString& aAccessKeyLabel); virtual bool Draggable() const { return AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable, @@ -184,7 +178,7 @@ public: : NS_LITERAL_STRING("false"), aError); } - void GetContentEditable(nsAString& aContentEditable) const + void GetContentEditable(nsString& aContentEditable) { ContentEditableTristate value = GetContentEditableValue(); if (value == eTrue) { @@ -257,7 +251,7 @@ public: #undef ERROR_EVENT #undef FORWARDED_EVENT #undef EVENT - void GetClassName(nsAString& aClassName) + void GetClassName(nsString& aClassName) { GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName); } @@ -299,17 +293,7 @@ public: return rcFrame.height; } - // nsIDOMHTMLElement methods. Note that these are non-virtual - // methods, implementations are expected to forward calls to these - // methods. - NS_IMETHOD InsertAdjacentHTML(const nsAString& aPosition, - const nsAString& aText); - NS_IMETHOD GetItemValue(nsIVariant** aValue); - NS_IMETHOD SetItemValue(nsIVariant* aValue); protected: - void GetProperties(nsISupports** aProperties); - void GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) const; - // These methods are used to implement element-specific behavior of Get/SetItemValue // when an element has @itemprop but no @itemscope. virtual void GetItemValueText(nsAString& text); @@ -318,11 +302,9 @@ protected: void GetTokenList(nsIAtom* aAtom, nsIVariant** aResult); nsresult SetTokenList(nsIAtom* aAtom, nsIVariant* aValue); public: - nsresult SetContentEditable(const nsAString &aContentEditable); virtual already_AddRefed GetUndoManager(); virtual bool UndoScope() MOZ_OVERRIDE; virtual void SetUndoScope(bool aUndoScope, mozilla::ErrorResult& aError) MOZ_OVERRIDE; - nsresult GetDataset(nsISupports** aDataset); // Callback for destructor of of dataset to ensure to null out weak pointer. nsresult ClearDataset(); @@ -331,6 +313,238 @@ public: */ nsSize GetWidthHeightForImage(imgIRequest *aImageRequest); + // XPIDL methods + NS_FORWARD_NSIDOMNODE_TO_NSINODE + + NS_FORWARD_NSIDOMELEMENT_TO_GENERIC + + NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL { + mozilla::dom::Element::GetId(aId); + return NS_OK; + } + NS_IMETHOD SetId(const nsAString& aId) MOZ_FINAL { + mozilla::dom::Element::SetId(aId); + return NS_OK; + } + NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL { + nsString title; + GetTitle(title); + aTitle.Assign(title); + return NS_OK; + } + NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL { + nsString lang; + GetLang(lang); + aLang.Assign(lang); + return NS_OK; + } + NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL { + nsString dir; + GetDir(dir); + aDir.Assign(dir); + return NS_OK; + } + NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL { + mozilla::ErrorResult rv; + SetDir(aDir, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetDOMClassName(nsAString& aClassName) MOZ_FINAL { + GetHTMLAttr(nsGkAtoms::_class, aClassName); + return NS_OK; + } + NS_IMETHOD SetDOMClassName(const nsAString& aClassName) MOZ_FINAL { + SetClassName(aClassName); + return NS_OK; + } + NS_IMETHOD GetDataset(nsISupports** aDataset) MOZ_FINAL; + NS_IMETHOD GetHidden(bool* aHidden) MOZ_FINAL { + *aHidden = Hidden(); + return NS_OK; + } + NS_IMETHOD SetHidden(bool aHidden) MOZ_FINAL { + mozilla::ErrorResult rv; + SetHidden(aHidden, rv); + return rv.ErrorCode(); + } + NS_IMETHOD DOMBlur() MOZ_FINAL { + mozilla::ErrorResult rv; + Blur(rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetItemScope(bool* aItemScope) MOZ_FINAL { + *aItemScope = ItemScope(); + return NS_OK; + } + NS_IMETHOD SetItemScope(bool aItemScope) MOZ_FINAL { + mozilla::ErrorResult rv; + SetItemScope(aItemScope, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetItemType(nsIVariant** aType) MOZ_FINAL { + GetTokenList(nsGkAtoms::itemtype, aType); + return NS_OK; + } + NS_IMETHOD SetItemType(nsIVariant* aType) MOZ_FINAL { + return SetTokenList(nsGkAtoms::itemtype, aType); + } + NS_IMETHOD GetItemId(nsAString& aId) MOZ_FINAL { + nsString id; + GetItemId(id); + aId.Assign(aId); + return NS_OK; + } + NS_IMETHOD SetItemId(const nsAString& aId) MOZ_FINAL { + mozilla::ErrorResult rv; + SetItemId(aId, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetProperties(nsISupports** aReturn) MOZ_FINAL; + NS_IMETHOD GetItemValue(nsIVariant** aValue) MOZ_FINAL; + NS_IMETHOD SetItemValue(nsIVariant* aValue) MOZ_FINAL; + NS_IMETHOD GetItemRef(nsIVariant** aRef) MOZ_FINAL { + GetTokenList(nsGkAtoms::itemref, aRef); + return NS_OK; + } + NS_IMETHOD SetItemRef(nsIVariant* aRef) MOZ_FINAL { + return SetTokenList(nsGkAtoms::itemref, aRef); + } + NS_IMETHOD GetItemProp(nsIVariant** aProp) MOZ_FINAL { + GetTokenList(nsGkAtoms::itemprop, aProp); + return NS_OK; + } + NS_IMETHOD SetItemProp(nsIVariant* aProp) MOZ_FINAL { + return SetTokenList(nsGkAtoms::itemprop, aProp); + } + NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL { + nsString accessKey; + GetAccessKey(accessKey); + aAccessKey.Assign(accessKey); + return NS_OK; + } + NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) MOZ_FINAL { + mozilla::ErrorResult rv; + SetAccessKey(aAccessKey, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) MOZ_FINAL { + nsString accessKeyLabel; + GetAccessKeyLabel(accessKeyLabel); + aAccessKeyLabel.Assign(accessKeyLabel); + return NS_OK; + } + NS_IMETHOD SetDraggable(bool aDraggable) MOZ_FINAL { + mozilla::ErrorResult rv; + SetDraggable(aDraggable, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetContentEditable(nsAString& aContentEditable) MOZ_FINAL { + nsString contentEditable; + GetContentEditable(contentEditable); + aContentEditable.Assign(contentEditable); + return NS_OK; + } + NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) MOZ_FINAL { + mozilla::ErrorResult rv; + SetContentEditable(aContentEditable, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) MOZ_FINAL { + *aIsContentEditable = IsContentEditable(); + return NS_OK; + } + NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) MOZ_FINAL; + NS_IMETHOD GetSpellcheck(bool* aSpellcheck) MOZ_FINAL { + *aSpellcheck = Spellcheck(); + return NS_OK; + } + NS_IMETHOD SetSpellcheck(bool aSpellcheck) MOZ_FINAL { + mozilla::ErrorResult rv; + SetSpellcheck(aSpellcheck, rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL { + mozilla::ErrorResult rv; + mozilla::dom::Element::GetOuterHTML(aOuterHTML, rv); + return rv.ErrorCode(); + } + NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL { + mozilla::ErrorResult rv; + mozilla::dom::Element::SetOuterHTML(aOuterHTML, rv); + return rv.ErrorCode(); + } \ + NS_IMETHOD InsertAdjacentHTML(const nsAString& position, + const nsAString& text) MOZ_FINAL; + NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) MOZ_FINAL { + if (!_argc) { + top = true; + } + mozilla::dom::Element::ScrollIntoView(top); + return NS_OK; + } + NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) MOZ_FINAL { + mozilla::dom::Element* offsetParent = GetOffsetParent(); + if (!offsetParent) { + *aOffsetParent = nullptr; + return NS_OK; + } + return CallQueryInterface(offsetParent, aOffsetParent); + } + NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) MOZ_FINAL { + *aOffsetTop = OffsetTop(); + return NS_OK; + } + NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) MOZ_FINAL { + *aOffsetLeft = OffsetLeft(); + return NS_OK; + } + NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) MOZ_FINAL { + *aOffsetWidth = OffsetWidth(); + return NS_OK; + } + NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) MOZ_FINAL { + *aOffsetHeight = OffsetHeight(); + return NS_OK; + } + NS_IMETHOD DOMClick() MOZ_FINAL { + Click(); + return NS_OK; + } + NS_IMETHOD GetTabIndex(int32_t* aTabIndex) MOZ_FINAL { + *aTabIndex = TabIndex(); + return NS_OK; + } + NS_IMETHOD SetTabIndex(int32_t aTabIndex) MOZ_FINAL { + mozilla::ErrorResult rv; + SetTabIndex(aTabIndex, rv); + return rv.ErrorCode(); + } + NS_IMETHOD Focus() MOZ_FINAL { + mozilla::ErrorResult rv; + Focus(rv); + return rv.ErrorCode(); + } + NS_IMETHOD GetDraggable(bool* aDraggable) MOZ_FINAL { + *aDraggable = Draggable(); + return NS_OK; + } + using mozilla::dom::Element::GetInnerHTML; + NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_FINAL { + mozilla::ErrorResult rv; + GetInnerHTML(aInnerHTML, rv); + return rv.ErrorCode(); + } + using mozilla::dom::Element::SetInnerHTML; + NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL { + mozilla::ErrorResult rv; + SetInnerHTML(aInnerHTML, rv); + return rv.ErrorCode(); + } + + using nsGenericHTMLElementBase::GetOwnerDocument; + + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } + public: // Implementation for nsIContent virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, @@ -1053,7 +1267,7 @@ public: nsGenericHTMLFormElement(already_AddRefed aNodeInfo); virtual ~nsGenericHTMLFormElement(); - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE; + NS_DECL_ISUPPORTS_INHERITED nsINode* GetParentObject() const; @@ -1457,266 +1671,11 @@ protected: return SetAttrHelper(nsGkAtoms::_atom, aValue); \ } -/** - * QueryInterface() implementation helper macros - */ - -#define NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(_base, _base_if) \ - { \ - nsresult html_rv = _base::QueryInterface(aIID, aInstancePtr); \ - if (NS_SUCCEEDED(html_rv)) \ - return html_rv; \ - \ - html_rv = DOMQueryInterface(static_cast<_base_if *>(this), aIID, \ - aInstancePtr); \ - if (NS_SUCCEEDED(html_rv)) \ - return html_rv; \ - } - -#define NS_HTML_CONTENT_INTERFACES(_base) \ - NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(_base, nsIDOMHTMLElement) - #define NS_INTERFACE_MAP_ENTRY_IF_TAG(_interface, _tag) \ NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \ mNodeInfo->Equals(nsGkAtoms::_tag)) -#define NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC \ - NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL { \ - mozilla::dom::Element::GetId(aId); \ - return NS_OK; \ - } \ - NS_IMETHOD SetId(const nsAString& aId) MOZ_FINAL { \ - mozilla::dom::Element::SetId(aId); \ - return NS_OK; \ - } \ - NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL { \ - nsGenericHTMLElement::GetTitle(aTitle); \ - return NS_OK; \ - } \ - NS_IMETHOD SetTitle(const nsAString& aTitle) MOZ_FINAL { \ - nsGenericHTMLElement::SetTitle(aTitle); \ - return NS_OK; \ - } \ - NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL { \ - nsGenericHTMLElement::GetLang(aLang); \ - return NS_OK; \ - } \ - NS_IMETHOD SetLang(const nsAString& aLang) MOZ_FINAL { \ - nsGenericHTMLElement::SetLang(aLang); \ - return NS_OK; \ - } \ - NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL { \ - nsGenericHTMLElement::GetDir(aDir); \ - return NS_OK; \ - } \ - NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetDir(aDir, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetClassName(nsAString& aClassName) MOZ_FINAL { \ - nsGenericHTMLElement::GetClassName(aClassName); \ - return NS_OK; \ - } \ - NS_IMETHOD SetClassName(const nsAString& aClassName) MOZ_FINAL { \ - nsGenericHTMLElement::SetClassName(aClassName); \ - return NS_OK; \ - } \ - NS_IMETHOD GetDataset(nsISupports** aDataset) MOZ_FINAL { \ - return nsGenericHTMLElement::GetDataset(aDataset); \ - } \ - NS_IMETHOD GetHidden(bool* aHidden) MOZ_FINAL { \ - *aHidden = nsGenericHTMLElement::Hidden(); \ - return NS_OK; \ - } \ - NS_IMETHOD SetHidden(bool aHidden) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetHidden(aHidden, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD DOMBlur() MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::Blur(rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetItemScope(bool* aItemScope) MOZ_FINAL { \ - *aItemScope = nsGenericHTMLElement::ItemScope(); \ - return NS_OK; \ - } \ - NS_IMETHOD SetItemScope(bool aItemScope) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetItemScope(aItemScope, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetItemType(nsIVariant** aType) MOZ_FINAL { \ - GetTokenList(nsGkAtoms::itemtype, aType); \ - return NS_OK; \ - } \ - NS_IMETHOD SetItemType(nsIVariant* aType) MOZ_FINAL { \ - return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemtype, aType); \ - } \ - NS_IMETHOD GetItemId(nsAString& aId) MOZ_FINAL { \ - nsGenericHTMLElement::GetItemId(aId); \ - return NS_OK; \ - } \ - NS_IMETHOD SetItemId(const nsAString& aId) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetItemId(aId, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetProperties(nsISupports** aReturn) \ - MOZ_FINAL { \ - nsGenericHTMLElement::GetProperties(aReturn); \ - return NS_OK; \ - } \ - NS_IMETHOD GetItemValue(nsIVariant** aValue) MOZ_FINAL { \ - return nsGenericHTMLElement::GetItemValue(aValue); \ - } \ - NS_IMETHOD SetItemValue(nsIVariant* aValue) MOZ_FINAL { \ - return nsGenericHTMLElement::SetItemValue(aValue); \ - } \ - NS_IMETHOD GetItemRef(nsIVariant** aRef) MOZ_FINAL { \ - GetTokenList(nsGkAtoms::itemref, aRef); \ - return NS_OK; \ - } \ - NS_IMETHOD SetItemRef(nsIVariant* aRef) MOZ_FINAL { \ - return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemref, aRef); \ - } \ - NS_IMETHOD GetItemProp(nsIVariant** aProp) MOZ_FINAL { \ - GetTokenList(nsGkAtoms::itemprop, aProp); \ - return NS_OK; \ - } \ - NS_IMETHOD SetItemProp(nsIVariant* aProp) MOZ_FINAL { \ - return nsGenericHTMLElement::SetTokenList(nsGkAtoms::itemprop, aProp); \ - } \ - NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL { \ - nsGenericHTMLElement::GetAccessKey(aAccessKey); \ - return NS_OK; \ - } \ - NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetAccessKey(aAccessKey, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) MOZ_FINAL { \ - nsGenericHTMLElement::GetAccessKeyLabel(aAccessKeyLabel); \ - return NS_OK; \ - } \ - NS_IMETHOD SetDraggable(bool aDraggable) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetDraggable(aDraggable, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetContentEditable(nsAString& aContentEditable) MOZ_FINAL { \ - nsGenericHTMLElement::GetContentEditable(aContentEditable); \ - return NS_OK; \ - } \ - NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetContentEditable(aContentEditable, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) MOZ_FINAL { \ - *aIsContentEditable = nsGenericHTMLElement::IsContentEditable(); \ - return NS_OK; \ - } \ - NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) MOZ_FINAL { \ - nsGenericHTMLElement::GetContextMenu(aContextMenu); \ - return NS_OK; \ - } \ - NS_IMETHOD GetSpellcheck(bool* aSpellcheck) MOZ_FINAL { \ - *aSpellcheck = nsGenericHTMLElement::Spellcheck(); \ - return NS_OK; \ - } \ - NS_IMETHOD SetSpellcheck(bool aSpellcheck) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetSpellcheck(aSpellcheck, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::GetOuterHTML(aOuterHTML, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetOuterHTML(aOuterHTML, rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD InsertAdjacentHTML(const nsAString& position, \ - const nsAString& text) MOZ_FINAL { \ - return nsGenericHTMLElement::InsertAdjacentHTML(position, text); \ - } \ - NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) MOZ_FINAL { \ - if (!_argc) { \ - top = true; \ - } \ - mozilla::dom::Element::ScrollIntoView(top); \ - return NS_OK; \ - } \ - NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) MOZ_FINAL { \ - mozilla::dom::Element* offsetParent = \ - nsGenericHTMLElement::GetOffsetParent(); \ - if (!offsetParent) { \ - *aOffsetParent = nullptr; \ - return NS_OK; \ - } \ - return CallQueryInterface(offsetParent, aOffsetParent); \ - } \ - NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) MOZ_FINAL { \ - *aOffsetTop = nsGenericHTMLElement::OffsetTop(); \ - return NS_OK; \ - } \ - NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) MOZ_FINAL { \ - *aOffsetLeft = nsGenericHTMLElement::OffsetLeft(); \ - return NS_OK; \ - } \ - NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) MOZ_FINAL { \ - *aOffsetWidth = nsGenericHTMLElement::OffsetWidth(); \ - return NS_OK; \ - } \ - NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) MOZ_FINAL { \ - *aOffsetHeight = nsGenericHTMLElement::OffsetHeight(); \ - return NS_OK; \ - } \ - NS_IMETHOD DOMClick() MOZ_FINAL { \ - Click(); \ - return NS_OK; \ - } \ - NS_IMETHOD GetTabIndex(int32_t* aTabIndex) MOZ_FINAL { \ - *aTabIndex = TabIndex(); \ - return NS_OK; \ - } \ - using nsGenericHTMLElement::SetTabIndex; \ - NS_IMETHOD SetTabIndex(int32_t aTabIndex) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - nsGenericHTMLElement::SetTabIndex(aTabIndex, rv); \ - return rv.ErrorCode(); \ - } \ - using nsGenericHTMLElement::Focus; \ - NS_IMETHOD Focus() MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - Focus(rv); \ - return rv.ErrorCode(); \ - } \ - NS_IMETHOD GetDraggable(bool* aDraggable) MOZ_FINAL { \ - *aDraggable = Draggable(); \ - return NS_OK; \ - } \ - using Element::GetInnerHTML; \ - NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - GetInnerHTML(aInnerHTML, rv); \ - return rv.ErrorCode(); \ - } \ - using Element::SetInnerHTML; \ - NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL { \ - mozilla::ErrorResult rv; \ - SetInnerHTML(aInnerHTML, rv); \ - return rv.ErrorCode(); \ - } - /** * A macro to declare the NS_NewHTMLXXXElement() functions. */ @@ -1832,13 +1791,13 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Video) inline nsISupports* ToSupports(nsGenericHTMLElement* aHTMLElement) { - return aHTMLElement; + return static_cast(aHTMLElement); } inline nsISupports* ToCanonicalSupports(nsGenericHTMLElement* aHTMLElement) { - return aHTMLElement; + return static_cast(aHTMLElement); } #endif /* nsGenericHTMLElement_h___ */ diff --git a/content/html/content/src/nsGenericHTMLFrameElement.cpp b/content/html/content/src/nsGenericHTMLFrameElement.cpp index fe0e39d7698..36ec90f56c0 100644 --- a/content/html/content/src/nsGenericHTMLFrameElement.cpp +++ b/content/html/content/src/nsGenericHTMLFrameElement.cpp @@ -26,13 +26,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement, NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameLoader) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement) +NS_IMPL_ADDREF_INHERITED(nsGenericHTMLFrameElement, nsGenericHTMLElement) +NS_IMPL_RELEASE_INHERITED(nsGenericHTMLFrameElement, nsGenericHTMLElement) + +NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsGenericHTMLFrameElement) NS_INTERFACE_TABLE_INHERITED3(nsGenericHTMLFrameElement, nsIFrameLoaderOwner, nsIDOMMozBrowserFrame, nsIMozBrowserFrame) - NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLFrameElement) -NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) +NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) NS_IMPL_BOOL_ATTR(nsGenericHTMLFrameElement, Mozbrowser, mozbrowser) diff --git a/content/html/content/src/nsGenericHTMLFrameElement.h b/content/html/content/src/nsGenericHTMLFrameElement.h index 7feec72b126..df599dc417d 100644 --- a/content/html/content/src/nsGenericHTMLFrameElement.h +++ b/content/html/content/src/nsGenericHTMLFrameElement.h @@ -38,7 +38,8 @@ public: virtual ~nsGenericHTMLFrameElement(); - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE; + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIFRAMELOADEROWNER NS_DECL_NSIDOMMOZBROWSERFRAME NS_DECL_NSIMOZBROWSERFRAME diff --git a/content/mathml/content/src/nsMathMLElement.cpp b/content/mathml/content/src/nsMathMLElement.cpp index 904e709589d..03de7aba8c4 100644 --- a/content/mathml/content/src/nsMathMLElement.cpp +++ b/content/mathml/content/src/nsMathMLElement.cpp @@ -29,19 +29,10 @@ using namespace mozilla::dom; //---------------------------------------------------------------------- // nsISupports methods: -NS_INTERFACE_TABLE_HEAD(nsMathMLElement) - NS_INTERFACE_TABLE_INHERITED4(nsMathMLElement, - nsIDOMNode, - nsIDOMElement, - nsILink, - Link) - NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS_INHERITED3(nsMathMLElement, nsMathMLElementBase, + nsIDOMElement, nsIDOMNode, Link) -NS_IMPL_ADDREF_INHERITED(nsMathMLElement, nsMathMLElementBase) -NS_IMPL_RELEASE_INHERITED(nsMathMLElement, nsMathMLElementBase) - -static nsresult +static nsresult WarnDeprecated(const PRUnichar* aDeprecatedAttribute, const PRUnichar* aFavoredAttribute, nsIDocument* aDocument) { diff --git a/content/mathml/content/src/nsMathMLElement.h b/content/mathml/content/src/nsMathMLElement.h index 6285ecd49c1..0f92afe2fa1 100644 --- a/content/mathml/content/src/nsMathMLElement.h +++ b/content/mathml/content/src/nsMathMLElement.h @@ -9,7 +9,6 @@ #include "mozilla/Attributes.h" #include "nsMappedAttributeElement.h" #include "nsIDOMElement.h" -#include "nsILink.h" #include "Link.h" class nsCSSValue; @@ -21,7 +20,6 @@ typedef nsMappedAttributeElement nsMathMLElementBase; */ class nsMathMLElement MOZ_FINAL : public nsMathMLElementBase, public nsIDOMElement, - public nsILink, public mozilla::dom::Link { public: @@ -80,8 +78,6 @@ public: return mIncrementScriptLevel; } - NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; } - NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; } virtual bool IsFocusable(int32_t *aTabIndex = nullptr, bool aWithMouse = false) MOZ_OVERRIDE; virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE; diff --git a/content/media/wmf/WMFReader.cpp b/content/media/wmf/WMFReader.cpp index b34f85dc727..b46b2b00a80 100644 --- a/content/media/wmf/WMFReader.cpp +++ b/content/media/wmf/WMFReader.cpp @@ -10,6 +10,7 @@ #include "WMFByteStream.h" #include "WMFSourceReaderCallback.h" #include "mozilla/dom/TimeRanges.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/Preferences.h" #include "DXVA2Manager.h" #include "ImageContainer.h" @@ -116,10 +117,8 @@ WMFReader::InitializeDXVA() HTMLMediaElement* element = owner->GetMediaElement(); NS_ENSURE_TRUE(element, false); - nsIDocument* doc = element->GetOwnerDocument(); - NS_ENSURE_TRUE(doc, false); - - nsRefPtr layerManager = nsContentUtils::LayerManagerForDocument(doc); + nsRefPtr layerManager = + nsContentUtils::LayerManagerForDocument(element->OwnerDoc()); NS_ENSURE_TRUE(layerManager, false); if (layerManager->GetBackendType() != LayersBackend::LAYERS_D3D9 && diff --git a/content/smil/nsSMILCSSProperty.cpp b/content/smil/nsSMILCSSProperty.cpp index 5caadeb7561..ac0cedf0bbb 100644 --- a/content/smil/nsSMILCSSProperty.cpp +++ b/content/smil/nsSMILCSSProperty.cpp @@ -245,7 +245,6 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID) case eCSSProperty_stroke_opacity: case eCSSProperty_stroke_width: case eCSSProperty_text_anchor: - case eCSSProperty_text_blink: case eCSSProperty_text_decoration: case eCSSProperty_text_decoration_line: case eCSSProperty_text_rendering: diff --git a/content/svg/content/src/SVGAElement.cpp b/content/svg/content/src/SVGAElement.cpp index c7a6e4b48f3..1020c99f258 100644 --- a/content/svg/content/src/SVGAElement.cpp +++ b/content/svg/content/src/SVGAElement.cpp @@ -10,7 +10,6 @@ #include "nsCOMPtr.h" #include "nsContentUtils.h" #include "nsGkAtoms.h" -#include "nsILink.h" #include "nsSVGString.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(A) @@ -34,11 +33,10 @@ nsSVGElement::StringInfo SVGAElement::sStringInfo[2] = //---------------------------------------------------------------------- // nsISupports methods -NS_IMPL_ISUPPORTS_INHERITED5(SVGAElement, SVGAElementBase, +NS_IMPL_ISUPPORTS_INHERITED4(SVGAElement, SVGAElementBase, nsIDOMNode, nsIDOMElement, nsIDOMSVGElement, - nsILink, Link) diff --git a/content/svg/content/src/SVGAElement.h b/content/svg/content/src/SVGAElement.h index 36533e66c98..3984d9f9d5e 100644 --- a/content/svg/content/src/SVGAElement.h +++ b/content/svg/content/src/SVGAElement.h @@ -7,7 +7,6 @@ #define mozilla_dom_SVGAElement_h #include "Link.h" -#include "nsILink.h" #include "nsSVGString.h" #include "mozilla/dom/SVGGraphicsElement.h" @@ -20,7 +19,6 @@ namespace dom { typedef SVGGraphicsElement SVGAElementBase; class SVGAElement MOZ_FINAL : public SVGAElementBase, - public nsILink, public Link { protected: @@ -38,10 +36,6 @@ public: virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - // nsILink - NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; } - NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; } - // nsIContent virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent, nsIContent *aBindingParent, diff --git a/content/svg/content/src/SVGLengthListSMILType.cpp b/content/svg/content/src/SVGLengthListSMILType.cpp index 91a00231a44..586841829e3 100644 --- a/content/svg/content/src/SVGLengthListSMILType.cpp +++ b/content/svg/content/src/SVGLengthListSMILType.cpp @@ -93,12 +93,6 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest, // should be, not zeros, and those values are not explicit or otherwise // available. - if (dest.IsEmpty() && valueToAdd.IsEmpty()) { - // Adding two identity values, no-op. This occurs when performing a - // discrete by-animation on an attribute with no specified base value. - return NS_OK; - } - if (!valueToAdd.Element()) { // Adding identity value - no-op NS_ABORT_IF_FALSE(valueToAdd.IsEmpty(), "Identity values should be empty"); diff --git a/content/svg/content/src/crashtests/898915-1.svg b/content/svg/content/src/crashtests/898915-1.svg new file mode 100644 index 00000000000..6e9b59c36ff --- /dev/null +++ b/content/svg/content/src/crashtests/898915-1.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/content/svg/content/src/crashtests/crashtests.list b/content/svg/content/src/crashtests/crashtests.list index bbf1918e556..7b82e9593b0 100644 --- a/content/svg/content/src/crashtests/crashtests.list +++ b/content/svg/content/src/crashtests/crashtests.list @@ -71,3 +71,4 @@ load 880544-2.svg load 880544-3.svg load 880544-4.svg load 880544-5.svg +load 898915-1.svg diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 85991a33575..0b31f82731e 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -1108,23 +1108,14 @@ NS_IMETHODIMP nsSVGElement::SetId(const nsAString & aId) NS_IMETHODIMP nsSVGElement::GetOwnerSVGElement(nsIDOMSVGElement * *aOwnerSVGElement) { - ErrorResult rv; - NS_IF_ADDREF(*aOwnerSVGElement = GetOwnerSVGElement(rv)); - return rv.ErrorCode(); + NS_IF_ADDREF(*aOwnerSVGElement = GetOwnerSVGElement()); + return NS_OK; } SVGSVGElement* -nsSVGElement::GetOwnerSVGElement(ErrorResult& rv) +nsSVGElement::GetOwnerSVGElement() { - SVGSVGElement* ownerSVGElement = GetCtx(); - - // If we didn't find anything and we're not the outermost SVG element, - // we've got an invalid structure - if (!ownerSVGElement && Tag() != nsGkAtoms::svg) { - rv.Throw(NS_ERROR_FAILURE); - } - - return ownerSVGElement; + return GetCtx(); // this may return nullptr } /* readonly attribute nsIDOMSVGElement viewportElement; */ diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h index 39d9555fa9d..2ccc74fe690 100644 --- a/content/svg/content/src/nsSVGElement.h +++ b/content/svg/content/src/nsSVGElement.h @@ -304,7 +304,7 @@ public: virtual bool IsTransformable() { return false; } // WebIDL - mozilla::dom::SVGSVGElement* GetOwnerSVGElement(mozilla::ErrorResult& rv); + mozilla::dom::SVGSVGElement* GetOwnerSVGElement(); nsSVGElement* GetViewportElement(); already_AddRefed ClassName(); already_AddRefed GetPresentationAttribute(const nsAString& aName, mozilla::ErrorResult& rv); diff --git a/content/svg/content/test/test_viewport.html b/content/svg/content/test/test_viewport.html index d55cbe02ad2..ca8da049799 100644 --- a/content/svg/content/test/test_viewport.html +++ b/content/svg/content/test/test_viewport.html @@ -32,6 +32,15 @@ function runTest() var sym = doc.getElementById("sym"); var symbolRect = doc.getElementById("symbolRect"); + + is(root.ownerSVGElement, null, "root.ownerSVGElement"); + is(inner.ownerSVGElement, root, "inner.ownerSVGElement"); + is(g1.ownerSVGElement, inner, "g1.ownerSVGElement"); + is(outer.ownerSVGElement, null, "outer.ownerSVGElement"); + is(g2.ownerSVGElement, outer, "g2.ownerSVGElement"); + is(g3.ownerSVGElement, null, "g3.ownerSVGElement"); + is(symbolRect.ownerSVGElement, root, "symbolRect.ownerSVGElement"); + is(root.viewportElement, null, "root.viewportElement"); is(inner.viewportElement, root, "inner.viewportElement"); diff --git a/content/xbl/src/nsXBLDocumentInfo.cpp b/content/xbl/src/nsXBLDocumentInfo.cpp index 47e4376a4c4..dcc4d472bca 100644 --- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -97,7 +97,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle obj, nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager(); if (!ssm) { ::JS_ReportError(cx, "Unable to verify access to a global object property."); - return JS_FALSE; + return false; } // Make sure to actually operate on our object, and not some object further @@ -105,11 +105,11 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle obj, JS::Rooted base(cx, obj); while (JS_GetClass(base) != &nsXBLDocGlobalObject::gSharedGlobalClass) { if (!::JS_GetPrototype(cx, base, &base)) { - return JS_FALSE; + return false; } if (!base) { ::JS_ReportError(cx, "Invalid access to a global object property."); - return JS_FALSE; + return false; } } @@ -166,7 +166,7 @@ nsXBLDocGlobalObject_finalize(JSFreeOp *fop, JSObject *obj) static JSBool nsXBLDocGlobalObject_resolve(JSContext *cx, JS::Handle obj, JS::Handle id) { - JSBool did_resolve = JS_FALSE; + JSBool did_resolve = false; return JS_ResolveStandardClass(cx, obj, id, &did_resolve); } diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index b80d86808a3..40b48228cbc 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -342,7 +342,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement) rv = nsContentUtils::GetSecurityManager()->CheckFunctionAccess(cx, method, thisObject); - JSBool ok = JS_TRUE; + JSBool ok = true; if (NS_SUCCEEDED(rv)) { JS::Rooted retval(cx); ok = ::JS_CallFunctionValue(cx, thisObject, OBJECT_TO_JSVAL(method), diff --git a/content/xml/content/src/nsXMLElement.cpp b/content/xml/content/src/nsXMLElement.cpp index 3f355fbe94f..372a072f5b7 100644 --- a/content/xml/content/src/nsXMLElement.cpp +++ b/content/xml/content/src/nsXMLElement.cpp @@ -17,14 +17,8 @@ NS_NewXMLElement(nsIContent** aInstancePtrResult, already_AddRefed return NS_OK; } -// QueryInterface implementation for nsXMLElement -NS_INTERFACE_TABLE_HEAD(nsXMLElement) - NS_INTERFACE_TABLE_INHERITED2(nsXMLElement, nsIDOMNode, nsIDOMElement) - NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE -NS_ELEMENT_INTERFACE_MAP_END - -NS_IMPL_ADDREF_INHERITED(nsXMLElement, Element) -NS_IMPL_RELEASE_INHERITED(nsXMLElement, Element) +NS_IMPL_ISUPPORTS_INHERITED2(nsXMLElement, Element, + nsIDOMNode, nsIDOMElement) JSObject* nsXMLElement::WrapNode(JSContext *aCx, JS::Handle aScope) diff --git a/content/xul/content/src/nsXULContextMenuBuilder.cpp b/content/xul/content/src/nsXULContextMenuBuilder.cpp index 7fc3508cbd4..6317e5fb3b5 100644 --- a/content/xul/content/src/nsXULContextMenuBuilder.cpp +++ b/content/xul/content/src/nsXULContextMenuBuilder.cpp @@ -77,7 +77,8 @@ nsXULContextMenuBuilder::AddItemFor(nsIDOMHTMLMenuItemElement* aElement, } nsCOMPtr menuitem; - nsresult rv = CreateElement(nsGkAtoms::menuitem, aElement, + nsCOMPtr element = do_QueryInterface(aElement); + nsresult rv = CreateElement(nsGkAtoms::menuitem, element, getter_AddRefs(menuitem)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 90873580d37..61a1f4a2fd6 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -346,7 +346,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULElement) new nsXULElementTearoff(this)) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIFrameLoaderOwner, new nsXULElementTearoff(this)) -NS_ELEMENT_INTERFACE_MAP_END +NS_INTERFACE_MAP_END_INHERITING(nsStyledElement) //---------------------------------------------------------------------- // nsIDOMNode interface diff --git a/content/xul/content/src/nsXULPopupListener.cpp b/content/xul/content/src/nsXULPopupListener.cpp index 5368d5ed765..cbe0e1f053b 100644 --- a/content/xul/content/src/nsXULPopupListener.cpp +++ b/content/xul/content/src/nsXULPopupListener.cpp @@ -136,6 +136,16 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent) } } + nsCOMPtr targetContent = do_QueryInterface(target); + if (!targetContent) { + return NS_OK; + } + if (targetContent->Tag() == nsGkAtoms::browser && + targetContent->IsXUL() && + nsEventStateManager::IsRemoteTarget(targetContent)) { + return NS_OK; + } + bool preventDefault; mouseEvent->GetDefaultPrevented(&preventDefault); if (preventDefault && targetNode && mIsContext) { @@ -180,7 +190,6 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent) // If a menu item child was clicked on that leads to a popup needing // to show, we know (guaranteed) that we're dealing with a menu or // submenu of an already-showing popup. We don't need to do anything at all. - nsCOMPtr targetContent = do_QueryInterface(target); if (!mIsContext) { nsIAtom *tag = targetContent ? targetContent->Tag() : nullptr; if (tag == nsGkAtoms::menu || tag == nsGkAtoms::menuitem) diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index da616fb23e8..9da35132af4 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -101,7 +101,7 @@ nsXULPDGlobalObject_finalize(JSFreeOp *fop, JSObject *obj) JSBool nsXULPDGlobalObject_resolve(JSContext *cx, JS::Handle obj, JS::Handle id) { - JSBool did_resolve = JS_FALSE; + JSBool did_resolve = false; return JS_ResolveStandardClass(cx, obj, id, &did_resolve); } diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index 4ab1ccdd03d..58af8dad316 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -65,6 +65,8 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::ALLOW_SCRIPT }, { "telemetry", "chrome://global/content/aboutTelemetry.xhtml", nsIAboutModule::ALLOW_SCRIPT }, + { "networking", "chrome://global/content/aboutNetworking.xhtml", + nsIAboutModule::ALLOW_SCRIPT }, // about:srcdoc is unresolvable by specification. It is included here // because the security manager would disallow srcdoc iframes otherwise. { "srcdoc", "about:blank", diff --git a/docshell/build/nsDocShellModule.cpp b/docshell/build/nsDocShellModule.cpp index 0490f43c448..791868b24bb 100644 --- a/docshell/build/nsDocShellModule.cpp +++ b/docshell/build/nsDocShellModule.cpp @@ -183,6 +183,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = { { NS_ABOUT_MODULE_CONTRACTID_PREFIX "newaddon", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "telemetry", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "networking", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "srcdoc", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, { NS_URI_LOADER_CONTRACTID, &kNS_URI_LOADER_CID }, { NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &kNS_DOCUMENTLOADER_SERVICE_CID }, diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 8c1a2cf962b..e8e05c6bae8 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1736,6 +1736,14 @@ bool Navigator::HasUserMediaSupport(JSContext* /* unused */, } #endif // MOZ_MEDIA_NAVIGATOR +/* static */ +bool Navigator::HasPushNotificationsSupport(JSContext* /* unused */, + JSObject* aGlobal) +{ + nsCOMPtr win = GetWindowFromGlobal(aGlobal); + return win && Preferences::GetBool("services.push.enabled", false) && CheckPermission(win, "push"); +} + /* static */ already_AddRefed Navigator::GetWindowFromGlobal(JSObject* aGlobal) diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index e97bef52f64..92639d4c933 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -283,6 +283,9 @@ public: JSObject* /* unused */); #endif // MOZ_MEDIA_NAVIGATOR + static bool HasPushNotificationsSupport(JSContext* /* unused */, + JSObject* aGlobal); + nsPIDOMWindow* GetParentObject() const { return GetWindow(); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index c862247f150..8dea4d77ed8 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2362,10 +2362,10 @@ nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle // The security check failed. The security manager set a JS // exception for us. - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } // Gets a subframe. @@ -2413,7 +2413,7 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle o { if (!JSID_IS_STRING(id)) { // Nothing to do if we're resolving a non-string property. - return JS_TRUE; + return true; } // Crash reports from the wild seem to get here during shutdown when there's @@ -2450,7 +2450,7 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle o JS::Rooted proto(cx); if (!::JS_GetPrototype(cx, obj, &proto)) { - return JS_FALSE; + return false; } JSBool hasProp; @@ -2459,7 +2459,7 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle o // No prototype, or the property exists on the prototype. Do // nothing. - return JS_TRUE; + return true; } // @@ -2489,17 +2489,17 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle o nsCOMPtr holder; nsresult rv = WrapNative(cx, obj, result, cache, true, v.address(), getter_AddRefs(holder)); - NS_ENSURE_SUCCESS(rv, JS_FALSE); + NS_ENSURE_SUCCESS(rv, false); if (!JS_WrapValue(cx, v.address()) || !JS_DefinePropertyById(cx, obj, id, v, JS_PropertyStub, JS_StrictPropertyStub, 0)) { - return JS_FALSE; + return false; } objp.set(obj); } - return JS_TRUE; + return true; } // static @@ -2512,7 +2512,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, for (;;) { if (!::JS_GetPrototype(cx, obj, &proto)) { - return JS_FALSE; + return false; } if (!proto) { break; @@ -2522,7 +2522,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JS::Rooted proto_proto(cx); if (!::JS_GetPrototype(cx, proto, &proto_proto)) { - return JS_FALSE; + return false; } // Pull the global scope polluter out of the prototype chain so @@ -2535,7 +2535,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, obj = proto; } - return JS_TRUE; + return true; } // static @@ -3018,7 +3018,7 @@ nsDOMConstructor::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx, NS_ENSURE_TRUE(name_struct, NS_ERROR_FAILURE); if (!IsConstructable(name_struct)) { - // ignore return value, we return JS_FALSE anyway + // ignore return value, we return false anyway return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -3099,7 +3099,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, NS_ENSURE_TRUE(class_name_struct, NS_ERROR_FAILURE); if (name_struct == class_name_struct) { - *bp = JS_TRUE; + *bp = true; return NS_OK; } @@ -3135,7 +3135,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, return NS_ERROR_UNEXPECTED; } } else { - *bp = JS_FALSE; + *bp = false; return NS_OK; } @@ -3172,7 +3172,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, const nsIID* class_interface; while ((class_interface = ci_data->mInterfaces[count++])) { if (class_iid->Equals(*class_interface)) { - *bp = JS_TRUE; + *bp = true; return NS_OK; } @@ -3849,10 +3849,10 @@ LocationSetter(JSContext *cx, JS::Handle obj, JS::Handle id, JS nsresult rv = LocationSetterGuts(cx, obj, vp.address()); if (NS_FAILED(rv)) { xpc::Throw(cx, rv); - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } static JSBool @@ -3982,8 +3982,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, // Don't resolve standard classes on XrayWrappers, only resolve them if we're // resolving on the real global object. if (!xpc::WrapperFactory::IsXrayWrapper(obj)) { - JSBool did_resolve = JS_FALSE; - JSBool ok = JS_TRUE; + JSBool did_resolve = false; + JSBool ok = true; JS::Rooted exn(cx, JSVAL_VOID); { @@ -4017,7 +4017,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, if (!ok) { JS_SetPendingException(cx, exn); - *_retval = JS_FALSE; + *_retval = false; return NS_OK; } @@ -4215,7 +4215,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, if (obj == realObj) { JS::Rooted proto(cx); if (!js::GetObjectProto(cx, obj, &proto)) { - *_retval = JS_FALSE; + *_retval = false; return NS_OK; } if (proto) { @@ -4224,7 +4224,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags, pobj.address(), &val)) { - *_retval = JS_FALSE; + *_retval = false; return NS_OK; } @@ -4250,7 +4250,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, if (!js::ReportIfUndeclaredVarAssignment(cx, str) || !::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE)) { - *_retval = JS_FALSE; + *_retval = false; return NS_OK; } @@ -4665,7 +4665,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, if (NS_FAILED(rv)) { xpc::Throw(cx, NS_ERROR_FAILURE); - return JS_FALSE; + return false; } return *nodeList != nullptr; @@ -4682,18 +4682,18 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob // we need to return early to prevent
from shadowing // document.all.item(), etc. if (nsDOMClassInfo::sItem_id == id || nsDOMClassInfo::sNamedItem_id == id) { - return JS_TRUE; + return true; } JS::Rooted proto(cx); while (js::GetObjectJSClass(obj) != &sHTMLDocumentAllClass) { if (!js::GetObjectProto(cx, obj, &proto)) { - return JS_FALSE; + return false; } if (!proto) { NS_ERROR("The JS engine lies!"); - return JS_TRUE; + return true; } obj = proto; @@ -4712,7 +4712,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob nsRefPtr nodeList; if (!GetDocumentAllNodeList(cx, obj, doc, getter_AddRefs(nodeList))) { - return JS_FALSE; + return false; } uint32_t length; @@ -4721,12 +4721,12 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob if (NS_FAILED(rv)) { xpc::Throw(cx, rv); - return JS_FALSE; + return false; } vp.set(INT_TO_JSVAL(length)); - return JS_TRUE; + return true; } // For all other strings, look for an element by id or name. @@ -4735,7 +4735,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob if (NS_FAILED(rv)) { xpc::Throw(cx, rv); - return JS_FALSE; + return false; } } else if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) { // Map document.all[n] (where n is a number) to the n:th item in @@ -4743,7 +4743,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob nsRefPtr nodeList; if (!GetDocumentAllNodeList(cx, obj, doc, getter_AddRefs(nodeList))) { - return JS_FALSE; + return false; } nsIContent *node = nodeList->Item(JSID_TO_INT(id)); @@ -4759,13 +4759,13 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle ob if (NS_FAILED(rv)) { xpc::Throw(cx, rv); - return JS_FALSE; + return false; } } else { vp.setUndefined(); } - return JS_TRUE; + return true; } JSBool @@ -4794,11 +4794,11 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JS::Handle obj v = JSVAL_ONE; } else { if (!DocumentAllGetProperty(cx, obj, id, &v)) { - return JS_FALSE; + return false; } } - JSBool ok = JS_TRUE; + JSBool ok = true; if (v.get() != JSVAL_VOID) { ok = ::JS_DefinePropertyById(cx, obj, id, v, nullptr, nullptr, 0); diff --git a/dom/base/nsDOMClassInfoID.h b/dom/base/nsDOMClassInfoID.h index a949997ff9f..c3904f3e0a3 100644 --- a/dom/base/nsDOMClassInfoID.h +++ b/dom/base/nsDOMClassInfoID.h @@ -57,8 +57,7 @@ DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::EventTarget, \ DOMCI_CASTABLE_INTERFACE(nsDOMEvent, nsIDOMEvent, 3, _extra) \ DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 4, _extra) \ DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 5, _extra) \ -DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 6, \ - _extra) \ +DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsIContent, 6, _extra) \ DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra) \ DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \ DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \ diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index c2a932f7296..a419678f5b5 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -5360,7 +5360,10 @@ nsGlobalWindow::CanMoveResizeWindows() } } - if (mDocShell) { + // The preference is useful for the webapp runtime. Webapps should be able + // to resize or move their window. + if (mDocShell && !Preferences::GetBool("dom.always_allow_move_resize_window", + false)) { bool allow; nsresult rv = mDocShell->GetAllowWindowControl(&allow); if (NS_SUCCEEDED(rv) && !allow) @@ -6770,7 +6773,7 @@ PostMessageWriteStructuredClone(JSContext* cx, return runtimeCallbacks->write(cx, writer, obj, nullptr); } - return JS_FALSE; + return false; } JSStructuredCloneCallbacks kPostMessageCallbacks = { diff --git a/dom/base/nsGlobalWindowCommands.cpp b/dom/base/nsGlobalWindowCommands.cpp index a4571b4e4a5..8d02ba8c9e9 100644 --- a/dom/base/nsGlobalWindowCommands.cpp +++ b/dom/base/nsGlobalWindowCommands.cpp @@ -25,6 +25,7 @@ #include "nsIContentViewer.h" #include "nsFocusManager.h" #include "nsCopySupport.h" +#include "nsIClipboard.h" #include "nsGUIEvent.h" #include "mozilla/Attributes.h" @@ -365,7 +366,7 @@ nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext) nsCOMPtr presShell = docShell->GetPresShell(); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCopySupport::FireClipboardEvent(NS_COPY, presShell, nullptr); + nsCopySupport::FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, presShell, nullptr); return NS_OK; } diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index b9721621119..e2aa5bb8f23 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -704,7 +704,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx) if (!ctx) { // Can happen; see bug 355811 - return JS_TRUE; + return true; } // XXX Save the operation callback time so we can restore it after the GC, @@ -724,12 +724,12 @@ nsJSContext::DOMOperationCallback(JSContext *cx) // Initialize mOperationCallbackTime to start timing how long the // script has run ctx->mOperationCallbackTime = now; - return JS_TRUE; + return true; } if (ctx->mModalStateDepth) { // We're waiting on a modal dialog, nothing more to do here. - return JS_TRUE; + return true; } PRTime duration = now - callbackTime; @@ -741,7 +741,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx) global && xpc::AccessCheck::isChrome(js::GetObjectCompartment(global)); if (duration < (isTrackingChromeCodeTime ? sMaxChromeScriptRunTime : sMaxScriptRunTime)) { - return JS_TRUE; + return true; } if (!nsContentUtils::IsSafeToRunScript()) { @@ -751,14 +751,14 @@ nsJSContext::DOMOperationCallback(JSContext *cx) // that developers have some idea of what went wrong. JS_ReportWarning(cx, "A long running script was terminated"); - return JS_FALSE; + return false; } // If we get here we're most likely executing an infinite loop in JS, // we'll tell the user about this and we'll give the user the option // of stopping the execution of the script. nsCOMPtr prompt = GetPromptFromContext(ctx); - NS_ENSURE_TRUE(prompt, JS_FALSE); + NS_ENSURE_TRUE(prompt, false); // Check if we should offer the option to debug JS::RootedScript script(cx); @@ -844,7 +844,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx) if (NS_FAILED(rv) || !title || !msg || !stopButton || !waitButton || (!debugButton && debugPossible) || !neverShowDlg) { NS_ERROR("Failed to get localized strings."); - return JS_TRUE; + return true; } // Append file and line number information, if available @@ -902,14 +902,14 @@ nsJSContext::DOMOperationCallback(JSContext *cx) } ctx->mOperationCallbackTime = PR_Now(); - return JS_TRUE; + return true; } else if ((buttonPressed == 2) && debugPossible) { return js_CallContextDebugHandler(cx); } JS_ClearPendingException(cx); - return JS_FALSE; + return false; } void @@ -3326,7 +3326,7 @@ NS_DOMWriteStructuredClone(JSContext* cx, if (NS_FAILED(rv)) { // Don't know what this is. Bail. xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR); - return JS_FALSE; + return false; } // Prepare the ImageData internals. diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index e3683b1e169..206bd68e83b 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -38,13 +38,13 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename, unsigned lineno = 0; if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) { - return JS_FALSE; + return false; } *aFilename = ::JS_GetScriptFilename(aContext, script); *aLineno = lineno; - return JS_TRUE; + return true; } nsIScriptGlobalObject * diff --git a/dom/base/nsJSUtils.h b/dom/base/nsJSUtils.h index da72c5900c4..602f777b116 100644 --- a/dom/base/nsJSUtils.h +++ b/dom/base/nsJSUtils.h @@ -104,12 +104,12 @@ public: size_t length; const jschar* chars = JS_GetStringCharsZAndLength(aContext, str, &length); if (!chars) - return JS_FALSE; + return false; NS_ASSERTION(IsEmpty(), "init() on initialized string"); nsDependentString* base = this; new(base) nsDependentString(chars, length); - return JS_TRUE; + return true; } JSBool init(JSContext* aContext, const JS::Value &v) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index a7eba22ad6b..80799dc03a8 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -549,7 +549,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) JSBool match; if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) || - (match != JS_TRUE)) { + !match) { return; } diff --git a/dom/imptests/editing/implementation.js b/dom/imptests/editing/implementation.js index 70440b75956..c774c2cacf2 100644 --- a/dom/imptests/editing/implementation.js +++ b/dom/imptests/editing/implementation.js @@ -1971,8 +1971,7 @@ function isSimpleModifiableElement(node) { if (["A", "FONT", "S", "SPAN", "STRIKE", "U"].indexOf(node.tagName) != -1 && node.hasAttribute("style") && (node.style.length == 1 - || (node.style.length == 4 - && "MozTextBlink" in node.style + || (node.style.length == 3 && "MozTextDecorationColor" in node.style && "MozTextDecorationLine" in node.style && "MozTextDecorationStyle" in node.style) diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index 8bcbefddb7c..d6d69206fe0 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -49,7 +49,7 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath) NS_ASSERTION(JSVAL_IS_STRING(stringVal), "This should never happen"); JSString* str = JSVAL_TO_STRING(stringVal); - JSBool isIdentifier = JS_FALSE; + JSBool isIdentifier = false; if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) { return false; } diff --git a/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl b/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl index ba5634a5567..25b9a74f8ef 100644 --- a/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLAnchorElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(76ec122a-db6d-4b3f-8a24-15faf117f695)] -interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement +[scriptable, uuid(339c01c8-2d41-4626-b231-eec63f0241b6)] +interface nsIDOMHTMLAnchorElement : nsISupports { attribute DOMString href; attribute DOMString target; diff --git a/dom/interfaces/html/nsIDOMHTMLAppletElement.idl b/dom/interfaces/html/nsIDOMHTMLAppletElement.idl index c2dc2b22b72..6cce81699f2 100644 --- a/dom/interfaces/html/nsIDOMHTMLAppletElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLAppletElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(6f52375a-c9da-47fc-abf8-d009d1515426)] -interface nsIDOMHTMLAppletElement : nsIDOMHTMLElement +[scriptable, uuid(0b7d12c9-4cd3-47db-99c6-0b5ff910446c)] +interface nsIDOMHTMLAppletElement : nsISupports { attribute DOMString align; attribute DOMString alt; diff --git a/dom/interfaces/html/nsIDOMHTMLAreaElement.idl b/dom/interfaces/html/nsIDOMHTMLAreaElement.idl index 6cbdb6a4a13..819242e5f8a 100644 --- a/dom/interfaces/html/nsIDOMHTMLAreaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLAreaElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(d2379fff-180b-4c8d-be2d-70c9048fa5a1)] -interface nsIDOMHTMLAreaElement : nsIDOMHTMLElement +[scriptable, uuid(40c78026-36dc-40ca-9221-de73267e9e99)] +interface nsIDOMHTMLAreaElement : nsISupports { attribute DOMString alt; attribute DOMString coords; diff --git a/dom/interfaces/html/nsIDOMHTMLAudioElement.idl b/dom/interfaces/html/nsIDOMHTMLAudioElement.idl index 98320c617fe..677e7de1bd6 100644 --- a/dom/interfaces/html/nsIDOMHTMLAudioElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLAudioElement.idl @@ -16,7 +16,7 @@ * @status UNDER_DEVELOPMENT */ -[scriptable, uuid(fdfda110-e96b-4e98-8716-167a6555c80a)] +[scriptable, uuid(75a7f3ca-0761-4b63-863b-6fd6a87ed51c)] interface nsIDOMHTMLAudioElement : nsIDOMHTMLMediaElement { }; diff --git a/dom/interfaces/html/nsIDOMHTMLBRElement.idl b/dom/interfaces/html/nsIDOMHTMLBRElement.idl index 7fbceedc857..528380c6fea 100644 --- a/dom/interfaces/html/nsIDOMHTMLBRElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLBRElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(e619cdc1-b869-4ebf-a77c-754c68017240)] -interface nsIDOMHTMLBRElement : nsIDOMHTMLElement +[scriptable, uuid(ba8fb51a-e552-4272-b3df-5e63a60b86ee)] +interface nsIDOMHTMLBRElement : nsISupports { attribute DOMString clear; }; diff --git a/dom/interfaces/html/nsIDOMHTMLBaseElement.idl b/dom/interfaces/html/nsIDOMHTMLBaseElement.idl index 9cf5b365224..9b64f081ba8 100644 --- a/dom/interfaces/html/nsIDOMHTMLBaseElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLBaseElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(56d283c1-1715-4844-b58c-c4ab72072872)] -interface nsIDOMHTMLBaseElement : nsIDOMHTMLElement +[scriptable, uuid(a348ac22-7880-4613-af4c-984ec2ef5adc)] +interface nsIDOMHTMLBaseElement : nsISupports { attribute DOMString href; attribute DOMString target; diff --git a/dom/interfaces/html/nsIDOMHTMLBodyElement.idl b/dom/interfaces/html/nsIDOMHTMLBodyElement.idl index 5b67a8341d0..488137a98ad 100644 --- a/dom/interfaces/html/nsIDOMHTMLBodyElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLBodyElement.idl @@ -20,8 +20,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(8b29a62f-b448-49f3-9242-241d5cf94ea9)] -interface nsIDOMHTMLBodyElement : nsIDOMHTMLElement +[scriptable, uuid(cc19f3c8-82fe-4337-8174-d4cde5bedcee)] +interface nsIDOMHTMLBodyElement : nsISupports { attribute DOMString aLink; attribute DOMString background; diff --git a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl index 23584a11ab0..031d4c2eee9 100644 --- a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl @@ -18,8 +18,8 @@ interface nsIDOMValidityState; -[scriptable, uuid(5564816e-2ab5-46ee-95a4-8f4688bdb449)] -interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement +[scriptable, uuid(44b7a468-7dba-4f0c-9b4e-ee46dc0f26c7)] +interface nsIDOMHTMLButtonElement : nsISupports { attribute boolean autofocus; attribute boolean disabled; diff --git a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl index 8922e150d8c..c9f40ea36ef 100644 --- a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl @@ -46,8 +46,8 @@ interface nsIFileCallback : nsISupports { void receive(in nsIDOMBlob file); }; -[scriptable, uuid(788f69a4-30e0-42b4-804d-b99549f9d463)] -interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement +[scriptable, uuid(8978d1c5-2981-4678-a1c3-b0b7bae04fbc)] +interface nsIDOMHTMLCanvasElement : nsISupports { attribute unsigned long width; attribute unsigned long height; diff --git a/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl b/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl index ec967086107..52db061885f 100644 --- a/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLDirectoryElement.idl @@ -17,7 +17,7 @@ */ // Exists so that | element instanceof Ci.nsIDOMHTMLDirectoryElement | works. -[scriptable, uuid(cf50373e-e004-4cec-bc65-be9250d9e4c8)] -interface nsIDOMHTMLDirectoryElement : nsIDOMHTMLElement +[scriptable, uuid(8cfff7a4-8b14-4ce0-97b0-babe78da16f8)] +interface nsIDOMHTMLDirectoryElement : nsISupports { }; diff --git a/dom/interfaces/html/nsIDOMHTMLDivElement.idl b/dom/interfaces/html/nsIDOMHTMLDivElement.idl index 42d1ce77ce3..ad0aa1745fb 100644 --- a/dom/interfaces/html/nsIDOMHTMLDivElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLDivElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(f18a1930-0701-443b-9420-a937b61964d9)] -interface nsIDOMHTMLDivElement : nsIDOMHTMLElement +[scriptable, uuid(d1b51f44-38e0-4496-8236-b795e36df0e2)] +interface nsIDOMHTMLDivElement : nsISupports { attribute DOMString align; }; diff --git a/dom/interfaces/html/nsIDOMHTMLElement.idl b/dom/interfaces/html/nsIDOMHTMLElement.idl index bec7661f5c2..1dd1faa5419 100644 --- a/dom/interfaces/html/nsIDOMHTMLElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLElement.idl @@ -27,6 +27,7 @@ interface nsIDOMHTMLElement : nsIDOMElement attribute DOMString title; attribute DOMString lang; attribute DOMString dir; + [binaryname(DOMClassName)] attribute DOMString className; readonly attribute nsISupports dataset; diff --git a/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl b/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl index 3b68adc12fb..5556c751acf 100644 --- a/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl @@ -13,8 +13,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element */ -[scriptable, uuid(749531cf-af23-4ba7-97ae-2a0a200f833b)] -interface nsIDOMHTMLEmbedElement : nsIDOMHTMLElement +[scriptable, uuid(adae53da-713d-4570-81ad-dabdd6d46241)] +interface nsIDOMHTMLEmbedElement : nsISupports { attribute DOMString align; attribute DOMString height; diff --git a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl index e90be65588c..3290a185d55 100644 --- a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl @@ -18,8 +18,8 @@ interface nsIDOMValidityState; -[scriptable, uuid(eb09f2e9-f0fc-4000-ab15-e68b0ac09bbd)] -interface nsIDOMHTMLFieldSetElement : nsIDOMHTMLElement +[scriptable, uuid(e3d91535-9da3-4c4b-a809-f17d85a4fb9f)] +interface nsIDOMHTMLFieldSetElement : nsISupports { attribute boolean disabled; readonly attribute nsIDOMHTMLFormElement form; diff --git a/dom/interfaces/html/nsIDOMHTMLFormElement.idl b/dom/interfaces/html/nsIDOMHTMLFormElement.idl index b2b7073721c..5e58a0f4b8b 100644 --- a/dom/interfaces/html/nsIDOMHTMLFormElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLFormElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(5e49bff8-fb61-41e3-b6a9-2017865a6d74)] -interface nsIDOMHTMLFormElement : nsIDOMHTMLElement +[scriptable, uuid(ad9b2ad0-9d29-43f6-b1a2-a1fd24627e6b)] +interface nsIDOMHTMLFormElement : nsISupports { attribute DOMString acceptCharset; attribute DOMString action; diff --git a/dom/interfaces/html/nsIDOMHTMLFrameElement.idl b/dom/interfaces/html/nsIDOMHTMLFrameElement.idl index 1d40b92eadd..463dc47f0d5 100644 --- a/dom/interfaces/html/nsIDOMHTMLFrameElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLFrameElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(1a79af54-dbbb-4532-be48-944f3995e7e9)] -interface nsIDOMHTMLFrameElement : nsIDOMHTMLElement +[scriptable, uuid(60ab25b9-3246-4f50-b0d4-21e73ba88cd6)] +interface nsIDOMHTMLFrameElement : nsISupports { attribute DOMString frameBorder; attribute DOMString longDesc; diff --git a/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl index a202f857b88..21be13197aa 100644 --- a/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLFrameSetElement.idl @@ -20,8 +20,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(2531cc4f-c918-4e6d-9021-7d89216c1ebe)] -interface nsIDOMHTMLFrameSetElement : nsIDOMHTMLElement +[scriptable, uuid(aea59d1c-ff6f-4b26-88dc-2f9b4be1a138)] +interface nsIDOMHTMLFrameSetElement : nsISupports { attribute DOMString cols; attribute DOMString rows; diff --git a/dom/interfaces/html/nsIDOMHTMLHRElement.idl b/dom/interfaces/html/nsIDOMHTMLHRElement.idl index 87ad5d387ac..6291b46d3c3 100644 --- a/dom/interfaces/html/nsIDOMHTMLHRElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLHRElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(26260ff8-6a9e-4bf5-9f61-93200f37e53a)] -interface nsIDOMHTMLHRElement : nsIDOMHTMLElement +[scriptable, uuid(30771953-b9f4-44de-b0fe-e490949af98b)] +interface nsIDOMHTMLHRElement : nsISupports { attribute DOMString align; attribute boolean noShade; diff --git a/dom/interfaces/html/nsIDOMHTMLHeadElement.idl b/dom/interfaces/html/nsIDOMHTMLHeadElement.idl index b2b22be825a..ba08bbbd09c 100644 --- a/dom/interfaces/html/nsIDOMHTMLHeadElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLHeadElement.idl @@ -16,7 +16,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(889602bb-4681-4b01-8582-4fad1fbb8325)] -interface nsIDOMHTMLHeadElement : nsIDOMHTMLElement +[scriptable, uuid(59b80014-00f5-412d-846f-725494122d42)] +interface nsIDOMHTMLHeadElement : nsISupports { }; diff --git a/dom/interfaces/html/nsIDOMHTMLHeadingElement.idl b/dom/interfaces/html/nsIDOMHTMLHeadingElement.idl index decdb412482..a5f67013064 100644 --- a/dom/interfaces/html/nsIDOMHTMLHeadingElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLHeadingElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(e601aadf-e9e7-4605-a6f9-2cd2006723de)] -interface nsIDOMHTMLHeadingElement : nsIDOMHTMLElement +[scriptable, uuid(a40b92f7-9da7-4c9f-8a0c-cf5b9e28bb30)] +interface nsIDOMHTMLHeadingElement : nsISupports { attribute DOMString align; }; diff --git a/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl b/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl index 876c7839c76..ad0e6792f50 100644 --- a/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(a624104d-10e8-42f3-9f61-45b64217ba4c)] -interface nsIDOMHTMLHtmlElement : nsIDOMHTMLElement +[scriptable, uuid(6a5d2ce7-2c45-43c1-bdab-9df7a06caed1)] +interface nsIDOMHTMLHtmlElement : nsISupports { attribute DOMString version; }; diff --git a/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl b/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl index 57508a25fa9..645da48e78c 100644 --- a/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(60D9BCF1-3B0C-4704-AE8C-5B6AC0180B2E)] -interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement +[scriptable, uuid(9fd7b656-1055-4cb2-b8b1-ed13efe24457)] +interface nsIDOMHTMLIFrameElement : nsISupports { attribute DOMString align; attribute DOMString frameBorder; diff --git a/dom/interfaces/html/nsIDOMHTMLImageElement.idl b/dom/interfaces/html/nsIDOMHTMLImageElement.idl index 79694be937e..3ae8dda9aad 100644 --- a/dom/interfaces/html/nsIDOMHTMLImageElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLImageElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(98c38ca0-5e3a-4c71-90a4-69d12a3c8d16)] -interface nsIDOMHTMLImageElement : nsIDOMHTMLElement +[scriptable, uuid(d3e488b9-3b29-410a-bcf4-18fb874c170a)] +interface nsIDOMHTMLImageElement : nsISupports { attribute DOMString alt; attribute DOMString src; diff --git a/dom/interfaces/html/nsIDOMHTMLInputElement.idl b/dom/interfaces/html/nsIDOMHTMLInputElement.idl index 10ecec09376..8bc4bb22717 100644 --- a/dom/interfaces/html/nsIDOMHTMLInputElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl @@ -20,8 +20,8 @@ interface nsIDOMValidityState; * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(d57537ed-39d0-46ea-8516-0ce0a5bfb805)] -interface nsIDOMHTMLInputElement : nsIDOMHTMLElement +[scriptable, uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)] +interface nsIDOMHTMLInputElement : nsISupports { attribute DOMString accept; attribute DOMString alt; diff --git a/dom/interfaces/html/nsIDOMHTMLLIElement.idl b/dom/interfaces/html/nsIDOMHTMLLIElement.idl index 67993fc7844..844c6dc00d6 100644 --- a/dom/interfaces/html/nsIDOMHTMLLIElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLLIElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(e2d41287-964c-472c-ba40-24dcdc9489c2)] -interface nsIDOMHTMLLIElement : nsIDOMHTMLElement +[scriptable, uuid(17bd5c1c-3746-4268-a9f6-45018025f09c)] +interface nsIDOMHTMLLIElement : nsISupports { attribute DOMString type; attribute long value; diff --git a/dom/interfaces/html/nsIDOMHTMLLabelElement.idl b/dom/interfaces/html/nsIDOMHTMLLabelElement.idl index ac433c023bd..81efc33c08e 100644 --- a/dom/interfaces/html/nsIDOMHTMLLabelElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLLabelElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(cbffa708-f51e-4c74-9644-19f9d417aac5)] -interface nsIDOMHTMLLabelElement : nsIDOMHTMLElement +[scriptable, uuid(efc0eaf2-5756-4388-a229-fbec2033529d)] +interface nsIDOMHTMLLabelElement : nsISupports { readonly attribute nsIDOMHTMLFormElement form; attribute DOMString htmlFor; diff --git a/dom/interfaces/html/nsIDOMHTMLLinkElement.idl b/dom/interfaces/html/nsIDOMHTMLLinkElement.idl index 7c48d7a6913..0b8ad253227 100644 --- a/dom/interfaces/html/nsIDOMHTMLLinkElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLLinkElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(ad43cb9b-3253-446d-8ba9-50ee50ff017e)] -interface nsIDOMHTMLLinkElement : nsIDOMHTMLElement +[scriptable, uuid(95d6ec66-2754-45bd-a068-49ac1fb45004)] +interface nsIDOMHTMLLinkElement : nsISupports { [binaryname(MozDisabled)] attribute boolean disabled; diff --git a/dom/interfaces/html/nsIDOMHTMLMapElement.idl b/dom/interfaces/html/nsIDOMHTMLMapElement.idl index fa2bd9cbe01..5824c90531b 100644 --- a/dom/interfaces/html/nsIDOMHTMLMapElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMapElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(828f3b64-1df7-4592-b903-757d2fc3a4ca)] -interface nsIDOMHTMLMapElement : nsIDOMHTMLElement +[scriptable, uuid(3f49f8c6-2e9d-4323-b30c-2404d5ff1f57)] +interface nsIDOMHTMLMapElement : nsISupports { readonly attribute nsIDOMHTMLCollection areas; attribute DOMString name; diff --git a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl index 30d95c39078..01a4ecae7fc 100644 --- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl @@ -27,8 +27,8 @@ interface nsIDOMMediaStream; #endif %} -[scriptable, uuid(21354ac9-7166-46a0-a3f0-a3135c3cc804)] -interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement +[scriptable, uuid(d83d38f3-68b9-4ea2-8748-1cc738d74333)] +interface nsIDOMHTMLMediaElement : nsISupports { // error state readonly attribute nsIDOMMediaError error; diff --git a/dom/interfaces/html/nsIDOMHTMLMenuElement.idl b/dom/interfaces/html/nsIDOMHTMLMenuElement.idl index c88ddf56c83..92861c8cd0e 100644 --- a/dom/interfaces/html/nsIDOMHTMLMenuElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMenuElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(689de43c-4614-4728-b3b1-30a02636c2a3)] -interface nsIDOMHTMLMenuElement : nsIDOMHTMLElement +[scriptable, uuid(a1ca9af6-f865-4fdf-901d-5858bb0ad5ea)] +interface nsIDOMHTMLMenuElement : nsISupports { attribute boolean compact; diff --git a/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl b/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl index fa4e9b2ab02..4e9980fb511 100644 --- a/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMenuItemElement.idl @@ -10,8 +10,8 @@ * element. */ -[scriptable, uuid(53180e95-90af-4c6e-9d16-34fa799f84d5)] -interface nsIDOMHTMLMenuItemElement : nsIDOMHTMLElement +[scriptable, uuid(979d6e44-5930-4232-b405-873939655c19)] +interface nsIDOMHTMLMenuItemElement : nsISupports { attribute DOMString type; attribute DOMString label; diff --git a/dom/interfaces/html/nsIDOMHTMLMetaElement.idl b/dom/interfaces/html/nsIDOMHTMLMetaElement.idl index 3376b2cfced..a616e3466e1 100644 --- a/dom/interfaces/html/nsIDOMHTMLMetaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMetaElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(f2fd397e-663d-47ae-ae26-1cc654d56461)] -interface nsIDOMHTMLMetaElement : nsIDOMHTMLElement +[scriptable, uuid(2a3f789e-0667-464f-a8d7-6f58513443d9)] +interface nsIDOMHTMLMetaElement : nsISupports { attribute DOMString content; attribute DOMString httpEquiv; diff --git a/dom/interfaces/html/nsIDOMHTMLOListElement.idl b/dom/interfaces/html/nsIDOMHTMLOListElement.idl index 25067a2bc50..30db9704524 100644 --- a/dom/interfaces/html/nsIDOMHTMLOListElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLOListElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(d2359d18-dffb-452d-bdce-984f6fc0f893)] -interface nsIDOMHTMLOListElement : nsIDOMHTMLElement +[scriptable, uuid(d899642a-53e2-4eb4-9d65-4a666a45ee01)] +interface nsIDOMHTMLOListElement : nsISupports { attribute boolean compact; attribute boolean reversed; diff --git a/dom/interfaces/html/nsIDOMHTMLObjectElement.idl b/dom/interfaces/html/nsIDOMHTMLObjectElement.idl index ac5c4ba6b73..e322b30efb2 100644 --- a/dom/interfaces/html/nsIDOMHTMLObjectElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLObjectElement.idl @@ -18,8 +18,8 @@ interface nsIDOMValidityState; -[scriptable, uuid(bed8f222-c4dd-41ba-9ec6-dfae0ec8def8)] -interface nsIDOMHTMLObjectElement : nsIDOMHTMLElement +[scriptable, uuid(baf443d2-da5d-40c9-be3c-c65a69a25250)] +interface nsIDOMHTMLObjectElement : nsISupports { readonly attribute nsIDOMHTMLFormElement form; attribute DOMString code; diff --git a/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl b/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl index d5566e231cc..7b145b4d90c 100644 --- a/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLOptGroupElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(a288495a-27f1-4954-bb6b-3bb6afb63ab2)] -interface nsIDOMHTMLOptGroupElement : nsIDOMHTMLElement +[scriptable, uuid(6fa79f99-4ce4-4634-840a-867fcfb32dba)] +interface nsIDOMHTMLOptGroupElement : nsISupports { attribute boolean disabled; attribute DOMString label; diff --git a/dom/interfaces/html/nsIDOMHTMLOptionElement.idl b/dom/interfaces/html/nsIDOMHTMLOptionElement.idl index a90d6bd161d..ed2ec9dd62d 100644 --- a/dom/interfaces/html/nsIDOMHTMLOptionElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLOptionElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(09017cf4-0004-4c27-a340-7f5d2fe282e3)] -interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement +[scriptable, uuid(c2b3e9ff-6b36-4158-ace3-05a9c5b8e1c1)] +interface nsIDOMHTMLOptionElement : nsISupports { attribute boolean disabled; readonly attribute nsIDOMHTMLFormElement form; diff --git a/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl b/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl index 19fe2121f08..0a172cdf850 100644 --- a/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLParagraphElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(9be22a4b-4edc-4c37-9403-c9350671b86f)] -interface nsIDOMHTMLParagraphElement : nsIDOMHTMLElement +[scriptable, uuid(b494e517-2388-4a63-80e7-2f73be3c38a3)] +interface nsIDOMHTMLParagraphElement : nsISupports { attribute DOMString align; }; diff --git a/dom/interfaces/html/nsIDOMHTMLPreElement.idl b/dom/interfaces/html/nsIDOMHTMLPreElement.idl index 5ac1202b40e..3ae5956675c 100644 --- a/dom/interfaces/html/nsIDOMHTMLPreElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLPreElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(c805dade-fe2a-4f30-b7d7-e572554a3498)] -interface nsIDOMHTMLPreElement : nsIDOMHTMLElement +[scriptable, uuid(a2441b77-ad22-4275-b1dd-1b58c044fd04)] +interface nsIDOMHTMLPreElement : nsISupports { attribute long width; }; diff --git a/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl b/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl index a22ed6cd437..df380b494be 100644 --- a/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLQuoteElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(18a3b3c4-447d-4df6-9681-e8953e2da6a8)] -interface nsIDOMHTMLQuoteElement : nsIDOMHTMLElement +[scriptable, uuid(f02502b5-32a6-4df7-8a57-1416553a3188)] +interface nsIDOMHTMLQuoteElement : nsISupports { attribute DOMString cite; }; diff --git a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl index f8ae4b2cf2e..02ec010010b 100644 --- a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(8783371a-6185-4176-9ed9-f781c75bf48a)] -interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement +[scriptable, uuid(4627336e-3070-4e73-8f67-3851b54cc0eb)] +interface nsIDOMHTMLScriptElement : nsISupports { attribute DOMString src; attribute boolean async; diff --git a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl index 87c63d230d9..a4233654ae0 100644 --- a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl @@ -19,8 +19,8 @@ interface nsIDOMValidityState; -[scriptable, uuid(8af2123f-c83a-430a-a739-d103a8eaba52)] -interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement +[scriptable, uuid(846578b2-6d4f-4399-86cc-2c05f19469d0)] +interface nsIDOMHTMLSelectElement : nsISupports { attribute boolean autofocus; attribute boolean disabled; diff --git a/dom/interfaces/html/nsIDOMHTMLSourceElement.idl b/dom/interfaces/html/nsIDOMHTMLSourceElement.idl index a5e896a32c6..7da9bc6034c 100644 --- a/dom/interfaces/html/nsIDOMHTMLSourceElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLSourceElement.idl @@ -16,8 +16,8 @@ * @status UNDER_DEVELOPMENT */ -[scriptable, uuid(a5cf9a0e-bb2f-4fdf-9a25-c52069bb62c2)] -interface nsIDOMHTMLSourceElement : nsIDOMHTMLElement +[scriptable, uuid(7adbaf06-572d-4c99-bd59-ac673ddcca93)] +interface nsIDOMHTMLSourceElement : nsISupports { attribute DOMString src; attribute DOMString type; diff --git a/dom/interfaces/html/nsIDOMHTMLStyleElement.idl b/dom/interfaces/html/nsIDOMHTMLStyleElement.idl index 371352e72de..25be003f24f 100644 --- a/dom/interfaces/html/nsIDOMHTMLStyleElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLStyleElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(e81273e1-d440-4dd3-9073-8199f7a9525e)] -interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement +[scriptable, uuid(fa326d22-8739-4eef-a80e-6449bde605d2)] +interface nsIDOMHTMLStyleElement : nsISupports { [binaryname(MozDisabled)] attribute boolean disabled; diff --git a/dom/interfaces/html/nsIDOMHTMLTableCaptionElem.idl b/dom/interfaces/html/nsIDOMHTMLTableCaptionElem.idl index 37679d4f7b6..00a1567a3bf 100644 --- a/dom/interfaces/html/nsIDOMHTMLTableCaptionElem.idl +++ b/dom/interfaces/html/nsIDOMHTMLTableCaptionElem.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, builtinclass, uuid(cde2ef8a-4953-425d-9bd5-977035156f01)] -interface nsIDOMHTMLTableCaptionElement : nsIDOMHTMLElement +[scriptable, builtinclass, uuid(78f0635b-44d2-4d5c-87de-29d54df6aed6)] +interface nsIDOMHTMLTableCaptionElement : nsISupports { attribute DOMString align; }; diff --git a/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl b/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl index e9f2cb0cabd..593abff4f1e 100644 --- a/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLTableCellElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(1fb22137-c231-4eae-9ca4-557bb0852d89)] -interface nsIDOMHTMLTableCellElement : nsIDOMHTMLElement +[scriptable, uuid(3203c36f-33fd-4628-8c88-77e82d38df1e)] +interface nsIDOMHTMLTableCellElement : nsISupports { readonly attribute long cellIndex; attribute DOMString abbr; diff --git a/dom/interfaces/html/nsIDOMHTMLTableElement.idl b/dom/interfaces/html/nsIDOMHTMLTableElement.idl index 4d16be2fee4..be89a650381 100644 --- a/dom/interfaces/html/nsIDOMHTMLTableElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLTableElement.idl @@ -16,7 +16,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(1a7bf1f1-5d6c-4200-9ceb-455874322315)] -interface nsIDOMHTMLTableElement : nsIDOMHTMLElement +[scriptable, uuid(135a30ee-0374-4ee7-9d36-91736bff5fb1)] +interface nsIDOMHTMLTableElement : nsISupports { }; diff --git a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl index 4c16aef963c..9dcb4a02887 100644 --- a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl @@ -19,8 +19,8 @@ interface nsIDOMValidityState; * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(b7e1b86f-c98e-4658-81ce-ac29962f854a)] -interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement +[scriptable, uuid(7a4aeb2e-fcf3-443e-b002-ca1c8ea322e9)] +interface nsIDOMHTMLTextAreaElement : nsISupports { attribute boolean autofocus; attribute unsigned long cols; diff --git a/dom/interfaces/html/nsIDOMHTMLTitleElement.idl b/dom/interfaces/html/nsIDOMHTMLTitleElement.idl index 23435e51948..f0706983f66 100644 --- a/dom/interfaces/html/nsIDOMHTMLTitleElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLTitleElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(388687e5-960f-472f-9f10-e3cbd820d5fc)] -interface nsIDOMHTMLTitleElement : nsIDOMHTMLElement +[scriptable, uuid(e8e5168a-e12e-4946-9fa7-5fe0d6932198)] +interface nsIDOMHTMLTitleElement : nsISupports { attribute DOMString text; }; diff --git a/dom/interfaces/html/nsIDOMHTMLUListElement.idl b/dom/interfaces/html/nsIDOMHTMLUListElement.idl index e5f6ef5be73..91c968d6f94 100644 --- a/dom/interfaces/html/nsIDOMHTMLUListElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLUListElement.idl @@ -16,8 +16,8 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(77fc8623-3380-4e9d-a532-a4a50e4f2abd)] -interface nsIDOMHTMLUListElement : nsIDOMHTMLElement +[scriptable, uuid(8ba1ee8d-36a4-43fc-9148-5144c2a29c96)] +interface nsIDOMHTMLUListElement : nsISupports { attribute boolean compact; attribute DOMString type; diff --git a/dom/interfaces/html/nsIDOMHTMLVideoElement.idl b/dom/interfaces/html/nsIDOMHTMLVideoElement.idl index 4d39eb79943..fef138e7a8d 100644 --- a/dom/interfaces/html/nsIDOMHTMLVideoElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLVideoElement.idl @@ -16,7 +16,7 @@ * @status UNDER_DEVELOPMENT */ -[scriptable, uuid(b48ec2c0-7529-4212-9717-1ce95507e7e4)] +[scriptable, uuid(185a3e8f-56a7-4bda-8dc7-2cff6ed07d1d)] interface nsIDOMHTMLVideoElement : nsIDOMHTMLMediaElement { attribute long width; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 5eb578e8cca..69f4a9497e2 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -827,38 +827,44 @@ ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL, void ContentParent::ShutDownProcess(bool aCloseWithError) { - if (!mIsDestroyed) { - mIsDestroyed = true; - const InfallibleTArray& idbParents = - ManagedPIndexedDBParent(); + ManagedPIndexedDBParent(); for (uint32_t i = 0; i < idbParents.Length(); ++i) { - static_cast(idbParents[i])->Disconnect(); + static_cast(idbParents[i])->Disconnect(); } - if (aCloseWithError) { - AsyncChannel* channel = GetIPCChannel(); - if (channel) { - channel->CloseWithError(); - } - } else { - // Close() can only be called once: It kicks off the destruction sequence. - Close(); - } - } - // NB: must MarkAsDead() here so that this isn't accidentally - // returned from Get*() while in the midst of shutdown. - MarkAsDead(); + // If Close() fails with an error, we'll end up back in this function, but + // with aCloseWithError = true. It's important that we call + // CloseWithError() in this case; see bug 895204. - // A ContentParent object might not get freed until after XPCOM shutdown has - // shut down the cycle collector. But by then it's too late to release any - // CC'ed objects, so we need to null them out here, while we still can. See - // bug 899761. - mMemoryReporters.Clear(); - if (mMessageManager) { - mMessageManager->Disconnect(); - mMessageManager = nullptr; - } + if (!aCloseWithError && !mCalledClose) { + // Close() can only be called once: It kicks off the destruction + // sequence. + mCalledClose = true; + Close(); + } + + if (aCloseWithError && !mCalledCloseWithError) { + AsyncChannel* channel = GetIPCChannel(); + if (channel) { + mCalledCloseWithError = true; + channel->CloseWithError(); + } + } + + // NB: must MarkAsDead() here so that this isn't accidentally + // returned from Get*() while in the midst of shutdown. + MarkAsDead(); + + // A ContentParent object might not get freed until after XPCOM shutdown has + // shut down the cycle collector. But by then it's too late to release any + // CC'ed objects, so we need to null them out here, while we still can. See + // bug 899761. + mMemoryReporters.Clear(); + if (mMessageManager) { + mMessageManager->Disconnect(); + mMessageManager = nullptr; + } } void @@ -1167,9 +1173,10 @@ ContentParent::ContentParent(mozIApplication* aApp, , mForceKillTask(nullptr) , mNumDestroyingTabs(0) , mIsAlive(true) - , mIsDestroyed(false) , mSendPermissionUpdates(false) , mIsForBrowser(aIsForBrowser) + , mCalledClose(false) + , mCalledCloseWithError(false) { // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated should // be true. diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 05573a68679..debf5cad1a3 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -471,13 +471,15 @@ private: // false, but some previously scheduled IPC traffic may still pass // through. bool mIsAlive; - // True after the OS-level shutdown sequence has been initiated. - // After going true, any use of this at all, including lingering - // IPC traffic passing through, will cause assertions to fail. - bool mIsDestroyed; + bool mSendPermissionUpdates; bool mIsForBrowser; + // These variables track whether we've called Close() and CloseWithError() + // on our channel. + bool mCalledClose; + bool mCalledCloseWithError; + friend class CrashReporterParent; nsRefPtr mConsoleService; diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index 9e8483018f1..d3d1019ff83 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -473,12 +473,12 @@ ReportExceptionIfPending(JSContext *cx) const char *ex = PeekException(); if (!ex) { - return JS_TRUE; + return true; } ThrowJSException(cx, nullptr); - return JS_FALSE; + return false; } @@ -633,7 +633,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, } JS::Rooted v(cx); - JSBool ok; + bool ok; { JS::AutoArrayRooter tvr(cx, 0, jsargs); @@ -650,9 +650,9 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, if (newObj) { v = OBJECT_TO_JSVAL(newObj); - ok = JS_TRUE; + ok = true; } else { - ok = JS_FALSE; + ok = false; } } else { ok = ::JS_CallFunctionValue(cx, npjsobj->mJSObj, fv, argCount, jsargs, v.address()); @@ -666,9 +666,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, if (ok) ok = JSValToNPVariant(npp, cx, v, result); - // return ok == JS_TRUE to quiet down compiler warning, even if - // return ok is what we really want. - return ok == JS_TRUE; + return ok; } // static @@ -712,7 +710,7 @@ nsJSObjWrapper::NP_HasProperty(NPObject *npobj, NPIdentifier id) } nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - JSBool found, ok = JS_FALSE; + JSBool found, ok = false; nsCxPusher pusher; pusher.Push(cx); @@ -776,7 +774,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier id, } nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - JSBool ok = JS_FALSE; + bool ok = false; nsCxPusher pusher; pusher.Push(cx); @@ -789,9 +787,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier id, "id must be either string or int!\n"); ok = ::JS_SetPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), v); - // return ok == JS_TRUE to quiet down compiler warning, even if - // return ok is what we really want. - return ok == JS_TRUE; + return ok; } // static @@ -813,7 +809,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier id) } nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - JSBool ok = JS_FALSE; + JSBool ok = false; nsCxPusher pusher; pusher.Push(cx); @@ -1113,11 +1109,11 @@ NPObjWrapper_AddProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->hasMethod) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } if (NPObjectIsOutOfProcessProxy(npobj)) { - return JS_TRUE; + return true; } PluginDestructionGuard pdg(LookupNPP(npobj)); @@ -1125,24 +1121,24 @@ NPObjWrapper_AddProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (hasProperty) - return JS_TRUE; + return true; // We must permit methods here since JS_DefineUCFunction() will add // the function as a property JSBool hasMethod = npobj->_class->hasMethod(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (!hasMethod) { ThrowJSException(cx, "Trying to add unsupported property on NPObject!"); - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } static JSBool @@ -1154,7 +1150,7 @@ NPObjWrapper_DelProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->removeProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } PluginDestructionGuard pdg(LookupNPP(npobj)); @@ -1164,11 +1160,11 @@ NPObjWrapper_DelProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (!hasProperty) { *succeeded = true; - return JS_TRUE; + return true; } } @@ -1188,7 +1184,7 @@ NPObjWrapper_SetProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->setProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } // Find out what plugin (NPP) is the owner of the object we're @@ -1198,7 +1194,7 @@ NPObjWrapper_SetProperty(JSContext *cx, JS::Handle obj, JS::Handle obj, JS::Handle_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (!hasProperty) { ThrowJSException(cx, "Trying to set unsupported property on NPObject!"); - return JS_FALSE; + return false; } } @@ -1221,21 +1217,21 @@ NPObjWrapper_SetProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->setProperty(npobj, identifier, &npv); _releasevariantvalue(&npv); // Release the variant if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (!ok) { ThrowJSException(cx, "Error setting property on NPObject!"); - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } static JSBool @@ -1247,7 +1243,7 @@ NPObjWrapper_GetProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->hasMethod || !npobj->_class->getProperty) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } // Find out what plugin (NPP) is the owner of the object we're @@ -1256,7 +1252,7 @@ NPObjWrapper_GetProperty(JSContext *cx, JS::Handle obj, JS::Handle obj, JS::HandleGetPropertyHelper(identifier, &hasProperty, &hasMethod, &npv); if (!ReportExceptionIfPending(cx)) { if (success) _releasevariantvalue(&npv); - return JS_FALSE; + return false; } if (success) { @@ -1294,19 +1290,19 @@ NPObjWrapper_GetProperty(JSContext *cx, JS::Handle obj, JS::Handle_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; hasMethod = npobj->_class->hasMethod(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; // We return NPObject Member class here to support ambiguous members. if (hasProperty && hasMethod) @@ -1319,10 +1315,10 @@ NPObjWrapper_GetProperty(JSContext *cx, JS::Handle obj, JS::Handle obj, unsigned argc, if (!npobj || !npobj->_class) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } // Find out what plugin (NPP) is the owner of the object we're @@ -1344,7 +1340,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, if (!npp) { ThrowJSException(cx, "Error finding NPP for NPObject!"); - return JS_FALSE; + return false; } PluginDestructionGuard pdg(npp); @@ -1360,7 +1356,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, if (!npargs) { ThrowJSException(cx, "Out of memory!"); - return JS_FALSE; + return false; } } @@ -1374,7 +1370,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, PR_Free(npargs); } - return JS_FALSE; + return false; } } @@ -1393,7 +1389,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, npobj->_class->construct) { ok = npobj->_class->construct(npobj, npargs, argc, &v); } else { - ok = JS_FALSE; + ok = false; msg = "Attempt to construct object from class with no constructor."; } @@ -1408,7 +1404,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, ok = npobj->_class->invoke(npobj, id, npargs, argc, &v); } else { - ok = JS_FALSE; + ok = false; msg = "Attempt to call a method on object with no invoke method."; } @@ -1419,7 +1415,7 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, ok = npobj->_class->invokeDefault(npobj, npargs, argc, &v); } else { - ok = JS_FALSE; + ok = false; msg = "Attempt to call a default method on object with no " "invokeDefault method."; @@ -1436,12 +1432,12 @@ CallNPMethodInternal(JSContext *cx, JS::Handle obj, unsigned argc, } if (!ok) { - // ReportExceptionIfPending returns a return value, which is JS_TRUE + // ReportExceptionIfPending returns a return value, which is true // if no exception was thrown. In that case, throw our own. if (ReportExceptionIfPending(cx)) ThrowJSException(cx, msg); - return JS_FALSE; + return false; } *rval = NPVariantToJSVal(npp, cx, &v); @@ -1479,7 +1475,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle obj, JSIterateOp if (!npobj || !npobj->_class) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } PluginDestructionGuard pdg(LookupNPP(npobj)); @@ -1494,7 +1490,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle obj, JSIterateOp ThrowJSException(cx, "Memory allocation failed for " "NPObjectEnumerateState!"); - return JS_FALSE; + return false; } if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(npobj->_class) || @@ -1505,13 +1501,13 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle obj, JSIterateOp delete state; if (ReportExceptionIfPending(cx)) { - // ReportExceptionIfPending returns a return value, which is JS_TRUE + // ReportExceptionIfPending returns a return value, which is true // if no exception was thrown. In that case, throw our own. ThrowJSException(cx, "Error enumerating properties on scriptable " "plugin object"); } - return JS_FALSE; + return false; } state->value = enum_value; @@ -1530,7 +1526,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle obj, JSIterateOp length = state->length; if (state->index != length) { *idp = NPIdentifierToJSId(enum_value[state->index++]); - return JS_TRUE; + return true; } // FALL THROUGH @@ -1545,7 +1541,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle obj, JSIterateOp break; } - return JS_TRUE; + return true; } static JSBool @@ -1558,7 +1554,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JS::Handle obj, JS::Handle_class->hasMethod) { ThrowJSException(cx, "Bad NPObject as private data!"); - return JS_FALSE; + return false; } PluginDestructionGuard pdg(LookupNPP(npobj)); @@ -1567,24 +1563,24 @@ NPObjWrapper_NewResolve(JSContext *cx, JS::Handle obj, JS::Handle_class->hasProperty(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (hasProperty) { NS_ASSERTION(JSID_IS_STRING(id) || JSID_IS_INT(id), "id must be either string or int!\n"); if (!::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, nullptr, nullptr, JSPROP_ENUMERATE | JSPROP_SHARED)) { - return JS_FALSE; + return false; } objp.set(obj); - return JS_TRUE; + return true; } bool hasMethod = npobj->_class->hasMethod(npobj, identifier); if (!ReportExceptionIfPending(cx)) - return JS_FALSE; + return false; if (hasMethod) { NS_ASSERTION(JSID_IS_STRING(id) || JSID_IS_INT(id), @@ -1599,7 +1595,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JS::Handle obj, JS::Handle id, NPVariant* getPropertyResult, JS::Value *vp) { - NS_ENSURE_TRUE(vp, JS_FALSE); + NS_ENSURE_TRUE(vp, false); if (!npobj || !npobj->_class || !npobj->_class->getProperty || !npobj->_class->invoke) { ThrowJSException(cx, "Bad NPObject"); - return JS_FALSE; + return false; } NPObjectMemberPrivate *memberPrivate = (NPObjectMemberPrivate *)PR_Malloc(sizeof(NPObjectMemberPrivate)); if (!memberPrivate) - return JS_FALSE; + return false; // Make sure to clear all members in case something fails here // during initialization. @@ -1969,7 +1965,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, JSObject *memobj = ::JS_NewObject(cx, &sNPObjectMemberClass, nullptr, nullptr); if (!memobj) { PR_Free(memberPrivate); - return JS_FALSE; + return false; } *vp = OBJECT_TO_JSVAL(memobj); @@ -1993,12 +1989,12 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, &npv); if (!ReportExceptionIfPending(cx)) { ::JS_RemoveValueRoot(cx, vp); - return JS_FALSE; + return false; } if (!hasProperty) { ::JS_RemoveValueRoot(cx, vp); - return JS_FALSE; + return false; } } @@ -2017,7 +2013,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, ::JS_RemoveValueRoot(cx, vp); - return JS_TRUE; + return true; } static JSBool @@ -2029,7 +2025,7 @@ NPObjectMember_Convert(JSContext *cx, JS::Handle obj, JSType type, JS nullptr); if (!memberPrivate) { NS_ERROR("no Ambiguous Member Private data!"); - return JS_FALSE; + return false; } switch (type) { @@ -2040,17 +2036,17 @@ NPObjectMember_Convert(JSContext *cx, JS::Handle obj, JSType type, JS if (!JSVAL_IS_PRIMITIVE(vp)) { return JS_DefaultValue(cx, JSVAL_TO_OBJECT(vp), type, vp.address()); } - return JS_TRUE; + return true; case JSTYPE_BOOLEAN: case JSTYPE_OBJECT: vp.set(memberPrivate->fieldValue); - return JS_TRUE; + return true; case JSTYPE_FUNCTION: // Leave this to NPObjectMember_Call. - return JS_TRUE; + return true; default: NS_ERROR("illegal operation on JSObject prototype object"); - return JS_FALSE; + return false; } } @@ -2132,7 +2128,7 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp) } if (!ok) { - // ReportExceptionIfPending returns a return value, which is JS_TRUE + // ReportExceptionIfPending returns a return value, which is true // if no exception was thrown. In that case, throw our own. if (ReportExceptionIfPending(cx)) ThrowJSException(cx, "Error calling method on NPObject!"); diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 59df986765a..82a08ead93d 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1100,10 +1100,10 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() } if (domapplet || domobject) { if (domapplet) { - parent = domapplet; + parent = do_QueryInterface(domapplet); } else { - parent = domobject; + parent = do_QueryInterface(domobject); } nsCOMPtr mydomNode = do_QueryInterface(mydomElement); if (parent == mydomNode) { diff --git a/dom/plugins/ipc/PluginScriptableObjectParent.cpp b/dom/plugins/ipc/PluginScriptableObjectParent.cpp index 337bfec0736..1bb9452f143 100644 --- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp @@ -1223,31 +1223,31 @@ PluginScriptableObjectParent::GetPropertyHelper(NPIdentifier aName, ParentNPObject* object = static_cast(mObject); if (object->invalidated) { NS_WARNING("Calling method on an invalidated object!"); - return JS_FALSE; + return false; } StackIdentifier identifier(GetInstance(), aName); if (!identifier) { - return JS_FALSE; + return false; } bool hasProperty, hasMethod, success; Variant result; if (!CallGetChildProperty(identifier, &hasProperty, &hasMethod, &result, &success)) { - return JS_FALSE; + return false; } if (!success) { - return JS_FALSE; + return false; } if (!ConvertToVariant(result, *aResult, GetInstance())) { NS_WARNING("Failed to convert result!"); - return JS_FALSE; + return false; } *aHasProperty = hasProperty; *aHasMethod = hasMethod; - return JS_TRUE; + return true; } diff --git a/dom/push/src/Push.js b/dom/push/src/Push.js index 4486820d58a..046cac3fa8b 100644 --- a/dom/push/src/Push.js +++ b/dom/push/src/Push.js @@ -42,26 +42,11 @@ Push.prototype = { debug("init()"); let principal = aWindow.document.nodePrincipal; - - this._pageURL = principal.URI; - let appsService = Cc["@mozilla.org/AppsService;1"] .getService(Ci.nsIAppsService); - this._app = appsService.getAppByLocalId(principal.appId); - this._manifestURL = appsService.getManifestURLByLocalId(principal.appId); - if (!this._manifestURL) { - // Now what? XXXbz should this be tested in a Func for this - // interface so it wouldn't appear at all? - return; - } - let perm = Services.perms.testExactPermissionFromPrincipal(principal, - "push"); - if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) { - // Now what? XXXbz should this be tested in a Func for this - // interface so it wouldn't appear at all? - return; - } + this._manifestURL = appsService.getManifestURLByLocalId(principal.appId); + this._pageURL = principal.URI; this.initDOMRequestHelper(aWindow, [ "PushService:Register:OK", diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index a1062d065fd..c579650ee34 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -724,7 +724,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) } JSBool match; - if (!JS_StringEqualsAscii(cx, key.toString(), GEO_SETINGS_ENABLED, &match) || (match != JS_TRUE)) { + if (!JS_StringEqualsAscii(cx, key.toString(), GEO_SETINGS_ENABLED, &match) || !match) { return; } diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 438451bf94c..bc8c19ecce2 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -165,9 +165,9 @@ WriteCallback(const jschar *buf, uint32_t len, void *data) nsJSONWriter *writer = static_cast(data); nsresult rv = writer->Write((const PRUnichar*)buf, (uint32_t)len); if (NS_FAILED(rv)) - return JS_FALSE; + return false; - return JS_TRUE; + return true; } NS_IMETHODIMP diff --git a/dom/system/gonk/TimeZoneSettingObserver.cpp b/dom/system/gonk/TimeZoneSettingObserver.cpp index eec9f9431e8..3d192e1d87e 100644 --- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -187,7 +187,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, } JSBool match; if (!JS_StringEqualsAscii(cx, key.toString(), TIME_TIMEZONE, &match) || - match != JS_TRUE) { + !match) { return NS_OK; } diff --git a/dom/tests/mochitest/general/Makefile.in b/dom/tests/mochitest/general/Makefile.in index 746a87a61b1..a815221da6e 100644 --- a/dom/tests/mochitest/general/Makefile.in +++ b/dom/tests/mochitest/general/Makefile.in @@ -53,6 +53,7 @@ MOCHITEST_FILES = \ test_stylesheetPI.html \ test_showModalDialog.html \ file_showModalDialog.html \ + test_paste_selection.html \ $(NULL) # Disable this test until bug 795711 is fixed. diff --git a/dom/tests/mochitest/general/test_paste_selection.html b/dom/tests/mochitest/general/test_paste_selection.html new file mode 100644 index 00000000000..d4fd23f274d --- /dev/null +++ b/dom/tests/mochitest/general/test_paste_selection.html @@ -0,0 +1,114 @@ + + + + Test for middle-click to paste selection with paste events + + + + + + +

+ + + + + + + + + + diff --git a/dom/tests/unit/xpcshell.ini b/dom/tests/unit/xpcshell.ini index e4dc5103a38..094bc6035c6 100644 --- a/dom/tests/unit/xpcshell.ini +++ b/dom/tests/unit/xpcshell.ini @@ -9,5 +9,4 @@ tail = skip-if = os == "android" [test_geolocation_timeout.js] [test_geolocation_timeout_wrap.js] -skip-if = os == "mac" -skip-if = os == "android" +skip-if = os == "mac" || os == "android" diff --git a/dom/webidl/PushManager.webidl b/dom/webidl/PushManager.webidl index facf3a31c87..6f73e91cbfa 100644 --- a/dom/webidl/PushManager.webidl +++ b/dom/webidl/PushManager.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[NoInterfaceObject, NavigatorProperty="push", JSImplementation="@mozilla.org/push/PushManager;1", Pref="services.push.enabled"] +[NoInterfaceObject, NavigatorProperty="push", JSImplementation="@mozilla.org/push/PushManager;1", Func="Navigator::HasPushNotificationsSupport"] interface PushManager { DOMRequest register(); DOMRequest unregister(DOMString pushEndpoint); diff --git a/dom/webidl/SVGElement.webidl b/dom/webidl/SVGElement.webidl index 9243744e926..d0096ea8a6c 100644 --- a/dom/webidl/SVGElement.webidl +++ b/dom/webidl/SVGElement.webidl @@ -28,7 +28,6 @@ interface SVGElement : Element { [SetterThrows] attribute DOMString xmlspace;*/ - [Throws] readonly attribute SVGSVGElement? ownerSVGElement; readonly attribute SVGElement? viewportElement; diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index 893390fb0a3..e5a0e4e379f 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -1341,7 +1341,7 @@ bool nsHTMLEditor::HavePrivateHTMLFlavor(nsIClipboard *aClipboard) NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType) { - if (!FireClipboardEvent(NS_PASTE)) + if (!FireClipboardEvent(NS_PASTE, aSelectionType)) return NS_OK; // Get Clipboard Service @@ -1422,7 +1422,9 @@ NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType) NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable) { - if (!FireClipboardEvent(NS_PASTE)) + // Use an invalid value for the clipboard type as data comes from aTransferable + // and we don't currently implement a way to put that in the data transfer yet. + if (!FireClipboardEvent(NS_PASTE, nsIClipboard::kGlobalClipboard)) return NS_OK; // handle transferable hooks @@ -1440,7 +1442,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable) // NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType) { - if (!FireClipboardEvent(NS_PASTE)) + if (!FireClipboardEvent(NS_PASTE, aSelectionType)) return NS_OK; ForceCompositionEnd(); diff --git a/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/editor/libeditor/text/nsPlaintextDataTransfer.cpp index c84900917fd..081c75859d1 100644 --- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -322,7 +322,7 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent) NS_IMETHODIMP nsPlaintextEditor::Paste(int32_t aSelectionType) { - if (!FireClipboardEvent(NS_PASTE)) + if (!FireClipboardEvent(NS_PASTE, aSelectionType)) return NS_OK; // Get Clipboard Service @@ -353,7 +353,9 @@ NS_IMETHODIMP nsPlaintextEditor::Paste(int32_t aSelectionType) NS_IMETHODIMP nsPlaintextEditor::PasteTransferable(nsITransferable *aTransferable) { - if (!FireClipboardEvent(NS_PASTE)) + // Use an invalid value for the clipboard type as data comes from aTransferable + // and we don't currently implement a way to put that in the data transfer yet. + if (!FireClipboardEvent(NS_PASTE, -1)) return NS_OK; if (!IsModifiable()) diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 38c6ede798c..2c4bd140eb5 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1137,7 +1137,7 @@ nsPlaintextEditor::CanCutOrCopy() } bool -nsPlaintextEditor::FireClipboardEvent(int32_t aType) +nsPlaintextEditor::FireClipboardEvent(int32_t aType, int32_t aSelectionType) { if (aType == NS_PASTE) ForceCompositionEnd(); @@ -1149,7 +1149,7 @@ nsPlaintextEditor::FireClipboardEvent(int32_t aType) if (NS_FAILED(GetSelection(getter_AddRefs(selection)))) return false; - if (!nsCopySupport::FireClipboardEvent(aType, presShell, selection)) + if (!nsCopySupport::FireClipboardEvent(aType, aSelectionType, presShell, selection)) return false; // If the event handler caused the editor to be destroyed, return false. @@ -1159,7 +1159,7 @@ nsPlaintextEditor::FireClipboardEvent(int32_t aType) NS_IMETHODIMP nsPlaintextEditor::Cut() { - if (FireClipboardEvent(NS_CUT)) + if (FireClipboardEvent(NS_CUT, nsIClipboard::kGlobalClipboard)) return DeleteSelection(eNone, eStrip); return NS_OK; } @@ -1173,7 +1173,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanCut(bool *aCanCut) NS_IMETHODIMP nsPlaintextEditor::Copy() { - FireClipboardEvent(NS_COPY); + FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard); return NS_OK; } diff --git a/editor/libeditor/text/nsPlaintextEditor.h b/editor/libeditor/text/nsPlaintextEditor.h index 5c065b1e598..d40c0b6d7f3 100644 --- a/editor/libeditor/text/nsPlaintextEditor.h +++ b/editor/libeditor/text/nsPlaintextEditor.h @@ -196,7 +196,7 @@ protected: bool IsModifiable(); bool CanCutOrCopy(); - bool FireClipboardEvent(int32_t aType); + bool FireClipboardEvent(int32_t aType, int32_t aSelectionType); bool UpdateMetaCharset(nsIDOMDocument* aDocument, const nsACString& aCharacterSet); diff --git a/embedding/browser/webBrowser/nsContextMenuInfo.cpp b/embedding/browser/webBrowser/nsContextMenuInfo.cpp index ef856ebdb57..27f569ce8f7 100644 --- a/embedding/browser/webBrowser/nsContextMenuInfo.cpp +++ b/embedding/browser/webBrowser/nsContextMenuInfo.cpp @@ -29,6 +29,7 @@ #include "nsAutoPtr.h" #include "imgRequestProxy.h" + //***************************************************************************** // class nsContextMenuInfo //***************************************************************************** @@ -225,8 +226,9 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode *aDOMNode, imgRequestPro // we'll defer to nsCOMPtr htmlElement = do_QueryInterface(domNode); if (htmlElement) { + nsCOMPtr element = do_QueryInterface(domNode); nsAutoString nameSpace; - htmlElement->GetNamespaceURI(nameSpace); + element->GetNamespaceURI(nameSpace); if (nameSpace.IsEmpty()) { nsresult rv = GetBackgroundImageRequestInternal(domNode, aRequest); if (NS_SUCCEEDED(rv) && *aRequest) diff --git a/embedding/components/webbrowserpersist/src/Makefile.in b/embedding/components/webbrowserpersist/src/Makefile.in index a688d9264c3..e82ebf0086b 100644 --- a/embedding/components/webbrowserpersist/src/Makefile.in +++ b/embedding/components/webbrowserpersist/src/Makefile.in @@ -15,3 +15,8 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/rules.mk +LOCAL_INCLUDES = \ + -I$(topsrcdir)/content/html/content/src \ + -I$(topsrcdir)/content/base/src \ + $(NULL) + diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 31d5a3d3d38..f61884111a4 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -86,8 +86,12 @@ #include "nsWebBrowserPersist.h" #include "nsIContent.h" +#include "mozilla/dom/HTMLInputElement.h" +#include "mozilla/dom/HTMLSharedElement.h" +#include "mozilla/dom/HTMLSharedObjectElement.h" using namespace mozilla; +using namespace mozilla::dom; // Buffer file writes in 32kb chunks #define BUFFERED_OUTPUT_SIZE (1024 * 32) @@ -2962,11 +2966,12 @@ nsWebBrowserPersist::CloneNodeWithFixedUpAttributes( if (nodeAsBase) { nsCOMPtr ownerDocument; - nodeAsBase->GetOwnerDocument(getter_AddRefs(ownerDocument)); + HTMLSharedElement* base = static_cast(nodeAsBase.get()); + base->GetOwnerDocument(getter_AddRefs(ownerDocument)); if (ownerDocument) { nsAutoString href; - nodeAsBase->GetHref(href); // Doesn't matter if this fails + base->GetHref(href); // Doesn't matter if this fails nsCOMPtr comment; nsAutoString commentText; commentText.AssignLiteral(" base "); if (!href.IsEmpty()) @@ -3173,7 +3178,8 @@ nsWebBrowserPersist::CloneNodeWithFixedUpAttributes( } // Unset the codebase too, since we'll correctly relativize the // code and archive paths. - newApplet->RemoveAttribute(NS_LITERAL_STRING("codebase")); + static_cast(newApplet.get())-> + RemoveAttribute(NS_LITERAL_STRING("codebase")); FixupNodeAttribute(*aNodeOut, "code"); FixupNodeAttribute(*aNodeOut, "archive"); // restore the base URI we really want to have @@ -3240,7 +3246,9 @@ nsWebBrowserPersist::CloneNodeWithFixedUpAttributes( nsAutoString valueStr; NS_NAMED_LITERAL_STRING(valueAttr, "value"); // Update element node attributes with user-entered form state - nsCOMPtr outElt = do_QueryInterface(*aNodeOut); + nsCOMPtr content = do_QueryInterface(*aNodeOut); + nsRefPtr outElt = + HTMLInputElement::FromContentOrNull(content); nsCOMPtr formControl = do_QueryInterface(*aNodeOut); switch (formControl->GetType()) { case NS_FORM_INPUT_EMAIL: diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index b969766ba58..2fba351b21b 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -945,7 +945,8 @@ mozInlineSpellChecker::ReplaceWord(nsIDOMNode *aNode, int32_t aOffset, editor->DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip); nsCOMPtr textEditor(do_QueryReferent(mEditor)); - textEditor->InsertText(newword); + if (textEditor) + textEditor->InsertText(newword); editor->EndTransaction(); } diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 0377ec0d087..d5403811469 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -292,7 +292,7 @@ public: * aFilter Resampling filter used for resampling the image. */ SurfacePattern(SourceSurface *aSourceSurface, ExtendMode aExtendMode, - const Matrix &aMatrix = Matrix(), Filter aFilter = FILTER_LINEAR) + const Matrix &aMatrix = Matrix(), Filter aFilter = FILTER_GOOD) : mSurface(aSourceSurface) , mExtendMode(aExtendMode) , mFilter(aFilter) diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp index cf1beba534a..0c1fd7b73d4 100644 --- a/gfx/2d/DrawTargetCG.cpp +++ b/gfx/2d/DrawTargetCG.cpp @@ -123,6 +123,19 @@ CGBlendMode ToBlendMode(CompositionOp op) return mode; } +static CGInterpolationQuality +InterpolationQualityFromFilter(Filter aFilter) +{ + switch (aFilter) { + default: + case FILTER_LINEAR: + return kCGInterpolationLow; + case FILTER_POINT: + return kCGInterpolationNone; + case FILTER_GOOD: + return kCGInterpolationDefault; + } +} DrawTargetCG::DrawTargetCG() : mCg(nullptr), mSnapshot(nullptr) @@ -291,10 +304,7 @@ DrawTargetCG::DrawSurface(SourceSurface *aSurface, CGRect flippedRect = CGRectMake(aDest.x, -(aDest.y + aDest.height), aDest.width, aDest.height); - if (aSurfOptions.mFilter == FILTER_POINT) - CGContextSetInterpolationQuality(cg, kCGInterpolationNone); - else - CGContextSetInterpolationQuality(cg, kCGInterpolationLow); + CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(aSurfOptions.mFilter)); CGContextDrawImage(cg, flippedRect, image); @@ -653,10 +663,7 @@ SetFillFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern & CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg)); const SurfacePattern& pat = static_cast(aPattern); - if (pat.mFilter == FILTER_POINT) - CGContextSetInterpolationQuality(cg, kCGInterpolationNone); - else - CGContextSetInterpolationQuality(cg, kCGInterpolationLow); + CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter)); CGFloat alpha = 1.; CGContextSetFillPattern(cg, pattern, &alpha); CGPatternRelease(pattern); @@ -681,10 +688,7 @@ SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg)); const SurfacePattern& pat = static_cast(aPattern); - if (pat.mFilter == FILTER_POINT) - CGContextSetInterpolationQuality(cg, kCGInterpolationNone); - else - CGContextSetInterpolationQuality(cg, kCGInterpolationLow); + CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter)); CGFloat alpha = 1.; CGContextSetStrokePattern(cg, pattern, &alpha); CGPatternRelease(pattern); @@ -770,10 +774,7 @@ DrawTargetCG::FillRect(const Rect &aRect, CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)); - if (pat.mFilter == FILTER_POINT) - CGContextSetInterpolationQuality(cg, kCGInterpolationNone); - else - CGContextSetInterpolationQuality(cg, kCGInterpolationLow); + CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter)); CGContextDrawImage(cg, imageRect, image); } else { diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 37865dccfac..ecbbead366f 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -285,7 +285,7 @@ DrawTargetSkia::DrawSurface(SourceSurface *aSurface, const SkBitmap& bitmap = static_cast(aSurface)->GetBitmap(); AutoPaintSetup paint(mCanvas.get(), aOptions); - if (aSurfOptions.mFilter != FILTER_LINEAR) { + if (aSurfOptions.mFilter == FILTER_POINT) { paint.mPaint.setFilterBitmap(false); } diff --git a/gfx/2d/HelpersCairo.h b/gfx/2d/HelpersCairo.h index 5dfcee261d3..33ca2ba31b3 100644 --- a/gfx/2d/HelpersCairo.h +++ b/gfx/2d/HelpersCairo.h @@ -82,6 +82,8 @@ GfxFilterToCairoFilter(Filter filter) { switch (filter) { + case FILTER_GOOD: + return CAIRO_FILTER_GOOD; case FILTER_LINEAR: return CAIRO_FILTER_BILINEAR; case FILTER_POINT: diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h index de919450a5e..8bbc970a708 100644 --- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -104,7 +104,7 @@ enum ExtendMode { EXTEND_CLAMP, EXTEND_REPEAT, EXTEND_REFLECT }; enum FillRule { FILL_WINDING, FILL_EVEN_ODD }; enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL, AA_DEFAULT }; enum Snapping { SNAP_NONE, SNAP_ALIGNED }; -enum Filter { FILTER_LINEAR, FILTER_POINT }; +enum Filter { FILTER_GOOD, FILTER_LINEAR, FILTER_POINT }; enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT }; enum JoinStyle { JOIN_BEVEL, JOIN_ROUND, JOIN_MITER, JOIN_MITER_OR_BEVEL }; enum CapStyle { CAP_BUTT, CAP_ROUND, CAP_SQUARE }; diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 9d86edc89eb..0e77ca4c6d5 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -977,9 +977,11 @@ already_AddRefed GLContext::CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { - return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, aFlags); + return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, + aFlags, aImageFormat); } void GLContext::ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter) diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index 54922dfbc55..2c71ca96bd7 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -2642,8 +2642,10 @@ public: /** * Return a valid, allocated TextureImage of |aSize| with - * |aContentType|. The TextureImage's texture is configured to - * use |aWrapMode| (usually GL_CLAMP_TO_EDGE or GL_REPEAT) and by + * |aContentType|. If |aContentType| is COLOR, |aImageFormat| can be used + * to hint at the preferred RGB format, however it is not necessarily + * respected. The TextureImage's texture is configured to use + * |aWrapMode| (usually GL_CLAMP_TO_EDGE or GL_REPEAT) and by * default, GL_LINEAR filtering. Specify * |aFlags=UseNearestFilter| for GL_NEAREST filtering. Specify * |aFlags=NeedsYFlip| if the image is flipped. Return @@ -2658,7 +2660,8 @@ public: CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags = TextureImage::NoFlags); + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown); /** * In EGL we want to use Tiled Texture Images, which we return @@ -2670,7 +2673,8 @@ public: virtual already_AddRefed TileGenFunc(const nsIntSize& aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags = TextureImage::NoFlags) + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) { return nullptr; } diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index fbc21b1c680..12ec71aeb80 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -184,12 +184,14 @@ public: CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE; + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE; virtual already_AddRefed TileGenFunc(const nsIntSize& aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE; + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE; virtual SharedTextureHandle CreateSharedHandle(SharedTextureShareType shareType, void* buffer, @@ -231,7 +233,8 @@ public: CreateTextureImageInternal(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags); + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat); }; @@ -247,7 +250,8 @@ class TextureImageCGL : public BasicTextureImage GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags); + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat); public: ~TextureImageCGL() { @@ -334,8 +338,10 @@ private: GLenum aWrapMode, ContentType aContentType, GLContext* aContext, - TextureImage::Flags aFlags = TextureImage::NoFlags) - : BasicTextureImage(aTexture, aSize, aWrapMode, aContentType, aContext, aFlags) + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) + : BasicTextureImage(aTexture, aSize, aWrapMode, aContentType, + aContext, aFlags, aImageFormat) , mPixelBuffer(0) , mPixelBufferSize(0) , mBoundPixelBuffer(false) @@ -350,7 +356,8 @@ already_AddRefed GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { bool useNearestFilter = aFlags & TextureImage::UseNearestFilter; MakeCurrent(); @@ -368,7 +375,8 @@ GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize, fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, aWrapMode); nsRefPtr teximage - (new TextureImageCGL(texture, aSize, aWrapMode, aContentType, this, aFlags)); + (new TextureImageCGL(texture, aSize, aWrapMode, aContentType, + this, aFlags, aImageFormat)); return teximage.forget(); } @@ -376,25 +384,30 @@ already_AddRefed GLContextCGL::CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { if (!IsOffscreenSizeAllowed(gfxIntSize(aSize.width, aSize.height)) && gfxPlatform::OffMainThreadCompositingEnabled()) { NS_ASSERTION(aWrapMode == LOCAL_GL_CLAMP_TO_EDGE, "Can't support wrapping with tiles!"); - nsRefPtr t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags); + nsRefPtr t = new gl::TiledTextureImage(this, aSize, aContentType, + aFlags, aImageFormat); return t.forget(); } - return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, aFlags); + return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, + aFlags, aImageFormat); } already_AddRefed GLContextCGL::TileGenFunc(const nsIntSize& aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { return CreateTextureImageInternal(aSize, aContentType, - LOCAL_GL_CLAMP_TO_EDGE, aFlags); + LOCAL_GL_CLAMP_TO_EDGE, aFlags, + aImageFormat); } static GLContextCGL * diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 9797c8378fe..a657a6c2e6c 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -609,13 +609,15 @@ public: CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags = TextureImage::NoFlags); + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown); // a function to generate Tiles for Tiled Texture Image virtual already_AddRefed TileGenFunc(const nsIntSize& aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE; + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE; // hold a reference to the given surface // for the lifetime of this context. void HoldSurface(gfxASurface *aSurf) { @@ -1103,10 +1105,11 @@ public: ContentType aContentType, GLContext* aContext, Flags aFlags = TextureImage::NoFlags, - TextureState aTextureState = Created) + TextureState aTextureState = Created, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) : TextureImage(aSize, aWrapMode, aContentType, aFlags) , mGLContext(aContext) - , mUpdateFormat(gfxASurface::ImageFormatUnknown) + , mUpdateFormat(aImageFormat) , mEGLImage(nullptr) , mTexture(aTexture) , mSurface(nullptr) @@ -1114,7 +1117,9 @@ public: , mTextureState(aTextureState) , mBound(false) { - mUpdateFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(GetContentType()); + if (mUpdateFormat == gfxASurface::ImageFormatUnknown) { + mUpdateFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(GetContentType()); + } if (gUseBackingSurface) { if (mUpdateFormat != gfxASurface::ImageFormatARGB32) { @@ -1529,16 +1534,18 @@ already_AddRefed GLContextEGL::CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { - nsRefPtr t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags); + nsRefPtr t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags, aImageFormat); return t.forget(); } already_AddRefed GLContextEGL::TileGenFunc(const nsIntSize& aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { MakeCurrent(); @@ -1546,7 +1553,8 @@ GLContextEGL::TileGenFunc(const nsIntSize& aSize, fGenTextures(1, &texture); nsRefPtr teximage = - new TextureImageEGL(texture, aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, this, aFlags); + new TextureImageEGL(texture, aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, + this, aFlags, TextureImage::Created, aImageFormat); teximage->BindTexture(LOCAL_GL_TEXTURE0); diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 0f680ffc052..036e822ce8f 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -940,7 +940,8 @@ TRY_AGAIN_NO_SHARING: CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags = TextureImage::NoFlags); + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown); private: friend class GLContextProviderGLX; @@ -988,7 +989,8 @@ class TextureImageGLX : public TextureImage GLContextGLX::CreateTextureImage(const nsIntSize&, ContentType, GLenum, - TextureImage::Flags); + TextureImage::Flags, + TextureImage::ImageFormat); public: virtual ~TextureImageGLX() @@ -1087,13 +1089,15 @@ already_AddRefed GLContextGLX::CreateTextureImage(const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { if (!TextureImageSupportsGetBackingSurface()) { return GLContext::CreateTextureImage(aSize, aContentType, aWrapMode, - aFlags); + aFlags, + aImageFormat); } Display *display = DefaultXDisplay(); @@ -1127,7 +1131,8 @@ GLContextGLX::CreateTextureImage(const nsIntSize& aSize, return GLContext::CreateTextureImage(aSize, aContentType, aWrapMode, - aFlags); + aFlags, + aImageFormat); } NS_ASSERTION(pixmap, "Failed to create pixmap!"); diff --git a/gfx/gl/GLContextSkia.cpp b/gfx/gl/GLContextSkia.cpp index e32ee2ead92..5cc4480ccb3 100644 --- a/gfx/gl/GLContextSkia.cpp +++ b/gfx/gl/GLContextSkia.cpp @@ -310,25 +310,42 @@ const GLubyte* glGetString_mozilla(GrGLenum name) // Only expose the bare minimum extensions we want to support to ensure a functional Ganesh // as GLContext only exposes certain extensions static bool extensionsStringBuilt = false; - static char extensionsString[256]; + static char extensionsString[1024]; if (!extensionsStringBuilt) { - if (sGLContext.get()->IsExtensionSupported(GLContext::EXT_texture_format_BGRA8888)) { - strcpy(extensionsString, "GL_EXT_texture_format_BGRA8888 "); + extensionsString[0] = '\0'; + + if (sGLContext.get()->IsGLES2()) { + // OES is only applicable to GLES2 + if (sGLContext.get()->IsExtensionSupported(GLContext::OES_packed_depth_stencil)) { + strcat(extensionsString, "GL_OES_packed_depth_stencil "); + } + + if (sGLContext.get()->IsExtensionSupported(GLContext::OES_rgb8_rgba8)) { + strcat(extensionsString, "GL_OES_rgb8_rgba8 "); + } + + if (sGLContext.get()->IsExtensionSupported(GLContext::OES_texture_npot)) { + strcat(extensionsString, "GL_OES_texture_npot "); + } + + if (sGLContext.get()->IsExtensionSupported(GLContext::OES_vertex_array_object)) { + strcat(extensionsString, "GL_OES_vertex_array_object "); + } + + if (sGLContext.get()->IsExtensionSupported(GLContext::OES_standard_derivatives)) { + strcat(extensionsString, "GL_OES_standard_derivatives "); + } } - if (sGLContext.get()->IsExtensionSupported(GLContext::OES_packed_depth_stencil)) { - strcat(extensionsString, "GL_OES_packed_depth_stencil "); + if (sGLContext.get()->IsExtensionSupported(GLContext::EXT_texture_format_BGRA8888)) { + strcat(extensionsString, "GL_EXT_texture_format_BGRA8888 "); } if (sGLContext.get()->IsExtensionSupported(GLContext::EXT_packed_depth_stencil)) { strcat(extensionsString, "GL_EXT_packed_depth_stencil "); } - if (sGLContext.get()->IsExtensionSupported(GLContext::OES_rgb8_rgba8)) { - strcat(extensionsString, "GL_OES_rgb8_rgba8 "); - } - if (sGLContext.get()->IsExtensionSupported(GLContext::EXT_bgra)) { strcat(extensionsString, "GL_EXT_bgra "); } @@ -338,6 +355,9 @@ const GLubyte* glGetString_mozilla(GrGLenum name) } extensionsStringBuilt = true; +#ifdef DEBUG + printf_stderr("Exported SkiaGL extensions: %s\n", extensionsString); +#endif } return reinterpret_cast(extensionsString); @@ -677,6 +697,19 @@ GrGLvoid glBlitFramebuffer_mozilla(GrGLint srcX0, GrGLint srcY0, mask, filter); } +GrGLvoid glBindVertexArray_mozilla(GrGLuint array) { + return sGLContext.get()->fBindVertexArray(array); +} + +GrGLvoid glDeleteVertexArrays_mozilla(GrGLsizei n, const GrGLuint *arrays) { + return sGLContext.get()->fDeleteVertexArrays(n, arrays); +} + +GrGLvoid glGenVertexArrays_mozilla(GrGLsizei n, GrGLuint *arrays) { + return sGLContext.get()->fGenVertexArrays(n, arrays); +} + + } // extern "C" GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context) @@ -793,6 +826,11 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context) // GLContext supports glCompressedTexImage2D i->fCompressedTexImage2D = glCompressedTexImage2D_mozilla; + // GL_OES_vertex_array_object + i->fBindVertexArray = glBindVertexArray_mozilla; + i->fDeleteVertexArrays = glDeleteVertexArrays_mozilla; + i->fGenVertexArrays = glGenVertexArrays_mozilla; + // Desktop GL i->fGetTexLevelParameteriv = glGetTexLevelParameteriv_mozilla; i->fDrawBuffer = glDrawBuffer_mozilla; diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index e1d4b32fc18..f45f266be34 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -211,7 +211,8 @@ BasicTextureImage::Resize(const nsIntSize& aSize) TiledTextureImage::TiledTextureImage(GLContext* aGL, nsIntSize aSize, TextureImage::ContentType aContentType, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) : TextureImage(aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, aFlags) , mCurrentImage(0) , mIterationCallback(nullptr) @@ -220,6 +221,7 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL, , mColumns(0) , mGL(aGL) , mTextureState(Created) + , mImageFormat(aImageFormat) { if (!(aFlags & TextureImage::DisallowBigImage) && mGL->WantsSmallTiles()) { mTileSize = 256; @@ -562,7 +564,7 @@ void TiledTextureImage::Resize(const nsIntSize& aSize) // Create a new tile. nsRefPtr teximg = - mGL->TileGenFunc(size, mContentType, mFlags); + mGL->TileGenFunc(size, mContentType, mFlags, mImageFormat); if (replace) mImages.ReplaceElementAt(i, teximg.forget()); else @@ -611,7 +613,8 @@ CreateBasicTextureImage(GLContext* aGL, const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags) + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat) { bool useNearestFilter = aFlags & TextureImage::UseNearestFilter; aGL->MakeCurrent(); @@ -628,7 +631,8 @@ CreateBasicTextureImage(GLContext* aGL, aGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, aWrapMode); nsRefPtr texImage = - new BasicTextureImage(texture, aSize, aWrapMode, aContentType, aGL, aFlags); + new BasicTextureImage(texture, aSize, aWrapMode, aContentType, + aGL, aFlags, aImageFormat); return texImage.forget(); } diff --git a/gfx/gl/GLTextureImage.h b/gfx/gl/GLTextureImage.h index 229294d9171..a973d5519a4 100644 --- a/gfx/gl/GLTextureImage.h +++ b/gfx/gl/GLTextureImage.h @@ -43,8 +43,6 @@ class GLContext; class TextureImage { NS_INLINE_DECL_REFCOUNTING(TextureImage) -protected: - typedef gfxASurface::gfxImageFormat ImageFormat; public: enum TextureState { @@ -61,6 +59,7 @@ public: }; typedef gfxASurface::gfxContentType ContentType; + typedef gfxASurface::gfxImageFormat ImageFormat; static already_AddRefed Create( GLContext* gl, @@ -232,6 +231,7 @@ public: const nsIntSize& GetSize() const { return mSize; } ContentType GetContentType() const { return mContentType; } + ImageFormat GetImageFormat() const { return mImageFormat; } virtual bool InUpdate() const = 0; GLenum GetWrapMode() const { return mWrapMode; } @@ -254,10 +254,12 @@ protected: */ TextureImage(const nsIntSize& aSize, GLenum aWrapMode, ContentType aContentType, - Flags aFlags = NoFlags) + Flags aFlags = NoFlags, + ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) : mSize(aSize) , mWrapMode(aWrapMode) , mContentType(aContentType) + , mImageFormat(aImageFormat) , mFilter(gfxPattern::FILTER_GOOD) , mFlags(aFlags) {} @@ -269,6 +271,7 @@ protected: nsIntSize mSize; GLenum mWrapMode; ContentType mContentType; + ImageFormat mImageFormat; gfx::SurfaceFormat mTextureFormat; gfxPattern::GraphicsFilter mFilter; Flags mFlags; @@ -294,8 +297,9 @@ public: GLenum aWrapMode, ContentType aContentType, GLContext* aContext, - TextureImage::Flags aFlags = TextureImage::NoFlags) - : TextureImage(aSize, aWrapMode, aContentType, aFlags) + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) + : TextureImage(aSize, aWrapMode, aContentType, aFlags, aImageFormat) , mTexture(aTexture) , mTextureState(Created) , mGLContext(aContext) @@ -349,8 +353,11 @@ class TiledTextureImage : public TextureImage { public: - TiledTextureImage(GLContext* aGL, nsIntSize aSize, - TextureImage::ContentType, TextureImage::Flags aFlags = TextureImage::NoFlags); + TiledTextureImage(GLContext* aGL, + nsIntSize aSize, + TextureImage::ContentType, + TextureImage::Flags aFlags = TextureImage::NoFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown); ~TiledTextureImage(); void DumpDiv(); virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion); @@ -388,6 +395,7 @@ protected: // The region of update requested nsIntRegion mUpdateRegion; TextureState mTextureState; + TextureImage::ImageFormat mImageFormat; }; /** @@ -400,7 +408,8 @@ CreateBasicTextureImage(GLContext* aGL, const nsIntSize& aSize, TextureImage::ContentType aContentType, GLenum aWrapMode, - TextureImage::Flags aFlags); + TextureImage::Flags aFlags, + TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown); } // namespace gl } // namespace mozilla diff --git a/gfx/layers/CompositorTypes.h b/gfx/layers/CompositorTypes.h index 42ac20100fe..e1b106a4bd6 100644 --- a/gfx/layers/CompositorTypes.h +++ b/gfx/layers/CompositorTypes.h @@ -26,18 +26,18 @@ const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0; */ typedef uint32_t TextureFlags; // Use nearest-neighbour texture filtering (as opposed to linear filtering). -const TextureFlags UseNearestFilter = 1 << 0; +const TextureFlags TEXTURE_USE_NEAREST_FILTER = 1 << 0; // The texture should be flipped around the y-axis when composited. -const TextureFlags NeedsYFlip = 1 << 1; +const TextureFlags TEXTURE_NEEDS_Y_FLIP = 1 << 1; // Force the texture to be represented using a single tile (note that this means // tiled textures, not tiled layers). const TextureFlags TEXTURE_DISALLOW_BIGIMAGE = 1 << 2; // Allow using 'repeat' mode for wrapping. -const TextureFlags AllowRepeat = 1 << 3; +const TextureFlags TEXTURE_ALLOW_REPEAT = 1 << 3; // The texture represents a tile which is newly created. -const TextureFlags NewTile = 1 << 4; +const TextureFlags TEXTURE_NEW_TILE = 1 << 4; // The texture is part of a component-alpha pair -const TextureFlags ComponentAlpha = 1 << 5; +const TextureFlags TEXTURE_COMPONENT_ALPHA = 1 << 5; // The buffer will be treated as if the RB bytes are swapped. // This is useful for rendering using Cairo/Thebes, because there is no // BGRX Android pixel format, and so we have to do byte swapping. diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp index 45d52d0a6e5..90e9bc84d09 100644 --- a/gfx/layers/LayersLogging.cpp +++ b/gfx/layers/LayersLogging.cpp @@ -210,11 +210,11 @@ AppendToString(nsACString& s, TextureFlags flags, } \ } bool previous = false; - AppendFlag(UseNearestFilter); - AppendFlag(NeedsYFlip); + AppendFlag(TEXTURE_USE_NEAREST_FILTER); + AppendFlag(TEXTURE_NEEDS_Y_FLIP); AppendFlag(TEXTURE_DISALLOW_BIGIMAGE); - AppendFlag(AllowRepeat); - AppendFlag(NewTile); + AppendFlag(TEXTURE_ALLOW_REPEAT); + AppendFlag(TEXTURE_NEW_TILE); AppendFlag(TEXTURE_DEALLOCATE_HOST); #undef AppendFlag diff --git a/gfx/layers/client/ClientCanvasLayer.cpp b/gfx/layers/client/ClientCanvasLayer.cpp index 258abb27834..1d8ad3e4cee 100644 --- a/gfx/layers/client/ClientCanvasLayer.cpp +++ b/gfx/layers/client/ClientCanvasLayer.cpp @@ -83,7 +83,7 @@ ClientCanvasLayer::RenderLayer() if (!mCanvasClient) { TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD; if (mNeedsYFlip) { - flags |= NeedsYFlip; + flags |= TEXTURE_NEEDS_Y_FLIP; } bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default); diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index e5c8f334fa6..5c2ae2bb57e 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -188,7 +188,7 @@ ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType, if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClientOnWhite)) { return; } - mTextureInfo.mTextureFlags |= ComponentAlpha; + mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA; } CreateFrontBufferAndNotify(aRect); @@ -305,7 +305,7 @@ ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBuffer return; } - if (mTextureInfo.mTextureFlags & ComponentAlpha) { + if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) { if (!CreateAndAllocateDeprecatedTextureClient(mFrontClientOnWhite)) { return; } @@ -614,7 +614,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() && mHasBuffer && (!(aFlags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE) || - !(mTextureInfo.mTextureFlags & AllowRepeat)); + !(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT)); if (canReuseBuffer) { if (mBufferRect.Contains(neededRegion.GetBounds())) { @@ -700,9 +700,9 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer, nsIntRect drawBounds = result.mRegionToDraw.GetBounds(); bool createdBuffer = false; - uint32_t bufferFlags = canHaveRotation ? AllowRepeat : 0; + uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0; if (mode == Layer::SURFACE_COMPONENT_ALPHA) { - bufferFlags |= ComponentAlpha; + bufferFlags |= TEXTURE_COMPONENT_ALPHA; } if (canReuseBuffer) { nsIntRect keepArea; diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index 7ac5172cbe4..42692f16033 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -510,7 +510,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental* newHost->SetCompositor(compositor); } RefPtr newHostOnWhite; - if (mTextureInfo.mTextureFlags & ComponentAlpha) { + if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) { newHostOnWhite = DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::TShmem, mTextureInfo.mDeprecatedTextureHostFlags, diff --git a/gfx/layers/composite/ImageHost.cpp b/gfx/layers/composite/ImageHost.cpp index e8702079e5f..610616566ca 100644 --- a/gfx/layers/composite/ImageHost.cpp +++ b/gfx/layers/composite/ImageHost.cpp @@ -117,7 +117,7 @@ ImageHost::Composite(EffectChain& aEffectChain, rect = gfx::Rect(0, 0, textureSize.width, textureSize.height); } - if (mFrontBuffer->GetFlags() & NeedsYFlip) { + if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) { effect->mTextureCoords.y = effect->mTextureCoords.YMost(); effect->mTextureCoords.height = -effect->mTextureCoords.height; } @@ -298,7 +298,7 @@ DeprecatedImageHostSingle::Composite(EffectChain& aEffectChain, rect = gfx::Rect(0, 0, textureSize.width, textureSize.height); } - if (mDeprecatedTextureHost->GetFlags() & NeedsYFlip) { + if (mDeprecatedTextureHost->GetFlags() & TEXTURE_NEEDS_Y_FLIP) { effect->mTextureCoords.y = effect->mTextureCoords.YMost(); effect->mTextureCoords.height = -effect->mTextureCoords.height; } diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index 1fb4f311e04..7f569ea03a8 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -304,7 +304,7 @@ TiledTexture::Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor* TEXTURE_HOST_TILED, flags); mDeprecatedTextureHost->SetCompositor(aCompositor); - flags |= NewTile; + flags |= TEXTURE_NEW_TILE; } mDeprecatedTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize)); diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index 4c9512f682f..5243dc33d33 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -1155,12 +1155,13 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() { ReentrantMonitorAutoEnter lock(mMonitor); - LayerPoint metricsScrollOffset; + CSSPoint lastPaintScrollOffset; if (mLastContentPaintMetrics.IsScrollable()) { - metricsScrollOffset = mLastContentPaintMetrics.GetScrollOffsetInLayerPixels(); + lastPaintScrollOffset = mLastContentPaintMetrics.mScrollOffset; } CSSToScreenScale localScale = mFrameMetrics.CalculateResolution(); - LayerPoint translation = mFrameMetrics.GetScrollOffsetInLayerPixels() - metricsScrollOffset; + LayerPoint translation = (mFrameMetrics.mScrollOffset - lastPaintScrollOffset) + * mLastContentPaintMetrics.LayersPixelsPerCSSPixel(); return ViewTransform(-translation, localScale / mLastContentPaintMetrics.mDevPixelsPerCSSPixel); } diff --git a/gfx/layers/ipc/AutoOpenSurface.h b/gfx/layers/ipc/AutoOpenSurface.h index 231285b9200..67f2dd52d1a 100644 --- a/gfx/layers/ipc/AutoOpenSurface.h +++ b/gfx/layers/ipc/AutoOpenSurface.h @@ -27,6 +27,7 @@ class MOZ_STACK_CLASS AutoOpenSurface { public: typedef gfxASurface::gfxContentType gfxContentType; + typedef gfxASurface::gfxImageFormat gfxImageFormat; /** |aDescriptor| must be valid while AutoOpenSurface is * in scope. */ @@ -39,6 +40,7 @@ public: * return an answer. */ gfxContentType ContentType(); + gfxImageFormat ImageFormat(); gfxIntSize Size(); /** This can't escape the scope of AutoOpenSurface. */ diff --git a/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp b/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp index ec9272cc215..1e9104f3945 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp @@ -61,6 +61,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize( return false; } +/*static*/ bool +ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat( + const SurfaceDescriptor&, + OpenMode, + gfxImageFormat*, + gfxASurface**) +{ + return false; +} + bool ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*) { diff --git a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp index d782650c663..45853e5d39a 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp @@ -504,6 +504,23 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize( return true; } +/*static*/ bool +ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat( + const SurfaceDescriptor& aDescriptor, + OpenMode aMode, + gfxImageFormat* aImageFormat, + gfxASurface** aSurface) +{ + if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) { + return false; + } + + sp buffer = + GrallocBufferActor::GetFrom(aDescriptor.get_SurfaceDescriptorGralloc()); + *aImageFormat = ImageFormatForPixelFormat(buffer->getPixelFormat()); + return true; +} + /*static*/ bool ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface) { diff --git a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp b/gfx/layers/ipc/ShadowLayerUtilsMac.cpp index 7db2cd86af6..df8cbe422a0 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsMac.cpp @@ -74,6 +74,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize( return false; } +/*static*/ bool +ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat( + const SurfaceDescriptor&, + OpenMode, + gfxImageFormat*, + gfxASurface**) +{ + return false; +} + bool ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface) { diff --git a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp index a03c483cd4f..031b155cec5 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp @@ -165,6 +165,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize( return false; } +/*static*/ bool +ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat( + const SurfaceDescriptor&, + OpenMode, + gfxImageFormat*, + gfxASurface**) +{ + return false; +} + bool ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface) { diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index c8e76469ec7..6435f31b3a2 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -636,6 +636,30 @@ ShadowLayerForwarder::GetDescriptorSurfaceSize( return size; } +/*static*/ gfxImageFormat +ShadowLayerForwarder::GetDescriptorSurfaceImageFormat( + const SurfaceDescriptor& aDescriptor, OpenMode aMode, + gfxASurface** aSurface) +{ + gfxImageFormat format; + if (PlatformGetDescriptorSurfaceImageFormat(aDescriptor, aMode, &format, aSurface)) { + return format; + } + + nsRefPtr surface = OpenDescriptor(aMode, aDescriptor); + NS_ENSURE_TRUE(surface, gfxASurface::ImageFormatUnknown); + + nsRefPtr img = surface->GetAsImageSurface(); + NS_ENSURE_TRUE(img, gfxASurface::ImageFormatUnknown); + + format = img->Format(); + NS_ASSERTION(format != gfxASurface::ImageFormatUnknown, + "ImageSurface RGB format should be known"); + + *aSurface = surface.forget().get(); + return format; +} + /*static*/ void ShadowLayerForwarder::CloseDescriptor(const SurfaceDescriptor& aDescriptor) { @@ -685,6 +709,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize( return false; } +/*static*/ bool +ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat( + const SurfaceDescriptor&, + OpenMode, + gfxImageFormat*, + gfxASurface**) +{ + return false; +} + bool ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*) { @@ -730,6 +764,24 @@ AutoOpenSurface::ContentType() mDescriptor, mMode, getter_AddRefs(mSurface)); } +gfxImageFormat +AutoOpenSurface::ImageFormat() +{ + if (mSurface) { + nsRefPtr img = mSurface->GetAsImageSurface(); + if (img) { + gfxImageFormat format = img->Format(); + NS_ASSERTION(format != gfxASurface::ImageFormatUnknown, + "ImageSurface RGB format should be known"); + + return format; + } + } + + return ShadowLayerForwarder::GetDescriptorSurfaceImageFormat( + mDescriptor, mMode, getter_AddRefs(mSurface)); +} + gfxIntSize AutoOpenSurface::Size() { diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 6223c319952..5d8dcf6251a 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -140,6 +140,8 @@ class ShadowLayerForwarder : public CompositableForwarder friend class DeprecatedTextureClientShmem; friend class ContentClientIncremental; + typedef gfxASurface::gfxImageFormat gfxImageFormat; + public: virtual ~ShadowLayerForwarder(); @@ -454,6 +456,18 @@ private: OpenMode aMode, gfxIntSize* aSize, gfxASurface** aSurface); + // And again, for the image format. + // This function will return ImageFormatUnknown only if |aDescriptor| + // describes a non-ImageSurface. + static gfxImageFormat + GetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor, + OpenMode aMode, + gfxASurface** aSurface); + static bool + PlatformGetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor, + OpenMode aMode, + gfxImageFormat* aContent, + gfxASurface** aSurface); static already_AddRefed PlatformOpenDescriptor(OpenMode aMode, const SurfaceDescriptor& aDescriptor); diff --git a/gfx/layers/ipc/SharedRGBImage.h b/gfx/layers/ipc/SharedRGBImage.h index 439960e4d88..49e8640caf8 100644 --- a/gfx/layers/ipc/SharedRGBImage.h +++ b/gfx/layers/ipc/SharedRGBImage.h @@ -40,7 +40,9 @@ public: DeprecatedSharedRGBImage(ISurfaceAllocator *aAllocator); ~DeprecatedSharedRGBImage(); - uint8_t *GetBuffer(); + virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; } + + virtual uint8_t *GetBuffer() MOZ_OVERRIDE; gfxIntSize GetSize(); size_t GetBufferSize(); @@ -94,6 +96,8 @@ public: SharedRGBImage(ImageClient* aCompositable); ~SharedRGBImage(); + virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; } + virtual TextureClient* GetTextureClient() MOZ_OVERRIDE; virtual uint8_t* GetBuffer() MOZ_OVERRIDE; diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 2c5b7593b6c..1785e1d81c2 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -110,9 +110,9 @@ FlagsToGLFlags(TextureFlags aFlags) { uint32_t result = TextureImage::NoFlags; - if (aFlags & UseNearestFilter) + if (aFlags & TEXTURE_USE_NEAREST_FILTER) result |= TextureImage::UseNearestFilter; - if (aFlags & NeedsYFlip) + if (aFlags & TEXTURE_NEEDS_Y_FLIP) result |= TextureImage::NeedsYFlip; if (aFlags & TEXTURE_DISALLOW_BIGIMAGE) result |= TextureImage::DisallowBigImage; @@ -154,13 +154,13 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface, // the size of aSurface. mTexImage = mGL->CreateTextureImage(size, gfx::ContentForFormat(aSurface->GetFormat()), - WrapMode(mGL, aFlags & AllowRepeat), + WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(aFlags)); } else { mTexImage = CreateBasicTextureImage(mGL, size, gfx::ContentForFormat(aSurface->GetFormat()), - WrapMode(mGL, aFlags & AllowRepeat), + WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(aFlags)); } } @@ -392,7 +392,7 @@ TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize, mTexture->GetContentType() != aContentType) { mTexture = mGL->CreateTextureImage(aSize, aContentType, - WrapMode(mGL, mFlags & AllowRepeat), + WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(mFlags)); } mTexture->Resize(aSize); @@ -422,16 +422,22 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage NS_WARNING("trying to update TextureImageDeprecatedTextureHostOGL without a compositor?"); return; } + AutoOpenSurface surf(OPEN_READ_ONLY, aImage); nsIntSize size = surf.Size(); + TextureImage::ImageFormat format = surf.ImageFormat(); if (!mTexture || (mTexture->GetSize() != size && !aOffset) || - mTexture->GetContentType() != surf.ContentType()) { + mTexture->GetContentType() != surf.ContentType() || + (mTexture->GetImageFormat() != format && + mTexture->GetImageFormat() != gfxASurface::ImageFormatUnknown)) { + mTexture = mGL->CreateTextureImage(size, surf.ContentType(), - WrapMode(mGL, mFlags & AllowRepeat), - FlagsToGLFlags(mFlags)); + WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT), + FlagsToGLFlags(mFlags), + format); } // XXX this is always just ridiculously slow @@ -513,7 +519,7 @@ SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage nsIntSize size = texture.size(); mSize = gfx::IntSize(size.width, size.height); if (texture.inverted()) { - mFlags |= NeedsYFlip; + mFlags |= TEXTURE_NEEDS_Y_FLIP; } if (mSharedHandle && mSharedHandle != newHandle) { @@ -738,21 +744,21 @@ YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage, mYTexture->mTexImage = CreateBasicTextureImage(mGL, gfxSize, gfxASurface::CONTENT_ALPHA, - WrapMode(mGL, mFlags & AllowRepeat), + WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(mFlags)); } if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) { mCbTexture->mTexImage = CreateBasicTextureImage(mGL, gfxCbCrSize, gfxASurface::CONTENT_ALPHA, - WrapMode(mGL, mFlags & AllowRepeat), + WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(mFlags)); } if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) { mCrTexture->mTexImage = CreateBasicTextureImage(mGL, gfxCbCrSize, gfxASurface::CONTENT_ALPHA, - WrapMode(mGL, mFlags & AllowRepeat), + WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT), FlagsToGLFlags(mFlags)); } @@ -828,7 +834,7 @@ TiledDeprecatedTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurfac { mSize = aSize; mGL->MakeCurrent(); - if (aFlags & NewTile) { + if (aFlags & TEXTURE_NEW_TILE) { SetFlags(aFlags); mGL->fGenTextures(1, &mTextureHandle); mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle); @@ -1107,7 +1113,7 @@ GrallocDeprecatedTextureHostOGL::GetRenderState() { if (mGraphicBuffer.get()) { - uint32_t flags = mFlags & NeedsYFlip ? LAYER_RENDER_STATE_Y_FLIPPED : 0; + uint32_t flags = mFlags & TEXTURE_NEEDS_Y_FLIP ? LAYER_RENDER_STATE_Y_FLIPPED : 0; /* * The 32 bit format of gralloc buffer is created as RGBA8888 or RGBX888 by default. diff --git a/gfx/skia/src/gpu/GrContext.cpp b/gfx/skia/src/gpu/GrContext.cpp index 85b2c833841..145230fe449 100644 --- a/gfx/skia/src/gpu/GrContext.cpp +++ b/gfx/skia/src/gpu/GrContext.cpp @@ -373,7 +373,6 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc, verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(GrPoint)); fGpu->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4); } - texture->releaseRenderTarget(); } else { // TODO: Our CPU stretch doesn't filter. But we create separate // stretched textures when the texture params is either filtered or diff --git a/gfx/skia/src/xml/SkJS.cpp b/gfx/skia/src/xml/SkJS.cpp index 8167c9c1eaf..777f59890f3 100644 --- a/gfx/skia/src/xml/SkJS.cpp +++ b/gfx/skia/src/xml/SkJS.cpp @@ -79,7 +79,7 @@ global_enumerate(JSContext *cx, JSObject *obj) #ifdef LAZY_STANDARD_CLASSES return JS_EnumerateStandardClasses(cx, obj); #else - return JS_TRUE; + return true; #endif } @@ -91,10 +91,10 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **o JSBool resolved; if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) - return JS_FALSE; + return false; if (resolved) { *objp = obj; - return JS_TRUE; + return true; } } #endif @@ -111,21 +111,21 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **o JSFunction *fun; if (!JSVAL_IS_STRING(id)) - return JS_TRUE; + return true; path = getenv("PATH"); if (!path) - return JS_TRUE; + return true; path = JS_strdup(cx, path); if (!path) - return JS_FALSE; + return false; name = JS_GetStringBytes(JSVAL_TO_STRING(id)); - ok = JS_TRUE; + ok = true; for (comp = strtok(path, ":"); comp; comp = strtok(NULL, ":")) { if (*comp != '\0') { full = JS_smprintf("%s/%s", comp, name); if (!full) { JS_ReportOutOfMemory(cx); - ok = JS_FALSE; + ok = false; break; } } else { @@ -146,7 +146,7 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **o return ok; } #else - return JS_TRUE; + return true; #endif } diff --git a/gfx/skia/src/xml/SkJSDisplayable.cpp b/gfx/skia/src/xml/SkJSDisplayable.cpp index 502779743fc..3f59922276b 100644 --- a/gfx/skia/src/xml/SkJSDisplayable.cpp +++ b/gfx/skia/src/xml/SkJSDisplayable.cpp @@ -79,7 +79,7 @@ JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc, SkDrawable* drawable = (SkDrawable*) p->fDisplayable; SkAnimateMaker maker(NULL, gCanvas, gPaint); drawable->draw(maker); - return JS_TRUE; + return true; } @@ -97,7 +97,7 @@ static JSBool _class##Constructor(JSContext *cx, JSObject *obj, uintN argc, jsva SkJSDisplayable* jsDisplayable = new SkJSDisplayable(); \ jsDisplayable->fDisplayable = new _prefix##_class(); \ JS_SetPrivate(cx, obj, (void*) jsDisplayable); \ - return JS_TRUE; \ + return true; \ } \ \ static JSObject* _class##Init(JSContext *cx, JSObject *obj, JSObject *proto) { \ @@ -219,7 +219,7 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { if (JSVAL_IS_INT(id) == 0) - return JS_TRUE; + return true; SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj); SkDisplayable* displayable = p->fDisplayable; SkDisplayTypes displayableType = displayable->getType(); @@ -290,12 +290,12 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id, default: SkASSERT(0); // !!! unimplemented } - return JS_TRUE; + return true; } JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { if (JSVAL_IS_INT(id) == 0) - return JS_TRUE; + return true; SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj); SkDisplayable* displayable = p->fDisplayable; SkDisplayTypes displayableType = displayable->getType(); @@ -368,7 +368,7 @@ JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsva SkASSERT(0); // !!! unimplemented } } - return JS_TRUE; + return true; } void SkJS::InitializeDisplayables(const SkBitmap& bitmap, JSContext *cx, JSObject *obj, JSObject *proto) { diff --git a/gfx/thebes/gfx2DGlue.h b/gfx/thebes/gfx2DGlue.h index bc1c555e003..39ec13696fb 100644 --- a/gfx/thebes/gfx2DGlue.h +++ b/gfx/thebes/gfx2DGlue.h @@ -64,6 +64,8 @@ inline Filter ToFilter(gfxPattern::GraphicsFilter aFilter) switch (aFilter) { case gfxPattern::FILTER_NEAREST: return FILTER_POINT; + case gfxPattern::FILTER_GOOD: + return FILTER_GOOD; default: return FILTER_LINEAR; } diff --git a/ipc/testshell/TestShellParent.cpp b/ipc/testshell/TestShellParent.cpp index 9906b9b4673..a89e6aa5acc 100644 --- a/ipc/testshell/TestShellParent.cpp +++ b/ipc/testshell/TestShellParent.cpp @@ -46,36 +46,36 @@ TestShellCommandParent::SetCallback(JSContext* aCx, JS::Value aCallback) { if (!mCallback.Hold(aCx)) { - return JS_FALSE; + return false; } mCallback = aCallback; mCx = aCx; - return JS_TRUE; + return true; } JSBool TestShellCommandParent::RunCallback(const nsString& aResponse) { - NS_ENSURE_TRUE(*mCallback.ToJSValPtr() != JSVAL_NULL && mCx, JS_FALSE); + NS_ENSURE_TRUE(*mCallback.ToJSValPtr() != JSVAL_NULL && mCx, false); JSAutoRequest ar(mCx); - NS_ENSURE_TRUE(mCallback.ToJSObject(), JS_FALSE); + NS_ENSURE_TRUE(mCallback.ToJSObject(), false); JSAutoCompartment ac(mCx, mCallback.ToJSObject()); JS::Rooted global(mCx, JS::CurrentGlobalOrNull(mCx)); JSString* str = JS_NewUCStringCopyN(mCx, aResponse.get(), aResponse.Length()); - NS_ENSURE_TRUE(str, JS_FALSE); + NS_ENSURE_TRUE(str, false); JS::Rooted strVal(mCx, JS::StringValue(str)); JS::Rooted rval(mCx); JSBool ok = JS_CallFunctionValue(mCx, global, mCallback, 1, strVal.address(), rval.address()); - NS_ENSURE_TRUE(ok, JS_FALSE); + NS_ENSURE_TRUE(ok, false); - return JS_TRUE; + return true; } void diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index e5758f15946..2f2cd9af81f 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -73,7 +73,7 @@ private: }; inline XPCShellEnvironment* -Environment(JSObject* global) +Environment(Handle global) { AutoSafeJSContext cx; JSAutoCompartment ac(cx, global); @@ -121,9 +121,9 @@ GetLine(char *bufp, fputs(prompt, stdout); fflush(stdout); if (!fgets(line, sizeof line, file)) - return JS_FALSE; + return false; strcpy(bufp, line); - return JS_TRUE; + return true; } static bool @@ -174,10 +174,11 @@ Load(JSContext *cx, JS_ReportError(cx, "cannot open file '%s' for reading", filename.ptr()); return false; } + Rooted global(cx, JS::CurrentGlobalOrNull(cx)); JS::CompileOptions options(cx); options.setUTF8(true) .setFileAndLine(filename.ptr(), 1) - .setPrincipals(Environment(JS::CurrentGlobalOrNull(cx))->GetPrincipal()); + .setPrincipals(Environment(global)->GetPrincipal()); JS::RootedObject rootedObj(cx, obj); JSScript *script = JS::Compile(cx, rootedObj, options, file); fclose(file); @@ -217,7 +218,8 @@ Quit(JSContext *cx, unsigned argc, JS::Value *vp) { - XPCShellEnvironment* env = Environment(JS::CurrentGlobalOrNull(cx)); + Rooted global(cx, JS::CurrentGlobalOrNull(cx)); + XPCShellEnvironment* env = Environment(global); env->SetIsQuitting(); return false; @@ -451,7 +453,7 @@ XPCShellEnvironment::ProcessFile(JSContext *cx, /* It's an interactive filehandle; drop into read-eval-print loop. */ lineno = 1; - hitEOF = JS_FALSE; + hitEOF = false; do { bufp = buffer; *bufp = '\0'; @@ -468,7 +470,7 @@ XPCShellEnvironment::ProcessFile(JSContext *cx, startline = lineno; do { if (!GetLine(bufp, file, startline == lineno ? "js> " : "")) { - hitEOF = JS_TRUE; + hitEOF = true; break; } bufp += strlen(bufp); @@ -496,7 +498,7 @@ XPCShellEnvironment::ProcessFile(JSContext *cx, if (!!bytes) fprintf(stdout, "%s\n", bytes.ptr()); else - ok = JS_FALSE; + ok = false; } } } while (!hitEOF && !env->IsQuitting()); @@ -552,7 +554,7 @@ XPCShellEnvironment::CreateEnvironment() } XPCShellEnvironment::XPCShellEnvironment() -: mQuitting(JS_FALSE) +: mQuitting(false) { } @@ -560,7 +562,7 @@ XPCShellEnvironment::~XPCShellEnvironment() { AutoSafeJSContext cx; - JSObject* global = GetGlobalObject(); + Rooted global(cx, GetGlobalObject()); if (global) { { JSAutoCompartment ac(cx, global); @@ -672,7 +674,7 @@ XPCShellEnvironment::Init() if (runtimeScriptFile) { fprintf(stdout, "[loading '%s'...]\n", kDefaultRuntimeScriptFilename); ProcessFile(cx, globalObj, kDefaultRuntimeScriptFilename, - runtimeScriptFile, JS_FALSE); + runtimeScriptFile, false); fclose(runtimeScriptFile); } diff --git a/ipc/testshell/XPCShellEnvironment.h b/ipc/testshell/XPCShellEnvironment.h index 36456f8a836..42475ec2395 100644 --- a/ipc/testshell/XPCShellEnvironment.h +++ b/ipc/testshell/XPCShellEnvironment.h @@ -44,7 +44,7 @@ public: } void SetIsQuitting() { - mQuitting = JS_TRUE; + mQuitting = true; } JSBool IsQuitting() { return mQuitting; diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 71cb5dc0743..dcc02aff883 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -251,13 +251,18 @@ JavaScriptChild::AnswerDefineProperty(const ObjectId &objId, const nsString &id, if (!convertGeckoStringToId(cx, id, &internedId)) return fail(cx, rs); - JSPropertyDescriptor desc; - if (!toDescriptor(cx, descriptor, &desc)) + Rooted desc(cx); + if (!toDescriptor(cx, descriptor, desc.address())) return false; - RootedValue v(cx, desc.value); - if (!js::CheckDefineProperty(cx, obj, internedId, v, desc.getter, desc.setter, desc.attrs) || - !JS_DefinePropertyById(cx, obj, internedId, v, desc.getter, desc.setter, desc.attrs)) + if (!js::CheckDefineProperty(cx, obj, internedId, desc.value(), desc.getter(), + desc.setter(), desc.attributes())) + { + return fail(cx, rs); + } + + if (!JS_DefinePropertyById(cx, obj, internedId, desc.value(), desc.getter(), + desc.setter(), desc.attributes())) { return fail(cx, rs); } diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index a9e5ef84d15..9e2b254eb14 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -358,14 +358,14 @@ JSBool UnknownPropertyStub(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) { JS_ReportError(cx, "getter could not be wrapped via CPOWs"); - return JS_FALSE; + return false; } JSBool UnknownStrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp) { JS_ReportError(cx, "setter could not be wrapped via CPOWs"); - return JS_FALSE; + return false; } bool @@ -375,16 +375,18 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in, JSP out->shortid = in.shortid(); if (!toValue(cx, in.value(), &out->value)) return false; - if (!unwrap(cx, in.objId(), &out->obj)) + Rooted obj(cx); + if (!unwrap(cx, in.objId(), &obj)) return false; + out->obj = obj; if (!in.getter()) { out->getter = NULL; } else if (in.attrs() & JSPROP_GETTER) { - JSObject *getter; + Rooted getter(cx); if (!unwrap(cx, in.getter(), &getter)) return false; - out->getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, getter); + out->getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, getter.get()); } else { if (in.getter() == DefaultPropertyOp) out->getter = JS_PropertyStub; @@ -395,10 +397,10 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in, JSP if (!in.setter()) { out->setter = NULL; } else if (in.attrs() & JSPROP_SETTER) { - JSObject *setter; + Rooted setter(cx); if (!unwrap(cx, in.setter(), &setter)) return false; - out->setter = JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, setter); + out->setter = JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, setter.get()); } else { if (in.setter() == DefaultPropertyOp) out->setter = JS_StrictPropertyStub; diff --git a/js/ipc/JavaScriptShared.h b/js/ipc/JavaScriptShared.h index ea76d05d7b3..1685915179a 100644 --- a/js/ipc/JavaScriptShared.h +++ b/js/ipc/JavaScriptShared.h @@ -112,14 +112,14 @@ class JavaScriptShared virtual bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp) = 0; virtual JSObject *unwrap(JSContext *cx, ObjectId id) = 0; - bool unwrap(JSContext *cx, ObjectId id, JSObject **objp) { + bool unwrap(JSContext *cx, ObjectId id, JS::MutableHandle objp) { if (!id) { - *objp = NULL; + objp.set(NULL); return true; } - *objp = unwrap(cx, id); - return !!*objp; + objp.set(unwrap(cx, id)); + return bool(objp.get()); } static void ConvertID(const nsID &from, JSIID *to); diff --git a/js/jsd/idl/jsdIDebuggerService.idl b/js/jsd/idl/jsdIDebuggerService.idl index 618f342cae8..0a50b61341a 100644 --- a/js/jsd/idl/jsdIDebuggerService.idl +++ b/js/jsd/idl/jsdIDebuggerService.idl @@ -1203,7 +1203,7 @@ interface jsdIProperty : jsdIEphemeral const unsigned long FLAG_VARIABLE = 0x20; /** exception occurred looking up property, value is exception */ const unsigned long FLAG_EXCEPTION = 0x40; - /** native getter returned JS_FALSE without throwing an exception */ + /** native getter returned false without throwing an exception */ const unsigned long FLAG_ERROR = 0x80; /** found via explicit lookup (property defined elsewhere.) */ const unsigned long FLAG_HINTED = 0x800; diff --git a/js/jsd/jsd_high.cpp b/js/jsd/jsd_high.cpp index e9f476603bf..539108ce9e3 100644 --- a/js/jsd/jsd_high.cpp +++ b/js/jsd/jsd_high.cpp @@ -133,7 +133,7 @@ _newJSDContext(JSRuntime* jsrt, goto label_newJSDContext_failure; jsdc->data = NULL; - jsdc->inited = JS_TRUE; + jsdc->inited = true; JSD_LOCK(); JS_INSERT_LINK(&jsdc->links, &_jsd_context_list); @@ -167,7 +167,7 @@ _destroyJSDContext(JSDContext* jsdc) jsd_DestroyObjectManager(jsdc); jsd_DestroyAtomTable(jsdc); - jsdc->inited = JS_FALSE; + jsdc->inited = false; /* * We should free jsdc here, but we let it leak in case there are any @@ -218,7 +218,7 @@ jsd_DebuggerOn(void) void jsd_DebuggerOff(JSDContext* jsdc) { - jsd_DebuggerPause(jsdc, JS_TRUE); + jsd_DebuggerPause(jsdc, true); /* clear hooks here */ JS_SetNewScriptHookProc(jsdc->jsrt, NULL, NULL); JS_SetDestroyScriptHookProc(jsdc->jsrt, NULL, NULL); @@ -339,10 +339,10 @@ jsd_DebugErrorHook(JSContext *cx, const char *message, if( ! jsdc ) { JS_ASSERT(0); - return JS_TRUE; + return true; } if( JSD_IS_DANGEROUS_THREAD(jsdc) ) - return JS_TRUE; + return true; /* local in case hook gets cleared on another thread */ JSD_LOCK(); @@ -351,14 +351,14 @@ jsd_DebugErrorHook(JSContext *cx, const char *message, JSD_UNLOCK(); if(!errorReporter) - return JS_TRUE; + return true; switch(errorReporter(jsdc, cx, message, report, errorReporterData)) { case JSD_ERROR_REPORTER_PASS_ALONG: - return JS_TRUE; + return true; case JSD_ERROR_REPORTER_RETURN: - return JS_FALSE; + return false; case JSD_ERROR_REPORTER_DEBUG: { jsval rval; @@ -374,17 +374,17 @@ jsd_DebugErrorHook(JSContext *cx, const char *message, jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_DEBUG_REQUESTED, hook, hookData, &rval); /* XXX Should make this dependent on ExecutionHook retval */ - return JS_TRUE; + return true; } case JSD_ERROR_REPORTER_CLEAR_RETURN: if(report && JSREPORT_IS_EXCEPTION(report->flags)) JS_ClearPendingException(cx); - return JS_FALSE; + return false; default: JS_ASSERT(0); break; } - return JS_TRUE; + return true; } JSBool @@ -396,7 +396,7 @@ jsd_SetErrorReporter(JSDContext* jsdc, jsdc->errorReporter = reporter; jsdc->errorReporterData = callerdata; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -410,5 +410,5 @@ jsd_GetErrorReporter(JSDContext* jsdc, if( callerdata ) *callerdata = jsdc->errorReporterData; JSD_UNLOCK(); - return JS_TRUE; + return true; } diff --git a/js/jsd/jsd_hook.cpp b/js/jsd/jsd_hook.cpp index 36d7be447b3..19fce9b51d0 100644 --- a/js/jsd/jsd_hook.cpp +++ b/js/jsd/jsd_hook.cpp @@ -175,7 +175,7 @@ jsd_CallCallHook (JSDContext* jsdc, JSBool hookanswer; JSDThreadState* jsdthreadstate; - hookanswer = JS_FALSE; + hookanswer = false; if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc, cx))) { hookanswer = hook(jsdc, jsdthreadstate, type, hookData); @@ -196,7 +196,7 @@ jsd_SetInterruptHook(JSDContext* jsdc, JS_SetInterrupt(jsdc->jsrt, jsd_InterruptHandler, (void*) jsdc); JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -207,7 +207,7 @@ jsd_ClearInterruptHook(JSDContext* jsdc) jsdc->interruptHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -220,7 +220,7 @@ jsd_SetDebugBreakHook(JSDContext* jsdc, jsdc->debugBreakHook = hook; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -230,7 +230,7 @@ jsd_ClearDebugBreakHook(JSDContext* jsdc) jsdc->debugBreakHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -243,7 +243,7 @@ jsd_SetDebuggerHook(JSDContext* jsdc, jsdc->debuggerHook = hook; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -253,7 +253,7 @@ jsd_ClearDebuggerHook(JSDContext* jsdc) jsdc->debuggerHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -266,7 +266,7 @@ jsd_SetThrowHook(JSDContext* jsdc, jsdc->throwHook = hook; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -276,7 +276,7 @@ jsd_ClearThrowHook(JSDContext* jsdc) jsdc->throwHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -289,7 +289,7 @@ jsd_SetFunctionHook(JSDContext* jsdc, jsdc->functionHook = hook; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -299,7 +299,7 @@ jsd_ClearFunctionHook(JSDContext* jsdc) jsdc->functionHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -312,7 +312,7 @@ jsd_SetTopLevelHook(JSDContext* jsdc, jsdc->toplevelHook = hook; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -322,6 +322,6 @@ jsd_ClearTopLevelHook(JSDContext* jsdc) jsdc->toplevelHook = NULL; JSD_UNLOCK(); - return JS_TRUE; + return true; } diff --git a/js/jsd/jsd_lock.cpp b/js/jsd/jsd_lock.cpp index 6a0a6ea9155..5ff7fbe9e1e 100644 --- a/js/jsd/jsd_lock.cpp +++ b/js/jsd/jsd_lock.cpp @@ -149,9 +149,9 @@ jsd_IsLocked(JSDStaticLock* lock) ASSERT_VALID_LOCK(lock); _CURRENT_THREAD(me); if (lock->owner != me) - return JS_FALSE; + return false; JS_ASSERT(lock->count > 0); - return JS_TRUE; + return true; } #endif /* DEBUG */ @@ -197,7 +197,7 @@ jsd_Unlock(void* lock) JSBool jsd_IsLocked(void* lock) { - return JS_TRUE; + return true; } #endif /* DEBUG */ diff --git a/js/jsd/jsd_scpt.cpp b/js/jsd/jsd_scpt.cpp index c6d690dd8dc..b6a8fc6092b 100644 --- a/js/jsd/jsd_scpt.cpp +++ b/js/jsd/jsd_scpt.cpp @@ -405,9 +405,9 @@ jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript) current = (JSDScript *)current->links.next ) { if(jsdscript == current) - return JS_TRUE; + return true; } - return JS_FALSE; + return false; } const char* @@ -493,7 +493,7 @@ jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned i; if (last < startLine) - return JS_TRUE; + return true; AutoSafeJSContext cx; JSAutoCompartment ac(cx, jsdscript->script); @@ -522,7 +522,7 @@ jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata) jsdc->scriptHook = hook; jsdc->scriptHookData = callerdata; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -534,7 +534,7 @@ jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata) if( callerdata ) *callerdata = jsdc->scriptHookData; JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -593,7 +593,7 @@ jsd_NewScriptHookProc( JSD_UNLOCK(); if( hook ) - hook(jsdc, jsdscript, JS_TRUE, hookData); + hook(jsdc, jsdscript, true, hookData); } void @@ -635,7 +635,7 @@ jsd_DestroyScriptHookProc( JSD_UNLOCK(); if( hook ) - hook(jsdc, jsdscript, JS_FALSE, hookData); + hook(jsdc, jsdscript, false, hookData); JSD_LOCK_SCRIPTS(jsdc); JS_HashTableRemove(jsdc->scriptsTable, (void *)script); @@ -679,7 +679,7 @@ _isActiveHook(JSDContext* jsdc, JSScript *script, JSDExecHook* jsdhook) if( ! jsdscript) { JSD_UNLOCK_SCRIPTS(jsdc); - return JS_FALSE; + return false; } list = &jsdscript->hooks; @@ -691,11 +691,11 @@ _isActiveHook(JSDContext* jsdc, JSScript *script, JSDExecHook* jsdhook) if(current == jsdhook) { JSD_UNLOCK_SCRIPTS(jsdc); - return JS_TRUE; + return true; } } JSD_UNLOCK_SCRIPTS(jsdc); - return JS_FALSE; + return false; } @@ -756,7 +756,7 @@ jsd_SetExecutionHook(JSDContext* jsdc, { jsd_ClearExecutionHook(jsdc, jsdscript, pc); JSD_UNLOCK(); - return JS_TRUE; + return true; } jsdhook = _findHook(jsdc, jsdscript, pc); @@ -765,14 +765,14 @@ jsd_SetExecutionHook(JSDContext* jsdc, jsdhook->hook = hook; jsdhook->callerdata = callerdata; JSD_UNLOCK(); - return JS_TRUE; + return true; } /* else... */ jsdhook = (JSDExecHook*)calloc(1, sizeof(JSDExecHook)); if( ! jsdhook ) { JSD_UNLOCK(); - return JS_FALSE; + return false; } jsdhook->jsdscript = jsdscript; jsdhook->pc = pc; @@ -790,13 +790,13 @@ jsd_SetExecutionHook(JSDContext* jsdc, if ( ! rv ) { free(jsdhook); JSD_UNLOCK(); - return JS_FALSE; + return false; } JS_APPEND_LINK(&jsdhook->links, &jsdscript->hooks); JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -812,7 +812,7 @@ jsd_ClearExecutionHook(JSDContext* jsdc, if( ! jsdhook ) { JSD_UNLOCK(); - return JS_FALSE; + return false; } { @@ -826,7 +826,7 @@ jsd_ClearExecutionHook(JSDContext* jsdc, free(jsdhook); JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -845,7 +845,7 @@ jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript) JS_ClearScriptTraps(jsdc->jsrt, jsdscript->script); JSD_UNLOCK(); - return JS_TRUE; + return true; } JSBool @@ -858,7 +858,7 @@ jsd_ClearAllExecutionHooks(JSDContext* jsdc) while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) ) jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript); JSD_UNLOCK(); - return JS_TRUE; + return true; } void diff --git a/js/jsd/jsd_stak.cpp b/js/jsd/jsd_stak.cpp index 8249c35858f..14b37ca9d84 100644 --- a/js/jsd/jsd_stak.cpp +++ b/js/jsd/jsd_stak.cpp @@ -361,7 +361,7 @@ jsd_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { - JSBool rv = JS_TRUE; + JSBool rv = true; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) @@ -378,7 +378,7 @@ jsd_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { - JSBool rv = JS_TRUE; + JSBool rv = true; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) @@ -409,7 +409,7 @@ jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSD_UNLOCK_THREADSTATES(jsdc); if( ! valid ) - return JS_FALSE; + return false; AutoPushJSContext cx(jsdthreadstate->context); JS_ASSERT(cx); @@ -446,7 +446,7 @@ jsd_EvaluateScriptInStackFrame(JSDContext* jsdc, JSD_UNLOCK_THREADSTATES(jsdc); if (!valid) - return JS_FALSE; + return false; AutoPushJSContext cx(jsdthreadstate->context); JS_ASSERT(cx); @@ -505,9 +505,9 @@ jsd_IsValidThreadState(JSDContext* jsdc, cur = (JSDThreadState*)cur->links.next ) { if( cur == jsdthreadstate ) - return JS_TRUE; + return true; } - return JS_FALSE; + return false; } JSBool @@ -518,14 +518,14 @@ jsd_IsValidFrameInThreadState(JSDContext* jsdc, JS_ASSERT(JSD_THREADSTATES_LOCKED(jsdc)); if( ! jsd_IsValidThreadState(jsdc, jsdthreadstate) ) - return JS_FALSE; + return false; if( jsdframe->jsdthreadstate != jsdthreadstate ) - return JS_FALSE; + return false; JSD_ASSERT_VALID_THREAD_STATE(jsdthreadstate); JSD_ASSERT_VALID_STACK_FRAME(jsdframe); - return JS_TRUE; + return true; } static JSContext* @@ -561,12 +561,12 @@ jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSContext* cx; if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate))) - return JS_FALSE; + return false; if(jsdval) JS_SetPendingException(cx, JSD_GetValueWrappedJSVal(jsdc, jsdval)); else JS_ClearPendingException(cx); - return JS_TRUE; + return true; } diff --git a/js/jsd/jsd_step.cpp b/js/jsd/jsd_step.cpp index da1886a2b03..0778ce43e15 100644 --- a/js/jsd/jsd_step.cpp +++ b/js/jsd/jsd_step.cpp @@ -82,10 +82,10 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons { JSDScript* jsdscript; JSScript* jsscript; - JSBool hookresult = JS_TRUE; + JSBool hookresult = true; if (!jsdc || !jsdc->inited) - return JS_FALSE; + return false; if (!hook && !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) { @@ -98,7 +98,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons if (before && isConstructing) { JS::RootedValue newObj(cx); if (!frame.getThisValue(cx, &newObj)) - return JS_FALSE; + return false; jsd_Constructing(jsdc, cx, JSVAL_TO_OBJECT(newObj), frame); } @@ -153,7 +153,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons pdata->maxRecurseDepth = pdata->recurseDepth; } /* make sure we're called for the return too. */ - hookresult = JS_TRUE; + hookresult = true; } else if (!pdata->recurseDepth && pdata->lastCallStart) { int64_t now, ll_delta; double delta; @@ -218,14 +218,14 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons hookresult = jsd_CallCallHook (jsdc, cx, type, hook, hookData); else - hookresult = JS_TRUE; + hookresult = true; } } } #ifdef JSD_TRACE _interpreterTrace(jsdc, cx, frame, isConstructing, before); - return JS_TRUE; + return true; #else return hookresult; #endif diff --git a/js/jsd/jsd_text.cpp b/js/jsd/jsd_text.cpp index e0393fb5787..8358c9330da 100644 --- a/js/jsd/jsd_text.cpp +++ b/js/jsd/jsd_text.cpp @@ -31,9 +31,9 @@ _clearText(JSDContext* jsdc, JSDSourceText* jsdsrc) jsdsrc->textLength = 0; jsdsrc->textSpace = 0; jsdsrc->status = JSD_SOURCE_CLEARED; - jsdsrc->dirty = JS_TRUE; + jsdsrc->dirty = true; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; - jsdsrc->doingEval = JS_FALSE; + jsdsrc->doingEval = false; } static JSBool @@ -66,7 +66,7 @@ _appendText(JSDContext* jsdc, JSDSourceText* jsdsrc, /* out of memory */ _clearText( jsdc, jsdsrc ); jsdsrc->status = JSD_SOURCE_FAILED; - return JS_FALSE; + return false; } } @@ -76,7 +76,7 @@ _appendText(JSDContext* jsdc, JSDSourceText* jsdsrc, memcpy(jsdsrc->text + jsdsrc->textLength, text, length); jsdsrc->textLength += length; - return JS_TRUE; + return true; } static JSDSourceText* @@ -88,7 +88,7 @@ _newSource(JSDContext* jsdc, char* url) jsdsrc->url = url; jsdsrc->status = JSD_SOURCE_INITED; - jsdsrc->dirty = JS_TRUE; + jsdsrc->dirty = true; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; return jsdsrc; @@ -145,9 +145,9 @@ _isSourceInSourceList(JSDContext* jsdc, JSDSourceText* jsdsrcToFind) jsdsrc = (JSDSourceText*)jsdsrc->links.next ) { if( jsdsrc == jsdsrcToFind ) - return JS_TRUE; + return true; } - return JS_FALSE; + return false; } /* compare strings in a case insensitive manner with a length limit @@ -261,7 +261,7 @@ jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, { *ppBuf = jsdsrc->text; *pLen = jsdsrc->textLength; - return JS_TRUE; + return true; } void @@ -394,7 +394,7 @@ jsd_AppendSourceText(JSDContext* jsdc, if( text && length && ! _appendText( jsdc, jsdsrc, text, length ) ) { - jsdsrc->dirty = JS_TRUE; + jsdsrc->dirty = true; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->status = JSD_SOURCE_FAILED; _moveSourceToRemovedList(jsdc, jsdsrc); @@ -402,7 +402,7 @@ jsd_AppendSourceText(JSDContext* jsdc, return NULL; } - jsdsrc->dirty = JS_TRUE; + jsdsrc->dirty = true; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->status = status; DEBUG_ITERATE_SOURCES(jsdc); @@ -472,7 +472,7 @@ jsd_AddFullSourceText(JSDContext* jsdc, JSD_UNLOCK_SOURCE_TEXT(jsdc); - return jsdsrc ? JS_TRUE : JS_FALSE; + return jsdsrc ? true : false; } /***************************************************************************/ @@ -493,7 +493,7 @@ jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url) JS_ASSERT(! jsdsrc->doingEval); #endif #endif - jsdsrc->doingEval = JS_TRUE; + jsdsrc->doingEval = true; } } @@ -517,7 +517,7 @@ jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url) JS_ASSERT(jsdsrc->doingEval); #endif #endif - jsdsrc->doingEval = JS_FALSE; + jsdsrc->doingEval = false; } JSD_UNLOCK_SOURCE_TEXT(jsdc); diff --git a/js/jsd/jsd_val.cpp b/js/jsd/jsd_val.cpp index 5de8b7bebdd..75a60b08fba 100644 --- a/js/jsd/jsd_val.cpp +++ b/js/jsd/jsd_val.cpp @@ -129,10 +129,10 @@ jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval) { JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(jsdval->val)); AutoSaveExceptionState as(cx); - JSBool ok = JS_FALSE; + JSBool ok = false; fun = JSD_GetValueFunction(jsdc, jsdval); if(fun) - ok = JS_GetFunctionScript(cx, fun) ? JS_FALSE : JS_TRUE; + ok = JS_GetFunctionScript(cx, fun) ? false : true; JS_ASSERT(fun); return ok; } @@ -146,7 +146,7 @@ jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { jsval val = jsdval->val; if(!JSVAL_IS_BOOLEAN(val)) - return JS_FALSE; + return false; return JSVAL_TO_BOOLEAN(val); } @@ -254,7 +254,7 @@ jsd_NewValue(JSDContext* jsdc, jsval value) ok = JS_AddNamedValueRoot(cx, &jsdval->val, "JSDValue"); if(ok && JSVAL_IS_STRING(val)) { if(!JS_WrapValue(cx, val.address())) { - ok = JS_FALSE; + ok = false; } } @@ -363,7 +363,7 @@ static JSBool _buildProps(JSDContext* jsdc, JSDValue* jsdval) JS_ASSERT(!JSVAL_IS_PRIMITIVE(jsdval->val)); if(JSVAL_IS_PRIMITIVE(jsdval->val)) - return JS_FALSE; + return false; obj = JSVAL_TO_OBJECT(jsdval->val); @@ -371,7 +371,7 @@ static JSBool _buildProps(JSDContext* jsdc, JSDValue* jsdval) if(!JS_GetPropertyDescArray(cx, obj, &pda)) { - return JS_FALSE; + return false; } for(i = 0; i < pda.length; i++) diff --git a/js/jsd/jsd_xpc.cpp b/js/jsd/jsd_xpc.cpp index a3ef6f16360..2b2181b7577 100644 --- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -560,10 +560,10 @@ jsds_CallHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate, } if (!hook) - return JS_TRUE; + return true; if (!jsds_FilterHook (jsdc, jsdthreadstate)) - return JS_FALSE; + return false; JSDStackFrameInfo *native_frame = JSD_GetStackFrame (jsdc, jsdthreadstate); nsCOMPtr frame = @@ -573,7 +573,7 @@ jsds_CallHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate, gJsds->DoUnPause(nullptr, true); jsdStackFrame::InvalidateAll(); - return JS_TRUE; + return true; } static uint32_t diff --git a/js/jsd/jsdebug.cpp b/js/jsd/jsdebug.cpp index fc754f4b59e..85aedafe76d 100644 --- a/js/jsd/jsdebug.cpp +++ b/js/jsd/jsdebug.cpp @@ -38,7 +38,7 @@ JSD_PUBLIC_API(void) JSD_DebuggerPause(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); - jsd_DebuggerPause(jsdc, JS_FALSE); + jsd_DebuggerPause(jsdc, false); } JSD_PUBLIC_API(void) @@ -775,7 +775,7 @@ JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc, return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, - JS_TRUE, rval); + true, rval); } JSD_PUBLIC_API(JSBool) @@ -793,7 +793,7 @@ JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc, return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, - JS_FALSE, rval); + false, rval); } JSD_PUBLIC_API(JSBool) @@ -810,7 +810,7 @@ JSD_EvaluateScriptInStackFrame(JSDContext* jsdc, return jsd_EvaluateScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, - filename, lineno, JS_TRUE, rval); + filename, lineno, true, rval); } JSD_PUBLIC_API(JSBool) @@ -827,7 +827,7 @@ JSD_AttemptScriptInStackFrame(JSDContext* jsdc, return jsd_EvaluateScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, - filename, lineno, JS_FALSE, rval); + filename, lineno, false, rval); } JSD_PUBLIC_API(JSString*) @@ -881,9 +881,9 @@ JSD_PUBLIC_API(JSBool) JSD_IsLockingAndThreadIdSupported() { #ifdef JSD_THREADSAFE - return JS_TRUE; + return true; #else - return JS_FALSE; + return false; #endif } @@ -919,7 +919,7 @@ JSD_IsLocked(JSDStaticLock* lock) #if defined(JSD_THREADSAFE) && defined(DEBUG) return jsd_IsLocked(lock); #else - return JS_TRUE; + return true; #endif } @@ -929,7 +929,7 @@ JSD_IsUnlocked(JSDStaticLock* lock) #if defined(JSD_THREADSAFE) && defined(DEBUG) return ! jsd_IsLocked(lock); #else - return JS_TRUE; + return true; #endif } diff --git a/js/jsd/jsdebug.h b/js/jsd/jsdebug.h index 0057392a5f3..7252108ec23 100644 --- a/js/jsd/jsdebug.h +++ b/js/jsd/jsdebug.h @@ -418,7 +418,7 @@ JSD_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript); /* * Declaration of callback for notification of script creation and destruction. -* 'creating' is JS_TRUE if creating new script, JS_FALSE if destroying existing +* 'creating' is true if creating new script, false if destroying existing * script (callback called just before actual destruction). * 'callerdata' is what was passed to JSD_SetScriptHook to set the hook. */ @@ -683,7 +683,7 @@ JSD_AppendUCSourceText(JSDContext* jsdc, * jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, * NULL, 0, JSD_SOURCE_COMPLETED); * JSD_UNLOCK_SOURCE_TEXT(jsdc); - * return jsdsrc ? JS_TRUE : JS_FALSE; + * return jsdsrc ? true : false; */ extern JSD_PUBLIC_API(JSBool) JSD_AddFullSourceText(JSDContext* jsdc, @@ -727,7 +727,7 @@ typedef unsigned /* * Implement a callback of this form in order to hook function call/returns. -* Return JS_TRUE from a TOPLEVEL_START or FUNCTION_CALL type call hook if you +* Return true from a TOPLEVEL_START or FUNCTION_CALL type call hook if you * want to hear about the TOPLEVEL_END or FUNCTION_RETURN too. Return value is * ignored to TOPLEVEL_END and FUNCTION_RETURN type hooks. */ @@ -965,7 +965,7 @@ JSD_IsStackFrameConstructing(JSDContext* jsdc, /* * Evaluate the given unicode source code in the context of the given stack frame. -* returns JS_TRUE and puts result in rval on success, JS_FALSE on failure. +* returns true and puts result in rval on success, false on failure. * NOTE: The ErrorReporter hook might be called if this fails. */ extern JSD_PUBLIC_API(JSBool) @@ -1099,7 +1099,7 @@ extern JSD_PUBLIC_API(void) JSD_Unlock(JSDStaticLock* lock); /* -* For debugging only if not (JS_THREADSAFE AND DEBUG) then returns JS_TRUE +* For debugging only if not (JS_THREADSAFE AND DEBUG) then returns true * So JSD_IsLocked(lock) may not equal !JSD_IsUnlocked(lock) */ extern JSD_PUBLIC_API(JSBool) @@ -1364,7 +1364,7 @@ JSD_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval); #define JSDPD_ALIAS JSPD_ALIAS /* property has an alias id */ #define JSDPD_EXCEPTION JSPD_EXCEPTION /* exception occurred looking up */ /* proprety, value is exception */ -#define JSDPD_ERROR JSPD_ERROR /* native getter returned JS_FALSE */ +#define JSDPD_ERROR JSPD_ERROR /* native getter returned false */ /* without throwing an exception */ /* this is not one of the JSPD_ flags in jsdbgapi.h - careful not to overlap*/ #define JSDPD_HINTED 0x800 /* found via explicit lookup */ diff --git a/js/jsd/jshash.cpp b/js/jsd/jshash.cpp index 255dc98ca40..e2a38538da7 100644 --- a/js/jsd/jshash.cpp +++ b/js/jsd/jshash.cpp @@ -179,14 +179,14 @@ Resize(JSHashTable *ht, uint32_t newshift) /* Integer overflow protection. */ if (nb > (size_t)-1 / sizeof(JSHashEntry*)) - return JS_FALSE; + return false; nb *= sizeof(JSHashEntry*); oldbuckets = ht->buckets; ht->buckets = (JSHashEntry**)ht->allocOps->allocTable(ht->allocPriv, nb); if (!ht->buckets) { ht->buckets = oldbuckets; - return JS_FALSE; + return false; } memset(ht->buckets, 0, nb); @@ -215,7 +215,7 @@ Resize(JSHashTable *ht, uint32_t newshift) #endif ht->allocOps->freeTable(ht->allocPriv, oldbuckets, nold * sizeof oldbuckets[0]); - return JS_TRUE; + return true; } JSHashEntry * @@ -298,11 +298,11 @@ JS_HashTableRemove(JSHashTable *ht, const void *key) keyHash = ht->keyHash(key); hep = JS_HashTableRawLookup(ht, keyHash, key); if ((he = *hep) == NULL) - return JS_FALSE; + return false; /* Hit; remove element */ JS_HashTableRawRemove(ht, hep, he); - return JS_TRUE; + return true; } void * diff --git a/js/public/Value.h b/js/public/Value.h index 0ea29f30552..3afcbc3af34 100644 --- a/js/public/Value.h +++ b/js/public/Value.h @@ -437,7 +437,7 @@ static inline jsval_layout BOOLEAN_TO_JSVAL_IMPL(JSBool b) { jsval_layout l; - MOZ_ASSERT(b == JS_TRUE || b == JS_FALSE); + MOZ_ASSERT(b == JS_TRUE_DEPRECATED || b == JS_FALSE_DEPRECATED); l.s.tag = JSVAL_TAG_BOOLEAN; l.s.payload.boo = b; return l; @@ -664,7 +664,7 @@ static inline jsval_layout BOOLEAN_TO_JSVAL_IMPL(JSBool b) { jsval_layout l; - MOZ_ASSERT(b == JS_TRUE || b == JS_FALSE); + MOZ_ASSERT(b == JS_TRUE_DEPRECATED || b == JS_FALSE_DEPRECATED); l.asBits = ((uint64_t)(uint32_t)b) | JSVAL_SHIFTED_TAG_BOOLEAN; return l; } diff --git a/js/src/TraceLogging.cpp b/js/src/TraceLogging.cpp index e46bf0c5159..96e8b148dee 100644 --- a/js/src/TraceLogging.cpp +++ b/js/src/TraceLogging.cpp @@ -13,6 +13,8 @@ #include #include +#include "jsapi.h" + using namespace js; #ifndef TRACE_LOG_DIR @@ -73,6 +75,12 @@ const char* const TraceLogging::type_name[] = { "stop,gc", "start,minor_gc", "stop,minor_gc", + "start,parser,script", + "stop,parser,script", + "start,parser,lazy", + "stop,parser,lazy", + "start,parser,function", + "stop,parser,function", "info,engine,interpreter", "info,engine,baseline", "info,engine,ionmonkey" @@ -148,6 +156,12 @@ TraceLogging::log(Type type, const char* file, unsigned int lineno) loggingTime += rdtsc()-now; } +void +TraceLogging::log(Type type, const CompileOptions &options) +{ + this->log(type, options.filename, options.lineno); +} + void TraceLogging::log(Type type, JSScript* script) { diff --git a/js/src/TraceLogging.h b/js/src/TraceLogging.h index 876d551477b..9a4a7e673fa 100644 --- a/js/src/TraceLogging.h +++ b/js/src/TraceLogging.h @@ -11,6 +11,8 @@ namespace js { +struct CompileOptions; + class TraceLogging { public: @@ -25,6 +27,12 @@ class TraceLogging GC_STOP, MINOR_GC_START, MINOR_GC_STOP, + PARSER_COMPILE_SCRIPT_START, + PARSER_COMPILE_SCRIPT_STOP, + PARSER_COMPILE_LAZY_START, + PARSER_COMPILE_LAZY_STOP, + PARSER_COMPILE_FUNCTION_START, + PARSER_COMPILE_FUNCTION_STOP, INFO_ENGINE_INTERPRETER, INFO_ENGINE_BASELINE, INFO_ENGINE_IONMONKEY, @@ -61,6 +69,7 @@ class TraceLogging ~TraceLogging(); void log(Type type, const char* filename, unsigned int line); + void log(Type type, const CompileOptions &options); void log(Type type, JSScript* script); void log(const char* log); void log(Type type); @@ -84,6 +93,13 @@ class AutoTraceLog { TraceLogging::Type stop; public: + AutoTraceLog(TraceLogging* logger, TraceLogging::Type start, TraceLogging::Type stop, const CompileOptions &options) + : logger(logger), + stop(stop) + { + logger->log(start, options); + } + AutoTraceLog(TraceLogging* logger, TraceLogging::Type start, TraceLogging::Type stop, JSScript* script) : logger(logger), stop(stop) diff --git a/js/src/build/ConfigStatus.py b/js/src/build/ConfigStatus.py index d424f31c1c9..b4fad204a13 100644 --- a/js/src/build/ConfigStatus.py +++ b/js/src/build/ConfigStatus.py @@ -19,8 +19,7 @@ from mozbuild.backend.configenvironment import ConfigEnvironment from mozbuild.backend.recursivemake import RecursiveMakeBackend from mozbuild.frontend.emitter import TreeMetadataEmitter from mozbuild.frontend.reader import BuildReader - -from Preprocessor import Preprocessor +from mozbuild.mozinfo import write_mozinfo log_manager = LoggingManager() @@ -87,6 +86,11 @@ def config_status(topobjdir = '.', topsrcdir = '.', env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines, non_global_defines=non_global_defines, substs=substs) + # mozinfo.json only needs written if configure changes and configure always + # passes this environment variable. + if 'WRITE_MOZINFO' in os.environ: + write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ) + reader = BuildReader(env) emitter = TreeMetadataEmitter(env) backend = RecursiveMakeBackend(env) diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 6396026541b..dd0e94fc57a 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -852,6 +852,8 @@ HashableValue::mark(JSTracer *trc) const /*** MapIterator *********************************************************************************/ +namespace { + class MapIteratorObject : public JSObject { public: @@ -871,6 +873,8 @@ class MapIteratorObject : public JSObject static bool next(JSContext *cx, unsigned argc, Value *vp); }; +} /* anonymous namespace */ + Class MapIteratorObject::class_ = { "Map Iterator", JSCLASS_IMPLEMENTS_BARRIERS | @@ -1415,6 +1419,8 @@ js_InitMapClass(JSContext *cx, HandleObject obj) /*** SetIterator *********************************************************************************/ +namespace { + class SetIteratorObject : public JSObject { public: @@ -1434,6 +1440,8 @@ class SetIteratorObject : public JSObject static bool next(JSContext *cx, unsigned argc, Value *vp); }; +} /* anonymous namespace */ + Class SetIteratorObject::class_ = { "Set Iterator", JSCLASS_IMPLEMENTS_BARRIERS | diff --git a/js/src/builtin/Profilers.cpp b/js/src/builtin/Profilers.cpp index b2949fa3e79..c3833e5f9eb 100644 --- a/js/src/builtin/Profilers.cpp +++ b/js/src/builtin/Profilers.cpp @@ -77,13 +77,13 @@ StartOSXProfiling(const char *profileName = NULL) JS_PUBLIC_API(JSBool) JS_StartProfiling(const char *profileName) { - JSBool ok = JS_TRUE; + JSBool ok = true; #ifdef __APPLE__ ok = StartOSXProfiling(profileName); #endif #ifdef __linux__ if (!js_StartPerf()) - ok = JS_FALSE; + ok = false; #endif return ok; } @@ -91,7 +91,7 @@ JS_StartProfiling(const char *profileName) JS_PUBLIC_API(JSBool) JS_StopProfiling(const char *profileName) { - JSBool ok = JS_TRUE; + JSBool ok = true; #ifdef __APPLE__ #ifdef MOZ_SHARK Shark::Stop(); @@ -102,7 +102,7 @@ JS_StopProfiling(const char *profileName) #endif #ifdef __linux__ if (!js_StopPerf()) - ok = JS_FALSE; + ok = false; #endif return ok; } @@ -114,7 +114,7 @@ JS_StopProfiling(const char *profileName) static JSBool ControlProfilers(bool toState) { - JSBool ok = JS_TRUE; + JSBool ok = true; if (! Probes::ProfilingActive && toState) { #ifdef __APPLE__ @@ -136,7 +136,7 @@ ControlProfilers(bool toState) #ifdef MOZ_CALLGRIND if (! js_StartCallgrind()) { UnsafeError("Failed to start Callgrind"); - ok = JS_FALSE; + ok = false; } #endif } else if (Probes::ProfilingActive && ! toState) { @@ -151,7 +151,7 @@ ControlProfilers(bool toState) #ifdef MOZ_CALLGRIND if (! js_StopCallgrind()) { UnsafeError("failed to stop Callgrind"); - ok = JS_FALSE; + ok = false; } #endif } @@ -184,7 +184,7 @@ JS_ResumeProfilers(const char *profileName) JS_PUBLIC_API(JSBool) JS_DumpProfile(const char *outfile, const char *profileName) { - JSBool ok = JS_TRUE; + JSBool ok = true; #ifdef MOZ_CALLGRIND js_DumpCallgrind(outfile); #endif diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 992575b507f..e3dda276ec6 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -1537,7 +1537,7 @@ static bool jsvalToBool(JSContext* cx, jsval val, bool* result) { if (JSVAL_IS_BOOLEAN(val)) { - *result = JSVAL_TO_BOOLEAN(val) != JS_FALSE; + *result = JSVAL_TO_BOOLEAN(val); return true; } if (JSVAL_IS_INT(val)) { @@ -2226,7 +2226,7 @@ ImplicitConvert(JSContext* cx, if (!p) { // We have called |dispose| or |forget| already. JS_ReportError(cx, "Attempting to convert an empty CDataFinalizer"); - return JS_FALSE; + return false; } // If the types are equal, copy the buffer contained within the CData. @@ -2603,7 +2603,7 @@ ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* b // Convert according to the ECMAScript ToBoolean() function. JSBool result; ASSERT_OK(JS_ValueToBoolean(cx, val, &result)); - *static_cast(buffer) = result != JS_FALSE; + *static_cast(buffer) = result != false; break; } #define DEFINE_INT_TYPE(name, type, ffiType) \ @@ -3123,21 +3123,21 @@ CType::ConstructBasic(JSContext* cx, { if (args.length() > 1) { JS_ReportError(cx, "CType constructor takes zero or one argument"); - return JS_FALSE; + return false; } // construct a CData object RootedObject result(cx, CData::Create(cx, obj, NullPtr(), NULL, true)); if (!result) - return JS_FALSE; + return false; if (args.length() == 1) { if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result))) - return JS_FALSE; + return false; } args.rval().setObject(*result); - return JS_TRUE; + return true; } JSObject* @@ -3596,14 +3596,14 @@ CType::PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableH { if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType or CTypeProto"); - return JS_FALSE; + return false; } unsigned slot = CType::IsCTypeProto(obj) ? (unsigned) SLOT_OURDATAPROTO : (unsigned) SLOT_PROTO; vp.set(JS_GetReservedSlot(obj, slot)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) || JSVAL_IS_VOID(vp)); - return JS_TRUE; + return true; } JSBool @@ -3611,15 +3611,15 @@ CType::NameGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandle { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); - return JS_FALSE; + return false; } JSString* name = CType::GetName(cx, obj); if (!name) - return JS_FALSE; + return false; vp.setString(name); - return JS_TRUE; + return true; } JSBool @@ -3627,12 +3627,12 @@ CType::SizeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandle { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_SIZE)); JS_ASSERT(JSVAL_IS_NUMBER(vp) || JSVAL_IS_VOID(vp)); - return JS_TRUE; + return true; } JSBool @@ -3640,15 +3640,15 @@ CType::PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleV { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); - return JS_FALSE; + return false; } JSObject* pointerType = PointerType::CreateInternal(cx, obj); if (!pointerType) - return JS_FALSE; + return false; vp.setObject(*pointerType); - return JS_TRUE; + return true; } bool @@ -3755,22 +3755,22 @@ CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool JS_ASSERT(prototype); JS_ASSERT(CData::IsCDataProto(prototype)); - *bp = JS_FALSE; + *bp = false; if (JSVAL_IS_PRIMITIVE(v)) - return JS_TRUE; + return true; RootedObject proto(cx, &v.toObject()); for (;;) { if (!JS_GetPrototype(cx, proto, &proto)) - return JS_FALSE; + return false; if (!proto) break; if (proto == prototype) { - *bp = JS_TRUE; + *bp = true; break; } } - return JS_TRUE; + return true; } static JSObject* @@ -3914,17 +3914,17 @@ PointerType::ConstructData(JSContext* cx, { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); - return JS_FALSE; + return false; } if (args.length() > 3) { JS_ReportError(cx, "constructor takes 0, 1, 2, or 3 arguments"); - return JS_FALSE; + return false; } RootedObject result(cx, CData::Create(cx, obj, NullPtr(), NULL, true)); if (!result) - return JS_FALSE; + return false; // Set return value early, must not observe *vp after args.rval().setObject(*result); @@ -3941,7 +3941,7 @@ PointerType::ConstructData(JSContext* cx, // Case 1 - Null pointer // if (args.length() == 0) - return JS_TRUE; + return true; // Analyze the arguments a bit to decide what to do next. RootedObject baseObj(cx, PointerType::GetBaseType(obj)); @@ -3955,7 +3955,7 @@ PointerType::ConstructData(JSContext* cx, if (!looksLikeClosure) { if (args.length() != 1) { JS_ReportError(cx, "first argument must be a function"); - return JS_FALSE; + return false; } return ExplicitConvert(cx, args[0], obj, CData::GetData(result)); } @@ -3974,7 +3974,7 @@ PointerType::ConstructData(JSContext* cx, } else if (!JSVAL_IS_PRIMITIVE(args[1])) { thisObj = &args[1].toObject(); } else if (!JS_ValueToObject(cx, args[1], thisObj.address())) { - return JS_FALSE; + return false; } } @@ -4007,12 +4007,12 @@ PointerType::TargetTypeGetter(JSContext* cx, { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_TARGET_T)); JS_ASSERT(vp.isObject()); - return JS_TRUE; + return true; } bool @@ -4044,22 +4044,22 @@ PointerType::OffsetBy(JSContext* cx, const CallArgs& args, int offset) { JSObject* obj = JS_THIS_OBJECT(cx, args.base()); if (!obj) - return JS_FALSE; + return false; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } RootedObject typeObj(cx, CData::GetCType(obj)); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); - return JS_FALSE; + return false; } RootedObject baseType(cx, PointerType::GetBaseType(typeObj)); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot modify pointer of undefined size"); - return JS_FALSE; + return false; } size_t elementSize = CType::GetSize(baseType); @@ -4069,10 +4069,10 @@ PointerType::OffsetBy(JSContext* cx, const CallArgs& args, int offset) // Create a PointerType CData object containing the new address. JSObject* result = CData::Create(cx, typeObj, NullPtr(), &address, true); if (!result) - return JS_FALSE; + return false; args.rval().setObject(*result); - return JS_TRUE; + return true; } bool @@ -4097,34 +4097,34 @@ PointerType::ContentsGetter(JSContext* cx, { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); - return JS_FALSE; + return false; } RootedObject baseType(cx, GetBaseType(typeObj)); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot get contents of undefined size"); - return JS_FALSE; + return false; } void* data = *static_cast(CData::GetData(obj)); if (data == NULL) { JS_ReportError(cx, "cannot read contents of null pointer"); - return JS_FALSE; + return false; } RootedValue result(cx); if (!ConvertToJS(cx, baseType, NullPtr(), data, false, false, result.address())) - return JS_FALSE; + return false; vp.set(result); - return JS_TRUE; + return true; } JSBool @@ -4136,26 +4136,26 @@ PointerType::ContentsSetter(JSContext* cx, { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); - return JS_FALSE; + return false; } JSObject* baseType = GetBaseType(typeObj); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot set contents of undefined size"); - return JS_FALSE; + return false; } void* data = *static_cast(CData::GetData(obj)); if (data == NULL) { JS_ReportError(cx, "cannot write contents to null pointer"); - return JS_FALSE; + return false; } return ImplicitConvert(cx, vp, baseType, data, false, NULL); @@ -4261,7 +4261,7 @@ ArrayType::ConstructData(JSContext* cx, if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); - return JS_FALSE; + return false; } // Decide whether we have an object to initialize from. We'll override this @@ -4273,13 +4273,13 @@ ArrayType::ConstructData(JSContext* cx, if (CType::IsSizeDefined(obj)) { if (args.length() > 1) { JS_ReportError(cx, "constructor takes zero or one argument"); - return JS_FALSE; + return false; } } else { if (args.length() != 1) { JS_ReportError(cx, "constructor takes one argument"); - return JS_FALSE; + return false; } RootedObject baseType(cx, GetBaseType(obj)); @@ -4297,7 +4297,7 @@ ArrayType::ConstructData(JSContext* cx, if (!JS_GetProperty(cx, arg, "length", &lengthVal) || !jsvalToSize(cx, lengthVal, false, &length)) { JS_ReportError(cx, "argument must be an array object or length"); - return JS_FALSE; + return false; } } else if (args[0].isString()) { @@ -4330,27 +4330,27 @@ ArrayType::ConstructData(JSContext* cx, } else { JS_ReportError(cx, "argument must be an array object or length"); - return JS_FALSE; + return false; } // Construct a new ArrayType of defined length, for the new CData object. obj = CreateInternal(cx, baseType, length, true); if (!obj) - return JS_FALSE; + return false; } JSObject* result = CData::Create(cx, obj, NullPtr(), NULL, true); if (!result) - return JS_FALSE; + return false; args.rval().setObject(*result); if (convertObject) { if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result))) - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } JSObject* @@ -4453,12 +4453,12 @@ ArrayType::ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, Mu { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_ELEMENT_T)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp)); - return JS_TRUE; + return true; } JSBool @@ -4473,12 +4473,12 @@ ArrayType::LengthGetter(JSContext* cx, HandleObject obj_, HandleId idval, Mutabl if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_LENGTH)); JS_ASSERT(vp.isNumber() || vp.isUndefined()); - return JS_TRUE; + return true; } JSBool @@ -4487,14 +4487,14 @@ ArrayType::Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandle // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_array) - return JS_TRUE; + return true; // Convert the index to a size_t and bounds-check it. size_t index; @@ -4504,11 +4504,11 @@ ArrayType::Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandle if (!ok && JSID_IS_STRING(idval) && !StringToInteger(cx, JSID_TO_STRING(idval), &dummy)) { // String either isn't a number, or doesn't fit in size_t. // Chances are it's a regular property lookup, so return. - return JS_TRUE; + return true; } if (!ok || index >= length) { JS_ReportError(cx, "invalid index"); - return JS_FALSE; + return false; } RootedObject baseType(cx, GetBaseType(typeObj)); @@ -4523,14 +4523,14 @@ ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_array) - return JS_TRUE; + return true; // Convert the index to a size_t and bounds-check it. size_t index; @@ -4540,11 +4540,11 @@ ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict if (!ok && JSID_IS_STRING(idval) && !StringToInteger(cx, JSID_TO_STRING(idval), &dummy)) { // String either isn't a number, or doesn't fit in size_t. // Chances are it's a regular property lookup, so return. - return JS_TRUE; + return true; } if (!ok || index >= length) { JS_ReportError(cx, "invalid index"); - return JS_FALSE; + return false; } JSObject* baseType = GetBaseType(typeObj); @@ -4759,18 +4759,18 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb // ctypes.CType.prototype. RootedObject dataProto(cx, CType::GetProtoFromType(cx, typeObj, SLOT_STRUCTDATAPROTO)); if (!dataProto) - return JS_FALSE; + return false; // Set up the 'prototype' and 'prototype.constructor' properties. // The prototype will reflect the struct fields as properties on CData objects // created from this type. RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, dataProto, NULL)); if (!prototype) - return JS_FALSE; + return false; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_READONLY | JSPROP_PERMANENT)) - return JS_FALSE; + return false; // Create a FieldInfoHash to stash on the type object, and an array to root // its constituents. (We cannot simply stash the hash in a reserved slot now @@ -4780,7 +4780,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb Array fieldRootsArray; if (!fields || !fields->init(len) || !fieldRootsArray.appendN(JSVAL_VOID, len)) { JS_ReportOutOfMemory(cx); - return JS_FALSE; + return false; } js::AutoArrayRooter fieldRoots(cx, fieldRootsArray.length(), fieldRootsArray.begin()); @@ -4794,22 +4794,22 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb for (uint32_t i = 0; i < len; ++i) { RootedValue item(cx); if (!JS_GetElement(cx, fieldsObj, i, &item)) - return JS_FALSE; + return false; RootedObject fieldType(cx, NULL); JSFlatString* flat = ExtractStructField(cx, item, fieldType.address()); if (!flat) - return JS_FALSE; + return false; Rooted name(cx, flat->ensureStable(cx)); if (!name) - return JS_FALSE; + return false; fieldRootsArray[i] = OBJECT_TO_JSVAL(fieldType); // Make sure each field name is unique FieldInfoHash::AddPtr entryPtr = fields->lookupForAdd(name); if (entryPtr) { JS_ReportError(cx, "struct fields must have unique names"); - return JS_FALSE; + return false; } // Add the field to the StructType's 'prototype' property. @@ -4817,7 +4817,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb name->chars().get(), name->length(), JSVAL_VOID, StructType::FieldGetter, StructType::FieldSetter, JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT)) - return JS_FALSE; + return false; size_t fieldSize = CType::GetSize(fieldType); size_t fieldAlign = CType::GetAlignment(fieldType); @@ -4827,7 +4827,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb // checking fieldOffset for overflow. if (fieldOffset + fieldSize < structSize) { JS_ReportError(cx, "size overflow"); - return JS_FALSE; + return false; } // Add field name to the hash @@ -4848,7 +4848,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb size_t structTail = Align(structSize, structAlign); if (structTail < structSize) { JS_ReportError(cx, "size overflow"); - return JS_FALSE; + return false; } structSize = structTail; @@ -4863,7 +4863,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb RootedValue sizeVal(cx); if (!SizeTojsval(cx, structSize, sizeVal.address())) - return JS_FALSE; + return false; JS_SetReservedSlot(typeObj, SLOT_FIELDINFO, PRIVATE_TO_JSVAL(fields.forget())); @@ -4872,7 +4872,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb //if (!JS_FreezeObject(cx, prototype)0 // XXX fixme - see bug 541212! // return false; JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype)); - return JS_TRUE; + return true; } ffi_type* @@ -4995,22 +4995,22 @@ StructType::ConstructData(JSContext* cx, { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); - return JS_FALSE; + return false; } if (!CType::IsSizeDefined(obj)) { JS_ReportError(cx, "cannot construct an opaque StructType"); - return JS_FALSE; + return false; } JSObject* result = CData::Create(cx, obj, NullPtr(), NULL, true); if (!result) - return JS_FALSE; + return false; args.rval().setObject(*result); if (args.length() == 0) - return JS_TRUE; + return true; char* buffer = static_cast(CData::GetData(result)); const FieldInfoHash* fields = GetFieldInfo(obj); @@ -5026,15 +5026,15 @@ StructType::ConstructData(JSContext* cx, // Try option 1) first. if (ExplicitConvert(cx, args[0], obj, buffer)) - return JS_TRUE; + return true; if (fields->count() != 1) - return JS_FALSE; + return false; // If ExplicitConvert failed, and there is no pending exception, then assume // hard failure (out of memory, or some other similarly serious condition). if (!JS_IsExceptionPending(cx)) - return JS_FALSE; + return false; // Otherwise, assume soft failure, and clear the pending exception so that we // can throw a different one as required. @@ -5052,15 +5052,15 @@ StructType::ConstructData(JSContext* cx, if (!ImplicitConvert(cx, args[field.mIndex], field.mType, buffer + field.mOffset, false, NULL)) - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } JS_ReportError(cx, "constructor takes 0, 1, or %u arguments", fields->count()); - return JS_FALSE; + return false; } const FieldInfoHash* @@ -5133,21 +5133,21 @@ StructType::FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, M { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_FIELDS)); if (!CType::IsSizeDefined(obj)) { JS_ASSERT(JSVAL_IS_VOID(vp)); - return JS_TRUE; + return true; } if (JSVAL_IS_VOID(vp)) { // Build the 'fields' array lazily. JSObject* fields = BuildFieldsArray(cx, obj); if (!fields) - return JS_FALSE; + return false; JS_SetReservedSlot(obj, SLOT_FIELDS, OBJECT_TO_JSVAL(fields)); vp.setObject(*fields); @@ -5155,7 +5155,7 @@ StructType::FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, M JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(vp))); - return JS_TRUE; + return true; } JSBool @@ -5163,18 +5163,18 @@ StructType::FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, Mutable { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); - return JS_FALSE; + return false; } const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval)); if (!field) - return JS_FALSE; + return false; char* data = static_cast(CData::GetData(obj)) + field->mOffset; RootedObject fieldType(cx, field->mType); @@ -5186,18 +5186,18 @@ StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); - return JS_FALSE; + return false; } const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval)); if (!field) - return JS_FALSE; + return false; char* data = static_cast(CData::GetData(obj)) + field->mOffset; return ImplicitConvert(cx, vp, field->mType, data, false, NULL); @@ -5657,17 +5657,17 @@ FunctionType::ConstructData(JSContext* cx, FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); if (fninfo->mIsVariadic) { JS_ReportError(cx, "Can't declare a variadic callback function"); - return JS_FALSE; + return false; } if (GetABICode(fninfo->mABI) == ABI_WINAPI) { JS_ReportError(cx, "Can't declare a ctypes.winapi_abi callback function, " "use ctypes.stdcall_abi instead"); - return JS_FALSE; + return false; } RootedObject closureObj(cx, CClosure::Create(cx, typeObj, fnObj, thisObj, errVal, data)); if (!closureObj) - return JS_FALSE; + return false; // Set the closure object as the referent of the new CData object. JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(closureObj)); @@ -5893,21 +5893,21 @@ CheckFunctionType(JSContext* cx, JSObject* obj) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_function) { JS_ReportError(cx, "not a FunctionType"); - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } JSBool FunctionType::ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) - return JS_FALSE; + return false; // Check if we have a cached argTypes array. vp.set(JS_GetReservedSlot(obj, SLOT_ARGS_T)); if (!JSVAL_IS_VOID(vp)) - return JS_TRUE; + return true; FunctionInfo* fninfo = GetFunctionInfo(obj); size_t len = fninfo->mArgTypes.length(); @@ -5915,54 +5915,54 @@ FunctionType::ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, Mu // Prepare a new array. Array vec; if (!vec.resize(len)) - return JS_FALSE; + return false; for (size_t i = 0; i < len; ++i) vec[i] = OBJECT_TO_JSVAL(fninfo->mArgTypes[i]); RootedObject argTypes(cx, JS_NewArrayObject(cx, len, vec.begin())); if (!argTypes) - return JS_FALSE; + return false; // Seal and cache it. if (!JS_FreezeObject(cx, argTypes)) - return JS_FALSE; + return false; JS_SetReservedSlot(obj, SLOT_ARGS_T, OBJECT_TO_JSVAL(argTypes)); vp.setObject(*argTypes); - return JS_TRUE; + return true; } JSBool FunctionType::ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) - return JS_FALSE; + return false; // Get the returnType object from the FunctionInfo. vp.setObject(*GetFunctionInfo(obj)->mReturnType); - return JS_TRUE; + return true; } JSBool FunctionType::ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) - return JS_FALSE; + return false; // Get the abi object from the FunctionInfo. vp.setObject(*GetFunctionInfo(obj)->mABI); - return JS_TRUE; + return true; } JSBool FunctionType::IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) - return JS_FALSE; + return false; vp.setBoolean(GetFunctionInfo(obj)->mIsVariadic); - return JS_TRUE; + return true; } /******************************************************************************* @@ -6407,15 +6407,15 @@ CData::ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandl { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } // Convert the value to a primitive; do not create a new CData object. RootedObject ctype(cx, GetCType(obj)); if (!ConvertToJS(cx, ctype, NullPtr(), GetData(obj), true, false, vp.address())) - return JS_FALSE; + return false; - return JS_TRUE; + return true; } JSBool @@ -6423,7 +6423,7 @@ CData::ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool stric { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); - return JS_FALSE; + return false; } return ImplicitConvert(cx, vp, GetCType(obj), GetData(obj), false, NULL); @@ -6696,11 +6696,11 @@ CData::ErrnoGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "this is not not global object ctypes"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_ERRNO)); - return JS_TRUE; + return true; } #if defined(XP_WIN) @@ -6709,11 +6709,11 @@ CData::LastErrorGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleV { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "not global object ctypes"); - return JS_FALSE; + return false; } vp.set(JS_GetReservedSlot(obj, SLOT_LASTERROR)); - return JS_TRUE; + return true; } #endif // defined(XP_WIN) diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 63fa43a86f4..4abe8805443 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -160,6 +160,13 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco RootedString source(cx, source_); SkipRoot skip(cx, &chars); +#if JS_TRACE_LOGGING + js::AutoTraceLog logger(js::TraceLogging::defaultLogger(), + js::TraceLogging::PARSER_COMPILE_SCRIPT_START, + js::TraceLogging::PARSER_COMPILE_SCRIPT_STOP, + options); +#endif + if (cx->isJSContext()) MaybeCallSourceHandler(cx->asJSContext(), options, chars, length); @@ -391,6 +398,13 @@ frontend::CompileLazyFunction(JSContext *cx, LazyScript *lazy, const jschar *cha .setNoScriptRval(false) .setSelfHostingMode(false); +#if JS_TRACE_LOGGING + js::AutoTraceLog logger(js::TraceLogging::defaultLogger(), + js::TraceLogging::PARSER_COMPILE_LAZY_START, + js::TraceLogging::PARSER_COMPILE_LAZY_STOP, + options); +#endif + Parser parser(cx, &cx->tempLifoAlloc(), options, chars, length, /* foldConstants = */ true, NULL, lazy); @@ -436,6 +450,13 @@ bool frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileOptions options, const AutoNameVector &formals, const jschar *chars, size_t length) { +#if JS_TRACE_LOGGING + js::AutoTraceLog logger(js::TraceLogging::defaultLogger(), + js::TraceLogging::PARSER_COMPILE_FUNCTION_START, + js::TraceLogging::PARSER_COMPILE_FUNCTION_STOP, + options); +#endif + // FIXME: make Function pass in two strings and parse them as arguments and // ProgramElements respectively. SkipRoot skip(cx, &chars); diff --git a/js/src/ion/AliasAnalysis.cpp b/js/src/ion/AliasAnalysis.cpp index 5fcfbea6532..3b2f7de6cfb 100644 --- a/js/src/ion/AliasAnalysis.cpp +++ b/js/src/ion/AliasAnalysis.cpp @@ -19,6 +19,8 @@ using namespace js::ion; using mozilla::Array; +namespace { + // Iterates over the flags in an AliasSet. class AliasSetIterator { @@ -51,6 +53,8 @@ class AliasSetIterator } }; +} /* anonymous namespace */ + AliasAnalysis::AliasAnalysis(MIRGenerator *mir, MIRGraph &graph) : mir(mir), graph_(graph), diff --git a/js/src/ion/AsmJS.cpp b/js/src/ion/AsmJS.cpp index d7fbd55c640..d3a7fcfb4d3 100644 --- a/js/src/ion/AsmJS.cpp +++ b/js/src/ion/AsmJS.cpp @@ -382,6 +382,8 @@ ParseVarStatement(AsmJSParser &parser, ParseNode **var) /*****************************************************************************/ +namespace { + // Respresents the type of a general asm.js expression. class Type { @@ -478,6 +480,8 @@ class Type } }; +} /* anonymous namespace */ + // Represents the subset of Type that can be used as the return type of a // function. class RetType @@ -527,6 +531,8 @@ class RetType bool operator!=(RetType rhs) const { return which_ != rhs.which_; } }; +namespace { + // Represents the subset of Type that can be used as a variable or // argument's type. Note: AsmJSCoercion and VarType are kept separate to // make very clear the signed/int distinction: a coercion may explicitly sign @@ -540,6 +546,7 @@ class RetType // else // i = bar() | 0; // return i | 0; (2) +// } // // the AsmJSCoercion of (1) is Signed (since | performs ToInt32) but, when // translated to an VarType, the result is a plain Int since, as shown, it @@ -593,6 +600,8 @@ class VarType bool operator!=(VarType rhs) const { return which_ != rhs.which_; } }; +} /* anonymous namespace */ + // Implements <: (subtype) operator when the rhs is an VarType static inline bool operator<=(Type lhs, VarType rhs) @@ -692,6 +701,8 @@ bool operator!=(const Signature &lhs, const Signature &rhs) /*****************************************************************************/ // Numeric literal utilities +namespace { + // Represents the type and value of an asm.js numeric literal. // // A literal is a double iff the literal contains an exponent or decimal point @@ -744,6 +755,8 @@ class NumLit } }; +} /* anonymous namespace */ + // Note: '-' is never rolled into the number; numbers are always positive and // negations must be applied manually. static bool @@ -892,6 +905,8 @@ TypedArrayStoreType(ArrayBufferView::ViewType viewType) typedef Vector LabelVector; typedef Vector BlockVector; +namespace { + // ModuleCompiler encapsulates the compilation of an entire asm.js module. Over // the course of an ModuleCompiler object's lifetime, many FunctionCompiler // objects will be created and destroyed in sequence, one for each function in @@ -936,6 +951,7 @@ typedef Vector BlockVector; // bar(1)|0; // Exit #3: (int) -> int // bar(2)|0; // Exit #3: (int) -> int // } +// } // // The ModuleCompiler maintains a hash table (ExitMap) which allows a call site // to add a new exit or reuse an existing one. The key is an ExitDescriptor @@ -1533,9 +1549,9 @@ class MOZ_STACK_CLASS ModuleCompiler return; } } -#endif out->reset(JS_smprintf("total compilation time %dms%s", msTotal, slowFuns ? slowFuns.get() : "")); +#endif } bool staticallyLink(ScopedJSDeletePtr *module, ScopedJSFreePtr *report) { @@ -1543,7 +1559,7 @@ class MOZ_STACK_CLASS ModuleCompiler // the link-time validation fails in LinkAsmJS and we need to re-parse // the entire module from scratch. uint32_t bodyEnd = parser_.tokenStream.currentToken().pos.end; - module_->initPostLinkFailureInfo(parser_.ss, bodyStart_, bodyEnd); + module_->initSourceDesc(parser_.ss, bodyStart_, bodyEnd); // Finish the code section. masm_.finish(); @@ -1624,8 +1640,12 @@ class MOZ_STACK_CLASS ModuleCompiler } }; +} /* anonymous namespace */ + /*****************************************************************************/ +namespace { + // Encapsulates the compilation of a single function in an asm.js module. The // function compiler handles the creation and final backend compilation of the // MIR graph. Also see ModuleCompiler comment. @@ -2537,6 +2557,8 @@ class FunctionCompiler } }; +} /* anonymous namespace */ + /*****************************************************************************/ // asm.js type-checking and code-generation algorithm @@ -6271,7 +6293,7 @@ static bool Warn(JSContext *cx, int code, const char *str) { return JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage, - NULL, code, str); + NULL, code, str ? str : ""); } extern bool diff --git a/js/src/ion/AsmJSLink.cpp b/js/src/ion/AsmJSLink.cpp index 1897f097ee6..8cbf7d4fe4a 100644 --- a/js/src/ion/AsmJSLink.cpp +++ b/js/src/ion/AsmJSLink.cpp @@ -398,10 +398,9 @@ HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, Hand if (cx->isExceptionPending()) return false; - const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo(); - - uint32_t length = info.bufEnd - info.bufStart; - Rooted src(cx, info.scriptSource->substring(cx, info.bufStart, info.bufEnd)); + const AsmJSModuleSourceDesc &desc= module.sourceDesc(); + uint32_t length = desc.bufEnd() - desc.bufStart(); + Rooted src(cx, desc.scriptSource()->substring(cx, desc.bufStart(), desc.bufEnd())); if (!src) return false; @@ -422,7 +421,7 @@ HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, Hand CompileOptions options(cx); options.setPrincipals(cx->compartment()->principals) - .setOriginPrincipals(info.scriptSource->originPrincipals()) + .setOriginPrincipals(desc.scriptSource()->originPrincipals()) .setCompileAndGo(false) .setNoScriptRval(false); @@ -501,8 +500,7 @@ SendFunctionsToPerf(JSContext *cx, AsmJSModule &module) unsigned long base = (unsigned long) module.functionCode(); - const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo(); - const char *filename = const_cast(info.scriptSource->filename()); + const char *filename = module.sourceDesc().scriptSource()->filename(); for (unsigned i = 0; i < module.numPerfFunctions(); i++) { const AsmJSModule::ProfiledFunction &func = module.perfProfiledFunction(i); @@ -536,8 +534,7 @@ SendBlocksToPerf(JSContext *cx, AsmJSModule &module) AsmJSPerfSpewer spewer; unsigned long funcBaseAddress = (unsigned long) module.functionCode(); - const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo(); - const char *filename = const_cast(info.scriptSource->filename()); + const char *filename = module.sourceDesc().scriptSource()->filename(); for (unsigned i = 0; i < module.numPerfBlocksFunctions(); i++) { const AsmJSModule::ProfiledBlocksFunction &func = module.perfProfiledBlocksFunction(i); @@ -555,27 +552,9 @@ SendBlocksToPerf(JSContext *cx, AsmJSModule &module) } #endif -// Implements the semantics of an asm.js module function that has been successfully validated. -// A successfully validated asm.js module does not have bytecode emitted, but rather a list of -// dynamic constraints that must be satisfied by the arguments passed by the caller. If these -// constraints are satisfied, then LinkAsmJS can return CallAsmJS native functions that trampoline -// into compiled code. If any of the constraints fails, LinkAsmJS reparses the entire asm.js module -// from source so that it can be run as plain bytecode. static bool -LinkAsmJS(JSContext *cx, unsigned argc, JS::Value *vp) +SendModuleToAttachedProfiler(JSContext *cx, AsmJSModule &module) { - CallArgs args = CallArgsFromVp(argc, vp); - RootedFunction fun(cx, &args.callee().as()); - RootedObject moduleObj(cx, &fun->getExtendedSlot(MODULE_FUN_SLOT).toObject()); - AsmJSModule &module = AsmJSModuleObjectToModule(moduleObj); - - // If linking fails, recompile the function (including emitting bytecode) - // as if it's normal JS code. - if (!DynamicallyLinkModule(cx, args, module)) { - RootedPropertyName name(cx, fun->name()); - return HandleDynamicLinkFailure(cx, args, module, name); - } - #if defined(MOZ_VTUNE) if (IsVTuneProfilingActive() && !SendFunctionsToVTune(cx, module)) return false; @@ -588,37 +567,77 @@ LinkAsmJS(JSContext *cx, unsigned argc, JS::Value *vp) return false; #endif + return true; +} + + +static JSObject * +CreateExportObject(JSContext *cx, HandleObject moduleObj) +{ + AsmJSModule &module = AsmJSModuleObjectToModule(moduleObj); + if (module.numExportedFunctions() == 1) { const AsmJSModule::ExportedFunction &func = module.exportedFunction(0); - if (!func.maybeFieldName()) { - RootedFunction fun(cx, NewExportedFunction(cx, func, moduleObj, 0)); - if (!fun) - return false; - - args.rval().set(ObjectValue(*fun)); - return true; - } + if (!func.maybeFieldName()) + return NewExportedFunction(cx, func, moduleObj, 0); } gc::AllocKind allocKind = gc::GetGCObjectKind(module.numExportedFunctions()); RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind)); if (!obj) - return false; + return NULL; for (unsigned i = 0; i < module.numExportedFunctions(); i++) { const AsmJSModule::ExportedFunction &func = module.exportedFunction(i); RootedFunction fun(cx, NewExportedFunction(cx, func, moduleObj, i)); if (!fun) - return false; + return NULL; JS_ASSERT(func.maybeFieldName() != NULL); RootedId id(cx, NameToId(func.maybeFieldName())); RootedValue val(cx, ObjectValue(*fun)); if (!DefineNativeProperty(cx, obj, id, val, NULL, NULL, JSPROP_ENUMERATE, 0, 0)) - return false; + return NULL; } + return obj; +} + +// Implements the semantics of an asm.js module function that has been successfully validated. +static bool +LinkAsmJS(JSContext *cx, unsigned argc, JS::Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + + // The LinkAsmJS builtin (created by NewAsmJSModuleFunction) is an extended + // function and stores its module in an extended slot. + RootedFunction fun(cx, &args.callee().as()); + RootedObject moduleObj(cx, &fun->getExtendedSlot(MODULE_FUN_SLOT).toObject()); + AsmJSModule &module = AsmJSModuleObjectToModule(moduleObj); + + // Link the module by performing the link-time validation checks in the + // asm.js spec and then patching the generated module to associate it with + // the given heap (ArrayBuffer) and a new global data segment (the closure + // state shared by the inner asm.js functions). + if (!DynamicallyLinkModule(cx, args, module)) { + // Linking failed, so reparse the entire asm.js module from scratch to + // get normal interpreted bytecode which we can simply Invoke. Very slow. + RootedPropertyName name(cx, fun->name()); + return HandleDynamicLinkFailure(cx, args, module, name); + } + + // Notify profilers so that asm.js generated code shows up with JS function + // names and lines in native (i.e., not SPS) profilers. + if (!SendModuleToAttachedProfiler(cx, module)) + return false; + + // Link-time validation succeeded, so wrap all the exported functions with + // CallAsmJS builtins that trampoline into the generated code. + JSObject *obj = CreateExportObject(cx, moduleObj); + if (!obj) + return false; + args.rval().set(ObjectValue(*obj)); return true; } diff --git a/js/src/ion/AsmJSModule.h b/js/src/ion/AsmJSModule.h index 3c33fc212eb..52732354148 100644 --- a/js/src/ion/AsmJSModule.h +++ b/js/src/ion/AsmJSModule.h @@ -11,6 +11,7 @@ #include "mozilla/MathAlgorithms.h" +#include "jsfriendapi.h" #include "jsscript.h" #include "gc/Marking.h" @@ -317,32 +318,6 @@ class AsmJSModule }; #endif - // If linking fails, we recompile the function as if it's ordinary JS. - // This struct holds the data required to do this. - struct PostLinkFailureInfo - { - ScriptSource * scriptSource; - uint32_t bufStart; // offset of the function body's start - uint32_t bufEnd; // offset of the function body's end - - PostLinkFailureInfo() - : scriptSource(), bufStart(), bufEnd() - {} - - void init(ScriptSource *scriptSource, uint32_t bufStart, uint32_t bufEnd) { - JS_ASSERT(!this->scriptSource); - this->scriptSource = scriptSource; - this->bufStart = bufStart; - this->bufEnd = bufEnd; - scriptSource->incref(); - } - - ~PostLinkFailureInfo() { - if (scriptSource) - scriptSource->decref(); - } - }; - private: typedef Vector ExportedFunctionVector; typedef Vector GlobalVector; @@ -384,7 +359,7 @@ class AsmJSModule HeapPtrPropertyName importArgumentName_; HeapPtrPropertyName bufferArgumentName_; - PostLinkFailureInfo postLinkFailureInfo_; + AsmJSModuleSourceDesc sourceDesc_; FunctionCountsVector functionCounts_; public: @@ -400,7 +375,7 @@ class AsmJSModule totalBytes_(0), linked_(false), maybeHeap_(), - postLinkFailureInfo_() + sourceDesc_() {} ~AsmJSModule(); @@ -706,13 +681,11 @@ class AsmJSModule PropertyName *importArgumentName() const { return importArgumentName_; } PropertyName *bufferArgumentName() const { return bufferArgumentName_; } - void initPostLinkFailureInfo(ScriptSource *scriptSource, - uint32_t bufStart, - uint32_t bufEnd) { - postLinkFailureInfo_.init(scriptSource, bufStart, bufEnd); + void initSourceDesc(ScriptSource *scriptSource, uint32_t bufStart, uint32_t bufEnd) { + sourceDesc_.init(scriptSource, bufStart, bufEnd); } - const PostLinkFailureInfo &postLinkFailureInfo() const { - return postLinkFailureInfo_; + const AsmJSModuleSourceDesc &sourceDesc() const { + return sourceDesc_; } void detachIonCompilation(size_t exitIndex) const { diff --git a/js/src/ion/AsmJSSignalHandlers.cpp b/js/src/ion/AsmJSSignalHandlers.cpp index 00ff89a04c0..837efd8e287 100644 --- a/js/src/ion/AsmJSSignalHandlers.cpp +++ b/js/src/ion/AsmJSSignalHandlers.cpp @@ -154,6 +154,8 @@ InnermostAsmJSActivation() # ifdef JS_THREADSAFE # include "jslock.h" +namespace { + class InstallSignalHandlersMutex { PRLock *mutex_; @@ -177,6 +179,8 @@ class InstallSignalHandlersMutex }; } signalMutex; +} /* anonymous namespace */ + bool InstallSignalHandlersMutex::Lock::sHandlersInstalled = false; InstallSignalHandlersMutex::Lock::Lock() @@ -189,6 +193,8 @@ InstallSignalHandlersMutex::Lock::~Lock() PR_Unlock(signalMutex.mutex_); } # else // JS_THREADSAFE +namespace { + struct InstallSignalHandlersMutex { class Lock { @@ -200,6 +206,8 @@ struct InstallSignalHandlersMutex }; }; +} /* anonymous namespace */ + bool InstallSignalHandlersMutex::Lock::sHandlersInstalled = false; # endif // JS_THREADSAFE #endif // !XP_MACOSX diff --git a/js/src/ion/IonAnalysis.cpp b/js/src/ion/IonAnalysis.cpp index 7e74429ec98..6a7cb36de81 100644 --- a/js/src/ion/IonAnalysis.cpp +++ b/js/src/ion/IonAnalysis.cpp @@ -348,6 +348,8 @@ ion::EliminatePhis(MIRGenerator *mir, MIRGraph &graph, return true; } +namespace { + // The type analysis algorithm inserts conversions and box/unbox instructions // to make the IR graph well-typed for future passes. // @@ -394,6 +396,8 @@ class TypeAnalyzer bool analyze(); }; +} /* anonymous namespace */ + // Try to specialize this phi based on its non-cyclic inputs. static MIRType GuessPhiType(MPhi *phi) @@ -537,7 +541,7 @@ TypeAnalyzer::adjustPhiInputs(MPhi *phi) // If we specialized a type that's not Value, either every input is of // that type or the input's typeset was unobserved (i.e. the opcode hasn't - // been executed yet.) Be optimistic and insert unboxes. + // been executed yet.) if (phiType != MIRType_Value) { for (size_t i = 0, e = phi->numOperands(); i < e; i++) { MDefinition *in = phi->getOperand(i); @@ -547,6 +551,17 @@ TypeAnalyzer::adjustPhiInputs(MPhi *phi) if (in->isBox() && in->toBox()->input()->type() == phiType) { phi->replaceOperand(i, in->toBox()->input()); } else { + // If we know this branch will fail to convert to phiType, + // insert a box that'll immediately fail in the fallible unbox + // below. + if (in->type() != MIRType_Value) { + MBox *box = MBox::New(in); + in->block()->insertBefore(in->block()->lastIns(), box); + in = box; + } + + // Be optimistic and insert unboxes when the operand is a + // value. MUnbox *unbox = MUnbox::New(in, phiType, MUnbox::Fallible); in->block()->insertBefore(in->block()->lastIns(), unbox); phi->replaceOperand(i, unbox); diff --git a/js/src/ion/IonMacroAssembler.cpp b/js/src/ion/IonMacroAssembler.cpp index 48d7e3ecf01..9e62c927113 100644 --- a/js/src/ion/IonMacroAssembler.cpp +++ b/js/src/ion/IonMacroAssembler.cpp @@ -25,6 +25,8 @@ using namespace js; using namespace js::ion; +namespace { + // Emulate a TypeSet logic from a Type object to avoid duplicating the guard // logic. class TypeWrapper { @@ -58,6 +60,8 @@ class TypeWrapper { } }; +} /* anonymous namespace */ + template void MacroAssembler::guardTypeSet(const Source &address, const TypeSet *types, Register scratch, Label *matched, Label *miss) diff --git a/js/src/ion/MIR.cpp b/js/src/ion/MIR.cpp index 8433e176a43..2d7dab65c58 100644 --- a/js/src/ion/MIR.cpp +++ b/js/src/ion/MIR.cpp @@ -696,6 +696,8 @@ ion::MergeTypes(MIRType *ptype, types::StackTypeSet **ptypeSet, if (!*ptypeSet) *ptypeSet = MakeMIRTypeSet(*ptype); *ptype = MIRType_Value; + } else if (*ptypeSet && (*ptypeSet)->empty()) { + *ptype = newType; } } if (*ptypeSet) { diff --git a/js/src/ion/RangeAnalysis.cpp b/js/src/ion/RangeAnalysis.cpp index ed5bad38866..3bf8eee233a 100644 --- a/js/src/ion/RangeAnalysis.cpp +++ b/js/src/ion/RangeAnalysis.cpp @@ -370,8 +370,8 @@ Range::unionWith(const Range *other) max_exponent_ = max_exponent; } -const int64_t RANGE_INF_MAX = int64_t(JSVAL_INT_MAX) + 1; -const int64_t RANGE_INF_MIN = int64_t(JSVAL_INT_MIN) - 1; +static const int64_t RANGE_INF_MAX = int64_t(JSVAL_INT_MAX) + 1; +static const int64_t RANGE_INF_MIN = int64_t(JSVAL_INT_MIN) - 1; Range::Range(const MDefinition *def) : symbolicLower_(NULL), diff --git a/js/src/ion/arm/Trampoline-arm.cpp b/js/src/ion/arm/Trampoline-arm.cpp index 0fc3e73b17f..ea4c1aebe00 100644 --- a/js/src/ion/arm/Trampoline-arm.cpp +++ b/js/src/ion/arm/Trampoline-arm.cpp @@ -320,7 +320,7 @@ IonRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) // JSReturnReg_Data, EDtrAddr(r5, EDtrOffImm(0))); // Restore non-volatile registers and return. - GenerateReturn(masm, JS_TRUE); + GenerateReturn(masm, true); Linker linker(masm); return linker.newCode(cx, JSC::OTHER_CODE); diff --git a/js/src/jit-test/tests/ion/bug901391.js b/js/src/jit-test/tests/ion/bug901391.js new file mode 100644 index 00000000000..dd0304350a9 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug901391.js @@ -0,0 +1,4 @@ +function testPartition() { + if( "null" || new testPartition()) {} +} +testPartition(); diff --git a/js/src/jsapi-tests/testClassGetter.cpp b/js/src/jsapi-tests/testClassGetter.cpp index 31fb5f1f251..ef59a7d003e 100644 --- a/js/src/jsapi-tests/testClassGetter.cpp +++ b/js/src/jsapi-tests/testClassGetter.cpp @@ -15,7 +15,7 @@ int called_test_prop_get; static JSBool test_prop_get( JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp ) { called_test_prop_get++; - return JS_TRUE; + return true; } static bool diff --git a/js/src/jsapi-tests/testDebugger.cpp b/js/src/jsapi-tests/testDebugger.cpp index e5dc3caa2a6..c777950cd5e 100644 --- a/js/src/jsapi-tests/testDebugger.cpp +++ b/js/src/jsapi-tests/testDebugger.cpp @@ -26,7 +26,7 @@ callCountHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, JSBo BEGIN_TEST(testDebugger_bug519719) { - CHECK(JS_SetDebugMode(cx, JS_TRUE)); + CHECK(JS_SetDebugMode(cx, true)); JS_SetCallHook(rt, callCountHook, NULL); EXEC("function call(fn) { fn(0); }\n" "function f(g) { for (var i = 0; i < 9; i++) call(g); }\n" @@ -54,7 +54,7 @@ nonStrictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, BEGIN_TEST(testDebugger_getThisNonStrict) { bool allWrapped = true; - CHECK(JS_SetDebugMode(cx, JS_TRUE)); + CHECK(JS_SetDebugMode(cx, true)); JS_SetCallHook(rt, nonStrictThisHook, (void *) &allWrapped); EXEC("function nonstrict() { }\n" "Boolean.prototype.nonstrict = nonstrict;\n" @@ -93,7 +93,7 @@ strictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, JSB BEGIN_TEST(testDebugger_getThisStrict) { bool anyWrapped = false; - CHECK(JS_SetDebugMode(cx, JS_TRUE)); + CHECK(JS_SetDebugMode(cx, true)); JS_SetCallHook(rt, strictThisHook, (void *) &anyWrapped); EXEC("function strict() { 'use strict'; }\n" "Boolean.prototype.strict = strict;\n" diff --git a/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp b/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp index c2348910d94..60f76b353f9 100644 --- a/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp +++ b/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp @@ -45,7 +45,7 @@ BEGIN_TEST(testDefineGetterSetterNonEnumerable) JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, (JSObject*) funSetObj), JSPROP_GETTER | JSPROP_SETTER | JSPROP_PERMANENT)); - JSBool found = JS_FALSE; + JSBool found = false; unsigned attrs = 0; CHECK(JS_GetPropertyAttributes(cx, vObject, PROPERTY_NAME, &attrs, &found)); CHECK(found); diff --git a/js/src/jsapi-tests/testIndexToString.cpp b/js/src/jsapi-tests/testIndexToString.cpp index 6b33aa6b882..385b6299711 100644 --- a/js/src/jsapi-tests/testIndexToString.cpp +++ b/js/src/jsapi-tests/testIndexToString.cpp @@ -64,7 +64,7 @@ BEGIN_TEST(testIndexToString) if (!js::StaticStrings::hasUint(u)) CHECK(cx->compartment()->dtoaCache.lookup(10, u) == str); - JSBool match = JS_FALSE; + JSBool match = false; CHECK(JS_StringEqualsAscii(cx, str, tests[i].expected, &match)); CHECK(match); } diff --git a/js/src/jsapi-tests/testJSEvaluateScript.cpp b/js/src/jsapi-tests/testJSEvaluateScript.cpp index 8fba89bba89..fe077f03e6e 100644 --- a/js/src/jsapi-tests/testJSEvaluateScript.cpp +++ b/js/src/jsapi-tests/testJSEvaluateScript.cpp @@ -18,11 +18,11 @@ BEGIN_TEST(testJSEvaluateScript) CHECK(JS_EvaluateScript(cx, obj, src, sizeof(src) - 1, __FILE__, __LINE__, retval.address())); - JSBool hasProp = JS_TRUE; + JSBool hasProp = true; CHECK(JS_AlreadyHasOwnProperty(cx, obj, "x", &hasProp)); CHECK(!hasProp); - hasProp = JS_FALSE; + hasProp = false; CHECK(JS_HasProperty(cx, global, "x", &hasProp)); CHECK(hasProp); @@ -34,11 +34,11 @@ BEGIN_TEST(testJSEvaluateScript) CHECK(JS_EvaluateScript(cx, obj, src2, sizeof(src2) - 1, __FILE__, __LINE__, retval.address())); - hasProp = JS_FALSE; + hasProp = false; CHECK(JS_AlreadyHasOwnProperty(cx, obj, "y", &hasProp)); CHECK(hasProp); - hasProp = JS_TRUE; + hasProp = true; CHECK(JS_AlreadyHasOwnProperty(cx, global, "y", &hasProp)); CHECK(!hasProp); diff --git a/js/src/jsapi-tests/testOps.cpp b/js/src/jsapi-tests/testOps.cpp index 27a4efbf487..adbfbf2decb 100644 --- a/js/src/jsapi-tests/testOps.cpp +++ b/js/src/jsapi-tests/testOps.cpp @@ -14,9 +14,9 @@ my_convert(JSContext* context, JS::HandleObject obj, JSType type, JS::MutableHan { if (type == JSTYPE_VOID || type == JSTYPE_STRING || type == JSTYPE_NUMBER || type == JSTYPE_BOOLEAN) { rval.set(JS_NumberValue(123)); - return JS_TRUE; + return true; } - return JS_FALSE; + return false; } static JSClass myClass = { @@ -38,7 +38,7 @@ createMyObject(JSContext* context, unsigned argc, jsval *vp) JS_EndRequest(context); - return JS_TRUE; + return true; } static const JSFunctionSpec s_functions[] = diff --git a/js/src/jsapi-tests/testPropCache.cpp b/js/src/jsapi-tests/testPropCache.cpp index 90205bbad91..532f58eccc1 100644 --- a/js/src/jsapi-tests/testPropCache.cpp +++ b/js/src/jsapi-tests/testPropCache.cpp @@ -13,7 +13,7 @@ static JSBool CounterAdd(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { g_counter++; - return JS_TRUE; + return true; } static JSClass CounterClass = { diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index b0f3636941a..e4e16f2f36b 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -11,7 +11,7 @@ static JSBool nativeGet(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { vp.set(INT_TO_JSVAL(17)); - return JS_TRUE; + return true; } BEGIN_TEST(testSetProperty_NativeGetterStubSetter) diff --git a/js/src/jsapi-tests/testSourcePolicy.cpp b/js/src/jsapi-tests/testSourcePolicy.cpp index 18a441b8e6b..10ee876b792 100644 --- a/js/src/jsapi-tests/testSourcePolicy.cpp +++ b/js/src/jsapi-tests/testSourcePolicy.cpp @@ -31,7 +31,7 @@ newScriptHook(JSContext *cx, const char *fn, unsigned lineno, JSScript *script, JSFunction *fun, void *data) { if (!JS_StringEqualsAscii(cx, script->sourceData(cx), simpleSource, (JSBool *)data)) - *((JSBool *)data) = JS_FALSE; + *((JSBool *)data) = false; } BEGIN_TEST(testScriptSourceReentrant) diff --git a/js/src/jsapi-tests/testTrap.cpp b/js/src/jsapi-tests/testTrap.cpp index d10329bede0..4a91e8dc3a1 100644 --- a/js/src/jsapi-tests/testTrap.cpp +++ b/js/src/jsapi-tests/testTrap.cpp @@ -45,7 +45,7 @@ BEGIN_TEST(testTrap_gc) CHECK_EQUAL(emptyTrapCallCount, 0); // Enable debug mode - CHECK(JS_SetDebugMode(cx, JS_TRUE)); + CHECK(JS_SetDebugMode(cx, true)); static const char trapClosureText[] = "some trap closure"; diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 493c50a58d6..4edd2361cf8 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -244,10 +244,10 @@ class JSAPITest for (unsigned i = 0; i < argc; i++) { JSString *str = JS_ValueToString(cx, argv[i]); if (!str) - return JS_FALSE; + return false; char *bytes = JS_EncodeString(cx, str); if (!bytes) - return JS_FALSE; + return false; printf("%s%s", i ? " " : "", bytes); JS_free(cx, bytes); } @@ -255,7 +255,7 @@ class JSAPITest putchar('\n'); fflush(stdout); JS_SET_RVAL(cx, vp, JSVAL_VOID); - return JS_TRUE; + return true; } bool definePrint(); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index ac38604fa90..625d532260d 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -133,8 +133,8 @@ const jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) }; const jsval JSVAL_NULL = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_NULL, 0)); const jsval JSVAL_ZERO = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_INT32, 0)); const jsval JSVAL_ONE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_INT32, 1)); -const jsval JSVAL_FALSE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_FALSE)); -const jsval JSVAL_TRUE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_TRUE)); +const jsval JSVAL_FALSE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN, false)); +const jsval JSVAL_TRUE = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_BOOLEAN, true)); const jsval JSVAL_VOID = IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_UNDEFINED, 0)); const HandleValue JS::NullHandleValue = HandleValue::fromMarkedLocation(&JSVAL_NULL); @@ -250,12 +250,12 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for CHECK_REQUEST(cx); assertSameCompartment(cx, JSValueArray(argv - 2, argc + 2)); sp = argv; - required = JS_TRUE; + required = true; while ((c = *format++) != '\0') { if (isspace(c)) continue; if (c == '/') { - required = JS_FALSE; + required = false; continue; } if (sp == argv + argc) { @@ -269,7 +269,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for name, numBuf, (argc == 1) ? "" : "s"); } } - return JS_FALSE; + return false; } break; } @@ -279,27 +279,27 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for break; case 'c': if (!JS_ValueToUint16(cx, *sp, va_arg(ap, uint16_t *))) - return JS_FALSE; + return false; break; case 'i': if (!JS_ValueToECMAInt32(cx, *sp, va_arg(ap, int32_t *))) - return JS_FALSE; + return false; break; case 'u': if (!JS_ValueToECMAUint32(cx, *sp, va_arg(ap, uint32_t *))) - return JS_FALSE; + return false; break; case 'j': if (!JS_ValueToInt32(cx, *sp, va_arg(ap, int32_t *))) - return JS_FALSE; + return false; break; case 'd': if (!JS_ValueToNumber(cx, *sp, va_arg(ap, double *))) - return JS_FALSE; + return false; break; case 'I': if (!JS_ValueToNumber(cx, *sp, &d)) - return JS_FALSE; + return false; *va_arg(ap, double *) = ToInteger(d); break; case 'S': @@ -307,12 +307,12 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for val = *sp; str = ToString(cx, val); if (!str) - return JS_FALSE; + return false; *sp = STRING_TO_JSVAL(str); if (c == 'W') { JSStableString *stable = str->ensureStable(cx); if (!stable) - return JS_FALSE; + return false; *va_arg(ap, const jschar **) = stable->chars().get(); } else { *va_arg(ap, JSString **) = str; @@ -320,14 +320,14 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for break; case 'o': if (!js_ValueToObjectOrNull(cx, *sp, &obj)) - return JS_FALSE; + return false; *sp = OBJECT_TO_JSVAL(obj); *va_arg(ap, JSObject **) = obj; break; case 'f': obj = ReportIfNotFunction(cx, *sp); if (!obj) - return JS_FALSE; + return false; *sp = OBJECT_TO_JSVAL(obj); *va_arg(ap, JSFunction **) = &obj->as(); break; @@ -338,11 +338,11 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for break; default: JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_CHAR, format); - return JS_FALSE; + return false; } sp++; } - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -360,7 +360,7 @@ JS_ConvertValue(JSContext *cx, jsval valueArg, JSType type, jsval *vp) switch (type) { case JSTYPE_VOID: *vp = JSVAL_VOID; - ok = JS_TRUE; + ok = true; break; case JSTYPE_OBJECT: ok = js_ValueToObjectOrNull(cx, value, &obj); @@ -385,12 +385,12 @@ JS_ConvertValue(JSContext *cx, jsval valueArg, JSType type, jsval *vp) break; case JSTYPE_BOOLEAN: *vp = BooleanValue(ToBoolean(value)); - return JS_TRUE; + return true; default: { char numBuf[12]; JS_snprintf(numBuf, sizeof numBuf, "%d", (int)type); JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_TYPE, numBuf); - ok = JS_FALSE; + ok = false; break; } } @@ -549,7 +549,7 @@ JS_ValueToBoolean(JSContext *cx, jsval value, JSBool *bp) CHECK_REQUEST(cx); assertSameCompartment(cx, value); *bp = ToBoolean(value); - return JS_TRUE; + return true; } JS_PUBLIC_API(JSType) @@ -2272,9 +2272,9 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node) enum { MAX_PARENTS_TO_PRINT = 10 }; JS_GetTraceThingInfo(dtrc->buffer, sizeof dtrc->buffer, - &dtrc->base, node->thing, node->kind, JS_TRUE); + &dtrc->base, node->thing, node->kind, true); if (fprintf(fp, "%p %-22s via ", node->thing, dtrc->buffer) < 0) - return JS_FALSE; + return false; /* * We need to print the parent chain in the reverse order. To do it in @@ -2293,7 +2293,7 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node) break; if (chainLimit == 0) { if (fputs("...", fp) < 0) - return JS_FALSE; + return false; break; } --chainLimit; @@ -2312,7 +2312,7 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node) } else { JS_GetTraceThingInfo(dtrc->buffer, sizeof dtrc->buffer, &dtrc->base, prev->thing, prev->kind, - JS_FALSE); + false); if (fprintf(fp, "(%p %s).%s", prev->thing, dtrc->buffer, node->edgeName) < 0) { ok = false; @@ -2377,7 +2377,7 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind, dtrc.lastNodep = &children; JS_TraceChildren(&dtrc.base, node->thing, node->kind); if (thingToFind == node->thing) - thingToFindWasTraced = JS_TRUE; + thingToFindWasTraced = true; if (children != NULL) { ++depth; node = children; @@ -2675,7 +2675,7 @@ JS_IdToValue(JSContext *cx, jsid id, jsval *vp) CHECK_REQUEST(cx); *vp = IdToJsval(id); assertSameCompartment(cx, *vp); - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -2698,13 +2698,13 @@ JS_DefaultValue(JSContext *cx, JSObject *objArg, JSType hint, jsval *vp) JS_PUBLIC_API(JSBool) JS_PropertyStub(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) { - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) JS_StrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp) { - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -2717,13 +2717,13 @@ JS_DeletePropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool *succ JS_PUBLIC_API(JSBool) JS_EnumerateStub(JSContext *cx, HandleObject obj) { - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) JS_ResolveStub(JSContext *cx, HandleObject obj, HandleId id) { - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -2834,7 +2834,7 @@ JS_SetPrototype(JSContext *cx, JS::Handle obj, JS::Handle CHECK_REQUEST(cx); assertSameCompartment(cx, obj, proto); - return SetClassAndProto(cx, obj, obj->getClass(), proto, JS_FALSE); + return SetClassAndProto(cx, obj, obj->getClass(), proto, false); } JS_PUBLIC_API(JSObject *) @@ -2887,7 +2887,7 @@ JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp) AssertHeapIsIdle(cx); assertSameCompartment(cx, obj); *idp = OBJECT_TO_JSID(obj); - return JS_TRUE; + return true; } class AutoHoldZone @@ -3116,7 +3116,7 @@ LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id, if (!shape) { /* XXX bad API: no way to tell "not defined" from "void value" */ vp.setUndefined(); - return JS_TRUE; + return true; } if (!obj2->isNative()) { @@ -3273,18 +3273,18 @@ JS_AlreadyHasOwnPropertyById(JSContext *cx, JSObject *objArg, jsid id_, JSBool * RootedShape prop(cx); if (!LookupPropertyById(cx, obj, id, 0, &obj2, &prop)) - return JS_FALSE; + return false; *foundp = (obj == obj2); - return JS_TRUE; + return true; } if (JSID_IS_INT(id) && obj->containsDenseElement(JSID_TO_INT(id))) { *foundp = true; - return JS_TRUE; + return true; } *foundp = obj->nativeContains(cx, id); - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -3458,7 +3458,7 @@ DefineProperty(JSContext *cx, HandleObject obj, const char *name, const Value &v } else { JSAtom *atom = Atomize(cx, name, strlen(name)); if (!atom) - return JS_FALSE; + return false; id = AtomToId(atom); } @@ -3571,7 +3571,7 @@ JS_DefineConstDoubles(JSContext *cx, JSObject *objArg, const JSConstDoubleSpec * CHECK_REQUEST(cx); JSPropertyOpWrapper noget = GetterWrapper(NULL); JSStrictPropertyOpWrapper noset = SetterWrapper(NULL); - for (ok = JS_TRUE; cds->name; cds++) { + for (ok = true; cds->name; cds++) { Value value = DoubleValue(cds->dval); attrs = cds->flags; if (!attrs) @@ -3605,7 +3605,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned RootedShape shape(cx); if (!LookupPropertyById(cx, obj, id, flags, &obj2, &shape)) - return JS_FALSE; + return false; if (!shape || (own && obj != obj2)) { desc->obj = NULL; @@ -3613,7 +3613,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned desc->getter = NULL; desc->setter = NULL; desc->value.setUndefined(); - return JS_TRUE; + return true; } desc->obj = obj2; @@ -3655,7 +3655,7 @@ JS_GetPropertyDescriptorById(JSContext *cx, JSObject *objArg, jsid idArg, unsign RootedObject obj(cx, objArg); RootedId id(cx, idArg); AutoPropertyDescriptorRooter desc(cx); - if (!GetPropertyDescriptorById(cx, obj, id, flags, JS_FALSE, &desc)) + if (!GetPropertyDescriptorById(cx, obj, id, flags, false, &desc)) return false; *desc_ = desc; return true; @@ -3669,7 +3669,7 @@ JS_GetPropertyAttrsGetterAndSetterById(JSContext *cx, JSObject *objArg, jsid idA RootedObject obj(cx, objArg); RootedId id(cx, idArg); AutoPropertyDescriptorRooter desc(cx); - if (!GetPropertyDescriptorById(cx, obj, id, 0, JS_FALSE, &desc)) + if (!GetPropertyDescriptorById(cx, obj, id, 0, false, &desc)) return false; *attrsp = desc.attrs; @@ -4517,7 +4517,7 @@ js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp) if (argc < 1) { js_ReportMissingArg(cx, args.calleev(), 0); - return JS_FALSE; + return false; } /* @@ -4548,7 +4548,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs) for (; fs->name; fs++) { RootedAtom atom(cx, Atomize(cx, fs->name, strlen(fs->name))); if (!atom) - return JS_FALSE; + return false; Rooted id(cx, AtomToId(atom)); @@ -4561,7 +4561,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs) if (!ctor) { ctor = JS_GetConstructor(cx, obj); if (!ctor) - return JS_FALSE; + return false; } flags &= ~JSFUN_GENERIC_NATIVE; @@ -4570,7 +4570,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs) fs->nargs + 1, flags, JSFunction::ExtendedFinalizeKind); if (!fun) - return JS_FALSE; + return false; /* * As jsapi.h notes, fs must point to storage that lives as long @@ -4598,38 +4598,38 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs) RootedAtom shAtom(cx, Atomize(cx, fs->selfHostedName, strlen(fs->selfHostedName))); if (!shAtom) - return JS_FALSE; + return false; RootedPropertyName shName(cx, shAtom->asPropertyName()); RootedValue funVal(cx); if (!cx->runtime()->maybeWrappedSelfHostedFunction(cx, shName, &funVal)) - return JS_FALSE; + return false; if (!funVal.isUndefined()) { if (!JSObject::defineProperty(cx, obj, atom->asPropertyName(), funVal, NULL, NULL, flags & ~JSFUN_FLAGS_MASK)) { - return JS_FALSE; + return false; } } else { JSFunction *fun = DefineFunction(cx, obj, id, /* native = */ NULL, fs->nargs, 0, JSFunction::ExtendedFinalizeKind, SingletonObject); if (!fun) - return JS_FALSE; + return false; fun->setIsSelfHostedBuiltin(); fun->setExtendedSlot(0, PrivateValue(const_cast(fs))); funVal.setObject(*fun); } RootedObject holder(cx, cx->global()->intrinsicsHolder()); if (!JSObject::defineProperty(cx, holder, shName, funVal)) - return JS_FALSE; + return false; } else { JSFunction *fun = DefineFunction(cx, obj, id, fs->call.op, fs->nargs, flags); if (!fun) - return JS_FALSE; + return false; if (fs->call.info) fun->setJitInfo(fs->call.info); } } - return JS_TRUE; + return true; } JS_PUBLIC_API(JSFunction *) @@ -4926,13 +4926,13 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *objArg, const char *utf8, siz assertSameCompartment(cx, obj); jschar *chars = JS::UTF8CharsToNewTwoByteCharsZ(cx, JS::UTF8Chars(utf8, length), &length).get(); if (!chars) - return JS_TRUE; + return true; /* * Return true on any out-of-memory error, so our caller doesn't try to * collect more buffered source. */ - result = JS_TRUE; + result = true; exnState = JS_SaveExceptionState(cx); { CompileOptions options(cx); @@ -4947,7 +4947,7 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *objArg, const char *utf8, siz * source, we return false so our caller knows to try to * collect more buffered source. */ - result = JS_FALSE; + result = false; } JS_SetErrorReporter(cx, older); } @@ -6460,10 +6460,10 @@ JS_GetPendingException(JSContext *cx, jsval *vp) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); if (!cx->isExceptionPending()) - return JS_FALSE; + return false; *vp = cx->getPendingException(); assertSameCompartment(cx, *vp); - return JS_TRUE; + return true; } JS_PUBLIC_API(void) @@ -6718,13 +6718,13 @@ JS_DescribeScriptedCaller(JSContext *cx, JSScript **script, unsigned *lineno) NonBuiltinScriptFrameIter i(cx); if (i.done()) - return JS_FALSE; + return false; if (script) *script = i.script(); if (lineno) *lineno = js::PCToLineNumber(i.script(), i.pc()); - return JS_TRUE; + return true; } #ifdef JS_THREADSAFE @@ -6746,7 +6746,7 @@ JS_CallOnce(JSCallOnceType *once, JSInitCallback func) *once = true; return func(); } else { - return JS_TRUE; + return true; } #endif } diff --git a/js/src/jsapi.h b/js/src/jsapi.h index ddb942c3679..083b7e4247e 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -819,7 +819,7 @@ typedef JSBool * call to this function when enum_op was JSENUMERATE_INIT or * JSENUMERATE_INIT_ALL. * - * The return value is used to indicate success, with a value of JS_FALSE + * The return value is used to indicate success, with a value of false * indicating failure. */ typedef JSBool @@ -917,7 +917,7 @@ typedef JSBool /* * Check whether v is an instance of obj. Return false on error or exception, - * true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in + * true on success with true in *bp if v is an instance of obj, false in * *bp otherwise. */ typedef JSBool @@ -3340,7 +3340,7 @@ JS_DefineOwnProperty(JSContext *cx, JSObject *obj, jsid id, jsval descriptor, JS * Determine the attributes (JSPROP_* flags) of a property on a given object. * * If the object does not have a property by that name, *foundp will be - * JS_FALSE and the value of *attrsp is undefined. + * false and the value of *attrsp is undefined. */ extern JS_PUBLIC_API(JSBool) JS_GetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name, @@ -3369,7 +3369,7 @@ JS_GetPropertyAttrsGetterAndSetterById(JSContext *cx, JSObject *obj, * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be - * JS_FALSE and nothing will be altered. + * false and nothing will be altered. */ extern JS_PUBLIC_API(JSBool) JS_SetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name, @@ -3595,7 +3595,7 @@ JS_DefineUCProperty(JSContext *cx, JSObject *obj, * Determine the attributes (JSPROP_* flags) of a property on a given object. * * If the object does not have a property by that name, *foundp will be - * JS_FALSE and the value of *attrsp is undefined. + * false and the value of *attrsp is undefined. */ extern JS_PUBLIC_API(JSBool) JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj, @@ -3618,7 +3618,7 @@ JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be - * JS_FALSE and nothing will be altered. + * false and nothing will be altered. */ extern JS_PUBLIC_API(JSBool) JS_SetUCPropertyAttributes(JSContext *cx, JSObject *obj, @@ -3968,9 +3968,9 @@ extern JS_PUBLIC_API(JSObject *) JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); /* - * Given a buffer, return JS_FALSE if the buffer might become a valid + * Given a buffer, return false if the buffer might become a valid * javascript statement with the addition of more lines. Otherwise return - * JS_TRUE. The intent is to support interactive compilation - accumulate + * true. The intent is to support interactive compilation - accumulate * lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to * the compiler. */ @@ -4414,7 +4414,7 @@ JS_FileEscapedString(FILE *fp, JSString *str, char quote); * // in a fallible context * JSFlatString *fstr = JS_FlattenString(cx, str); * if (!fstr) - * return JS_FALSE; + * return false; * JS_ASSERT(fstr == JS_ASSERT_STRING_IS_FLAT(str)); * * // in an infallible context, for the same 'str' @@ -4513,7 +4513,7 @@ JS_ConcatStrings(JSContext *cx, JSString *left, JSString *right); * * On errors, the functions report the error. In that case, *dstlenp contains * the number of characters or bytes transferred so far. If cx is NULL, no - * error is reported on failure, and the functions simply return JS_FALSE. + * error is reported on failure, and the functions simply return false. * * NB: This function does not store an additional zero byte or jschar after the * transcoded string. diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 7873aa0753c..3acae47d6c1 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -498,11 +498,11 @@ js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap) JSBool warning; if (checkReportFlags(cx, &flags)) - return JS_TRUE; + return true; message = JS_vsmprintf(format, ap); if (!message) - return JS_FALSE; + return false; messagelen = strlen(message); PodZero(&report); @@ -667,7 +667,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback, } else { reportp->messageArgs = cx->pod_malloc(argCount + 1); if (!reportp->messageArgs) - return JS_FALSE; + return false; /* NULL-terminate for easy copying. */ reportp->messageArgs[argCount] = NULL; } @@ -768,7 +768,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback, goto error; JS_snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber); } - return JS_TRUE; + return true; error: if (!messageArgsPassed && reportp->messageArgs) { @@ -789,7 +789,7 @@ error: js_free((void *)*messagep); *messagep = NULL; } - return JS_FALSE; + return false; } JSBool @@ -802,7 +802,7 @@ js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback, JSBool warning; if (checkReportFlags(cx, &flags)) - return JS_TRUE; + return true; warning = JSREPORT_IS_WARNING(flags); PodZero(&report); @@ -812,7 +812,7 @@ js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback, if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber, &message, &report, argumentsType, ap)) { - return JS_FALSE; + return false; } ReportError(cx, message, &report, callback, userRef); @@ -908,7 +908,7 @@ js_ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v, bytes = DecompileValueGenerator(cx, spindex, v, fallback); if (!bytes) - return JS_FALSE; + return false; if (strcmp(bytes, js_undefined_str) == 0 || strcmp(bytes, js_null_str) == 0) { @@ -967,7 +967,7 @@ js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumb JS_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3); bytes = DecompileValueGenerator(cx, spindex, v, fallback); if (!bytes) - return JS_FALSE; + return false; ok = JS_ReportErrorFlagsAndNumber(cx, flags, js_GetErrorMessage, NULL, errorNumber, bytes, arg1, arg2); diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index a8c83558626..95c7b7e06a8 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -569,7 +569,7 @@ static JSBool date_regionMatches(const char* s1, int s1off, const jschar* s2, int s2off, int count, int ignoreCase) { - JSBool result = JS_FALSE; + JSBool result = false; /* return true if matches, otherwise, false */ while (count > 0 && s1[s1off] && s2[s2off]) { @@ -587,7 +587,7 @@ date_regionMatches(const char* s1, int s1off, const jschar* s2, int s2off, } if (count == 0) { - result = JS_TRUE; + result = true; } return result; @@ -615,11 +615,11 @@ date_msecFromArgs(JSContext *cx, CallArgs args, double *rval) if (loop < args.length()) { double d; if (!ToNumber(cx, args[loop], &d)) - return JS_FALSE; + return false; /* return NaN if any arg is not finite */ if (!IsFinite(d)) { *rval = js_NaN; - return JS_TRUE; + return true; } array[loop] = ToInteger(d); } else { @@ -638,7 +638,7 @@ date_msecFromArgs(JSContext *cx, CallArgs args, double *rval) msec_time = date_msecFromDate(array[0], array[1], array[2], array[3], array[4], array[5], array[6]); *rval = msec_time; - return JS_TRUE; + return true; } /* @@ -719,7 +719,7 @@ ndigits(size_t n, size_t *result, const jschar *s, size_t* i, size_t limit) return ((*i - init) == n); *i = init; - return JS_FALSE; + return false; } static int @@ -803,7 +803,7 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) size_t min = 0; size_t sec = 0; double frac = 0; - bool isLocalTime = JS_FALSE; + bool isLocalTime = false; size_t tzHour = 0; size_t tzMin = 0; @@ -876,7 +876,7 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) ++i; NEED_NDIGITS(2, tzMin); } else { - isLocalTime = JS_TRUE; + isLocalTime = true; } done: @@ -912,12 +912,12 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) *result = msec; - return JS_TRUE; + return true; syntax: /* syntax error */ *result = 0; - return JS_FALSE; + return false; #undef PEEK #undef NEED @@ -943,12 +943,12 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) int n = -1; int tzoffset = -1; int prevc = 0; - JSBool seenplusminus = JS_FALSE; + JSBool seenplusminus = false; int temp; - JSBool seenmonthname = JS_FALSE; + JSBool seenmonthname = false; if (date_parseISOString(str, result, dtInfo)) - return JS_TRUE; + return true; s = str->chars(); limit = str->length(); @@ -992,7 +992,7 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) if ((prevc == '+' || prevc == '-')/* && year>=0 */) { /* make ':' case below change tzoffset */ - seenplusminus = JS_TRUE; + seenplusminus = true; /* offset */ if (n < 24) @@ -1084,7 +1084,7 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) if (seenmonthname) { goto syntax; } - seenmonthname = JS_TRUE; + seenmonthname = true; temp = /*byte*/ (action - 2) + 1; if (mon < 0) { @@ -1189,12 +1189,12 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo) } *result = msec; - return JS_TRUE; + return true; syntax: /* syntax error */ *result = 0; - return JS_FALSE; + return false; } static bool @@ -2585,26 +2585,26 @@ date_format(JSContext *cx, double date, formatspec format, MutableHandleValue rv * characters. It's then likely in some other character * encoding, and we probably won't display it correctly. */ - usetz = JS_TRUE; + usetz = true; tzlen = strlen(tzbuf); if (tzlen > 100) { - usetz = JS_FALSE; + usetz = false; } else { for (i = 0; i < tzlen; i++) { jschar c = tzbuf[i]; if (c > 127 || !(isalpha(c) || isdigit(c) || c == ' ' || c == '(' || c == ')')) { - usetz = JS_FALSE; + usetz = false; } } } /* Also reject it if it's not parenthesized or if it's '()'. */ if (tzbuf[0] != '(' || tzbuf[1] == ')') - usetz = JS_FALSE; + usetz = false; } else - usetz = JS_FALSE; + usetz = false; switch (format) { case FORMATSPEC_FULL: diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 94def9b1e61..c25f11dd26b 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -214,7 +214,7 @@ JS_SetSingleStepMode(JSContext *cx, JSScript *scriptArg, JSBool singleStep) assertSameCompartment(cx, script); if (!CheckDebugMode(cx)) - return JS_FALSE; + return false; return script->setStepModeFlag(cx, singleStep); } @@ -281,7 +281,7 @@ JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *hoop, void **closurep) *closurep = rt->debugHooks.interruptHookData; rt->debugHooks.interruptHook = 0; rt->debugHooks.interruptHookData = 0; - return JS_TRUE; + return true; } /************************************************************************/ @@ -407,12 +407,12 @@ JS_GetLinePCs(JSContext *cx, JSScript *script, size_t len = (script->length > maxLines ? maxLines : script->length); unsigned *lines = cx->pod_malloc(len); if (!lines) - return JS_FALSE; + return false; jsbytecode **pcs = cx->pod_malloc(len); if (!pcs) { js_free(lines); - return JS_FALSE; + return false; } unsigned lineno = script->lineno; @@ -447,7 +447,7 @@ JS_GetLinePCs(JSContext *cx, JSScript *script, else js_free(pcs); - return JS_TRUE; + return true; } JS_PUBLIC_API(unsigned) @@ -663,7 +663,7 @@ GetPropertyDesc(JSContext *cx, JSObject *obj_, HandleShape shape, JSPropertyDesc pd->spare = 0; pd->alias = JSVAL_VOID; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -779,7 +779,7 @@ JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler handler, void *closure) { rt->debugHooks.debuggerHandler = handler; rt->debugHooks.debuggerHandlerData = closure; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -787,7 +787,7 @@ JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure) { rt->debugHooks.sourceHandler = handler; rt->debugHooks.sourceHandlerData = closure; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -795,7 +795,7 @@ JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure) { rt->debugHooks.executeHook = hook; rt->debugHooks.executeHookData = closure; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -803,7 +803,7 @@ JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure) { rt->debugHooks.callHook = hook; rt->debugHooks.callHookData = closure; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -811,7 +811,7 @@ JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure) { rt->debugHooks.throwHook = hook; rt->debugHooks.throwHookData = closure; - return JS_TRUE; + return true; } JS_PUBLIC_API(JSBool) @@ -819,7 +819,7 @@ JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure) { rt->debugHooks.debugErrorHook = hook; rt->debugHooks.debugErrorHookData = closure; - return JS_TRUE; + return true; } /************************************************************************/ @@ -941,14 +941,14 @@ js_CallContextDebugHandler(JSContext *cx) switch (js::CallContextDebugHandler(cx, script, iter.pc(), rval.address())) { case JSTRAP_ERROR: JS_ClearPendingException(cx); - return JS_FALSE; + return false; case JSTRAP_THROW: JS_SetPendingException(cx, rval); - return JS_FALSE; + return false; case JSTRAP_RETURN: case JSTRAP_CONTINUE: default: - return JS_TRUE; + return true; } } diff --git a/js/src/jsdbgapi.h b/js/src/jsdbgapi.h index 0ce7101337b..61652133f3c 100644 --- a/js/src/jsdbgapi.h +++ b/js/src/jsdbgapi.h @@ -260,7 +260,7 @@ typedef struct JSPropertyDesc { #define JSPD_ALIAS 0x08 /* property has an alias id */ #define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */ /* value is exception */ -#define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */ +#define JSPD_ERROR 0x80 /* native getter returned false without */ /* throwing an exception */ typedef struct JSPropertyDescArray { @@ -358,8 +358,8 @@ class JS_PUBLIC_API(JSBrokenFrameIterator) * or function call: just before execution begins and just after it finishes. * In both cases the 'current' frame is that of the executing code. * - * The 'before' param is JS_TRUE for the hook invocation before the execution - * and JS_FALSE for the invocation after the code has run. + * The 'before' param is true for the hook invocation before the execution + * and false for the invocation after the code has run. * * The 'ok' param is significant only on the post execution invocation to * signify whether or not the code completed 'normally'. diff --git a/js/src/jsdtoa.cpp b/js/src/jsdtoa.cpp index 3c4856c41b9..050edf9621d 100644 --- a/js/src/jsdtoa.cpp +++ b/js/src/jsdtoa.cpp @@ -112,7 +112,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, /* If Infinity, -Infinity, or NaN, return the string regardless of mode. */ if (decPt != 9999) { - JSBool exponentialNotation = JS_FALSE; + JSBool exponentialNotation = false; int minNDigits = 0; /* Min number of significant digits required */ char *p; char *q; @@ -120,7 +120,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, switch (mode) { case DTOSTR_STANDARD: if (decPt < -5 || decPt > 21) - exponentialNotation = JS_TRUE; + exponentialNotation = true; else minNDigits = decPt; break; @@ -137,14 +137,14 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, minNDigits = precision; /* Fall through */ case DTOSTR_STANDARD_EXPONENTIAL: - exponentialNotation = JS_TRUE; + exponentialNotation = true; break; case DTOSTR_PRECISION: JS_ASSERT(precision > 0); minNDigits = precision; if (decPt < -5 || decPt > precision) - exponentialNotation = JS_TRUE; + exponentialNotation = true; break; } @@ -422,7 +422,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) * (d - prevDouble(d))/2 = mlo/2^s2; * (nextDouble(d) - d)/2 = mhi/2^s2. */ - done = JS_FALSE; + done = false; do { int32_t j, j1; Bigint *delta; @@ -459,7 +459,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) if (j1 == 0 && !(word1(d) & 1)) { if (j > 0) digit++; - done = JS_TRUE; + done = true; } else #endif if (j < 0 || (j == 0 @@ -478,10 +478,10 @@ js_dtobasestr(DtoaState *state, int base, double dinput) * such as 3.5 in base 3. */ digit++; } - done = JS_TRUE; + done = true; } else if (j1 > 0) { digit++; - done = JS_TRUE; + done = true; } JS_ASSERT(digit < (uint32_t)base); *p++ = BASEDIGIT(digit); diff --git a/js/src/jsexn.h b/js/src/jsexn.h index 79d138f70b0..faa51f953e0 100644 --- a/js/src/jsexn.h +++ b/js/src/jsexn.h @@ -24,8 +24,8 @@ js_InitExceptionClasses(JSContext *cx, js::HandleObject obj); * the error number. If there is, then create an appropriate exception object, * set it as the pending exception, and set the JSREPORT_EXCEPTION flag on the * error report. Exception-aware host error reporters should probably ignore - * error reports so flagged. Returns JS_TRUE if an associated exception is - * found and set, JS_FALSE otherwise. + * error reports so flagged. Returns true if an associated exception is + * found and set, false otherwise. */ extern JSBool js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp, diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 8670f84ed0e..ab2e0f3e93a 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -1137,6 +1137,22 @@ js::IsInRequest(JSContext *cx) } #endif +void +AsmJSModuleSourceDesc::init(ScriptSource *scriptSource, uint32_t bufStart, uint32_t bufEnd) +{ + JS_ASSERT(scriptSource_ == NULL); + scriptSource_ = scriptSource; + bufStart_ = bufStart; + bufEnd_ = bufEnd; + scriptSource_->incref(); +} + +AsmJSModuleSourceDesc::~AsmJSModuleSourceDesc() +{ + if (scriptSource_) + scriptSource_->decref(); +} + #ifdef JSGC_GENERATIONAL JS_FRIEND_API(void) JS_StoreObjectPostBarrierCallback(JSContext* cx, diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index c3ee2a5163e..9943f946bd9 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -1788,6 +1788,31 @@ extern JS_FRIEND_API(bool) CheckDefineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); +class ScriptSource; + +// An AsmJSModuleSourceDesc object holds a reference to the ScriptSource +// containing an asm.js module as well as the [begin, end) range of the +// module's chars within the ScriptSource. +class AsmJSModuleSourceDesc +{ + ScriptSource *scriptSource_; + uint32_t bufStart_; + uint32_t bufEnd_; + + public: + AsmJSModuleSourceDesc() : scriptSource_(NULL), bufStart_(UINT32_MAX), bufEnd_(UINT32_MAX) {} + void init(ScriptSource *scriptSource, uint32_t bufStart, uint32_t bufEnd); + ~AsmJSModuleSourceDesc(); + + ScriptSource *scriptSource() const { JS_ASSERT(scriptSource_ != NULL); return scriptSource_; } + uint32_t bufStart() const { JS_ASSERT(bufStart_ != UINT32_MAX); return bufStart_; } + uint32_t bufEnd() const { JS_ASSERT(bufStart_ != UINT32_MAX); return bufEnd_; } + + private: + AsmJSModuleSourceDesc(const AsmJSModuleSourceDesc &) MOZ_DELETE; + void operator=(const AsmJSModuleSourceDesc &) MOZ_DELETE; +}; + } /* namespace js */ extern JS_FRIEND_API(JSBool) diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 0e7cb72f2fb..2fa56bcd029 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -824,7 +824,7 @@ js_fun_call(JSContext *cx, unsigned argc, Value *vp) /* Allocate stack space for fval, obj, and the args. */ InvokeArgs args(cx); if (!args.init(argc)) - return JS_FALSE; + return false; /* Push fval, thisv, and the args. */ args.setCallee(fval); diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index af5863e6037..d181e6b3912 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -299,25 +299,25 @@ num_parseFloat(JSContext *cx, unsigned argc, Value *vp) if (args.length() == 0) { args.rval().setDouble(js_NaN); - return JS_TRUE; + return true; } JSString *str = ToString(cx, args[0]); if (!str) - return JS_FALSE; + return false; const jschar *bp = str->getChars(cx); if (!bp) - return JS_FALSE; + return false; const jschar *end = bp + str->length(); const jschar *ep; double d; if (!js_strtod(cx, bp, end, &ep, &d)) - return JS_FALSE; + return false; if (ep == bp) { args.rval().setDouble(js_NaN); - return JS_TRUE; + return true; } args.rval().setDouble(d); - return JS_TRUE; + return true; } /* ES5 15.1.2.2. */ @@ -1377,7 +1377,7 @@ js::NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb) cstr = NumberToCString(cx, &cbuf, v.toDouble()); if (!cstr) { JS_ReportOutOfMemory(cx); - return JS_FALSE; + return false; } } @@ -1685,7 +1685,7 @@ js_strtod(ThreadSafeContext *cx, const jschar *s, const jschar *send, if (length >= sizeof cbuf) { cstr = (char *) cx->malloc_(length + 1); if (!cstr) - return JS_FALSE; + return false; } else { cstr = cbuf; } @@ -1717,5 +1717,5 @@ js_strtod(ThreadSafeContext *cx, const jschar *s, const jschar *send, js_free(cstr); *ep = i ? s1 + i : s; *dp = d; - return JS_TRUE; + return true; } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 00a34352901..527514296f8 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -542,7 +542,7 @@ Reject(JSContext *cx, JSObject *obj, unsigned errorNumber, bool throwError, bool return Throw(cx, obj, errorNumber); *rval = false; - return JS_TRUE; + return true; } static bool @@ -608,7 +608,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD RootedObject obj2(cx); JS_ASSERT(!obj->getOps()->lookupGeneric); if (!HasOwnProperty(cx, NULL, obj, id, &obj2, &shape)) - return JS_FALSE; + return false; JS_ASSERT(!obj->getOps()->defineProperty); @@ -639,7 +639,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD RootedValue dummy(cx); unsigned dummyAttrs; if (!CheckAccess(cx, obj, id, JSACC_WATCH, &dummy, &dummyAttrs)) - return JS_FALSE; + return false; RootedValue tmp(cx, UndefinedValue()); return baseops::DefineGeneric(cx, obj, id, tmp, @@ -724,7 +724,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD } if (!js_NativeGet(cx, obj, obj2, shape, 0, &v)) - return JS_FALSE; + return false; } if (desc.isDataDescriptor()) { @@ -870,7 +870,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD */ RootedValue dummy(cx); if (!CheckAccess(cx, obj2, id, JSACC_WATCH, &dummy, &attrs)) - return JS_FALSE; + return false; /* 8.12.9 step 12. */ unsigned changed = 0; @@ -3152,7 +3152,7 @@ js_FindClassObject(ExclusiveContext *cx, JSProtoKey protoKey, MutableHandleValue return false; if (cobj) { vp.set(ObjectValue(*cobj)); - return JS_TRUE; + return true; } id = NameToId(ClassName(protoKey, cx)); } else { @@ -4155,13 +4155,13 @@ GetPropertyHelperInline(JSContext *cx, /* We may just be checking if that object has an iterator. */ if (JSID_IS_ATOM(id, cx->names().iteratorIntrinsic)) - return JS_TRUE; + return true; /* Do not warn about tests like (obj[prop] == undefined). */ if (cx->resolveFlags == RESOLVE_INFER) { pc += js_CodeSpec[op].length; if (Detecting(cx, script, pc)) - return JS_TRUE; + return true; } unsigned flags = JSREPORT_WARNING | JSREPORT_STRICT; @@ -4176,7 +4176,7 @@ GetPropertyHelperInline(JSContext *cx, return false; } } - return JS_TRUE; + return true; } if (!obj2->isNative()) { @@ -4198,9 +4198,9 @@ GetPropertyHelperInline(JSContext *cx, /* This call site is hot -- use the always-inlined variant of js_NativeGet(). */ if (!NativeGetInline(cx, obj, receiver, obj2, shape, getHow, vp)) - return JS_FALSE; + return false; - return JS_TRUE; + return true; } bool @@ -4610,7 +4610,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive return JSObject::reportReadOnly(cx, id, JSREPORT_ERROR); if (cx->hasExtraWarningsOption()) return JSObject::reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING); - return JS_TRUE; + return true; } } @@ -4621,7 +4621,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive */ if (!shape->shadowable()) { if (shape->hasDefaultSetter() && !shape->hasGetterValue()) - return JS_TRUE; + return true; return shape->set(cx, obj, receiver, strict, vp); } @@ -5013,7 +5013,7 @@ js::CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode, if (!writing) { RootedObject proto(cx); if (!JSObject::getProto(cx, obj, &proto)) - return JS_FALSE; + return false; vp.setObjectOrNull(proto); } *attrsp = JSPROP_PERMANENT; @@ -5022,7 +5022,7 @@ js::CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode, default: RootedShape shape(cx); if (!JSObject::lookupGeneric(cx, obj, id, &pobj, &shape)) - return JS_FALSE; + return false; if (!shape) { if (!writing) vp.setUndefined(); @@ -5282,7 +5282,7 @@ js_GetterOnlyPropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool s MutableHandleValue vp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_GETTER_ONLY); - return JS_FALSE; + return false; } #ifdef DEBUG diff --git a/js/src/json.cpp b/js/src/json.cpp index eed63974d85..e916d251c4a 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -142,14 +142,14 @@ WriteIndent(JSContext *cx, StringifyContext *scx, uint32_t limit) { if (!scx->gap.empty()) { if (!scx->sb.append('\n')) - return JS_FALSE; + return false; for (uint32_t i = 0; i < limit; i++) { if (!scx->sb.append(scx->gap.begin(), scx->gap.end())) - return JS_FALSE; + return false; } } - return JS_TRUE; + return true; } template @@ -288,7 +288,7 @@ JO(JSContext *cx, HandleObject obj, StringifyContext *scx) } if (!scx->sb.append('{')) - return JS_FALSE; + return false; /* Steps 5-7. */ Maybe ids; @@ -378,18 +378,18 @@ JA(JSContext *cx, HandleObject obj, StringifyContext *scx) } if (!scx->sb.append('[')) - return JS_FALSE; + return false; /* Step 6. */ uint32_t length; if (!GetLengthProperty(cx, obj, &length)) - return JS_FALSE; + return false; /* Steps 7-10. */ if (length != 0) { /* Steps 4, 10b(i). */ if (!WriteIndent(cx, scx, scx->depth)) - return JS_FALSE; + return false; /* Steps 7-10. */ RootedValue outputValue(cx); @@ -401,29 +401,29 @@ JA(JSContext *cx, HandleObject obj, StringifyContext *scx) * values as |null| in separate steps. */ if (!JSObject::getElement(cx, obj, obj, i, &outputValue)) - return JS_FALSE; + return false; if (!PreprocessValue(cx, obj, i, &outputValue, scx)) - return JS_FALSE; + return false; if (IsFilteredValue(outputValue)) { if (!scx->sb.append("null")) - return JS_FALSE; + return false; } else { if (!Str(cx, outputValue, scx)) - return JS_FALSE; + return false; } /* Steps 3, 4, 10b(i). */ if (i < length - 1) { if (!scx->sb.append(',')) - return JS_FALSE; + return false; if (!WriteIndent(cx, scx, scx->depth)) - return JS_FALSE; + return false; } } /* Step 10(b)(iii). */ if (!WriteIndent(cx, scx, scx->depth - 1)) - return JS_FALSE; + return false; } return scx->sb.append(']'); @@ -790,7 +790,7 @@ static bool json_toSource(JSContext *cx, unsigned argc, Value *vp) { vp->setString(cx->names().JSON); - return JS_TRUE; + return true; } #endif diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index b75bd875609..19adaa99de6 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -388,10 +388,10 @@ js_DisassembleAtPC(JSContext *cx, JSScript *scriptArg, JSBool lines, } len = js_Disassemble1(cx, script, next, next - script->code, lines, sp); if (!len) - return JS_FALSE; + return false; next += len; } - return JS_TRUE; + return true; } JSBool @@ -406,7 +406,7 @@ js_DumpPC(JSContext *cx) js::gc::AutoSuppressGC suppressGC(cx); Sprinter sprinter(cx); if (!sprinter.init()) - return JS_FALSE; + return false; ScriptFrameIter iter(cx); RootedScript script(cx, iter.script()); JSBool ok = js_DisassembleAtPC(cx, script, true, iter.pc(), false, &sprinter); @@ -420,7 +420,7 @@ js_DumpScript(JSContext *cx, JSScript *scriptArg) js::gc::AutoSuppressGC suppressGC(cx); Sprinter sprinter(cx); if (!sprinter.init()) - return JS_FALSE; + return false; RootedScript script(cx, scriptArg); JSBool ok = js_Disassemble(cx, script, true, &sprinter); fprintf(stdout, "%s", sprinter.string()); @@ -436,7 +436,7 @@ js_DumpScriptDepth(JSContext *cx, JSScript *scriptArg, jsbytecode *pc) js::gc::AutoSuppressGC suppressGC(cx); Sprinter sprinter(cx); if (!sprinter.init()) - return JS_FALSE; + return false; RootedScript script(cx, scriptArg); JSBool ok = js_DisassembleAtPC(cx, script, true, pc, true, &sprinter); fprintf(stdout, "%s", sprinter.string()); diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 26d08c69011..fde81c1795b 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -42,7 +42,7 @@ struct Zone; * prevents many bugs from being caught at compile time. E.g.: * * jsid id = ... - * if (id == JS_TRUE) // error + * if (id) // error * ... * * size_t n = id; // error diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index c55e81ba2d3..613fc03c7ff 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -2957,12 +2957,12 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, "Reflect.parse", "0", "s"); - return JS_FALSE; + return false; } RootedString src(cx, ToString(cx, args[0])); if (!src) - return JS_FALSE; + return false; ScopedJSFreePtr filename; uint32_t lineno = 1; @@ -2976,7 +2976,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) if (!arg.isObject()) { js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, arg, NullPtr(), "not an object", NULL); - return JS_FALSE; + return false; } RootedObject config(cx, &arg.toObject()); @@ -2987,7 +2987,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) RootedId locId(cx, NameToId(cx->names().loc)); RootedValue trueVal(cx, BooleanValue(true)); if (!baseops::GetPropertyDefault(cx, config, locId, trueVal, &prop)) - return JS_FALSE; + return false; loc = ToBoolean(prop); @@ -2996,22 +2996,22 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) RootedId sourceId(cx, NameToId(cx->names().source)); RootedValue nullVal(cx, NullValue()); if (!baseops::GetPropertyDefault(cx, config, sourceId, nullVal, &prop)) - return JS_FALSE; + return false; if (!prop.isNullOrUndefined()) { RootedString str(cx, ToString(cx, prop)); if (!str) - return JS_FALSE; + return false; size_t length = str->length(); const jschar *chars = str->getChars(cx); if (!chars) - return JS_FALSE; + return false; TwoByteChars tbchars(chars, length); filename = LossyTwoByteCharsToNewLatin1CharsZ(cx, tbchars).c_str(); if (!filename) - return JS_FALSE; + return false; } /* config.line */ @@ -3019,7 +3019,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) RootedValue oneValue(cx, Int32Value(1)); if (!baseops::GetPropertyDefault(cx, config, lineId, oneValue, &prop) || !ToUint32(cx, prop, &lineno)) { - return JS_FALSE; + return false; } } @@ -3027,13 +3027,13 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) RootedId builderId(cx, NameToId(cx->names().builder)); RootedValue nullVal(cx, NullValue()); if (!baseops::GetPropertyDefault(cx, config, builderId, nullVal, &prop)) - return JS_FALSE; + return false; if (!prop.isNullOrUndefined()) { if (!prop.isObject()) { js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, prop, NullPtr(), "not an object", NULL); - return JS_FALSE; + return false; } builder = &prop.toObject(); } @@ -3042,11 +3042,11 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) /* Extract the builder methods first to report errors before parsing. */ ASTSerializer serialize(cx, loc, filename, lineno); if (!serialize.init(builder)) - return JS_FALSE; + return false; JSStableString *stable = src->ensureStable(cx); if (!stable) - return JS_FALSE; + return false; const StableCharPtr chars = stable->chars(); size_t length = stable->length(); @@ -3060,16 +3060,16 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) ParseNode *pn = parser.parse(NULL); if (!pn) - return JS_FALSE; + return false; RootedValue val(cx); if (!serialize.program(pn, &val)) { args.rval().setNull(); - return JS_FALSE; + return false; } args.rval().set(val); - return JS_TRUE; + return true; } static const JSFunctionSpec static_methods[] = { diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index ebb9bf9fa22..86b1beea2e6 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -326,7 +326,7 @@ XDRScriptConst(XDRState *xdr, HeapValue *vp) if (mode == XDR_ENCODE) i = uint32_t(vp->toInt32()); if (!xdr->codeUint32(&i)) - return JS_FALSE; + return false; if (mode == XDR_DECODE) vp->init(Int32Value(int32_t(i))); break; @@ -445,7 +445,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc if (mode == XDR_ENCODE) length = script->length; if (!xdr->codeUint32(&length)) - return JS_FALSE; + return false; if (mode == XDR_ENCODE) { prologLength = script->mainOffset; @@ -506,32 +506,32 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc } if (!xdr->codeUint32(&prologLength)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&version)) - return JS_FALSE; + return false; /* * To fuse allocations, we need srcnote, atom, objects, regexp, and trynote * counts early. */ if (!xdr->codeUint32(&natoms)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&nsrcnotes)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&ntrynotes)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&nobjects)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&nregexps)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&nconsts)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&nTypeSets)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&ndefaults)) - return JS_FALSE; + return false; if (!xdr->codeUint32(&scriptBits)) - return JS_FALSE; + return false; if (mode == XDR_DECODE) { /* Note: version is packed into the 32b space with another 16b value. */ diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 307843d3eb1..86b609c3a3d 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -1524,25 +1524,27 @@ js_TrimString(JSContext *cx, Value *vp, JSBool trimLeft, JSBool trimRight) static bool str_trim(JSContext *cx, unsigned argc, Value *vp) { - return js_TrimString(cx, vp, JS_TRUE, JS_TRUE); + return js_TrimString(cx, vp, true, true); } static bool str_trimLeft(JSContext *cx, unsigned argc, Value *vp) { - return js_TrimString(cx, vp, JS_TRUE, JS_FALSE); + return js_TrimString(cx, vp, true, false); } static bool str_trimRight(JSContext *cx, unsigned argc, Value *vp) { - return js_TrimString(cx, vp, JS_FALSE, JS_TRUE); + return js_TrimString(cx, vp, false, true); } /* * Perl-inspired string functions. */ +namespace { + /* Result of a successfully performed flat match. */ class FlatMatch { @@ -1565,6 +1567,8 @@ class FlatMatch int32_t match() const { return match_; } }; +} /* anonymous namespace */ + static inline bool IsRegExpMetaChar(jschar c) { @@ -1589,6 +1593,8 @@ HasRegExpMetaChars(const jschar *chars, size_t length) return false; } +namespace { + /* * StringRegExpGuard factors logic out of String regexp operations. * @@ -1735,6 +1741,8 @@ class StringRegExpGuard RegExpShared ®Exp() { return *re_; } }; +} /* anonymous namespace */ + static bool DoMatchLocal(JSContext *cx, CallArgs args, RegExpStatics *res, Handle input, RegExpShared &re) @@ -2810,6 +2818,8 @@ js::str_replace(JSContext *cx, unsigned argc, Value *vp) return BuildFlatReplacement(cx, rdata.str, rdata.repstr, *fm, &args); } +namespace { + class SplitMatchResult { size_t endIndex_; size_t length_; @@ -2836,6 +2846,8 @@ class SplitMatchResult { } }; +} /* anonymous namespace */ + template static JSObject * SplitHelper(JSContext *cx, Handle str, uint32_t limit, const Matcher &splitMatch, @@ -2964,6 +2976,8 @@ SplitHelper(JSContext *cx, Handle str, uint32_t limit, const Ma return NewDenseCopiedArray(cx, splits.length(), splits.begin()); } +namespace { + /* * The SplitMatch operation from ES5 15.5.4.14 is implemented using different * paths for regular expression and string separators. @@ -3032,6 +3046,8 @@ class SplitStringMatcher } }; +} /* anonymous namespace */ + /* ES5 15.5.4.14 */ bool js::str_split(JSContext *cx, unsigned argc, Value *vp) @@ -3532,21 +3548,21 @@ js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp) if (args.length() == 1) { uint16_t code; if (!ToUint16(cx, args[0], &code)) - return JS_FALSE; + return false; if (StaticStrings::hasUnit(code)) { args.rval().setString(cx->runtime()->staticStrings.getUnit(code)); - return JS_TRUE; + return true; } args[0].setInt32(code); } jschar *chars = cx->pod_malloc(args.length() + 1); if (!chars) - return JS_FALSE; + return false; for (unsigned i = 0; i < args.length(); i++) { uint16_t code; if (!ToUint16(cx, args[i], &code)) { js_free(chars); - return JS_FALSE; + return false; } chars[i] = (jschar)code; } @@ -3554,11 +3570,11 @@ js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp) JSString *str = js_NewString(cx, chars, args.length()); if (!str) { js_free(chars); - return JS_FALSE; + return false; } args.rval().setString(str); - return JS_TRUE; + return true; } static const JSFunctionSpec string_static_methods[] = { @@ -4001,12 +4017,12 @@ js::DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen, JS_ReportErrorNumber(maybecx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } - return JS_FALSE; + return false; } for (size_t i = 0; i < srclen; i++) dst[i] = (char) src[i]; *dstlenp = srclen; - return JS_TRUE; + return true; } bool @@ -4023,13 +4039,13 @@ js::InflateStringToBuffer(JSContext *maybecx, const char *src, size_t srclen, JS_ReportErrorNumber(maybecx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } - return JS_FALSE; + return false; } for (size_t i = 0; i < srclen; i++) dst[i] = (unsigned char) src[i]; } *dstlenp = srclen; - return JS_TRUE; + return true; } #define ____ false @@ -4299,21 +4315,21 @@ Decode(JSContext *cx, Handle str, const bool *reservedSet, Muta c = (jschar)((v & 0x3FF) + 0xDC00); jschar H = (jschar)((v >> 10) + 0xD800); if (!sb.append(H)) - return JS_FALSE; + return false; } else { c = (jschar)v; } } if (c < 128 && reservedSet && reservedSet[c]) { if (!sb.append(chars + start, k - start + 1)) - return JS_FALSE; + return false; } else { if (!sb.append(c)) - return JS_FALSE; + return false; } } else { if (!sb.append(c)) - return JS_FALSE; + return false; } } diff --git a/js/src/jstypes.h b/js/src/jstypes.h index 17f67f70e12..fe300897b86 100644 --- a/js/src/jstypes.h +++ b/js/src/jstypes.h @@ -184,14 +184,11 @@ /************************************************************************ ** TYPES: JSBool ** DESCRIPTION: -** Use JSBool for variables and parameter types. Use JS_FALSE and JS_TRUE -** for clarity of target type in assignments and actual arguments. Use -** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans -** just as you would C int-valued conditions. +** This type is deprecated; avoid it. See bug 898914. ************************************************************************/ typedef int JSBool; -#define JS_TRUE (int)1 -#define JS_FALSE (int)0 +#define JS_TRUE_DEPRECATED (int)1 +#define JS_FALSE_DEPRECATED (int)0 /*********************************************************************** ** MACROS: JS_LIKELY diff --git a/js/src/jswatchpoint.cpp b/js/src/jswatchpoint.cpp index 99806904ef7..476e52f5ca2 100644 --- a/js/src/jswatchpoint.cpp +++ b/js/src/jswatchpoint.cpp @@ -25,6 +25,8 @@ DefaultHasher::hash(const Lookup &key) return DefaultHasher::hash(key.object.get()) ^ HashId(key.id.get()); } +namespace { + class AutoEntryHolder { typedef WatchpointMap::Map Map; Map ↦ @@ -48,6 +50,8 @@ class AutoEntryHolder { } }; +} /* anonymous namespace */ + bool WatchpointMap::init() { diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index 46ead5d7159..41f13f9ffbe 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -892,7 +892,7 @@ js::NukeCrossCompartmentWrappers(JSContext* cx, } } - return JS_TRUE; + return true; } // Given a cross-compartment wrapper |wobj|, update it to point to diff --git a/js/src/perf/jsperf.cpp b/js/src/perf/jsperf.cpp index 68bd4301aef..dc1617e1af5 100644 --- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -23,9 +23,9 @@ static PerfMeasurement* GetPMFromThis(JSContext* cx, jsval* vp); { \ PerfMeasurement* p = GetPM(cx, obj, #name); \ if (!p) \ - return JS_FALSE; \ + return false; \ vp.set(JS_NumberValue(double(p->name))); \ - return JS_TRUE; \ + return true; \ } GETTER(cpu_cycles) diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 836e9a9e30e..15d16069036 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -5010,9 +5010,9 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op) compileOnly = true; if (op->getBoolOption('w')) - reportWarnings = JS_TRUE; + reportWarnings = true; else if (op->getBoolOption('W')) - reportWarnings = JS_FALSE; + reportWarnings = false; if (op->getBoolOption('s')) JS_ToggleOptions(cx, JSOPTION_EXTRA_WARNINGS); diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 67d3281cf1a..aa066726145 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -391,7 +391,7 @@ args_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, RootedValue undef(cx, UndefinedValue()); if (!baseops::DefineGeneric(cx, argsobj, id, undef, ArgGetter, ArgSetter, attrs)) - return JS_FALSE; + return false; objp.set(argsobj); return true; diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 453fd2deb14..457c9926980 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -173,10 +173,10 @@ js::BoxNonStrictThis(JSContext *cx, const CallReceiver &call) #if JS_HAS_NO_SUCH_METHOD -const uint32_t JSSLOT_FOUND_FUNCTION = 0; -const uint32_t JSSLOT_SAVED_ID = 1; +static const uint32_t JSSLOT_FOUND_FUNCTION = 0; +static const uint32_t JSSLOT_SAVED_ID = 1; -Class js_NoSuchMethodClass = { +static Class js_NoSuchMethodClass = { "NoSuchMethod", JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, @@ -225,7 +225,7 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp) { InvokeArgs args(cx); if (!args.init(2)) - return JS_FALSE; + return false; JS_ASSERT(vp[0].isObject()); JS_ASSERT(vp[1].isObject()); @@ -237,7 +237,7 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp) args[0].set(obj->getReservedSlot(JSSLOT_SAVED_ID)); JSObject *argsobj = NewDenseCopiedArray(cx, argc, vp + 2); if (!argsobj) - return JS_FALSE; + return false; args[1].setObject(*argsobj); JSBool ok = Invoke(cx, args); vp[0] = args.rval(); @@ -2034,7 +2034,7 @@ END_CASE(JSOP_NE) bool equal; \ if (!StrictlyEqual(cx, lref, rref, &equal)) \ goto error; \ - COND = equal OP JS_TRUE; \ + COND = equal OP true; \ regs.sp--; \ JS_END_MACRO diff --git a/js/xpconnect/idl/nsIXPCSecurityManager.idl b/js/xpconnect/idl/nsIXPCSecurityManager.idl index 6347b13eed2..1a12614bc91 100644 --- a/js/xpconnect/idl/nsIXPCSecurityManager.idl +++ b/js/xpconnect/idl/nsIXPCSecurityManager.idl @@ -26,7 +26,7 @@ interface nsIXPCSecurityManager : nsISupports /** * For each of these hooks returning NS_OK means 'let the action continue'. * Returning an error code means 'veto the action'. XPConnect will return - * JS_FALSE to the js engine if the action is vetoed. The implementor of this + * false to the js engine if the action is vetoed. The implementor of this * interface is responsible for setting a JS exception into the JSContext * if that is appropriate. */ diff --git a/js/xpconnect/src/dictionary_helper_gen.py b/js/xpconnect/src/dictionary_helper_gen.py index 5db3d401855..568d2b044d3 100644 --- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -370,7 +370,7 @@ def write_cpp(iface, fd): iface.base) fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n") - fd.write(" JSBool found = JS_FALSE;\n") + fd.write(" JSBool found = false;\n") needccx = False for a in attributes: if a.realtype.nativeType('in').count("nsIVariant"): diff --git a/js/xpconnect/src/qsgen.py b/js/xpconnect/src/qsgen.py index d9bed77dc1a..97a0ef78973 100644 --- a/js/xpconnect/src/qsgen.py +++ b/js/xpconnect/src/qsgen.py @@ -386,51 +386,51 @@ argumentUnboxingTemplates = { 'octet': " uint32_t ${name}_u32;\n" " if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}_u32))\n" - " return JS_FALSE;\n" + " return false;\n" " uint8_t ${name} = (uint8_t) ${name}_u32;\n", 'short': " int32_t ${name}_i32;\n" " if (!JS_ValueToECMAInt32(cx, ${argVal}, &${name}_i32))\n" - " return JS_FALSE;\n" + " return false;\n" " int16_t ${name} = (int16_t) ${name}_i32;\n", 'unsigned short': " uint32_t ${name}_u32;\n" " if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}_u32))\n" - " return JS_FALSE;\n" + " return false;\n" " uint16_t ${name} = (uint16_t) ${name}_u32;\n", 'long': " int32_t ${name};\n" " if (!JS_ValueToECMAInt32(cx, ${argVal}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", 'unsigned long': " uint32_t ${name};\n" " if (!JS_ValueToECMAUint32(cx, ${argVal}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", 'long long': " int64_t ${name};\n" " if (!JS::ToInt64(cx, ${argVal}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", 'unsigned long long': " uint64_t ${name};\n" " if (!JS::ToUint64(cx, ${argVal}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", 'float': " double ${name}_dbl;\n" " if (!JS_ValueToNumber(cx, ${argVal}, &${name}_dbl))\n" - " return JS_FALSE;\n" + " return false;\n" " float ${name} = (float) ${name}_dbl;\n", 'double': " double ${name};\n" " if (!JS_ValueToNumber(cx, ${argVal}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", 'boolean': " JSBool ${name};\n" @@ -439,35 +439,35 @@ argumentUnboxingTemplates = { '[astring]': " xpc_qsAString ${name}(cx, ${argVal}, ${argPtr});\n" " if (!${name}.IsValid())\n" - " return JS_FALSE;\n", + " return false;\n", '[domstring]': " xpc_qsDOMString ${name}(cx, ${argVal}, ${argPtr},\n" " xpc_qsDOMString::e${nullBehavior},\n" " xpc_qsDOMString::e${undefinedBehavior});\n" " if (!${name}.IsValid())\n" - " return JS_FALSE;\n", + " return false;\n", 'string': " JSAutoByteString ${name}_bytes;\n" " if (!xpc_qsJsvalToCharStr(cx, ${argVal}, &${name}_bytes))\n" - " return JS_FALSE;\n" + " return false;\n" " char *${name} = ${name}_bytes.ptr();\n", 'wstring': " const PRUnichar *${name};\n" " if (!xpc_qsJsvalToWcharStr(cx, ${argVal}, ${argPtr}, &${name}))\n" - " return JS_FALSE;\n", + " return false;\n", '[cstring]': " xpc_qsACString ${name}(cx, ${argVal}, ${argPtr});\n" " if (!${name}.IsValid())\n" - " return JS_FALSE;\n", + " return false;\n", '[utf8string]': " xpc_qsAUTF8String ${name}(cx, ${argVal}, ${argPtr});\n" " if (!${name}.IsValid())\n" - " return JS_FALSE;\n", + " return false;\n", '[jsval]': " JS::RootedValue ${name}(cx, ${argVal});\n" @@ -537,7 +537,7 @@ def writeArgumentUnboxing(f, i, name, type, optional, rvdeclared, "XPCVariant::newVariant(cx, ${argVal})));\n" " if (!${name}) {\n" " xpc_qsThrowBadArg(cx, NS_ERROR_INVALID_ARG, vp, %d);\n" - " return JS_FALSE;\n" + " return false;\n" " }") % i f.write(substitute(template, params)) return rvdeclared @@ -559,7 +559,7 @@ def writeArgumentUnboxing(f, i, name, type, optional, rvdeclared, propIndex) else: f.write(" xpc_qsThrowBadArg(cx, rv, vp, %d);\n" % i) - f.write(" return JS_FALSE;\n" + f.write(" return false;\n" " }\n") return True @@ -617,45 +617,45 @@ def outParamForm(name, type): resultConvTemplates = { 'void': " ${jsvalRef} = JSVAL_VOID;\n" - " return JS_TRUE;\n", + " return true;\n", 'octet': " ${jsvalRef} = INT_TO_JSVAL((int32_t) result);\n" - " return JS_TRUE;\n", + " return true;\n", 'short': " ${jsvalRef} = INT_TO_JSVAL((int32_t) result);\n" - " return JS_TRUE;\n", + " return true;\n", 'long': " ${jsvalRef} = INT_TO_JSVAL(result);\n" - " return JS_TRUE;\n", + " return true;\n", 'long long': " return xpc_qsInt64ToJsval(cx, result, ${jsvalPtr});\n", 'unsigned short': " ${jsvalRef} = INT_TO_JSVAL((int32_t) result);\n" - " return JS_TRUE;\n", + " return true;\n", 'unsigned long': " ${jsvalRef} = UINT_TO_JSVAL(result);\n" - " return JS_TRUE;\n", + " return true;\n", 'unsigned long long': " return xpc_qsUint64ToJsval(cx, result, ${jsvalPtr});\n", 'float': " ${jsvalRef} = JS_NumberValue(result);\n" - " return JS_TRUE;\n", + " return true;\n", 'double': " ${jsvalRef} = JS_NumberValue(result);\n" - " return JS_TRUE;\n", + " return true;\n", 'boolean': " ${jsvalRef} = (result ? JSVAL_TRUE : JSVAL_FALSE);\n" - " return JS_TRUE;\n", + " return true;\n", '[astring]': " return xpc::StringToJsval(cx, result, ${jsvalPtr});\n", @@ -674,8 +674,8 @@ def isVariantType(t): def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. - The emitted code contains a return statement; it returns JS_TRUE on - success, JS_FALSE on error. + The emitted code contains a return statement; it returns true on + success, false on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) @@ -695,11 +695,11 @@ def writeResultConv(f, type, jsvalPtr, jsvalRef): else: f.write(" if (!result) {\n" " *%s = JSVAL_NULL;\n" - " return JS_TRUE;\n" + " return true;\n" " }\n" " nsWrapperCache* cache = xpc_qsGetWrapperCache(result);\n" " if (xpc_FastGetCachedWrapper(cache, obj, %s)) {\n" - " return JS_TRUE;\n" + " return true;\n" " }\n" " // After this point do not use 'result'!\n" " qsObjectHelper helper(result, cache);\n" @@ -835,7 +835,7 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName, # Compute "this". f.write(" JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n" " if (!obj)\n" - " return JS_FALSE;\n") + " return false;\n") # Get the 'self' pointer. if customMethodCall is None or not 'thisType' in customMethodCall: @@ -852,13 +852,13 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName, f.write(" if (!xpc_qsUnwrapThis(cx, obj, &self, " "&selfref.ptr, %s, %s))\n" % (pthisval, unwrapFatalArg)) - f.write(" return JS_FALSE;\n") + f.write(" return false;\n") if not unwrapThisFailureFatal: f.write(" if (!self) {\n") if (isGetter): f.write(" *vp = JSVAL_NULL;\n") - f.write(" return JS_TRUE;\n") + f.write(" return true;\n") f.write(" }\n"); if isMethod: @@ -984,7 +984,7 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName, if isMethod or isGetter: writeResultConv(f, member.realtype, 'vp', '*vp') else: - f.write(" return JS_TRUE;\n") + f.write(" return true;\n") # Epilog. f.write("}\n") diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index a4127d9c9f9..6d2aeb4f7c7 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5760,10 +5760,7 @@ nsCSSFrameConstructor::AppendFramesToParent(nsFrameConstructorState& aStat } if (!aFrameList.IsEmpty()) { - const nsStyleDisplay* parentDisplay = aParentFrame->StyleDisplay(); - bool positioned = - parentDisplay->mPosition == NS_STYLE_POSITION_RELATIVE && - !aParentFrame->IsSVGText(); + bool positioned = aParentFrame->IsRelativelyPositioned(); nsFrameItems ibSiblings; CreateIBSiblings(aState, aParentFrame, positioned, aFrameList, ibSiblings); @@ -10231,7 +10228,7 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState, bool positioned = NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay && - NS_STYLE_POSITION_RELATIVE == aDisplay->mPosition && + aDisplay->IsRelativelyPositionedStyle() && !aParentFrame->IsSVGText(); nsIFrame* newFrame = NS_NewInlineFrame(mPresShell, styleContext); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 741701da6d3..2063cf80e3c 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2496,7 +2496,7 @@ NS_IMETHODIMP nsDocumentViewer::SelectAll() NS_IMETHODIMP nsDocumentViewer::CopySelection() { - nsCopySupport::FireClipboardEvent(NS_COPY, mPresShell, nullptr); + nsCopySupport::FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, mPresShell, nullptr); return NS_OK; } diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index c5ad9c6e876..abb93aba7a9 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -118,8 +118,6 @@ using namespace mozilla::system; #include "nsDocument.h" #include "mozilla/dom/HTMLVideoElement.h" -extern void NS_ShutdownEventTargetChainItemRecyclePool(); - using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::dom::ipc; @@ -376,8 +374,6 @@ nsLayoutStatics::Shutdown() nsRegion::ShutdownStatic(); - NS_ShutdownEventTargetChainItemRecyclePool(); - HTMLInputElement::DestroyUploadLastDir(); nsLayoutUtils::Shutdown(); diff --git a/layout/forms/crashtests/crashtests.list b/layout/forms/crashtests/crashtests.list index 34cb602c809..3775f6f6529 100644 --- a/layout/forms/crashtests/crashtests.list +++ b/layout/forms/crashtests/crashtests.list @@ -15,7 +15,7 @@ load 363696-1.xul load 363696-2.html load 363696-3.html load 366205-1.html -skip-if(1) load 366537-1.xhtml # intermittent failures (bug 899349) +load 366537-1.xhtml load 367587-1.html load 370703-1.html load 370940-1.html diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 8c5de7c0c4c..c454f999dc0 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -27,6 +27,7 @@ #include "nsIDOMMouseEvent.h" #include "nsINodeInfo.h" #include "nsIFile.h" +#include "mozilla/dom/HTMLButtonElement.h" #include "mozilla/dom/HTMLInputElement.h" #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" @@ -133,8 +134,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray& aElements) // Make sure access key and tab order for the element actually redirect to the // file picking button. - nsCOMPtr fileContent = do_QueryInterface(mContent); - nsCOMPtr browseControl = do_QueryInterface(mBrowse); + nsRefPtr fileContent = HTMLInputElement::FromContentOrNull(mContent); + nsRefPtr browseControl = HTMLButtonElement::FromContentOrNull(mBrowse); nsAutoString accessKey; fileContent->GetAccessKey(accessKey); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 5ed849d91e4..fab8f694a1a 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -36,7 +36,6 @@ #include "nsContainerFrame.h" #include "prprf.h" #include "nsCSSRendering.h" -#include "nsILink.h" #include "nsIDOMHTMLAnchorElement.h" #include "nsIDOMHTMLImageElement.h" #include "nsINameSpaceManager.h" @@ -72,6 +71,8 @@ #include "mozilla/Preferences.h" +#include "mozilla/dom/Link.h" + using namespace mozilla; // sizes (pixels) for image icon, padding and border frame @@ -1562,7 +1563,7 @@ nsImageFrame::GetAnchorHREFTargetAndNode(nsIURI** aHref, nsString& aTarget, // Walk up the content tree, looking for an nsIDOMAnchorElement for (nsIContent* content = mContent->GetParent(); content; content = content->GetParent()) { - nsCOMPtr link(do_QueryInterface(content)); + nsCOMPtr link(do_QueryInterface(content)); if (link) { nsCOMPtr href = content->GetHrefURI(); if (href) { diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 48d5e727366..89550fb0611 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -778,7 +778,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, pfd->mMargin = reflowState.mComputedMargin; pfd->mBorderPadding = reflowState.mComputedBorderPadding; pfd->SetFlag(PFD_RELATIVEPOS, - (reflowState.mStyleDisplay->mPosition == NS_STYLE_POSITION_RELATIVE)); + reflowState.mStyleDisplay->IsRelativelyPositionedStyle()); if (pfd->GetFlag(PFD_RELATIVEPOS)) { pfd->mOffsets = reflowState.mComputedOffsets; } diff --git a/layout/reftests/border-radius/reftest.list b/layout/reftests/border-radius/reftest.list index 2977d073584..d89e44af075 100644 --- a/layout/reftests/border-radius/reftest.list +++ b/layout/reftests/border-radius/reftest.list @@ -74,7 +74,7 @@ skip-if(B2G) fails-if(Android) == scrollbar-clamping-2.html scrollbar-clamping-2 fuzzy-if(true,1,1) == corner-joins-1.xhtml corner-joins-1-ref.xhtml skip-if(B2G) random-if(winWidget) HTTP(..) == corner-joins-2.xhtml corner-joins-2-ref.xhtml -skip-if(B2G) fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,20) fuzzy-if(Android&&browserIsRemote,7,146) fuzzy-if(Android&&!browserIsRemote,166,248) == scroll-1.html scroll-1-ref.html # see bug 732535 +skip-if(B2G) fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,20) fuzzy-if(Android&&browserIsRemote,7,146) fuzzy-if(Android&&!browserIsRemote,166,400) == scroll-1.html scroll-1-ref.html # see bug 732535 == transforms-1.html transforms-1-ref.html diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 9e4bb521ad7..f1eccd6bc78 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1636,7 +1636,7 @@ HTTP(..) == 621253-2-externalFilter.html 621253-2-ref.html skip-if(B2G) random-if(winWidget) fuzzy-if(OSX==10.8,19,17) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positioning discrepancy in rotated text (may depend on platform fonts) random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue as above, and HTTP(..) for filters.svg, used to mask antialiasing issues where glyphs touch fuzzy-if(d2d,5,1) == 622585-1.html 622585-1-ref.html # bug 789402 -fuzzy-if(Android&&AndroidVersion>=15,8,100) == 625409-1.html 625409-1-ref.html +fuzzy-if(Android&&AndroidVersion>=15,8,300) == 625409-1.html 625409-1-ref.html == 627393-1.html about:blank == 630835-1.html about:blank == 631352-1.html 631352-1-ref.html @@ -1653,7 +1653,7 @@ HTTP(..) == 635639-1.html 635639-1-ref.html HTTP(..) == 635639-2.html 635639-2-ref.html random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed! skip-if(B2G) fuzzy-if(Android&&AndroidVersion>=15,8,500) == 637852-1.html 637852-1-ref.html # bug 839735 -== 637852-2.html 637852-2-ref.html +fuzzy-if(Android&&AndroidVersion>=15,8,500) == 637852-2.html 637852-2-ref.html fuzzy-if(Android&&AndroidVersion>=15,8,500) == 637852-3.html 637852-3-ref.html skip-if(B2G) == 641770-1.html 641770-1-ref.html == 641856-1.html 641856-1-ref.html @@ -1735,11 +1735,11 @@ fuzzy(40,850) fuzzy-if(azureQuartz,68,586) == 797797-2.html 797797-2-ref.html # == 801681-2.html 801681-2-ref.html == 801994-1.html 801994-1-ref.html == 804323-1.html 804323-1-ref.html -fuzzy-if(Android,4,100) == 811301-1.html 811301-1-ref.html +fuzzy-if(Android,8,400) == 811301-1.html 811301-1-ref.html == 812824-1.html 812824-1-ref.html == 814677.html 814677-ref.html skip-if(B2G) == 814952-1.html 814952-1-ref.html -skip-if(B2G) fuzzy-if(Android,4,61) == 815593-1.html 815593-1-ref.html +skip-if(B2G) fuzzy-if(Android,4,400) == 815593-1.html 815593-1-ref.html == 816359-1.html 816359-1-ref.html == 816458-1.html 816458-1-ref.html == 816948-1.html 816948-1-ref.html @@ -1762,7 +1762,7 @@ test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html == 860242-1.html 860242-1-ref.html != 860370.html 860370-notref.html == 871338-1.html 871338-1-ref.html -random-if(Android&&AndroidVersion>=15) == 875060-1.html 875060-1-ref.html #Bug 885303 +== 875060-1.html 875060-1-ref.html == 883987-1a.html 883987-1-ref.html == 883987-1b.html 883987-1-ref.html == 883987-1c.html 883987-1-ref.html diff --git a/layout/reftests/canvas/reftest.list b/layout/reftests/canvas/reftest.list index 05c682537db..d294a44ab50 100644 --- a/layout/reftests/canvas/reftest.list +++ b/layout/reftests/canvas/reftest.list @@ -65,7 +65,7 @@ random-if(!cocoaWidget||OSX==10.6||OSX==10.7) != text-emoji.html text-emoji-notr fuzzy-if(azureSkiaGL,256,601) fails-if(azureQuartz) == linear-gradient-1a.html linear-gradient-1-ref.html # this passes with cairo on 10.7 and 10.8 but not with azure for reasons unknown -fails-if(azureSkiaGL||OSX==10.6||(azureQuartz&&(OSX==10.7||OSX==10.8))) == linear-gradient-1b.html linear-gradient-1-ref.html +fails-if(!(Android&&AndroidVersion>=15)&&(azureSkiaGL||OSX==10.6||(azureQuartz&&(OSX==10.7||OSX==10.8)))) == linear-gradient-1b.html linear-gradient-1-ref.html == zero-dimensions.html zero-dimensions-ref.html diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index edc8d35d62a..aed1a8a20aa 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -3,7 +3,7 @@ fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,3,89700) f fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(azureQuartz&&OSX==10.6,1,11469) == linear-keywords-1a.html linear-keywords-1-ref.html fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureSkiaGL,2,89997) fuzzy-if(azureQuartz,1,11985) == linear-keywords-1b.html linear-keywords-1-ref.html fuzzy-if(!contentSameGfxBackendAsCanvas,2,88500) fuzzy-if(azureQuartz&&OSX==10.6,1,10230) == linear-percent.html linear-percent-ref.html -fuzzy-if(!contentSameGfxBackendAsCanvas,1,92400) fuzzy-if(azureSkiaGL,2,143400) fuzzy-if(azureQuartz,1,18215) == linear-mix.html linear-mix-ref.html +fuzzy-if(!contentSameGfxBackendAsCanvas,4,92400) fuzzy-if(azureSkiaGL,2,143400) fuzzy-if(azureQuartz,1,18215) fuzzy-if(Android&&AndroidVersion>=15,4,93000) == linear-mix.html linear-mix-ref.html == linear-diagonal-1a.html linear-diagonal-1-ref.html == linear-diagonal-1b.html linear-diagonal-1-ref.html == linear-diagonal-1c.html linear-diagonal-1-ref.html diff --git a/layout/reftests/image-element/reftest.list b/layout/reftests/image-element/reftest.list index 50a0bff1d0f..1f95df0c90e 100644 --- a/layout/reftests/image-element/reftest.list +++ b/layout/reftests/image-element/reftest.list @@ -1,6 +1,6 @@ == bug-364968.html bug-364968-ref.html == bug-463204.html bug-463204-ref.html -fails-if(Android) == canvas-outside-document.html canvas-inside-document.html +fails-if(Android&&AndroidVersion<15) == canvas-outside-document.html canvas-inside-document.html == mozsetimageelement-01.html mozsetimageelement-01-ref.html skip-if(B2G) == mozsetimageelement-02.html about:blank # bug 773482 skip-if(B2G) == image-outside-document-invalidate.html about:blank # bug 773482 diff --git a/layout/reftests/image/reftest.list b/layout/reftests/image/reftest.list index 44e95da0455..240fcaa08a4 100644 --- a/layout/reftests/image/reftest.list +++ b/layout/reftests/image/reftest.list @@ -1,4 +1,4 @@ -fuzzy-if(Android,8,25) == background-image-zoom-1.html background-image-zoom-1-ref.html +fuzzy-if(Android,8,30) == background-image-zoom-1.html background-image-zoom-1-ref.html == background-image-zoom-2.html about:blank == image-seam-1a.html image-seam-1-ref.html == image-seam-1b.html image-seam-1-ref.html diff --git a/layout/reftests/marquee/reftest.list b/layout/reftests/marquee/reftest.list index c84a1fba5d1..360258b0a22 100644 --- a/layout/reftests/marquee/reftest.list +++ b/layout/reftests/marquee/reftest.list @@ -1,9 +1,9 @@ == 166591-dynamic-1.html 166591-dynamic-1-ref.html -fuzzy-if(Android&&AndroidVersion>=15,8,30) == 336736-1a.html 336736-1-ref.html +fuzzy-if(Android&&AndroidVersion>=15,8,50) == 336736-1a.html 336736-1-ref.html == 336736-1b.html 336736-1-ref.html == 406073-1.html 406073-1-ref.html == 407016-2.html 407016-2-ref.html -fuzzy-if(Android&&AndroidVersion>=15,8,200) == 413027-4.html 413027-4-ref.html +fuzzy-if(Android&&AndroidVersion>=15,8,220) == 413027-4.html 413027-4-ref.html fuzzy-if(Android&&AndroidVersion>=15,8,30) == 425247-1.html 425247-1-ref.html fuzzy-if(Android&&AndroidVersion>=15,8,30) == 425247-2.html 425247-2-ref.html random == 429849-1.html 429849-1-ref.html # bug 432288 diff --git a/layout/reftests/scrolling/reftest.list b/layout/reftests/scrolling/reftest.list index 357cac389a3..1471c4a8184 100644 --- a/layout/reftests/scrolling/reftest.list +++ b/layout/reftests/scrolling/reftest.list @@ -9,9 +9,9 @@ random-if(Android&&!browserIsRemote) HTTP == opacity-mixed-scrolling-1.html opac skip-if(B2G) random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357 HTTP == simple-1.html simple-1.html?ref skip-if(B2G) HTTP == subpixel-1.html#d subpixel-1-ref.html#d -fuzzy-if(Android,4,67) HTTP == text-1.html text-1.html?ref -fuzzy-if(Android,4,11) HTTP == text-2.html?up text-2.html?ref -fuzzy-if(Android,251,722) HTTP == transformed-1.html transformed-1.html?ref +fuzzy-if(Android,4,120) HTTP == text-1.html text-1.html?ref +fuzzy-if(Android,4,120) HTTP == text-2.html?up text-2.html?ref +fuzzy-if(Android&&AndroidVersion<15,251,722) fails-if(Android&&AndroidVersion>=15) HTTP == transformed-1.html transformed-1.html?ref #Bug 900607 HTTP == transformed-1.html?up transformed-1.html?ref fuzzy-if(Android,5,20000) == uncovering-1.html uncovering-1-ref.html fuzzy-if(Android,5,20000) == uncovering-2.html uncovering-2-ref.html diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index bb7b3f7c261..46ca445a0df 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -76,7 +76,7 @@ fuzzy-if(/^Windows\x20NT\x206\.[12]/.test(http.oscpu),1,5) fuzzy-if(azureQuartz, fuzzy-if(Android,4,87) skip-if(B2G) == dynamic-clipPath-01.svg pass.svg == dynamic-clipPath-02.svg pass.svg == dynamic-feFlood-01.svg pass.svg -random-if(gtk2Widget) == dynamic-feImage-01.svg pass.svg # intermittent failures (bug 886080) +skip-if(gtk2Widget) == dynamic-feImage-01.svg pass.svg # intermittent failures (bug 886080) == dynamic-fill-01.svg dynamic-fill-01-ref.svg skip-if(B2G) fuzzy-if(d2d,1,10000) == dynamic-filter-contents-01a.svg dynamic-filter-contents-01-ref.svg skip-if(B2G) fuzzy-if(d2d,1,10000) == dynamic-filter-contents-01b.svg dynamic-filter-contents-01-ref.svg @@ -166,7 +166,7 @@ skip-if(B2G) == foreignObject-start-hidden-01.svg pass.svg # followup from Bug 5 skip-if(B2G) == foreignObject-start-hidden-02.svg pass.svg skip-if(B2G) == foreignObject-style-change-01.svg pass.svg == foreignObject-dynamic-abspos-01.html foreignObject-dynamic-abspos-01-ref.html -fuzzy-if(Android,18,500) == foreignObject-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html +fuzzy-if(Android,18,600) == foreignObject-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html == foreignObject-dynamic-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html == getElementById-a-element-01.svg pass.svg fuzzy-if(Android,9,980) == gradient-live-01a.svg gradient-live-01-ref.svg diff --git a/layout/reftests/svg/smil/transform/reftest.list b/layout/reftests/svg/smil/transform/reftest.list index bb6adbe7523..c829f638978 100644 --- a/layout/reftests/svg/smil/transform/reftest.list +++ b/layout/reftests/svg/smil/transform/reftest.list @@ -11,7 +11,7 @@ fuzzy(32,200) random-if(Android&&AndroidVersion>=15) == rotate-angle-4.svg rotat fuzzy(32,125) random-if(Android&&AndroidVersion>=15) == rotate-angle-5.svg rotate-angle-ref.svg # bug 839865 fuzzy(16,6237) random-if(Android&&AndroidVersion>=15) == scale-1.svg scale-1-ref.svg # bug 839865 == set-transform-1.svg lime.svg -fuzzy(132,13656) == skew-1.svg skew-1-ref.svg # bug 839865 +fuzzy(132,15500) == skew-1.svg skew-1-ref.svg # bug 839865 random-if(Android&&!browserIsRemote) == translate-clipPath-1.svg lime.svg # bug 760266 fails-if(OSX==10.6) == translate-gradient-1.svg lime.svg fuzzy-if(Android,8,200) == translate-pattern-1.svg lime.svg diff --git a/layout/reftests/transform-3d/reftest.list b/layout/reftests/transform-3d/reftest.list index 6d85eabd377..b50999f7261 100644 --- a/layout/reftests/transform-3d/reftest.list +++ b/layout/reftests/transform-3d/reftest.list @@ -22,8 +22,8 @@ fails-if(Android) == rotatex-perspective-3a.html rotatex-perspective-3-ref.html skip-if(B2G) == preserve3d-4a.html green-rect.html fuzzy-if(Android&&AndroidVersion>=15,4,300) == preserve3d-5a.html preserve3d-5-ref.html == scale3d-z.html scalez-1-ref.html -fuzzy-if(winWidget,102,580) fuzzy-if(d2d,143,681) fails-if(Android) fuzzy-if(OSX==10.8,145,752) == scale3d-all.html scale3d-1-ref.html # subpixel AA -fuzzy-if(winWidget,102,580) fuzzy-if(d2d,143,681) fails-if(Android) fuzzy-if(OSX==10.8,145,752) == scale3d-all-separate.html scale3d-1-ref.html # subpixel AA +fuzzy-if(winWidget,102,580) fuzzy-if(d2d,143,681) fails-if(Android&&AndroidVersion<15) fuzzy-if(OSX==10.8,145,752) == scale3d-all.html scale3d-1-ref.html # subpixel AA +fuzzy-if(winWidget,102,580) fuzzy-if(d2d,143,681) fails-if(Android&&AndroidVersion<15) fuzzy-if(OSX==10.8,145,752) == scale3d-all-separate.html scale3d-1-ref.html # subpixel AA == scale3d-xz.html scale3d-1-ref.html == translatez-1a.html translatez-1-ref.html != translatez-1b.html translatez-1-ref.html diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 9754a15a6bf..24001e1733e 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -682,35 +682,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const return; } - const nsCSSValue *textBlink = - data->ValueFor(eCSSProperty_text_blink); - const nsCSSValue *decorationLine = - data->ValueFor(eCSSProperty_text_decoration_line); - - NS_ABORT_IF_FALSE(textBlink->GetUnit() == eCSSUnit_Enumerated, - nsPrintfCString("bad text-blink unit %d", - textBlink->GetUnit()).get()); - NS_ABORT_IF_FALSE(decorationLine->GetUnit() == eCSSUnit_Enumerated, - nsPrintfCString("bad text-decoration-line unit %d", - decorationLine->GetUnit()).get()); - - bool blinkNone = (textBlink->GetIntValue() == NS_STYLE_TEXT_BLINK_NONE); - bool lineNone = - (decorationLine->GetIntValue() == NS_STYLE_TEXT_DECORATION_LINE_NONE); - - if (blinkNone && lineNone) { - AppendValueToString(eCSSProperty_text_decoration_line, aValue); - } else { - if (!blinkNone) { - AppendValueToString(eCSSProperty_text_blink, aValue); - } - if (!lineNone) { - if (!aValue.IsEmpty()) { - aValue.Append(PRUnichar(' ')); - } - AppendValueToString(eCSSProperty_text_decoration_line, aValue); - } - } + AppendValueToString(eCSSProperty_text_decoration_line, aValue); break; } case eCSSProperty_transition: { diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index e319805bd3d..553bff7bff3 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -9555,7 +9555,7 @@ CSSParserImpl::ParseTextDecoration() return false; } - nsCSSValue blink, line, style, color; + nsCSSValue line, style, color; switch (value.GetUnit()) { case eCSSUnit_Enumerated: { // We shouldn't accept decoration line style and color via @@ -9567,7 +9567,6 @@ CSSParserImpl::ParseTextDecoration() int32_t intValue = value.GetIntValue(); if (intValue == eDecorationNone) { - blink.SetIntValue(NS_STYLE_TEXT_BLINK_NONE, eCSSUnit_Enumerated); line.SetIntValue(NS_STYLE_TEXT_DECORATION_LINE_NONE, eCSSUnit_Enumerated); break; @@ -9589,18 +9588,14 @@ CSSParserImpl::ParseTextDecoration() intValue |= newValue; } - blink.SetIntValue((intValue & eDecorationBlink) != 0 ? - NS_STYLE_TEXT_BLINK_BLINK : NS_STYLE_TEXT_BLINK_NONE, - eCSSUnit_Enumerated); - line.SetIntValue((intValue & ~eDecorationBlink), eCSSUnit_Enumerated); + line.SetIntValue(intValue, eCSSUnit_Enumerated); break; } default: - blink = line = color = style = value; + line = color = style = value; break; } - AppendValue(eCSSProperty_text_blink, blink); AppendValue(eCSSProperty_text_decoration_line, line); AppendValue(eCSSProperty_text_decoration_color, color); AppendValue(eCSSProperty_text_decoration_style, style); @@ -9618,7 +9613,7 @@ CSSParserImpl::ParseTextDecorationLine(nsCSSValue& aValue) // look for more keywords nsCSSValue keyword; int32_t index; - for (index = 0; index < 2; index++) { + for (index = 0; index < 3; index++) { if (ParseEnum(keyword, nsCSSProps::kTextDecorationLineKTable)) { int32_t newValue = keyword.GetIntValue(); if (newValue == NS_STYLE_TEXT_DECORATION_LINE_NONE || diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 3c975905bd0..122571af855 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2745,18 +2745,6 @@ CSS_PROP_SHORTHAND( TextDecoration, CSS_PROPERTY_PARSE_FUNCTION, "") -CSS_PROP_TEXTRESET( - -moz-text-blink, - text_blink, - CSS_PROP_DOMPROP_PREFIXED(TextBlink), - CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | - CSS_PROPERTY_APPLIES_TO_PLACEHOLDER, - "", - VARIANT_HK, - kTextBlinkKTable, - offsetof(nsStyleTextReset, mTextBlink), - eStyleAnimType_EnumU8) CSS_PROP_TEXTRESET( -moz-text-decoration-color, text_decoration_color, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 949624214e3..e536673ba77 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1435,17 +1435,12 @@ const int32_t nsCSSProps::kTextAlignLastKTable[] = { eCSSKeyword_UNKNOWN,-1 }; -const int32_t nsCSSProps::kTextBlinkKTable[] = { - eCSSKeyword_none, NS_STYLE_TEXT_BLINK_NONE, - eCSSKeyword_blink, NS_STYLE_TEXT_BLINK_BLINK, - eCSSKeyword_UNKNOWN,-1 -}; - const int32_t nsCSSProps::kTextDecorationLineKTable[] = { eCSSKeyword_none, NS_STYLE_TEXT_DECORATION_LINE_NONE, eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, + eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_LINE_BLINK, eCSSKeyword__moz_anchor_decoration, NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS, eCSSKeyword_UNKNOWN,-1 }; @@ -2364,7 +2359,6 @@ static const nsCSSProperty gPaddingEndSubpropTable[] = { }; static const nsCSSProperty gTextDecorationSubpropTable[] = { - eCSSProperty_text_blink, eCSSProperty_text_decoration_color, eCSSProperty_text_decoration_line, eCSSProperty_text_decoration_style, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 9faf02bc823..1ab32afd7bc 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -470,7 +470,8 @@ public: static const int32_t kContentKTable[]; static const int32_t kCursorKTable[]; static const int32_t kDirectionKTable[]; - // Not const because we modify its entries when CSS prefs change. + // Not const because we modify its entries when the pref + // "layout.css.flexbox.enabled" changes: static int32_t kDisplayKTable[]; static const int32_t kElevationKTable[]; static const int32_t kEmptyCellsKTable[]; @@ -528,7 +529,6 @@ public: static const int32_t kTableLayoutKTable[]; static const int32_t kTextAlignKTable[]; static const int32_t kTextAlignLastKTable[]; - static const int32_t kTextBlinkKTable[]; static const int32_t kTextDecorationLineKTable[]; static const int32_t kTextDecorationStyleKTable[]; static const int32_t kTextOverflowKTable[]; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 0724d973982..62dabbc4934 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -2644,18 +2644,6 @@ nsComputedDOMStyle::DoGetTextAlignLast() return val; } -CSSValue* -nsComputedDOMStyle::DoGetMozTextBlink() -{ - nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue; - - val->SetIdent( - nsCSSProps::ValueToKeywordEnum(StyleTextReset()->mTextBlink, - nsCSSProps::kTextBlinkKTable)); - - return val; -} - CSSValue* nsComputedDOMStyle::DoGetTextDecoration() { @@ -2686,25 +2674,14 @@ nsComputedDOMStyle::DoGetTextDecoration() // don't want these to appear in the computed style. line &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS | NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL); - uint8_t blink = textReset->mTextBlink; - if (blink == NS_STYLE_TEXT_BLINK_NONE && - line == NS_STYLE_TEXT_DECORATION_LINE_NONE) { + if (line == NS_STYLE_TEXT_DECORATION_LINE_NONE) { val->SetIdent(eCSSKeyword_none); } else { nsAutoString str; - if (line != NS_STYLE_TEXT_DECORATION_LINE_NONE) { - nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line, - line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, - NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, str); - } - if (blink != NS_STYLE_TEXT_BLINK_NONE) { - if (!str.IsEmpty()) { - str.Append(PRUnichar(' ')); - } - nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_blink, blink, - NS_STYLE_TEXT_BLINK_BLINK, NS_STYLE_TEXT_BLINK_BLINK, str); - } + nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line, + line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, + NS_STYLE_TEXT_DECORATION_LINE_BLINK, str); val->SetString(str); } @@ -2745,7 +2722,7 @@ nsComputedDOMStyle::DoGetTextDecorationLine() NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL); nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line, intValue, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, - NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, decorationLineString); + NS_STYLE_TEXT_DECORATION_LINE_BLINK, decorationLineString); val->SetString(decorationLineString); } @@ -5140,7 +5117,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength) COMPUTED_STYLE_MAP_ENTRY(stack_sizing, StackSizing), COMPUTED_STYLE_MAP_ENTRY(_moz_tab_size, TabSize), COMPUTED_STYLE_MAP_ENTRY(text_align_last, TextAlignLast), - COMPUTED_STYLE_MAP_ENTRY(text_blink, MozTextBlink), COMPUTED_STYLE_MAP_ENTRY(text_decoration_color, TextDecorationColor), COMPUTED_STYLE_MAP_ENTRY(text_decoration_line, TextDecorationLine), COMPUTED_STYLE_MAP_ENTRY(text_decoration_style, TextDecorationStyle), diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index a89feedf1a4..dc77197daef 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -307,7 +307,6 @@ private: mozilla::dom::CSSValue* DoGetLineHeight(); mozilla::dom::CSSValue* DoGetTextAlign(); mozilla::dom::CSSValue* DoGetTextAlignLast(); - mozilla::dom::CSSValue* DoGetMozTextBlink(); mozilla::dom::CSSValue* DoGetTextDecoration(); mozilla::dom::CSSValue* DoGetTextDecorationColor(); mozilla::dom::CSSValue* DoGetTextDecorationLine(); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 14191f9a64c..eb8168ffe58 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -4012,11 +4012,6 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct, } } - // text-blink: enum, inherit, initial - SetDiscrete(*aRuleData->ValueForTextBlink(), text->mTextBlink, - canStoreInRuleTree, SETDSC_ENUMERATED, parentText->mTextBlink, - NS_STYLE_TEXT_BLINK_NONE, 0, 0, 0, 0); - // text-decoration-line: enum (bit field), inherit, initial const nsCSSValue* decorationLineValue = aRuleData->ValueForTextDecorationLine(); diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index e025efa6738..0b9c1c9d05b 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -659,10 +659,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { // Note: make sure that the largest NS_STYLE_TEXT_ALIGN_* value is smaller than // the smallest NS_STYLE_VERTICAL_ALIGN_* value below! -// See nsStyleText -#define NS_STYLE_TEXT_BLINK_NONE 0 -#define NS_STYLE_TEXT_BLINK_BLINK 1 - // See nsStyleText, nsStyleFont #define NS_STYLE_TEXT_DECORATION_LINE_NONE 0 #define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE NS_FONT_DECORATION_UNDERLINE diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 00d1384e157..8e17deb2c44 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2826,7 +2826,6 @@ nsStyleTextReset::nsStyleTextReset(void) { MOZ_COUNT_CTOR(nsStyleTextReset); mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE, eStyleUnit_Enumerated); - mTextBlink = NS_STYLE_TEXT_BLINK_NONE; mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE; mTextDecorationColor = NS_RGB(0,0,0); mTextDecorationStyle = diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 3a20336b141..0d986cc958d 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1281,7 +1281,6 @@ struct nsStyleTextReset { nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h) nsStyleTextOverflow mTextOverflow; // [reset] enum, string - uint8_t mTextBlink; // [reset] see nsStyleConsts.h uint8_t mTextDecorationLine; // [reset] see nsStyleConsts.h uint8_t mUnicodeBidi; // [reset] see nsStyleConsts.h protected: diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 3eb4839b064..f95023e74b7 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -3089,19 +3089,11 @@ var gCSSProperties = { other_values: [ "center", "justify", "start", "end", "left", "right" ], invalid_values: [] }, - "-moz-text-blink": { - domProp: "MozTextBlink", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "none" ], - other_values: [ "blink" ], - invalid_values: [ "underline", "overline", "line-through", "none underline", "underline blink", "blink underline" ] - }, "text-decoration": { domProp: "textDecoration", inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, - subproperties: [ "-moz-text-blink", "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style" ], + subproperties: [ "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style" ], initial_values: [ "none" ], other_values: [ "underline", "overline", "line-through", "blink", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ], invalid_values: [ "none none", "underline none", "none underline", "blink none", "none blink", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink", @@ -3121,7 +3113,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, initial_values: [ "none" ], - other_values: [ "underline", "overline", "line-through", "line-through underline", "underline overline line-through", "-moz-anchor-decoration", "-moz-anchor-decoration" ], + other_values: [ "underline", "overline", "line-through", "blink", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ], invalid_values: [ "none none", "underline none", "none underline", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink" ] }, "-moz-text-decoration-style": { diff --git a/layout/style/test/test_bug652486.html b/layout/style/test/test_bug652486.html index fafc95a3399..65d53ac4409 100644 --- a/layout/style/test/test_bug652486.html +++ b/layout/style/test/test_bug652486.html @@ -35,106 +35,100 @@ var tests = [ // When only text-decoration was specified, text-decoration should look like // a longhand property. { decoration: "none", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "none", expectedCSSValue: "none" }, { decoration: "underline", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "underline", expectedCSSValue: "underline" }, { decoration: "overline", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "overline", expectedCSSValue: "overline" }, { decoration: "line-through", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "line-through", expectedCSSValue: "line-through" }, { decoration: "blink", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "blink", expectedCSSValue: "blink" }, { decoration: "underline overline", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "underline overline", expectedCSSValue: "underline overline" }, { decoration: "underline line-through", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "underline line-through", expectedCSSValue: "underline line-through" }, { decoration: "blink underline", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "underline blink", expectedCSSValue: "underline blink" }, { decoration: "underline blink", - blink: null, line: null, color: null, style: null, + line: null, color: null, style: null, expectedValue: "underline blink", expectedCSSValue: "underline blink" }, // When only text-decoration-line or text-blink was specified, // text-decoration should look like a longhand property. { decoration: null, - blink: "blink", line: null, color: null, style: null, + line: "blink", color: null, style: null, expectedValue: "blink", expectedCSSValue: "blink" }, { decoration: null, - blink: null, line: "underline", color: null, style: null, + line: "underline", color: null, style: null, expectedValue: "underline", expectedCSSValue: "underline" }, { decoration: null, - blink: null, line: "overline", color: null, style: null, + line: "overline", color: null, style: null, expectedValue: "overline", expectedCSSValue: "overline" }, { decoration: null, - blink: null, line: "line-through", color: null, style: null, + line: "line-through", color: null, style: null, expectedValue: "line-through", expectedCSSValue: "line-through" }, { decoration: null, - blink: "blink", line: "underline", color: null, style: null, + line: "blink underline", color: null, style: null, expectedValue: "underline blink", expectedCSSValue: "underline blink" }, - { decoration: null, - blink: "none", line: "underline", color: null, style: null, - expectedValue: "underline", expectedCSSValue: "underline" }, - { decoration: null, - blink: "blink", line: "none", color: null, style: null, - expectedValue: "blink", expectedCSSValue: "blink" }, // When text-decoration-color isn't its initial value, // text-decoration should be a shorthand property. { decoration: "blink", - blink: null, line: null, color: "rgb(0, 0, 0)", style: null, + line: null, color: "rgb(0, 0, 0)", style: null, expectedValue: "", expectedCSSValue: null }, { decoration: "underline", - blink: null, line: null, color: "black", style: null, + line: null, color: "black", style: null, expectedValue: "", expectedCSSValue: null }, { decoration: "overline", - blink: null, line: null, color: "#ff0000", style: null, + line: null, color: "#ff0000", style: null, expectedValue: "", expectedCSSValue: null }, { decoration: "line-through", - blink: null, line: null, color: "initial", style: null, + line: null, color: "initial", style: null, expectedValue: "line-through", expectedCSSValue: "line-through" }, { decoration: "blink underline", - blink: null, line: null, color: "currentColor", style: null, + line: null, color: "currentColor", style: null, expectedValue: "underline blink", expectedCSSValue: "underline blink" }, { decoration: "underline line-through", - blink: null, line: null, color: "-moz-use-text-color", style: null, + line: null, color: "-moz-use-text-color", style: null, expectedValue: "underline line-through", expectedCSSValue: "underline line-through" }, // When text-decoration-style isn't its initial value, // text-decoration should be a shorthand property. { decoration: "blink", - blink: null, line: null, color: null, style: "-moz-none", + line: null, color: null, style: "-moz-none", expectedValue: "", expectedCSSValue: null }, { decoration: "underline", - blink: null, line: null, color: null, style: "dotted", + line: null, color: null, style: "dotted", expectedValue: "", expectedCSSValue: null }, { decoration: "overline", - blink: null, line: null, color: null, style: "dashed", + line: null, color: null, style: "dashed", expectedValue: "", expectedCSSValue: null }, { decoration: "line-through", - blink: null, line: null, color: null, style: "double", + line: null, color: null, style: "double", expectedValue: "", expectedCSSValue: null }, { decoration: "blink underline", - blink: null, line: null, color: null, style: "wavy", + line: null, color: null, style: "wavy", expectedValue: "", expectedCSSValue: null }, { decoration: "underline blink overline line-through", - blink: null, line: null, color: null, style: "solid", + line: null, color: null, style: "solid", expectedValue: "underline overline line-through blink", expectedCSSValue: "underline overline line-through blink" }, { decoration: "line-through overline underline", - blink: null, line: null, color: null, style: "initial", + line: null, color: null, style: "initial", expectedValue: "underline overline line-through", expectedCSSValue: "underline overline line-through" } ]; @@ -145,9 +139,6 @@ function makeDeclaration(aTest) if (aTest.decoration) { str += "text-decoration: " + aTest.decoration + "; "; } - if (aTest.blink) { - str += "-moz-text-blink: " + aTest.blink + "; "; - } if (aTest.color) { str += "-moz-text-decoration-color: " + aTest.color + "; "; } @@ -170,9 +161,6 @@ for (var i = 0; i < tests.length; ++i) { if (test.decoration) { $('t').style.textDecoration = test.decoration; } - if (test.blink) { - $('t').style.MozTextBlink = test.blink; - } if (test.color) { $('t').style.MozTextDecorationColor = test.color; } diff --git a/mobile/android/base/resources/xml/preferences_devtools.xml b/mobile/android/base/resources/xml/preferences_devtools.xml index ad34821a52f..479eb8ae954 100644 --- a/mobile/android/base/resources/xml/preferences_devtools.xml +++ b/mobile/android/base/resources/xml/preferences_devtools.xml @@ -12,6 +12,6 @@ android:title="@string/pref_developer_remotedebugging" /> + url="https://developer.mozilla.org/docs/Tools/Remote_Debugging" /> diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index f29c86d9a69..17794d31191 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -4879,7 +4879,7 @@ var ErrorPageEventHandler = { let isMalware = errorDoc.documentURI.contains("e=malwareBlocked"); let bucketName = isMalware ? "WARNING_MALWARE_PAGE_" : "WARNING_PHISHING_PAGE_"; let nsISecTel = Ci.nsISecurityUITelemetry; - let isIframe = (aOwnerDoc.defaultView.parent === aOwnerDoc.defaultView); + let isIframe = (errorDoc.defaultView.parent === errorDoc.defaultView); bucketName += isIframe ? "TOP_" : "FRAME_"; let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter); diff --git a/netwerk/base/public/nsILoadGroup.idl b/netwerk/base/public/nsILoadGroup.idl index 0579d601a31..308d9ce0250 100644 --- a/netwerk/base/public/nsILoadGroup.idl +++ b/netwerk/base/public/nsILoadGroup.idl @@ -81,7 +81,12 @@ interface nsILoadGroup : nsIRequest }; %{C++ -#include "mozilla/net/PSpdyPush3.h" +// Forward-declare mozilla::net::SpdyPushCache3 +namespace mozilla { +namespace net { +class SpdyPushCache3; +} +} %} [ptr] native SpdyPushCache3Ptr(mozilla::net::SpdyPushCache3); diff --git a/netwerk/base/src/nsLoadGroup.cpp b/netwerk/base/src/nsLoadGroup.cpp index 88566afdd79..1b02494c6a2 100644 --- a/netwerk/base/src/nsLoadGroup.cpp +++ b/netwerk/base/src/nsLoadGroup.cpp @@ -24,6 +24,8 @@ #include "nsTArray.h" #include "nsIHttpChannelInternal.h" #include "mozilla/Telemetry.h" +#include "nsAutoPtr.h" +#include "mozilla/net/PSpdyPush3.h" using namespace mozilla; diff --git a/netwerk/protocol/http/SpdySession3.h b/netwerk/protocol/http/SpdySession3.h index 97e9ab2c072..641c3b78637 100644 --- a/netwerk/protocol/http/SpdySession3.h +++ b/netwerk/protocol/http/SpdySession3.h @@ -21,6 +21,7 @@ class nsISocketTransport; namespace mozilla { namespace net { +class SpdyPushedStream3; class SpdyStream3; class SpdySession3 MOZ_FINAL : public ASpdySession diff --git a/python/mach/mach/dispatcher.py b/python/mach/mach/dispatcher.py index 1eaceb91e65..da75d140372 100644 --- a/python/mach/mach/dispatcher.py +++ b/python/mach/mach/dispatcher.py @@ -148,6 +148,9 @@ class CommandAction(argparse.Action): cats = [(k, v[2]) for k, v in r.categories.items()] sorted_cats = sorted(cats, key=itemgetter(1), reverse=True) for category, priority in sorted_cats: + if not r.commands_by_category[category]: + continue + title, description, _priority = r.categories[category] group = parser.add_argument_group(title, description) diff --git a/config/writemozinfo.py b/python/mozbuild/mozbuild/mozinfo.py similarity index 72% rename from config/writemozinfo.py rename to python/mozbuild/mozbuild/mozinfo.py index 68f50ad9391..f4b24bcb468 100755 --- a/config/writemozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -1,29 +1,21 @@ -#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This script is run during configure, taking variables set in configure -# and producing a JSON file that describes some portions of the build -# configuration, such as the target OS and CPU. -# -# The output file is intended to be used as input to the mozinfo package. -from __future__ import print_function +# This module produces a JSON file that provides basic build info and +# configuration metadata. + import os import re -import sys import json -import buildconfig -def build_dict(env=None): +def build_dict(config, env=os.environ): """ Build a dict containing data about the build configuration from the environment. """ - substs = env or buildconfig.substs - env = env or os.environ + substs = config.substs # Check that all required variables are present first. required = ["TARGET_CPU", "OS_TARGET", "MOZ_WIDGET_TOOLKIT"] @@ -33,12 +25,11 @@ def build_dict(env=None): ', '.join(missing)) d = {} - d['topsrcdir'] = substs.get('TOPSRCDIR', buildconfig.topsrcdir) + d['topsrcdir'] = config.topsrcdir if 'MOZCONFIG' in env: mozconfig = env["MOZCONFIG"] - if 'TOPSRCDIR' in env: - mozconfig = os.path.join(env["TOPSRCDIR"], mozconfig) + mozconfig = os.path.join(config.topsrcdir, mozconfig) d['mozconfig'] = os.path.normpath(mozconfig) # os @@ -89,24 +80,17 @@ def build_dict(env=None): return d -def write_json(file, env=None): - """ - Write JSON data about the configuration specified in |env| - to |file|, which may be a filename or file-like object. + +def write_mozinfo(file, config, env=os.environ): + """Write JSON data about the configuration specified in config and an + environment variable dict to |file|, which may be a filename or file-like + object. See build_dict for information about what environment variables are used, and what keys are produced. """ - build_conf = build_dict(env=env) + build_conf = build_dict(config, env) if isinstance(file, basestring): with open(file, "w") as f: json.dump(build_conf, f) else: json.dump(build_conf, file) - - -if __name__ == '__main__': - try: - write_json(sys.argv[1] if len(sys.argv) > 1 else sys.stdout) - except Exception as e: - print(str(e), file=sys.stderr) - sys.exit(1) diff --git a/python/mozbuild/mozbuild/test/test_mozinfo.py b/python/mozbuild/mozbuild/test/test_mozinfo.py new file mode 100755 index 00000000000..870f0b6c305 --- /dev/null +++ b/python/mozbuild/mozbuild/test/test_mozinfo.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +import json +import os +import tempfile +import unittest + +from StringIO import StringIO + +import mozunit + +from mozbuild.backend.configenvironment import ConfigEnvironment + +from mozbuild.mozinfo import ( + build_dict, + write_mozinfo, +) + + +class Base(object): + def _config(self, substs={}): + d = os.path.dirname(__file__) + return ConfigEnvironment(d, d, substs=substs) + + +class TestBuildDict(unittest.TestCase, Base): + def test_missing(self): + """ + Test that missing required values raises. + """ + + with self.assertRaises(Exception): + build_dict(self._config(substs=dict(OS_TARGET='foo'))) + + with self.assertRaises(Exception): + build_dict(self._config(substs=dict(TARGET_CPU='foo'))) + + with self.assertRaises(Exception): + build_dict(self._config(substs=dict(MOZ_WIDGET_TOOLKIT='foo'))) + + def test_win(self): + d = build_dict(self._config(dict( + OS_TARGET='WINNT', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='windows', + ))) + self.assertEqual('win', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('windows', d['toolkit']) + self.assertEqual(32, d['bits']) + + def test_linux(self): + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual('linux', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('gtk2', d['toolkit']) + self.assertEqual(32, d['bits']) + + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='x86_64', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual('linux', d['os']) + self.assertEqual('x86_64', d['processor']) + self.assertEqual('gtk2', d['toolkit']) + self.assertEqual(64, d['bits']) + + def test_mac(self): + d = build_dict(self._config(dict( + OS_TARGET='Darwin', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='cocoa', + ))) + self.assertEqual('mac', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('cocoa', d['toolkit']) + self.assertEqual(32, d['bits']) + + d = build_dict(self._config(dict( + OS_TARGET='Darwin', + TARGET_CPU='x86_64', + MOZ_WIDGET_TOOLKIT='cocoa', + ))) + self.assertEqual('mac', d['os']) + self.assertEqual('x86_64', d['processor']) + self.assertEqual('cocoa', d['toolkit']) + self.assertEqual(64, d['bits']) + + def test_mac_universal(self): + d = build_dict(self._config(dict( + OS_TARGET='Darwin', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='cocoa', + UNIVERSAL_BINARY='1', + ))) + self.assertEqual('mac', d['os']) + self.assertEqual('universal-x86-x86_64', d['processor']) + self.assertEqual('cocoa', d['toolkit']) + self.assertFalse('bits' in d) + + d = build_dict(self._config(dict( + OS_TARGET='Darwin', + TARGET_CPU='x86_64', + MOZ_WIDGET_TOOLKIT='cocoa', + UNIVERSAL_BINARY='1', + ))) + self.assertEqual('mac', d['os']) + self.assertEqual('universal-x86-x86_64', d['processor']) + self.assertEqual('cocoa', d['toolkit']) + self.assertFalse('bits' in d) + + def test_android(self): + d = build_dict(self._config(dict( + OS_TARGET='Android', + TARGET_CPU='arm', + MOZ_WIDGET_TOOLKIT='android', + ))) + self.assertEqual('android', d['os']) + self.assertEqual('arm', d['processor']) + self.assertEqual('android', d['toolkit']) + self.assertEqual(32, d['bits']) + + def test_x86(self): + """ + Test that various i?86 values => x86. + """ + d = build_dict(self._config(dict( + OS_TARGET='WINNT', + TARGET_CPU='i486', + MOZ_WIDGET_TOOLKIT='windows', + ))) + self.assertEqual('x86', d['processor']) + + d = build_dict(self._config(dict( + OS_TARGET='WINNT', + TARGET_CPU='i686', + MOZ_WIDGET_TOOLKIT='windows', + ))) + self.assertEqual('x86', d['processor']) + + def test_arm(self): + """ + Test that all arm CPU architectures => arm. + """ + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='arm', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual('arm', d['processor']) + + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='armv7', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual('arm', d['processor']) + + def test_unknown(self): + """ + Test that unknown values pass through okay. + """ + d = build_dict(self._config(dict( + OS_TARGET='RandOS', + TARGET_CPU='cptwo', + MOZ_WIDGET_TOOLKIT='foobar', + ))) + self.assertEqual("randos", d["os"]) + self.assertEqual("cptwo", d["processor"]) + self.assertEqual("foobar", d["toolkit"]) + # unknown CPUs should not get a bits value + self.assertFalse("bits" in d) + + def test_debug(self): + """ + Test that debug values are properly detected. + """ + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual(False, d['debug']) + + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='gtk2', + MOZ_DEBUG='1', + ))) + self.assertEqual(True, d['debug']) + + def test_crashreporter(self): + """ + Test that crashreporter values are properly detected. + """ + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='gtk2', + ))) + self.assertEqual(False, d['crashreporter']) + + d = build_dict(self._config(dict( + OS_TARGET='Linux', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='gtk2', + MOZ_CRASHREPORTER='1', + ))) + self.assertEqual(True, d['crashreporter']) + + +class TestWriteMozinfo(unittest.TestCase, Base): + """ + Test the write_mozinfo function. + """ + def setUp(self): + fd, self.f = tempfile.mkstemp() + os.close(fd) + + def tearDown(self): + os.unlink(self.f) + + def test_basic(self): + """ + Test that writing to a file produces correct output. + """ + c = self._config(dict( + OS_TARGET='WINNT', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='windows', + )) + c.topsrcdir = '/tmp' + write_mozinfo(self.f, c, {'MOZCONFIG': 'foo'}) + with open(self.f) as f: + d = json.load(f) + self.assertEqual('win', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('windows', d['toolkit']) + self.assertEqual('/tmp', d['topsrcdir']) + self.assertEqual(os.path.normpath('/tmp/foo'), d['mozconfig']) + self.assertEqual(32, d['bits']) + + def test_fileobj(self): + """ + Test that writing to a file-like object produces correct output. + """ + s = StringIO() + c = self._config(dict( + OS_TARGET='WINNT', + TARGET_CPU='i386', + MOZ_WIDGET_TOOLKIT='windows', + )) + write_mozinfo(s, c) + d = json.loads(s.getvalue()) + self.assertEqual('win', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('windows', d['toolkit']) + self.assertEqual(32, d['bits']) + + +if __name__ == '__main__': + mozunit.main() diff --git a/startupcache/test/TestStartupCache.cpp b/startupcache/test/TestStartupCache.cpp index 8dd248e50a6..9c8bf469ef3 100644 --- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -445,7 +445,7 @@ CompareCountArrays(JSContext *cx, JSObject *aBefore, JSObject *aAfter) return NS_ERROR_UNEXPECTED; } - JSBool same = JS_TRUE; + JSBool same = true; if (!JS_LooselyEqual(cx, before_num, after_num, &same)) { return NS_ERROR_UNEXPECTED; } else { diff --git a/testing/marionette/client/marionette/geckoinstance.py b/testing/marionette/client/marionette/geckoinstance.py index 5f97db9f3c4..cbec3e67b29 100644 --- a/testing/marionette/client/marionette/geckoinstance.py +++ b/testing/marionette/client/marionette/geckoinstance.py @@ -18,11 +18,12 @@ class GeckoInstance(object): "browser.sessionstore.resume_from_crash": False, "browser.warnOnQuit": False} - def __init__(self, host, port, bin, profile): + def __init__(self, host, port, bin, profile, app_args=None): self.marionette_host = host self.marionette_port = port self.bin = bin self.profile = profile + self.app_args = app_args or [] self.runner = None def start(self): @@ -41,7 +42,7 @@ class GeckoInstance(object): self.runner = runner_class.create( binary=self.bin, profile_args=profile_args, - cmdargs=['-no-remote', '-marionette'], + cmdargs=['-no-remote', '-marionette'] + self.app_args, kp_kwargs={ 'processOutputLine': [NullOutput()], 'logfile': self.gecko_log}) diff --git a/testing/marionette/client/marionette/marionette.py b/testing/marionette/client/marionette/marionette.py index 8a9bcb80419..c70713ee931 100644 --- a/testing/marionette/client/marionette/marionette.py +++ b/testing/marionette/client/marionette/marionette.py @@ -198,14 +198,13 @@ class Marionette(object): TIMEOUT_SCRIPT = 'script' TIMEOUT_PAGE = 'page load' - def __init__(self, host='localhost', port=2828, app=None, bin=None, + def __init__(self, host='localhost', port=2828, app=None, app_args=None, bin=None, profile=None, emulator=None, sdcard=None, emulatorBinary=None, emulatorImg=None, emulator_res=None, gecko_path=None, connectToRunningEmulator=False, homedir=None, baseurl=None, noWindow=False, logcat_dir=None, busybox=None, symbols_path=None, timeout=None): self.host = host self.port = self.local_port = port - self.app = app self.bin = bin self.instance = None self.profile = profile @@ -236,7 +235,7 @@ class Marionette(object): else: instance_class = geckoinstance.GeckoInstance self.instance = instance_class(host=self.host, port=self.port, - bin=self.bin, profile=self.profile) + bin=self.bin, profile=self.profile, app_args=app_args) self.instance.start() assert(self.wait_for_port()) diff --git a/testing/marionette/client/marionette/runtests.py b/testing/marionette/client/marionette/runtests.py index 1bc1e34a847..d0bd9242599 100644 --- a/testing/marionette/client/marionette/runtests.py +++ b/testing/marionette/client/marionette/runtests.py @@ -210,8 +210,8 @@ class MarionetteTestRunner(object): def __init__(self, address=None, emulator=None, emulatorBinary=None, emulatorImg=None, emulator_res='480x800', homedir=None, - app=None, bin=None, profile=None, autolog=False, revision=None, - logger=None, testgroup="marionette", noWindow=False, + app=None, app_args=None, bin=None, profile=None, autolog=False, + revision=None, logger=None, testgroup="marionette", noWindow=False, logcat_dir=None, xml_output=None, repeat=0, gecko_path=None, testvars=None, tree=None, type=None, device_serial=None, symbols_path=None, timeout=None, es_servers=None, **kwargs): @@ -222,6 +222,7 @@ class MarionetteTestRunner(object): self.emulator_res = emulator_res self.homedir = homedir self.app = app + self.app_args = app_args or [] self.bin = bin self.profile = profile self.autolog = autolog @@ -327,6 +328,7 @@ class MarionetteTestRunner(object): self.marionette = Marionette(host=host, port=int(port), app=self.app, + app_args=self.app_args, bin=self.bin, profile=self.profile, baseurl=self.baseurl, @@ -696,6 +698,11 @@ class MarionetteTestOptions(OptionParser): dest='app', action='store', help='application to use') + self.add_option('--app-arg', + dest='app_args', + action='append', + default=[], + help='specify a command line argument to be passed onto the application') self.add_option('--binary', dest='bin', action='store', diff --git a/testing/mochitest/androidx86.json b/testing/mochitest/androidx86.json index 2773b58e74a..856e74907ef 100644 --- a/testing/mochitest/androidx86.json +++ b/testing/mochitest/androidx86.json @@ -1,20 +1,24 @@ { "runtests": {}, "excludetests": { - "content/base/test/test_bug590812.html": "bug 687032", - "content/base/test/test_CSP.html": "TIMED_OUT", - "content/base/test/test_CSP_frameancestors.html": "", - "content/base/test/test_CSP_inlinescript.html": "", - "content/base/test/test_CrossSiteXHR.html": "", - "content/base/test/test_CrossSiteXHR_cache.html": "", - "content/base/test/test_CrossSiteXHR_origin.html": "", + "MochiKit-1.4.2/tests/test_MochiKit-Async.html": "fails on x86 only", "content/base/test/test_bug166235.html": "", "content/base/test/test_bug338583.html": "", "content/base/test/test_bug466080.html": "", + "content/base/test/test_bug475156.html": "bug 855762", + "content/base/test/test_bug482935.html": "bug 855762", "content/base/test/test_bug503481.html": "TIMED_OUT", "content/base/test/test_bug503481b.html": "TIMED_OUT", "content/base/test/test_bug505783.html": "TIMED_OUT", + "content/base/test/test_bug590812.html": "bug 687032", "content/base/test/test_copypaste.html": "", + "content/base/test/test_CrossSiteXHR.html": "", + "content/base/test/test_CrossSiteXHR_cache.html": "", + "content/base/test/test_CrossSiteXHR_origin.html": "", + "content/base/test/test_CSP.html": "TIMED_OUT", + "content/base/test/test_CSP_frameancestors.html": "", + "content/base/test/test_CSP_inlinescript.html": "", + "content/base/test/test_CSP_evalscript_getCRMFRequest.html": "bug 824652", "content/base/test/test_csp_redirects.html": "TIMED_OUT", "content/base/test/test_fileapi_slice.html": "bug 775227", "content/base/test/test_mozfiledataurl.html": "TIMED_OUT", @@ -88,6 +92,7 @@ "content/html/content/test/test_fullscreen-api.html": "TIMED_OUT", "content/html/content/test/test_iframe_sandbox_plugins.html": "", "content/html/content/test/test_object_plugin_nav.html": "TIMED_OUT", + "content/html/content/test/test_video_wakelock.html": "bug 871015", "content/html/document/test/test_bug199692.html": "bug 811644", "content/html/document/test/test_bug369370.html": "", "content/html/document/test/test_bug391777.html": "", @@ -95,12 +100,8 @@ "content/html/document/test/test_bug446483.html": "", "content/html/document/test/test_bug741266.html": "", "content/media/test/test_buffered.html": "", - "content/media/webaudio/test/test_currentTime.html": "bug 868116", - "content/media/webaudio/test/test_delayNode.html": "bug 865642", - "content/media/webaudio/test/test_delayNodeWithGain.html": "bug 865642", - "content/media/webaudio/test/test_gainNode.html": "bug 865642", - "content/media/webaudio/test/test_scriptProcessorNode.html": "bug 865642", - "content/media/webaudio/test/test_scriptProcessorNodeChannelCount.html": "bug 865642", + "content/media/test/test_can_play_type_mpeg.html": "fails on x86 only", + "content/media/test/test_unseekable.html": "fails on x86 only", "content/media/webspeech/synth/ipc/test/test_ipc.html": "bug 857673", "content/media/webspeech/recognition/test/test_nested_eventloop.html": "", "content/smil/test/test_smilRepeatTiming.xhtml": "TIMED_OUT", @@ -108,6 +109,7 @@ "content/xul/content/test/test_bug486990.xul": "TIMED_OUT", "docshell/test/navigation/test_bug13871.html": "RANDOM", "docshell/test/navigation/test_bug430723.html": "TIMED_OUT", + "docshell/test/navigation/test_not-opener.html", "fails on x86 only", "docshell/test/navigation/test_popup-navigates-children.html": "bug 783589", "docshell/test/navigation/test_sessionhistory.html": "RANDOM", "docshell/test/navigation/test_bug344861.html": "", @@ -174,6 +176,7 @@ "dom/tests/mochitest/general/test_497898.html": "", "dom/tests/mochitest/general/test_focusrings.xul": "TIMED_OUT", "dom/tests/mochitest/general/test_vibrator.html": "CRASH_SUTAGENT", + "dom/tests/mochitest/general/test_showModalDialog.html": "Don't run modal tests on Android", "dom/tests/mochitest/geolocation/test_allowCurrent.html": "TIMED_OUT", "dom/tests/mochitest/geolocation/test_allowWatch.html": "TIMED_OUT", "dom/tests/mochitest/geolocation/test_cachedPosition.html": "TIMED_OUT", @@ -202,6 +205,7 @@ "dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html": "TIMED_OUT", "dom/tests/mochitest/webapps/test_bug_779982.html": "Bug 793211", "dom/tests/mochitest/whatwg/test_bug500328.html": "TIMED_OUT", + "dom/workers/test/test_closeOnGC.html": "bug 881404", "dom/workers/test/test_xhr_timeout.html": "bug 798220", "editor/composer/test/test_bug389350.html": "", "editor/libeditor/base/tests/test_bug408231.html": "", @@ -272,6 +276,7 @@ "layout/style/test/test_visited_pref.html": "TIMED_OUT", "layout/style/test/test_visited_reftests.html": "TIMED_OUT", "layout/xul/base/test/test_bug511075.html": "bug 798806", + "parser/htmlparser/tests/mochitest/test_bug709083.html": "bug 737020", "parser/htmlparser/tests/mochitest/test_html5_tree_construction.html": "TIMED_OUT", "parser/htmlparser/tests/mochitest/test_html5_tree_construction_part2.html": "TIMED_OUT", "robocop": "TIMED_OUT", @@ -317,73 +322,7 @@ "dom/tests/mochitest/ajax/offline": "SLOW_DIRECTORY", "layout/base/tests": "SLOW_DIRECTORY", "Harness_sanity/test_bug816847.html": "No test app installed", - "content/media/webaudio/test/test_audioBufferSourceNodeLoopStartEndSame.html": "", - "content/media/webspeech/recognition/test/test_audio_capture_error.html": "", - "docshell/test/navigation/test_bug13871.html": "", - "layout/forms/test/test_bug231389.html": "", - "docshell/test/navigation/test_bug278916.html": "", - "docshell/test/navigation/test_bug279495.html": "", - "layout/forms/test/test_bug287446.html": "", - "dom/tests/mochitest/bugs/test_bug291653.html": "", - "docshell/test/navigation/test_bug344861.html": "", - "layout/forms/test/test_bug345267.html": "", - "dom/tests/mochitest/bugs/test_bug369306.html": "", - "docshell/test/navigation/test_bug430624.html": "", - "docshell/test/navigation/test_bug430723.html": "", - "content/xul/content/test/test_bug486990.xul": "", - "layout/forms/test/test_bug564115.html": "", - "layout/forms/test/test_bug571352.html": "", - "layout/forms/test/test_bug572406.html": "", - "layout/forms/test/test_bug572649.html": "", - "layout/forms/test/test_bug595310.html": "", - "dom/tests/mochitest/bugs/test_bug61098.html": "", - "content/html/content/test/test_bug615833.html": "", - "layout/forms/test/test_bug620936.html": "", - "layout/forms/test/test_bug644542.html": "", - "content/html/content/test/test_fullscreen-api.html": "", - "dom/devicestorage/ipc/test_ipc.html": "", - "layout/base/tests/test_remote_frame.html": "", - "dom/tests/mochitest/bugs/test_resize_move_windows.html": "", - "layout/base/tests/test_scroll_event_ordering.html": "", - "layout/base/tests/test_scroll_selection_into_view.html": "", - "content/media/test/test_streams_element_capture.html": "", - "content/events/test/test_wheel_default_action.html": "TIMED OUT", - "content/html/content/test/forms/test_formaction_attribute.html": "TIMED OUT", - "js/xpconnect/tests/mochitest/test_bug865260.html": "CRASH", - "content/media/webaudio/test/test_bug867089.html": "CRASH", - "content/base/test/test_bug560780.html": "Unexpected result", - "content/base/test/test_bug588990.html": "Unexpected result", - "content/base/test/test_bug704063.html": "Unexpected result", - "content/canvas/test/test_canvas.html": "Unexpected result", - "content/html/content/test/forms/test_input_attributes_reflection.html": "Unexpected result", - "docshell/test/navigation/test_not-opener.html": "Unexpected result", - "dom/contacts/tests/test_contacts_basics.html": "Unexpected result", - "dom/contacts/tests/test_contacts_international.html": "Unexpected result", - "dom/imptests/webapps/DOMCore/tests/approved/test_interfaces.html": "Unexpected result", - "dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html": "Unexpected result", - "dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html": "Unexpected result", - "dom/tests/mochitest/bugs/test_bug857555.html": "Unexpected result", - "gfx/tests/test_acceleration.html": "Unexpected result", - "js/xpconnect/tests/mochitest/test_asmjs.html": "Unexpected result", - "js/xpconnect/tests/mochitest/test_bug829872.html": "Unexpected result", - "layout/style/test/test_media_queries.html": "Unexpected result", - "layout/style/test/test_transitions_events.html": "Unexpected result", - "Harness_sanity/test_sanityEventUtils.html": "Unexpected result", - "content/html/content/test/test_video_wakelock.html": "Test timed out", - "content/media/test/test_a4_tone.html": "Unexpected result", - "content/media/test/test_can_play_type_mpeg.html": "Unexpected result", - "content/media/test/test_playback_rate.html": "Test timed out", - "content/media/webaudio/test/test_mediaDecoding.html": "Unexpected result", - "content/canvas/test/crossorigin/test_video_crossorigin.html": "Unexpected result", - "/dom/media/tests/mochitest/test_peerConnection_bug825703.html": "Unexpected Result", - "/dom/media/tests/mochitest/test_peerConnection_bug825703.html": "Unexpected Result", - "/dom/media/tests/mochitest/test_peerConnection_bug825703.html": "Unexpected Result", - "/dom/media/tests/mochitest/test_peerConnection_bug825703.html": "Unexpected Result", - "/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html": "Unexpected Result", - "/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html": "Unexpected Result", - "/dom/tests/mochitest/general/test_interfaces.html": "Unexpected Result", - "/dom/tests/mochitest/general/test_interfaces.html": "Unexpected Result", - "/dom/tests/mochitest/general/test_interfaces.html": "Unexpected Result", - "/dom/tests/mochitest/general/test_showModalDialog.html": "Unexpected Result" + "Harness_sanity/test_sanityEventUtils.html": "bug 688052", + "Harness_sanity/test_sanitySimpletest.html": "bug 688052" } } diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 698adf02191..871843dd9f7 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -299,6 +299,7 @@ "dom/tests/mochitest/general/test_idleapi_permissions.html":"", "dom/tests/mochitest/general/test_interfaces.html":"", "dom/tests/mochitest/general/test_showModalDialog.html": "Don't run modal tests on Android", + "dom/tests/mochitest/general/test_paste_selection.html":"", "dom/tests/mochitest/geolocation/test_allowCurrent.html":"", "dom/tests/mochitest/geolocation/test_allowWatch.html":"", "dom/tests/mochitest/geolocation/test_cachedPosition.html":"", diff --git a/testing/specialpowers/content/specialpowersAPI.js b/testing/specialpowers/content/specialpowersAPI.js index edaba414178..2ecc3466922 100644 --- a/testing/specialpowers/content/specialpowersAPI.js +++ b/testing/specialpowers/content/specialpowersAPI.js @@ -1346,17 +1346,19 @@ SpecialPowersAPI.prototype = { sendAsyncMessage("SpecialPowers.Focus", {}); }, - getClipboardData: function(flavor) { + getClipboardData: function(flavor, whichClipboard) { if (this._cb == null) this._cb = Components.classes["@mozilla.org/widget/clipboard;1"]. getService(Components.interfaces.nsIClipboard); + if (whichClipboard === undefined) + whichClipboard = this._cb.kGlobalClipboard; var xferable = Components.classes["@mozilla.org/widget/transferable;1"]. createInstance(Components.interfaces.nsITransferable); xferable.init(this._getDocShell(content.window) .QueryInterface(Components.interfaces.nsILoadContext)); xferable.addDataFlavor(flavor); - this._cb.getData(xferable, this._cb.kGlobalClipboard); + this._cb.getData(xferable, whichClipboard); var data = {}; try { xferable.getTransferData(flavor, data, {}); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index e0c23607a84..7a2970b0c0e 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -302,8 +302,10 @@ nsFormFillController::SetPopupOpen(bool aPopupOpen) nsIPresShell::SCROLL_IF_NOT_VISIBLE), nsIPresShell::SCROLL_OVERFLOW_HIDDEN); // mFocusedPopup can be destroyed after ScrollContentIntoView, see bug 420089 - if (mFocusedPopup) - mFocusedPopup->OpenAutocompletePopup(this, mFocusedInput); + if (mFocusedPopup) { + nsCOMPtr element = do_QueryInterface(mFocusedInput); + mFocusedPopup->OpenAutocompletePopup(this, element); + } } else mFocusedPopup->ClosePopup(); } @@ -446,8 +448,10 @@ nsFormFillController::GetSearchParam(nsAString &aSearchParam) } mFocusedInput->GetName(aSearchParam); - if (aSearchParam.IsEmpty()) - mFocusedInput->GetId(aSearchParam); + if (aSearchParam.IsEmpty()) { + nsCOMPtr element = do_QueryInterface(mFocusedInput); + element->GetId(aSearchParam); + } return NS_OK; } @@ -532,7 +536,8 @@ nsFormFillController::OnTextEntered(bool* aPrevent) NS_ENSURE_TRUE(mFocusedInput, NS_OK); // Fire off a DOMAutoComplete event nsCOMPtr domDoc; - mFocusedInput->GetOwnerDocument(getter_AddRefs(domDoc)); + nsCOMPtr element = do_QueryInterface(mFocusedInput); + element->GetOwnerDocument(getter_AddRefs(domDoc)); NS_ENSURE_STATE(domDoc); nsCOMPtr event; @@ -576,7 +581,8 @@ nsFormFillController::GetInPrivateContext(bool *aInPrivateContext) } nsCOMPtr inputDoc; - mFocusedInput->GetOwnerDocument(getter_AddRefs(inputDoc)); + nsCOMPtr element = do_QueryInterface(mFocusedInput); + element->GetOwnerDocument(getter_AddRefs(inputDoc)); nsCOMPtr doc = do_QueryInterface(inputDoc); nsCOMPtr container = doc->GetContainer(); nsCOMPtr docShell = do_QueryInterface(container); @@ -1144,7 +1150,8 @@ nsIDocShell * nsFormFillController::GetDocShellForInput(nsIDOMHTMLInputElement *aInput) { nsCOMPtr domDoc; - aInput->GetOwnerDocument(getter_AddRefs(domDoc)); + nsCOMPtr element = do_QueryInterface(aInput); + element->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr doc = do_QueryInterface(domDoc); NS_ENSURE_TRUE(doc, nullptr); nsCOMPtr webNav = do_GetInterface(doc->GetWindow()); diff --git a/toolkit/components/thumbnails/PageThumbs.jsm b/toolkit/components/thumbnails/PageThumbs.jsm index fa45eb6015c..b7aee14c4d1 100644 --- a/toolkit/components/thumbnails/PageThumbs.jsm +++ b/toolkit/components/thumbnails/PageThumbs.jsm @@ -185,6 +185,18 @@ this.PageThumbs = { "?url=" + encodeURIComponent(aUrl); }, + /** + * Gets the path of the thumbnail file for a given web page's + * url. This file may or may not exist depending on whether the + * thumbnail has been captured or not. + * + * @param aUrl The web page's url. + * @return The path of the thumbnail file. + */ + getThumbnailPath: function PageThumbs_getThumbnailPath(aUrl) { + return PageThumbsStorage.getFilePathForURL(aUrl); + }, + /** * Checks if an existing thumbnail for the specified URL is either missing * or stale, and if so, queues a background request to capture it. That diff --git a/toolkit/components/thumbnails/test/Makefile.in b/toolkit/components/thumbnails/test/Makefile.in index 2e979d428ad..4a38d68c548 100644 --- a/toolkit/components/thumbnails/test/Makefile.in +++ b/toolkit/components/thumbnails/test/Makefile.in @@ -20,6 +20,7 @@ MOCHITEST_BROWSER_FILES := \ browser_thumbnails_storage_migrate3.js \ browser_thumbnails_bug726727.js \ browser_thumbnails_bug727765.js \ + browser_thumbnails_bug818225.js \ browser_thumbnails_update.js \ head.js \ background_red.html \ diff --git a/toolkit/components/thumbnails/test/browser_thumbnails_bug818225.js b/toolkit/components/thumbnails/test/browser_thumbnails_bug818225.js new file mode 100644 index 00000000000..40be5b2a2dc --- /dev/null +++ b/toolkit/components/thumbnails/test/browser_thumbnails_bug818225.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/" + + "test/background_red.html?" + Date.now(); + +// Test PageThumbs API function getThumbnailPath +function runTests() { + + let path = PageThumbs.getThumbnailPath(URL); + yield testIfExists(path, false, "Thumbnail file does not exist"); + + yield createThumbnail(URL); + + path = PageThumbs.getThumbnailPath(URL); + let expectedPath = PageThumbsStorage.getFilePathForURL(URL); + is(path, expectedPath, "Thumbnail file has correct path"); + + yield testIfExists(path, true, "Thumbnail file exists"); + +} + +function createThumbnail(aURL) { + addTab(aURL, function () { + whenFileExists(aURL, function () { + gBrowser.removeTab(gBrowser.selectedTab); + next(); + }); + }); +} + +function testIfExists(aPath, aExpected, aMessage) { + return OS.File.exists(aPath).then( + function onSuccess(exists) { + is(exists, aExpected, aMessage); + }, + function onFailure(error) { + ok(false, "OS.File.exists() failed " + error); + } + ); +} diff --git a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp index 4cd4a23bdeb..bc6124797b6 100644 --- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp +++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp @@ -31,7 +31,6 @@ #include "nsIDOMHTMLElement.h" #include "nsIDocument.h" #include "nsISelection.h" -#include "nsILink.h" #include "nsTextFragment.h" #include "nsIDOMNSEditableElement.h" #include "nsIEditor.h" @@ -49,6 +48,7 @@ #include "nsIObserverService.h" #include "nsFocusManager.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/Link.h" #include "nsRange.h" #include "nsTypeAheadFind.h" @@ -851,7 +851,7 @@ nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange, // eventually we'll run out of ancestors if (startContent->IsHTML()) { - nsCOMPtr link(do_QueryInterface(startContent)); + nsCOMPtr link(do_QueryInterface(startContent)); if (link) { // Check to see if inside HTML link *aIsInsideLink = startContent->HasAttr(kNameSpaceID_None, hrefAtom); diff --git a/toolkit/content/aboutNetworking.css b/toolkit/content/aboutNetworking.css new file mode 100644 index 00000000000..517c2a7c1d5 --- /dev/null +++ b/toolkit/content/aboutNetworking.css @@ -0,0 +1,60 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +body { + min-width: 330px; + max-width: 100%; + min-height: 330px; + max-height: 100%; +} + +#menu { + position: absolute; + top: 5px; + color: gray; +} + +.warningBackground { + display: none; + background: -moz-Dialog; + width:100%; + height:100%; + z-index:10; + top:0; + left:0; + position:fixed; +} + +.warningMessage { + color: -moz-FieldText; + position: relative; + min-width: 330px; + max-width: 50em; + margin: 4em auto; + border: 1px solid ThreeDShadow; + border-radius: 10px; + padding: 3em; + -moz-padding-start: 30px; + background: -moz-Field; + margin-left: auto; + text-align: center; +} + +.tab { + display: none; +} + +.active { + display: block; +} + +#menu .selected { + color: blue; +} + +#refreshdiv { + top: 5px; + position: absolute; + right: 30px; +} diff --git a/toolkit/content/aboutNetworking.js b/toolkit/content/aboutNetworking.js new file mode 100644 index 00000000000..da6e352e1e8 --- /dev/null +++ b/toolkit/content/aboutNetworking.js @@ -0,0 +1,174 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +const Ci = Components.interfaces; +const Cc = Components.classes; +const Cu = Components.utils; + +const gDashboard = Cc['@mozilla.org/network/dashboard;1']. + getService(Ci.nsIDashboard); +const gPrefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefService).getBranch("network."); + +const REFRESH_INTERVAL_MS = 3000; + +function col(element) { + let col = document.createElement('td'); + let content = document.createTextNode(element); + col.appendChild(content); + return col; +} + +function displayHttp(data) { + let cont = document.getElementById('http_content'); + let parent = cont.parentNode; + let new_cont = document.createElement('tbody'); + new_cont.setAttribute('id', 'http_content'); + + for (let i = 0; i < data.host.length; i++) { + let row = document.createElement('tr'); + row.appendChild(col(data.host[i])); + row.appendChild(col(data.port[i])); + row.appendChild(col(data.spdy[i])); + row.appendChild(col(data.ssl[i])); + row.appendChild(col(data.active[i].rtt.length)); + row.appendChild(col(data.idle[i].rtt.length)); + new_cont.appendChild(row); + } + + parent.replaceChild(new_cont, cont); +} + +function displaySockets(data) { + let cont = document.getElementById('sockets_content'); + let parent = cont.parentNode; + let new_cont = document.createElement('tbody'); + new_cont.setAttribute('id', 'sockets_content'); + + for (let i = 0; i < data.host.length; i++) { + let row = document.createElement('tr'); + row.appendChild(col(data.host[i])); + row.appendChild(col(data.port[i])); + row.appendChild(col(data.tcp[i])); + row.appendChild(col(data.active[i])); + row.appendChild(col(data.socksent[i])); + row.appendChild(col(data.sockreceived[i])); + new_cont.appendChild(row); + } + + parent.replaceChild(new_cont, cont); +} + +function displayDns(data) { + let cont = document.getElementById('dns_content'); + let parent = cont.parentNode; + let new_cont = document.createElement('tbody'); + new_cont.setAttribute('id', 'dns_content'); + + for (let i = 0; i < data.hostname.length; i++) { + let row = document.createElement('tr'); + row.appendChild(col(data.hostname[i])); + row.appendChild(col(data.family[i])); + let column = document.createElement('td'); + + for (let j = 0; j< data.hostaddr[i].length; j++) { + column.appendChild(document.createTextNode(data.hostaddr[i][j])); + column.appendChild(document.createElement('br')); + } + + row.appendChild(column); + row.appendChild(col(data.expiration[i])); + new_cont.appendChild(row); + } + + parent.replaceChild(new_cont, cont); +} + +function displayWebsockets(data) { + let cont = document.getElementById('websockets_content'); + let parent = cont.parentNode; + let new_cont = document.createElement('tbody'); + new_cont.setAttribute('id', 'websockets_content'); + + for (let i = 0; i < data.hostport.length; i++) { + let row = document.createElement('tr'); + row.appendChild(col(data.hostport[i])); + row.appendChild(col(data.encrypted[i])); + row.appendChild(col(data.msgsent[i])); + row.appendChild(col(data.msgreceived[i])); + row.appendChild(col(data.sentsize[i])); + row.appendChild(col(data.receivedsize[i])); + new_cont.appendChild(row); + } + + parent.replaceChild(new_cont, cont); +} + +function requestNetworkingData() { + gDashboard.requestSockets(displaySockets); + gDashboard.requestHttpConnections(displayHttp); + gDashboard.requestWebsocketConnections(displayWebsockets); + gDashboard.requestDNSInfo(displayDns); +} + +function init() { + gDashboard.enableLogging = true; + if (gPrefs.getBoolPref("warnOnAboutNetworking")) { + let div = document.getElementById("warning_message"); + div.classList.add("active"); + document.getElementById("confpref").addEventListener("click", confirm); + } + + requestNetworkingData(); + + document.getElementById("autorefcheck").addEventListener("click", function() { + let refrButton = document.getElementById("refreshButton"); + if (this.checked) { + this.interval = setInterval(requestNetworkingData, REFRESH_INTERVAL_MS); + refrButton.disabled = "disabled"; + } else { + clearInterval(this.interval); + refrButton.disabled = null; + } + }); + + let refr = document.getElementById("refreshButton"); + refr.addEventListener("click", requestNetworkingData); + if (document.getElementById("autorefcheck").checked) + refr.disabled = "disabled"; + + // Event delegation on #menu element + let menu = document.getElementById("menu"); + menu.addEventListener("click", function click(e) { + if (e.target) + show(e.target); + }); +} + +function confirm () { + let div = document.getElementById("warning_message"); + div.classList.remove("active"); + let warnBox = document.getElementById("warncheck"); + gPrefs.setBoolPref("warnOnAboutNetworking", warnBox.checked); +} + +function show(button) { + let current_tab = document.querySelector(".active"); + let content = document.getElementById(button.value); + if (current_tab == content) + return; + current_tab.classList.remove("active"); + content.classList.add("active"); + + let current_button = document.querySelector(".selected"); + current_button.classList.remove("selected"); + button.classList.add("selected"); +} + +window.addEventListener("DOMContentLoaded", function load() { + window.removeEventListener("DOMContentLoaded", load); + init(); +}); diff --git a/toolkit/content/aboutNetworking.xhtml b/toolkit/content/aboutNetworking.xhtml new file mode 100644 index 00000000000..d1c0203aeda --- /dev/null +++ b/toolkit/content/aboutNetworking.xhtml @@ -0,0 +1,102 @@ + + + + + %htmlDTD; + %globalDTD; + %brandDTD; + %networkingDTD; +]> + + + + &aboutNetworking.title; + + +