diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h index 24af2af261f..d4f7c98208b 100644 --- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -86,7 +86,7 @@ private: * Used to process notifications from core for the document accessible. */ class NotificationController final : public EventQueue, - public nsARefreshObserver + public nsARefreshObserver { public: NotificationController(DocAccessible* aDocument, nsIPresShell* aPresShell); diff --git a/accessible/base/nsAccessibilityService.h b/accessible/base/nsAccessibilityService.h index 44678e4a359..75091fc216b 100644 --- a/accessible/base/nsAccessibilityService.h +++ b/accessible/base/nsAccessibilityService.h @@ -64,10 +64,10 @@ struct MarkupMapInfo { } // namespace mozilla class nsAccessibilityService final : public mozilla::a11y::DocManager, - public mozilla::a11y::FocusManager, - public mozilla::a11y::SelectionManager, - public nsIAccessibilityService, - public nsIObserver + public mozilla::a11y::FocusManager, + public mozilla::a11y::SelectionManager, + public nsIAccessibilityService, + public nsIObserver { public: typedef mozilla::a11y::Accessible Accessible; diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index 86ef9e5e51e..d8449c92850 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -1289,10 +1289,12 @@ DocAccessible::ContentInserted(nsIContent* aContainerNode, // null (document element is inserted or removed). Accessible* container = aContainerNode ? GetAccessibleOrContainer(aContainerNode) : this; - - mNotificationController->ScheduleContentInsertion(container, - aStartChildNode, - aEndChildNode); + if (container) { + // Ignore notification if the container node is no longer in the DOM tree. + mNotificationController->ScheduleContentInsertion(container, + aStartChildNode, + aEndChildNode); + } } } diff --git a/accessible/windows/msaa/IUnknownImpl.h b/accessible/windows/msaa/IUnknownImpl.h index cb2565776e3..dbf6c1374ff 100644 --- a/accessible/windows/msaa/IUnknownImpl.h +++ b/accessible/windows/msaa/IUnknownImpl.h @@ -51,13 +51,13 @@ private: #define DECL_IUNKNOWN \ public: \ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**); \ - virtual ULONG STDMETHODCALLTYPE AddRef() final \ + virtual ULONG STDMETHODCALLTYPE AddRef() final \ { \ MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); \ ++mRefCnt; \ return mRefCnt; \ } \ - virtual ULONG STDMETHODCALLTYPE Release() final \ + virtual ULONG STDMETHODCALLTYPE Release() final \ { \ MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); \ --mRefCnt; \ diff --git a/accessible/windows/uia/uiaRawElmProvider.h b/accessible/windows/uia/uiaRawElmProvider.h index cb10779c137..ba0921530a7 100644 --- a/accessible/windows/uia/uiaRawElmProvider.h +++ b/accessible/windows/uia/uiaRawElmProvider.h @@ -21,7 +21,7 @@ class AccessibleWrap; * IRawElementProviderSimple implementation (maintains IAccessibleEx approach). */ class uiaRawElmProvider final : public IAccessibleEx, - public IRawElementProviderSimple + public IRawElementProviderSimple { public: uiaRawElmProvider(AccessibleWrap* aAcc) : mAcc(aAcc) { } diff --git a/browser/components/feeds/nsFeedSniffer.h b/browser/components/feeds/nsFeedSniffer.h index 57e10d954d0..fce66773bb1 100644 --- a/browser/components/feeds/nsFeedSniffer.h +++ b/browser/components/feeds/nsFeedSniffer.h @@ -10,7 +10,7 @@ #include "mozilla/Attributes.h" class nsFeedSniffer final : public nsIContentSniffer, - nsIStreamListener + nsIStreamListener { public: NS_DECL_ISUPPORTS diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_wrong_window_focus.js b/browser/devtools/scratchpad/test/browser_scratchpad_wrong_window_focus.js index ccd99cbc54e..8fe78abd816 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_wrong_window_focus.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_wrong_window_focus.js @@ -51,7 +51,7 @@ function testFocus(sw, hud) { var loc = node.querySelector(".message-location"); ok(loc, "location element exists"); - is(loc.textContent.trim(), sw.Scratchpad.uniqueName + ":1:0", + is(loc.textContent.trim(), sw.Scratchpad.uniqueName + ":1:1", "location value is correct"); sw.addEventListener("focus", function onFocus() { diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js b/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js index 8945d2fa6c6..fad42e0c0c6 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js @@ -35,10 +35,10 @@ function test() { // The expected stack trace object. let stacktrace = [ - { columnNumber: 2, filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 9 }, - { columnNumber: 9, filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 14 }, - { columnNumber: 9, filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 18 }, - { columnNumber: 0, filename: TEST_URI, functionName: "", language: 2, lineNumber: 21 } + { columnNumber: 3, filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 9 }, + { columnNumber: 10, filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 14 }, + { columnNumber: 10, filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 18 }, + { columnNumber: 1, filename: TEST_URI, functionName: "", language: 2, lineNumber: 21 } ]; ok(obj._stacktrace, "found stacktrace object"); diff --git a/browser/devtools/webconsole/test/browser_webconsole_column_numbers.js b/browser/devtools/webconsole/test/browser_webconsole_column_numbers.js index bbc5dde8134..73dba069fbf 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_column_numbers.js +++ b/browser/devtools/webconsole/test/browser_webconsole_column_numbers.js @@ -30,7 +30,7 @@ function consoleOpened(aHud) { function testLocationColumn() { let messages = hud.outputNode.children; - let expected = ['10:6', '10:38', '11:8', '12:10', '13:8', '14:6']; + let expected = ['10:7', '10:39', '11:9', '12:11', '13:9', '14:7']; for(let i = 0, len = messages.length; i < len; i++) { let msg = messages[i].textContent; diff --git a/caps/nsNullPrincipalURI.h b/caps/nsNullPrincipalURI.h index 1837fcaa618..6fb0b02d645 100644 --- a/caps/nsNullPrincipalURI.h +++ b/caps/nsNullPrincipalURI.h @@ -25,8 +25,8 @@ {0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6} } class nsNullPrincipalURI final : public nsIURI - , public nsISizeOf - , public nsIIPCSerializableURI + , public nsISizeOf + , public nsIIPCSerializableURI { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/caps/nsScriptSecurityManager.h b/caps/nsScriptSecurityManager.h index 646114d211d..da9b3a29908 100644 --- a/caps/nsScriptSecurityManager.h +++ b/caps/nsScriptSecurityManager.h @@ -33,8 +33,8 @@ class ClassInfoData; { 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }} class nsScriptSecurityManager final : public nsIScriptSecurityManager, - public nsIChannelEventSink, - public nsIObserver + public nsIChannelEventSink, + public nsIObserver { public: static void Shutdown(); diff --git a/chrome/nsChromeProtocolHandler.h b/chrome/nsChromeProtocolHandler.h index 0d86b009db4..42c3f52be05 100644 --- a/chrome/nsChromeProtocolHandler.h +++ b/chrome/nsChromeProtocolHandler.h @@ -19,7 +19,7 @@ } class nsChromeProtocolHandler final : public nsIProtocolHandler, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/configure.in b/configure.in index a2f09c97999..20bde77e81c 100644 --- a/configure.in +++ b/configure.in @@ -5704,12 +5704,18 @@ MOZ_ARG_DISABLE_BOOL(permissions, MOZ_PERMISSIONS=1 ) +AC_SUBST(MOZ_PERMISSIONS) +if test -n "$MOZ_PERMISSIONS"; then + AC_DEFINE(MOZ_PERMISSIONS) +fi + dnl ======================================================== dnl Child permissions, currently only used for b2g dnl ======================================================== if test -n "$MOZ_B2G"; then if test -n "$MOZ_PERMISSIONS"; then MOZ_CHILD_PERMISSIONS=1 + AC_DEFINE(MOZ_CHILD_PERMISSIONS) else AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS]) fi @@ -8429,7 +8435,6 @@ AC_SUBST(BIN_FLAGS) AC_SUBST(MOZ_WIDGET_TOOLKIT) AC_SUBST(MOZ_UPDATE_XTERM) AC_SUBST(MOZ_AUTH_EXTENSION) -AC_SUBST(MOZ_PERMISSIONS) AC_SUBST(MOZ_PREF_EXTENSIONS) AC_SUBST(MOZ_DEBUG) AC_SUBST(MOZ_DEBUG_SYMBOLS) diff --git a/docshell/shistory/src/nsSHEntry.h b/docshell/shistory/src/nsSHEntry.h index cc00572035f..19e3827faa4 100644 --- a/docshell/shistory/src/nsSHEntry.h +++ b/docshell/shistory/src/nsSHEntry.h @@ -23,8 +23,8 @@ class nsIInputStream; class nsIURI; class nsSHEntry final : public nsISHEntry, - public nsISHContainer, - public nsISHEntryInternal + public nsISHContainer, + public nsISHEntryInternal { public: nsSHEntry(); diff --git a/docshell/shistory/src/nsSHEntryShared.h b/docshell/shistory/src/nsSHEntryShared.h index 1e7a2e67775..6559fa51634 100644 --- a/docshell/shistory/src/nsSHEntryShared.h +++ b/docshell/shistory/src/nsSHEntryShared.h @@ -31,7 +31,7 @@ class nsISupportsArray; // // nsSHEntryShared is the vehicle for this sharing. class nsSHEntryShared final : public nsIBFCacheEntry, - public nsIMutationObserver + public nsIMutationObserver { public: static void EnsureHistoryTracker(); diff --git a/docshell/shistory/src/nsSHistory.h b/docshell/shistory/src/nsSHistory.h index 71237cfd334..36af8855f68 100644 --- a/docshell/shistory/src/nsSHistory.h +++ b/docshell/shistory/src/nsSHistory.h @@ -28,9 +28,9 @@ class nsISHEntry; class nsISHTransaction; class nsSHistory final : public PRCList, - public nsISHistory, - public nsISHistoryInternal, - public nsIWebNavigation + public nsISHistory, + public nsISHistoryInternal, + public nsIWebNavigation { public: nsSHistory(); diff --git a/dom/archivereader/ArchiveReader.h b/dom/archivereader/ArchiveReader.h index b84cc3c03f3..31a75b3dd97 100644 --- a/dom/archivereader/ArchiveReader.h +++ b/dom/archivereader/ArchiveReader.h @@ -33,7 +33,7 @@ class ArchiveRequest; * This is the ArchiveReader object */ class ArchiveReader final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/archivereader/ArchiveZipFile.cpp b/dom/archivereader/ArchiveZipFile.cpp index 13e804b403a..0866503d32d 100644 --- a/dom/archivereader/ArchiveZipFile.cpp +++ b/dom/archivereader/ArchiveZipFile.cpp @@ -21,7 +21,7 @@ USING_ARCHIVEREADER_NAMESPACE * Input stream object for zip files */ class ArchiveInputStream final : public nsIInputStream, - public nsISeekableStream + public nsISeekableStream { public: ArchiveInputStream(uint64_t aParentSize, diff --git a/dom/asmjscache/AsmJSCache.cpp b/dom/asmjscache/AsmJSCache.cpp index c4dcc6987b3..dbe07f4413d 100644 --- a/dom/asmjscache/AsmJSCache.cpp +++ b/dom/asmjscache/AsmJSCache.cpp @@ -1108,7 +1108,7 @@ FindHashMatch(const Metadata& aMetadata, const ReadParams& aReadParams, // A runnable that executes for a cache access originating in the main process. class SingleProcessRunnable final : public File, - private MainProcessRunnable + private MainProcessRunnable { public: // In the single-process case, the calling JS compilation thread holds the @@ -1186,7 +1186,7 @@ private: // in the content process. This runnable gets registered as an IPDL subprotocol // actor so that it can communicate with the corresponding ChildProcessRunnable. class ParentProcessRunnable final : public PAsmJSCacheEntryParent, - public MainProcessRunnable + public MainProcessRunnable { public: // The given principal comes from an IPC::Principal which will be dec-refed @@ -1357,7 +1357,7 @@ DeallocEntryParent(PAsmJSCacheEntryParent* aActor) namespace { class ChildProcessRunnable final : public File, - public PAsmJSCacheEntryChild + public PAsmJSCacheEntryChild { public: NS_DECL_NSIRUNNABLE diff --git a/dom/base/Attr.h b/dom/base/Attr.h index 3716c4ba66e..6b36e51aca7 100644 --- a/dom/base/Attr.h +++ b/dom/base/Attr.h @@ -29,7 +29,7 @@ namespace dom { // Attribute helper class used to wrap up an attribute with a dom // object that implements nsIDOMAttr and nsIDOMNode class Attr final : public nsIAttribute, - public nsIDOMAttr + public nsIDOMAttr { virtual ~Attr() {} diff --git a/dom/base/Comment.h b/dom/base/Comment.h index 572169704cd..d13fc1d00ba 100644 --- a/dom/base/Comment.h +++ b/dom/base/Comment.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class Comment final : public nsGenericDOMDataNode, - public nsIDOMComment + public nsIDOMComment { private: void Init() diff --git a/dom/base/Console.h b/dom/base/Console.h index 67ca8ff3595..0c0a356382b 100644 --- a/dom/base/Console.h +++ b/dom/base/Console.h @@ -26,7 +26,7 @@ class ConsoleCallData; struct ConsoleStackEntry; class Console final : public nsIObserver - , public nsWrapperCache + , public nsWrapperCache { ~Console(); diff --git a/dom/base/DOMImplementation.h b/dom/base/DOMImplementation.h index 4cbf44fa27e..8b2a1914393 100644 --- a/dom/base/DOMImplementation.h +++ b/dom/base/DOMImplementation.h @@ -25,7 +25,7 @@ namespace dom { class DocumentType; class DOMImplementation final : public nsIDOMDOMImplementation - , public nsWrapperCache + , public nsWrapperCache { ~DOMImplementation() { diff --git a/dom/base/DOMParser.h b/dom/base/DOMParser.h index 9ee16934c6c..b4adeffefec 100644 --- a/dom/base/DOMParser.h +++ b/dom/base/DOMParser.h @@ -21,8 +21,8 @@ namespace mozilla { namespace dom { class DOMParser final : public nsIDOMParser, - public nsSupportsWeakReference, - public nsWrapperCache + public nsSupportsWeakReference, + public nsWrapperCache { typedef mozilla::dom::GlobalObject GlobalObject; diff --git a/dom/base/DOMRect.h b/dom/base/DOMRect.h index fb7dfaeff1e..d0e94e54a12 100644 --- a/dom/base/DOMRect.h +++ b/dom/base/DOMRect.h @@ -76,7 +76,7 @@ protected: }; class DOMRect final : public DOMRectReadOnly - , public nsIDOMClientRect + , public nsIDOMClientRect { public: explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0, @@ -147,7 +147,7 @@ private: }; class DOMRectList final : public nsIDOMClientRectList, - public nsWrapperCache + public nsWrapperCache { ~DOMRectList() {} diff --git a/dom/base/Element.h b/dom/base/Element.h index 8044541db0c..100243f496e 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -1467,45 +1467,44 @@ _elementName::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const #define NS_FORWARD_NSIDOMELEMENT_TO_GENERIC \ typedef mozilla::dom::Element Element; \ -NS_IMETHOD GetTagName(nsAString& aTagName) final override \ +NS_IMETHOD GetTagName(nsAString& aTagName) final override \ { \ Element::GetTagName(aTagName); \ return NS_OK; \ } \ -NS_IMETHOD GetId(nsAString& aId) final override \ +NS_IMETHOD GetId(nsAString& aId) final override \ { \ Element::GetId(aId); \ return NS_OK; \ } \ -NS_IMETHOD SetId(const nsAString& aId) final override \ +NS_IMETHOD SetId(const nsAString& aId) final override \ { \ Element::SetId(aId); \ return NS_OK; \ } \ -NS_IMETHOD GetClassName(nsAString& aClassName) final override \ +NS_IMETHOD GetClassName(nsAString& aClassName) final override \ { \ Element::GetClassName(aClassName); \ return NS_OK; \ } \ -NS_IMETHOD SetClassName(const nsAString& aClassName) final override \ +NS_IMETHOD SetClassName(const nsAString& aClassName) final override \ { \ Element::SetClassName(aClassName); \ return NS_OK; \ } \ -NS_IMETHOD GetClassList(nsISupports** aClassList) final override \ +NS_IMETHOD GetClassList(nsISupports** aClassList) final override \ { \ Element::GetClassList(aClassList); \ return NS_OK; \ } \ -NS_IMETHOD GetAttributes(nsIDOMMozNamedAttrMap** aAttributes) final \ - override \ +NS_IMETHOD GetAttributes(nsIDOMMozNamedAttrMap** aAttributes) final override \ { \ NS_ADDREF(*aAttributes = Attributes()); \ return NS_OK; \ } \ using Element::GetAttribute; \ -NS_IMETHOD GetAttribute(const nsAString& name, nsAString& _retval) final \ - override \ +NS_IMETHOD GetAttribute(const nsAString& name, nsAString& _retval) final \ + override \ { \ nsString attr; \ GetAttribute(name, attr); \ @@ -1514,13 +1513,13 @@ NS_IMETHOD GetAttribute(const nsAString& name, nsAString& _retval) final \ } \ NS_IMETHOD GetAttributeNS(const nsAString& namespaceURI, \ const nsAString& localName, \ - nsAString& _retval) final override \ + nsAString& _retval) final override \ { \ Element::GetAttributeNS(namespaceURI, localName, _retval); \ return NS_OK; \ } \ NS_IMETHOD SetAttribute(const nsAString& name, \ - const nsAString& value) override \ + const nsAString& value) override \ { \ mozilla::ErrorResult rv; \ Element::SetAttribute(name, value, rv); \ @@ -1528,22 +1527,21 @@ NS_IMETHOD SetAttribute(const nsAString& name, \ } \ NS_IMETHOD SetAttributeNS(const nsAString& namespaceURI, \ const nsAString& qualifiedName, \ - const nsAString& value) final override \ + const nsAString& value) final override \ { \ mozilla::ErrorResult rv; \ Element::SetAttributeNS(namespaceURI, qualifiedName, value, rv); \ return rv.ErrorCode(); \ } \ using Element::RemoveAttribute; \ -NS_IMETHOD RemoveAttribute(const nsAString& name) final override \ +NS_IMETHOD RemoveAttribute(const nsAString& name) final override \ { \ mozilla::ErrorResult rv; \ RemoveAttribute(name, rv); \ return rv.ErrorCode(); \ } \ NS_IMETHOD RemoveAttributeNS(const nsAString& namespaceURI, \ - const nsAString& localName) final \ - override \ + const nsAString& localName) final override \ { \ mozilla::ErrorResult rv; \ Element::RemoveAttributeNS(namespaceURI, localName, rv); \ @@ -1551,31 +1549,31 @@ NS_IMETHOD RemoveAttributeNS(const nsAString& namespaceURI, \ } \ using Element::HasAttribute; \ NS_IMETHOD HasAttribute(const nsAString& name, \ - bool* _retval) final override \ + bool* _retval) final override \ { \ *_retval = HasAttribute(name); \ return NS_OK; \ } \ NS_IMETHOD HasAttributeNS(const nsAString& namespaceURI, \ const nsAString& localName, \ - bool* _retval) final override \ + bool* _retval) final override \ { \ *_retval = Element::HasAttributeNS(namespaceURI, localName); \ return NS_OK; \ } \ -NS_IMETHOD HasAttributes(bool* _retval) final override \ +NS_IMETHOD HasAttributes(bool* _retval) final override \ { \ *_retval = Element::HasAttributes(); \ return NS_OK; \ } \ NS_IMETHOD GetAttributeNode(const nsAString& name, \ - nsIDOMAttr** _retval) final override \ + nsIDOMAttr** _retval) final override \ { \ NS_IF_ADDREF(*_retval = Element::GetAttributeNode(name)); \ return NS_OK; \ } \ NS_IMETHOD SetAttributeNode(nsIDOMAttr* newAttr, \ - nsIDOMAttr** _retval) final override \ + nsIDOMAttr** _retval) final override \ { \ if (!newAttr) { \ return NS_ERROR_INVALID_POINTER; \ @@ -1586,7 +1584,7 @@ NS_IMETHOD SetAttributeNode(nsIDOMAttr* newAttr, \ return rv.ErrorCode(); \ } \ NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* oldAttr, \ - nsIDOMAttr** _retval) final override \ + nsIDOMAttr** _retval) final override \ { \ if (!oldAttr) { \ return NS_ERROR_INVALID_POINTER; \ @@ -1598,14 +1596,14 @@ NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* oldAttr, \ } \ NS_IMETHOD GetAttributeNodeNS(const nsAString& namespaceURI, \ const nsAString& localName, \ - nsIDOMAttr** _retval) final override \ + nsIDOMAttr** _retval) final override \ { \ NS_IF_ADDREF(*_retval = Element::GetAttributeNodeNS(namespaceURI, \ localName)); \ return NS_OK; \ } \ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* newAttr, \ - nsIDOMAttr** _retval) final override \ + nsIDOMAttr** _retval) final override \ { \ mozilla::ErrorResult rv; \ mozilla::dom::Attr* attr = static_cast(newAttr); \ @@ -1613,34 +1611,33 @@ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* newAttr, \ return rv.ErrorCode(); \ } \ NS_IMETHOD GetElementsByTagName(const nsAString& name, \ - nsIDOMHTMLCollection** _retval) final \ - override \ + nsIDOMHTMLCollection** _retval) final \ + override \ { \ Element::GetElementsByTagName(name, _retval); \ return NS_OK; \ } \ NS_IMETHOD GetElementsByTagNameNS(const nsAString& namespaceURI, \ const nsAString& localName, \ - nsIDOMHTMLCollection** _retval) final \ - override\ + nsIDOMHTMLCollection** _retval) final \ + override \ { \ return Element::GetElementsByTagNameNS(namespaceURI, localName, \ _retval); \ } \ NS_IMETHOD GetElementsByClassName(const nsAString& classes, \ - nsIDOMHTMLCollection** _retval) final \ - override\ + nsIDOMHTMLCollection** _retval) final \ + override \ { \ return Element::GetElementsByClassName(classes, _retval); \ } \ -NS_IMETHOD GetChildElements(nsIDOMNodeList** aChildElements) final \ - override \ +NS_IMETHOD GetChildElements(nsIDOMNodeList** aChildElements) final override \ { \ nsIHTMLCollection* list = FragmentOrElement::Children(); \ return CallQueryInterface(list, aChildElements); \ } \ -NS_IMETHOD GetFirstElementChild(nsIDOMElement** aFirstElementChild) final \ - override \ +NS_IMETHOD GetFirstElementChild(nsIDOMElement** aFirstElementChild) final \ + override \ { \ Element* element = Element::GetFirstElementChild(); \ if (!element) { \ @@ -1649,8 +1646,8 @@ NS_IMETHOD GetFirstElementChild(nsIDOMElement** aFirstElementChild) final \ } \ return CallQueryInterface(element, aFirstElementChild); \ } \ -NS_IMETHOD GetLastElementChild(nsIDOMElement** aLastElementChild) final \ - override \ +NS_IMETHOD GetLastElementChild(nsIDOMElement** aLastElementChild) final \ + override \ { \ Element* element = Element::GetLastElementChild(); \ if (!element) { \ @@ -1660,7 +1657,7 @@ NS_IMETHOD GetLastElementChild(nsIDOMElement** aLastElementChild) final \ return CallQueryInterface(element, aLastElementChild); \ } \ NS_IMETHOD GetPreviousElementSibling(nsIDOMElement** aPreviousElementSibling) \ - final override \ + final override \ { \ Element* element = Element::GetPreviousElementSibling(); \ if (!element) { \ @@ -1670,7 +1667,7 @@ NS_IMETHOD GetPreviousElementSibling(nsIDOMElement** aPreviousElementSibling) \ return CallQueryInterface(element, aPreviousElementSibling); \ } \ NS_IMETHOD GetNextElementSibling(nsIDOMElement** aNextElementSibling) \ - final override \ + final override \ { \ Element* element = Element::GetNextElementSibling(); \ if (!element) { \ @@ -1679,126 +1676,123 @@ NS_IMETHOD GetNextElementSibling(nsIDOMElement** aNextElementSibling) \ } \ return CallQueryInterface(element, aNextElementSibling); \ } \ -NS_IMETHOD GetChildElementCount(uint32_t* aChildElementCount) final \ - override \ +NS_IMETHOD GetChildElementCount(uint32_t* aChildElementCount) final override \ { \ *aChildElementCount = Element::ChildElementCount(); \ return NS_OK; \ } \ -NS_IMETHOD MozRemove() final override \ +NS_IMETHOD MozRemove() final override \ { \ nsINode::Remove(); \ return NS_OK; \ } \ -NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) final \ - override \ +NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) final override \ { \ *_retval = Element::GetClientRects().take(); \ return NS_OK; \ } \ -NS_IMETHOD GetBoundingClientRect(nsIDOMClientRect** _retval) final \ - override \ +NS_IMETHOD GetBoundingClientRect(nsIDOMClientRect** _retval) final override \ { \ *_retval = Element::GetBoundingClientRect().take(); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollTop(int32_t* aScrollTop) final override \ +NS_IMETHOD GetScrollTop(int32_t* aScrollTop) final override \ { \ *aScrollTop = Element::ScrollTop(); \ return NS_OK; \ } \ -NS_IMETHOD SetScrollTop(int32_t aScrollTop) final override \ +NS_IMETHOD SetScrollTop(int32_t aScrollTop) final override \ { \ Element::SetScrollTop(aScrollTop); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollLeft(int32_t* aScrollLeft) final override \ +NS_IMETHOD GetScrollLeft(int32_t* aScrollLeft) final override \ { \ *aScrollLeft = Element::ScrollLeft(); \ return NS_OK; \ } \ -NS_IMETHOD SetScrollLeft(int32_t aScrollLeft) final override \ +NS_IMETHOD SetScrollLeft(int32_t aScrollLeft) final override \ { \ Element::SetScrollLeft(aScrollLeft); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollWidth(int32_t* aScrollWidth) final override \ +NS_IMETHOD GetScrollWidth(int32_t* aScrollWidth) final override \ { \ *aScrollWidth = Element::ScrollWidth(); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollHeight(int32_t* aScrollHeight) final override \ +NS_IMETHOD GetScrollHeight(int32_t* aScrollHeight) final override \ { \ *aScrollHeight = Element::ScrollHeight(); \ return NS_OK; \ } \ -NS_IMETHOD GetClientTop(int32_t* aClientTop) final override \ +NS_IMETHOD GetClientTop(int32_t* aClientTop) final override \ { \ *aClientTop = Element::ClientTop(); \ return NS_OK; \ } \ -NS_IMETHOD GetClientLeft(int32_t* aClientLeft) final override \ +NS_IMETHOD GetClientLeft(int32_t* aClientLeft) final override \ { \ *aClientLeft = Element::ClientLeft(); \ return NS_OK; \ } \ -NS_IMETHOD GetClientWidth(int32_t* aClientWidth) final override \ +NS_IMETHOD GetClientWidth(int32_t* aClientWidth) final override \ { \ *aClientWidth = Element::ClientWidth(); \ return NS_OK; \ } \ -NS_IMETHOD GetClientHeight(int32_t* aClientHeight) final override \ +NS_IMETHOD GetClientHeight(int32_t* aClientHeight) final override \ { \ *aClientHeight = Element::ClientHeight(); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollLeftMax(int32_t* aScrollLeftMax) final override \ +NS_IMETHOD GetScrollLeftMax(int32_t* aScrollLeftMax) final override \ { \ *aScrollLeftMax = Element::ScrollLeftMax(); \ return NS_OK; \ } \ -NS_IMETHOD GetScrollTopMax(int32_t* aScrollTopMax) final override \ +NS_IMETHOD GetScrollTopMax(int32_t* aScrollTopMax) final override \ { \ *aScrollTopMax = Element::ScrollTopMax(); \ return NS_OK; \ } \ NS_IMETHOD MozMatchesSelector(const nsAString& selector, \ - bool* _retval) final override \ + bool* _retval) final override \ { \ mozilla::ErrorResult rv; \ *_retval = Element::MozMatchesSelector(selector, rv); \ return rv.ErrorCode(); \ } \ -NS_IMETHOD SetCapture(bool retargetToElement) final override \ +NS_IMETHOD SetCapture(bool retargetToElement) final override \ { \ Element::SetCapture(retargetToElement); \ return NS_OK; \ } \ -NS_IMETHOD ReleaseCapture(void) final override \ +NS_IMETHOD ReleaseCapture(void) final override \ { \ Element::ReleaseCapture(); \ return NS_OK; \ } \ -NS_IMETHOD MozRequestFullScreen(void) final override \ +NS_IMETHOD MozRequestFullScreen(void) final override \ { \ mozilla::ErrorResult rv; \ Element::MozRequestFullScreen(nullptr, JS::UndefinedHandleValue, rv); \ return rv.ErrorCode(); \ } \ -NS_IMETHOD MozRequestPointerLock(void) final override \ +NS_IMETHOD MozRequestPointerLock(void) final override \ { \ Element::MozRequestPointerLock(); \ return NS_OK; \ } \ using nsINode::QuerySelector; \ NS_IMETHOD QuerySelector(const nsAString& aSelector, \ - nsIDOMElement **aReturn) final override \ + nsIDOMElement **aReturn) final override \ { \ return nsINode::QuerySelector(aSelector, aReturn); \ } \ using nsINode::QuerySelectorAll; \ NS_IMETHOD QuerySelectorAll(const nsAString& aSelector, \ - nsIDOMNodeList **aReturn) final override \ + nsIDOMNodeList **aReturn) final override \ { \ return nsINode::QuerySelectorAll(aSelector, aReturn); \ } diff --git a/dom/base/EventSource.h b/dom/base/EventSource.h index 7086b9f3f20..6815b85f81a 100644 --- a/dom/base/EventSource.h +++ b/dom/base/EventSource.h @@ -37,11 +37,11 @@ class AsyncVerifyRedirectCallbackFwr; struct EventSourceInit; class EventSource final : public DOMEventTargetHelper - , public nsIObserver - , public nsIStreamListener - , public nsIChannelEventSink - , public nsIInterfaceRequestor - , public nsSupportsWeakReference + , public nsIObserver + , public nsIStreamListener + , public nsIChannelEventSink + , public nsIInterfaceRequestor + , public nsSupportsWeakReference { friend class AsyncVerifyRedirectCallbackFwr; diff --git a/dom/base/File.cpp b/dom/base/File.cpp index 6dfaf680a8e..dfd05f746c3 100644 --- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -52,8 +52,8 @@ namespace dom { // from NS_NewByteInputStream is held alive as long as the // stream is. We do that by passing back this class instead. class DataOwnerAdapter final : public nsIInputStream, - public nsISeekableStream, - public nsIIPCSerializableInputStream + public nsISeekableStream, + public nsIIPCSerializableInputStream { typedef FileImplMemory::DataOwner DataOwner; public: diff --git a/dom/base/File.h b/dom/base/File.h index c8d4ac7ae23..ad704a007c2 100644 --- a/dom/base/File.h +++ b/dom/base/File.h @@ -52,10 +52,10 @@ class FileImpl; class OwningArrayBufferOrArrayBufferViewOrBlobOrString; class File final : public nsIDOMFile - , public nsIXHRSendable - , public nsIMutable - , public nsSupportsWeakReference - , public nsWrapperCache + , public nsIXHRSendable + , public nsIMutable + , public nsSupportsWeakReference + , public nsWrapperCache { public: NS_DECL_NSIDOMBLOB @@ -524,7 +524,8 @@ public: return true; } - class DataOwner final : public mozilla::LinkedListElement { + class DataOwner final : public mozilla::LinkedListElement + { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DataOwner) DataOwner(void* aMemoryBuffer, uint64_t aLength) @@ -814,7 +815,7 @@ private: }; class FileList final : public nsIDOMFileList, - public nsWrapperCache + public nsWrapperCache { ~FileList() {} diff --git a/dom/base/ImportManager.h b/dom/base/ImportManager.h index d63d7c84940..8d1aa77c342 100644 --- a/dom/base/ImportManager.h +++ b/dom/base/ImportManager.h @@ -62,7 +62,7 @@ class ImportManager; typedef nsTHashtable> NodeTable; class ImportLoader final : public nsIStreamListener - , public nsIDOMEventListener + , public nsIDOMEventListener { // A helper inner class to decouple the logic of updating the import graph diff --git a/dom/base/MessageChannel.h b/dom/base/MessageChannel.h index 87b28832a61..d9b1fb52f59 100644 --- a/dom/base/MessageChannel.h +++ b/dom/base/MessageChannel.h @@ -22,7 +22,7 @@ namespace dom { class MessagePort; class MessageChannel final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/base/MessagePortList.h b/dom/base/MessagePortList.h index 5b62bf72fac..b6f09ced68b 100644 --- a/dom/base/MessagePortList.h +++ b/dom/base/MessagePortList.h @@ -19,7 +19,7 @@ namespace mozilla { namespace dom { class MessagePortList final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { ~MessagePortList() {} diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index ca1498159f3..332aa4d0564 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -105,8 +105,8 @@ class AudioChannelManager; } // namespace system class Navigator final : public nsIDOMNavigator - , public nsIMozNavigatorNetwork - , public nsWrapperCache + , public nsIMozNavigatorNetwork + , public nsWrapperCache { public: explicit Navigator(nsPIDOMWindow* aInnerWindow); diff --git a/dom/base/NodeIterator.h b/dom/base/NodeIterator.h index 54d89f2fc17..a3313df74e8 100644 --- a/dom/base/NodeIterator.h +++ b/dom/base/NodeIterator.h @@ -23,8 +23,8 @@ namespace mozilla { namespace dom { class NodeIterator final : public nsIDOMNodeIterator, - public nsTraversal, - public nsStubMutationObserver + public nsTraversal, + public nsStubMutationObserver { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/base/ResponsiveImageSelector.cpp b/dom/base/ResponsiveImageSelector.cpp index 9339fcd36a6..888077d505c 100644 --- a/dom/base/ResponsiveImageSelector.cpp +++ b/dom/base/ResponsiveImageSelector.cpp @@ -103,20 +103,18 @@ ResponsiveImageSelector::SetCandidatesFromSourceSet(const nsAString & aSrcSet) // Find end of url for (;iter != end && !nsContentUtils::IsHTMLWhitespace(*iter); ++iter); - urlEnd = iter; - // Omit trailing commas from URL. // Multiple commas are a non-fatal error. - while (urlEnd != url) { - if (*(--urlEnd) != char16_t(',')) { - urlEnd++; + while (iter != url) { + if (*(--iter) != char16_t(',')) { + iter++; break; } } - const nsDependentSubstring &urlStr = Substring(url, urlEnd); + const nsDependentSubstring &urlStr = Substring(url, iter); - MOZ_ASSERT(url != urlEnd, "Shouldn't have empty URL at this point"); + MOZ_ASSERT(url != iter, "Shouldn't have empty URL at this point"); ResponsiveImageCandidate candidate; if (candidate.ConsumeDescriptors(iter, end)) { diff --git a/dom/base/SubtleCrypto.h b/dom/base/SubtleCrypto.h index 9712e740aef..eb530496aa9 100644 --- a/dom/base/SubtleCrypto.h +++ b/dom/base/SubtleCrypto.h @@ -22,7 +22,7 @@ class Promise; typedef ArrayBufferViewOrArrayBuffer CryptoOperationData; class SubtleCrypto final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { ~SubtleCrypto() {} diff --git a/dom/base/TextInputProcessor.h b/dom/base/TextInputProcessor.h index 40160532088..e8e7336b1cd 100644 --- a/dom/base/TextInputProcessor.h +++ b/dom/base/TextInputProcessor.h @@ -21,7 +21,7 @@ class TextEventDispatcher; } // namespace widget class TextInputProcessor final : public nsITextInputProcessor - , public widget::TextEventDispatcherListener + , public widget::TextEventDispatcherListener { typedef mozilla::widget::IMENotification IMENotification; typedef mozilla::widget::TextEventDispatcher TextEventDispatcher; diff --git a/dom/base/URLSearchParams.h b/dom/base/URLSearchParams.h index 86ac459008d..173628fb58c 100644 --- a/dom/base/URLSearchParams.h +++ b/dom/base/URLSearchParams.h @@ -27,7 +27,7 @@ public: }; class URLSearchParams final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { ~URLSearchParams(); diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index e03e15ef6c5..3c98128121c 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -62,11 +62,11 @@ namespace mozilla { namespace dom { class WebSocketImpl final : public nsIInterfaceRequestor - , public nsIWebSocketListener - , public nsIObserver - , public nsSupportsWeakReference - , public nsIRequest - , public nsIEventTarget + , public nsIWebSocketListener + , public nsIObserver + , public nsSupportsWeakReference + , public nsIRequest + , public nsIEventTarget { public: NS_DECL_NSIINTERFACEREQUESTOR diff --git a/dom/base/nsContentPermissionHelper.h b/dom/base/nsContentPermissionHelper.h index f51d706c610..e3368e836dd 100644 --- a/dom/base/nsContentPermissionHelper.h +++ b/dom/base/nsContentPermissionHelper.h @@ -107,7 +107,7 @@ class nsContentPermissionRequestProxy : public nsIContentPermissionRequest * RemotePermissionRequest will send a prompt ipdl request to b2g process. */ class RemotePermissionRequest final : public nsISupports - , public mozilla::dom::PContentPermissionRequestChild + , public mozilla::dom::PContentPermissionRequestChild { public: NS_DECL_ISUPPORTS diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 5754db9a443..6604b747ea6 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -399,7 +399,7 @@ EventListenerManagerHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) } class SameOriginCheckerImpl final : public nsIChannelEventSink, - public nsIInterfaceRequestor + public nsIInterfaceRequestor { ~SameOriginCheckerImpl() {} diff --git a/dom/base/nsDOMMutationObserver.h b/dom/base/nsDOMMutationObserver.h index 47762d434c7..76d509365d7 100644 --- a/dom/base/nsDOMMutationObserver.h +++ b/dom/base/nsDOMMutationObserver.h @@ -31,7 +31,7 @@ class nsDOMMutationObserver; using mozilla::dom::MutationObservingInfo; class nsDOMMutationRecord final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { virtual ~nsDOMMutationRecord() {} @@ -443,7 +443,7 @@ private: { 0x9e, 0xab, 0x07, 0x47, 0xa9, 0xe4, 0x65, 0xb4 } } class nsDOMMutationObserver final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: nsDOMMutationObserver(already_AddRefed&& aOwner, diff --git a/dom/base/nsDOMScriptObjectFactory.h b/dom/base/nsDOMScriptObjectFactory.h index 0ef6ead0f9c..03263da0a0e 100644 --- a/dom/base/nsDOMScriptObjectFactory.h +++ b/dom/base/nsDOMScriptObjectFactory.h @@ -23,7 +23,7 @@ #include "mozilla/Attributes.h" class nsDOMScriptObjectFactory final : public nsIDOMScriptObjectFactory, - public nsIObserver + public nsIObserver { ~nsDOMScriptObjectFactory() {} diff --git a/dom/base/nsDOMSerializer.h b/dom/base/nsDOMSerializer.h index 1560998ed90..27accd6ecb7 100644 --- a/dom/base/nsDOMSerializer.h +++ b/dom/base/nsDOMSerializer.h @@ -15,7 +15,7 @@ class nsINode; class nsDOMSerializer final : public nsIDOMSerializer, - public nsWrapperCache + public nsWrapperCache { public: nsDOMSerializer(); diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h index e3b351e73d8..aa13a3bd4c0 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h @@ -55,7 +55,7 @@ private: }; class nsDOMWindowUtils final : public nsIDOMWindowUtils, - public nsSupportsWeakReference + public nsSupportsWeakReference { typedef mozilla::widget::TextEventDispatcher TextEventDispatcher; diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index cc048458bb6..1b1bf79ee6a 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -597,8 +597,8 @@ protected: // XXXbz I wish we could just derive the _allcaps thing from _i #define DECL_SHIM(_i, _allcaps) \ - class _i##Shim final : public nsIInterfaceRequestor, \ - public _i \ + class _i##Shim final : public nsIInterfaceRequestor, \ + public _i \ { \ ~_i##Shim() {} \ public: \ diff --git a/dom/base/nsFocusManager.h b/dom/base/nsFocusManager.h index 5c2b433643a..b93571d5208 100644 --- a/dom/base/nsFocusManager.h +++ b/dom/base/nsFocusManager.h @@ -32,8 +32,8 @@ struct nsDelayedBlurOrFocusEvent; */ class nsFocusManager final : public nsIFocusManager, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { typedef mozilla::widget::InputContextAction InputContextAction; diff --git a/dom/base/nsFormData.h b/dom/base/nsFormData.h index 59671337f4e..f830994a234 100644 --- a/dom/base/nsFormData.h +++ b/dom/base/nsFormData.h @@ -26,9 +26,9 @@ class GlobalObject; } // namespace mozilla class nsFormData final : public nsIDOMFormData, - public nsIXHRSendable, - public nsFormSubmission, - public nsWrapperCache + public nsIXHRSendable, + public nsFormSubmission, + public nsWrapperCache { private: ~nsFormData() {} diff --git a/dom/base/nsFrameLoader.h b/dom/base/nsFrameLoader.h index 326d725dd15..b2ba049a0b3 100644 --- a/dom/base/nsFrameLoader.h +++ b/dom/base/nsFrameLoader.h @@ -55,8 +55,8 @@ class QX11EmbedContainer; #endif class nsFrameLoader final : public nsIFrameLoader, - public nsStubMutationObserver, - public mozilla::dom::ipc::MessageManagerCallback + public nsStubMutationObserver, + public mozilla::dom::ipc::MessageManagerCallback { friend class AutoResetInShow; typedef mozilla::dom::PBrowserParent PBrowserParent; diff --git a/dom/base/nsFrameMessageManager.h b/dom/base/nsFrameMessageManager.h index 0a74f820ba5..bdd1fa8e159 100644 --- a/dom/base/nsFrameMessageManager.h +++ b/dom/base/nsFrameMessageManager.h @@ -153,10 +153,10 @@ private: }; class nsFrameMessageManager final : public nsIContentFrameMessageManager, - public nsIMessageBroadcaster, - public nsIFrameScriptLoader, - public nsIProcessScriptLoader, - public nsIProcessChecker + public nsIMessageBroadcaster, + public nsIFrameScriptLoader, + public nsIProcessScriptLoader, + public nsIProcessChecker { friend class mozilla::dom::MessageManagerReporter; typedef mozilla::dom::StructuredCloneData StructuredCloneData; diff --git a/dom/base/nsGenConImageContent.cpp b/dom/base/nsGenConImageContent.cpp index 3f6ddd3e39d..8a49a9d0e9c 100644 --- a/dom/base/nsGenConImageContent.cpp +++ b/dom/base/nsGenConImageContent.cpp @@ -21,7 +21,7 @@ using namespace mozilla; class nsGenConImageContent final : public nsXMLElement, - public nsImageLoadingContent + public nsImageLoadingContent { public: explicit nsGenConImageContent(already_AddRefed& aNodeInfo) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 2a11fb4df91..6d2694fa9f3 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -477,7 +477,7 @@ static const char sPopStatePrefStr[] = "browser.history.allowPopState"; * on nsGlobalWindow, where any script could see it. */ class nsGlobalWindowObserver final : public nsIObserver, - public nsIInterfaceRequestor + public nsIInterfaceRequestor { public: explicit nsGlobalWindowObserver(nsGlobalWindow* aWindow) : mWindow(aWindow) {} diff --git a/dom/base/nsLocation.h b/dom/base/nsLocation.h index 2db8315e4ec..ea420e356a7 100644 --- a/dom/base/nsLocation.h +++ b/dom/base/nsLocation.h @@ -26,8 +26,8 @@ class nsIDocShellLoadInfo; //***************************************************************************** class nsLocation final : public nsIDOMLocation - , public nsWrapperCache - , public mozilla::dom::URLSearchParamsObserver + , public nsWrapperCache + , public mozilla::dom::URLSearchParamsObserver { typedef mozilla::ErrorResult ErrorResult; diff --git a/dom/base/nsMimeTypeArray.h b/dom/base/nsMimeTypeArray.h index ee6631a532f..d4a8f5618b3 100644 --- a/dom/base/nsMimeTypeArray.h +++ b/dom/base/nsMimeTypeArray.h @@ -17,7 +17,7 @@ class nsMimeType; class nsPluginElement; class nsMimeTypeArray final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit nsMimeTypeArray(nsPIDOMWindow* aWindow); diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index a85be30e81a..578de9884a2 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -1293,8 +1293,8 @@ nsObjectLoadingContent::GetBaseURI(nsIURI **aResult) // see an interface requestor even though WebIDL bindings don't expose // that stuff. class ObjectInterfaceRequestorShim final : public nsIInterfaceRequestor, - public nsIChannelEventSink, - public nsIStreamListener + public nsIChannelEventSink, + public nsIStreamListener { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/base/nsPluginArray.h b/dom/base/nsPluginArray.h index e9b5eb8a779..dc82f4f951d 100644 --- a/dom/base/nsPluginArray.h +++ b/dom/base/nsPluginArray.h @@ -18,8 +18,8 @@ class nsPluginElement; class nsMimeType; class nsPluginArray final : public nsIObserver, - public nsSupportsWeakReference, - public nsWrapperCache + public nsSupportsWeakReference, + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -76,7 +76,7 @@ private: }; class nsPluginElement final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/base/nsRange.h b/dom/base/nsRange.h index 2438c21e550..b5330a0aa12 100644 --- a/dom/base/nsRange.h +++ b/dom/base/nsRange.h @@ -31,8 +31,8 @@ class DOMRectList; } class nsRange final : public nsIDOMRange, - public nsStubMutationObserver, - public nsWrapperCache + public nsStubMutationObserver, + public nsWrapperCache { typedef mozilla::ErrorResult ErrorResult; typedef mozilla::dom::DOMRect DOMRect; diff --git a/dom/base/nsTextNode.cpp b/dom/base/nsTextNode.cpp index 7e5a7e96bfe..75d32da204f 100644 --- a/dom/base/nsTextNode.cpp +++ b/dom/base/nsTextNode.cpp @@ -28,7 +28,7 @@ using namespace mozilla::dom; * class used to implement attr() generated content */ class nsAttributeTextNode final : public nsTextNode, - public nsStubMutationObserver + public nsStubMutationObserver { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/base/nsWindowMemoryReporter.h b/dom/base/nsWindowMemoryReporter.h index 59e8e242b13..7d76ab927d2 100644 --- a/dom/base/nsWindowMemoryReporter.h +++ b/dom/base/nsWindowMemoryReporter.h @@ -140,8 +140,8 @@ public: * */ class nsWindowMemoryReporter final : public nsIMemoryReporter, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/dom/base/nsXMLHttpRequest.h b/dom/base/nsXMLHttpRequest.h index fec3deb958b..ca37a7c45ac 100644 --- a/dom/base/nsXMLHttpRequest.h +++ b/dom/base/nsXMLHttpRequest.h @@ -147,7 +147,7 @@ public: }; class nsXMLHttpRequestUpload final : public nsXHREventTarget, - public nsIXMLHttpRequestUpload + public nsIXMLHttpRequestUpload { public: explicit nsXMLHttpRequestUpload(mozilla::DOMEventTargetHelper* aOwner) @@ -180,15 +180,15 @@ class nsXMLHttpRequestXPCOMifier; // Make sure that any non-DOM interfaces added here are also added to // nsXMLHttpRequestXPCOMifier. class nsXMLHttpRequest final : public nsXHREventTarget, - public nsIXMLHttpRequest, - public nsIJSXMLHttpRequest, - public nsIStreamListener, - public nsIChannelEventSink, - public nsIProgressEventSink, - public nsIInterfaceRequestor, - public nsSupportsWeakReference, - public nsITimerCallback, - public nsISizeOfEventTarget + public nsIXMLHttpRequest, + public nsIJSXMLHttpRequest, + public nsIStreamListener, + public nsIChannelEventSink, + public nsIProgressEventSink, + public nsIInterfaceRequestor, + public nsSupportsWeakReference, + public nsITimerCallback, + public nsISizeOfEventTarget { friend class nsXHRParseEndListener; friend class nsXMLHttpRequestXPCOMifier; @@ -634,7 +634,8 @@ protected: nsCOMPtr mXMLParserStreamListener; // used to implement getAllResponseHeaders() - class nsHeaderVisitor : public nsIHttpHeaderVisitor { + class nsHeaderVisitor : public nsIHttpHeaderVisitor + { public: NS_DECL_ISUPPORTS NS_DECL_NSIHTTPHEADERVISITOR @@ -820,10 +821,10 @@ private: // A shim class designed to expose the non-DOM interfaces of // XMLHttpRequest via XPCOM stuff. class nsXMLHttpRequestXPCOMifier final : public nsIStreamListener, - public nsIChannelEventSink, - public nsIProgressEventSink, - public nsIInterfaceRequestor, - public nsITimerCallback + public nsIChannelEventSink, + public nsIProgressEventSink, + public nsIInterfaceRequestor, + public nsITimerCallback { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpRequestXPCOMifier, diff --git a/dom/base/test/chrome/cpows_parent.xul b/dom/base/test/chrome/cpows_parent.xul index 1e0db8c41fe..c447c67e9c7 100644 --- a/dom/base/test/chrome/cpows_parent.xul +++ b/dom/base/test/chrome/cpows_parent.xul @@ -232,6 +232,12 @@ todo_is(savedElement.toString, savedElement.toString, "toString identity works"); todo_is(savedElement.QueryInterface, savedElement.QueryInterface, "toString identity works"); + is(Object.prototype.toString.call(savedElement), "[object HTMLDivElement]", + "prove that this works (and doesn't leak)"); + + is(Object.prototype.toString.call(savedElement), "[object HTMLDivElement]", + "prove that this works twice (since we cache it and doesn't leak)"); + // This does work because we create a CPOW for isEqualNode that stays // alive as long as we have a reference to the first CPOW (so as long // as it's detectable). diff --git a/dom/bindings/Exceptions.cpp b/dom/bindings/Exceptions.cpp index 7e0bc4ce082..bf21bf2f505 100644 --- a/dom/bindings/Exceptions.cpp +++ b/dom/bindings/Exceptions.cpp @@ -758,7 +758,7 @@ NS_IMETHODIMP JSStackFrame::GetFormattedStack(nsAString& aStack) JS::Rooted stack(cx, mStack); JS::Rooted formattedStack(cx); - if (!JS::StringifySavedFrameStack(cx, stack, &formattedStack)) { + if (!JS::BuildStackString(cx, stack, &formattedStack)) { JS_ClearPendingException(cx); aStack.Truncate(); return NS_OK; diff --git a/dom/bindings/test/test_exception_options_from_jsimplemented.html b/dom/bindings/test/test_exception_options_from_jsimplemented.html index e086d8559b9..58e12fadce4 100644 --- a/dom/bindings/test/test_exception_options_from_jsimplemented.html +++ b/dom/bindings/test/test_exception_options_from_jsimplemented.html @@ -45,13 +45,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592 ise(e.code, DOMException.NOT_SUPPORTED_ERR, "Should have the right 'code'"); ise(e.stack, - "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:38:6\n", + "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:38:7\n", "Exception stack should still only show our code"); ise(e.filename, "http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html", "Should still have the right file name"); ise(e.lineNumber, 38, "Should still have the right line number"); - todo_is(e.columnNumber, 6, + todo_is(e.columnNumber, 7, "No column number support for DOMException yet"); } SimpleTest.finish(); diff --git a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html index 2e5993d37d8..4833b8eda0e 100644 --- a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html +++ b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html @@ -45,7 +45,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592 ensurePromiseFail.bind(null, 1), checkExn.bind(null, 44, "NS_ERROR_UNEXPECTED", "", undefined, ourFile, 1, - "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:44:6\n")), + "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:44:7\n")), t.testPromiseWithThrowingContentPromiseInit(function() { thereIsNoSuchContentFunction1(); }).then( @@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592 checkExn.bind(null, 61, "ReferenceError", "thereIsNoSuchContentFunction2 is not defined", undefined, ourFile, 4, - "doTest/<@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:61:11\n")), + "doTest/<@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:61:11\nAsync*doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:60:7\n")), t.testPromiseWithThrowingChromeThenable().then( ensurePromiseFail.bind(null, 5), checkExn.bind(null, 0, "NS_ERROR_UNEXPECTED", "", undefined, "", 5, "")), @@ -81,13 +81,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592 checkExn.bind(null, 79, "NotFoundError", "We are a second DOMException", DOMException.NOT_FOUND_ERR, ourFile, 7, - "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:79:6\n")), + "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:79:7\n")), t.testPromiseWithDOMExceptionThrowingThenFunction().then( ensurePromiseFail.bind(null, 8), checkExn.bind(null, 85, "NetworkError", "We are a third DOMException", DOMException.NETWORK_ERR, ourFile, 8, - "Async*doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:85:6\n")), + "Async*doTest@http://mochi.test:8888/tests/dom/bindings/test/test_promise_rejections_from_jsimplemented.html:85:7\n")), t.testPromiseWithDOMExceptionThrowingThenable().then( ensurePromiseFail.bind(null, 9), checkExn.bind(null, 0, "TypeMismatchError", diff --git a/dom/bluetooth/BluetoothProfileManagerBase.h b/dom/bluetooth/BluetoothProfileManagerBase.h index 1fadfd99962..517c1cfc388 100644 --- a/dom/bluetooth/BluetoothProfileManagerBase.h +++ b/dom/bluetooth/BluetoothProfileManagerBase.h @@ -89,17 +89,17 @@ public: virtual void GetName(nsACString& aName) = 0; }; -#define BT_DECL_PROFILE_MGR_BASE \ -public: \ - NS_DECL_ISUPPORTS \ - NS_DECL_NSIOBSERVER \ - virtual void OnGetServiceChannel(const nsAString& aDeviceAddress, \ - const nsAString& aServiceUuid, \ +#define BT_DECL_PROFILE_MGR_BASE \ +public: \ + NS_DECL_ISUPPORTS \ + NS_DECL_NSIOBSERVER \ + virtual void OnGetServiceChannel(const nsAString& aDeviceAddress, \ + const nsAString& aServiceUuid, \ int aChannel) override; \ virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) override; \ virtual void GetAddress(nsAString& aDeviceAddress) override; \ virtual bool IsConnected() override; \ - virtual void Connect(const nsAString& aDeviceAddress, \ + virtual void Connect(const nsAString& aDeviceAddress, \ BluetoothProfileController* aController) override; \ virtual void Disconnect(BluetoothProfileController* aController) override; \ virtual void OnConnect(const nsAString& aErrorStr) override; \ diff --git a/dom/bluetooth2/BluetoothProfileManagerBase.h b/dom/bluetooth2/BluetoothProfileManagerBase.h index f7db5907962..833af81abf8 100644 --- a/dom/bluetooth2/BluetoothProfileManagerBase.h +++ b/dom/bluetooth2/BluetoothProfileManagerBase.h @@ -88,17 +88,17 @@ public: virtual void GetName(nsACString& aName) = 0; }; -#define BT_DECL_PROFILE_MGR_BASE \ -public: \ - NS_DECL_ISUPPORTS \ - NS_DECL_NSIOBSERVER \ - virtual void OnGetServiceChannel(const nsAString& aDeviceAddress, \ - const nsAString& aServiceUuid, \ +#define BT_DECL_PROFILE_MGR_BASE \ +public: \ + NS_DECL_ISUPPORTS \ + NS_DECL_NSIOBSERVER \ + virtual void OnGetServiceChannel(const nsAString& aDeviceAddress, \ + const nsAString& aServiceUuid, \ int aChannel) override; \ virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) override; \ virtual void GetAddress(nsAString& aDeviceAddress) override; \ virtual bool IsConnected() override; \ - virtual void Connect(const nsAString& aDeviceAddress, \ + virtual void Connect(const nsAString& aDeviceAddress, \ BluetoothProfileController* aController) override; \ virtual void Disconnect(BluetoothProfileController* aController) override; \ virtual void OnConnect(const nsAString& aErrorStr) override; \ diff --git a/dom/camera/DOMCameraCapabilities.h b/dom/camera/DOMCameraCapabilities.h index 499caff358b..8195a84047a 100644 --- a/dom/camera/DOMCameraCapabilities.h +++ b/dom/camera/DOMCameraCapabilities.h @@ -30,7 +30,7 @@ namespace dom { * CameraRecorderVideoProfile */ class CameraRecorderVideoProfile final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -69,7 +69,7 @@ private: * CameraRecorderAudioProfile */ class CameraRecorderAudioProfile final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -103,7 +103,7 @@ private: * CameraRecorderProfile */ class CameraRecorderProfile final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -149,7 +149,7 @@ private: template class CameraClosedListenerProxy; class CameraRecorderProfiles final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -182,7 +182,7 @@ private: * CameraCapabilities */ class CameraCapabilities final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/camera/DOMCameraControl.h b/dom/camera/DOMCameraControl.h index f850aacf4f5..dae5754d2a2 100644 --- a/dom/camera/DOMCameraControl.h +++ b/dom/camera/DOMCameraControl.h @@ -46,7 +46,7 @@ class StartRecordingHelper; // Main camera control. class nsDOMCameraControl final : public DOMMediaStream - , public nsSupportsWeakReference + , public nsSupportsWeakReference { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_CAMERA_CONTROL_CID) diff --git a/dom/camera/DOMCameraDetectedFace.h b/dom/camera/DOMCameraDetectedFace.h index f73c4cc61ed..45eb49ed8d9 100644 --- a/dom/camera/DOMCameraDetectedFace.h +++ b/dom/camera/DOMCameraDetectedFace.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class DOMCameraDetectedFace final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/cellbroadcast/CellBroadcastMessage.h b/dom/cellbroadcast/CellBroadcastMessage.h index 73f94786f7b..4a606317865 100644 --- a/dom/cellbroadcast/CellBroadcastMessage.h +++ b/dom/cellbroadcast/CellBroadcastMessage.h @@ -20,7 +20,7 @@ namespace dom { class CellBroadcastEtwsInfo; class CellBroadcastMessage final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -92,7 +92,7 @@ private: }; class CellBroadcastEtwsInfo final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/cellbroadcast/ipc/CellBroadcastIPCService.h b/dom/cellbroadcast/ipc/CellBroadcastIPCService.h index 9241203bde3..fe2d170cc16 100644 --- a/dom/cellbroadcast/ipc/CellBroadcastIPCService.h +++ b/dom/cellbroadcast/ipc/CellBroadcastIPCService.h @@ -16,7 +16,7 @@ namespace dom { namespace cellbroadcast { class CellBroadcastIPCService final : public PCellBroadcastChild - , public nsICellBroadcastService + , public nsICellBroadcastService { public: @@ -55,4 +55,4 @@ private: } // namespace dom } // namespace mozilla -#endif // mozilla_dom_cellbroadcast_CellBroadcastIPCService_h \ No newline at end of file +#endif // mozilla_dom_cellbroadcast_CellBroadcastIPCService_h diff --git a/dom/cellbroadcast/ipc/CellBroadcastParent.h b/dom/cellbroadcast/ipc/CellBroadcastParent.h index 3880762bde7..3d79fa0196a 100644 --- a/dom/cellbroadcast/ipc/CellBroadcastParent.h +++ b/dom/cellbroadcast/ipc/CellBroadcastParent.h @@ -16,7 +16,7 @@ namespace dom { namespace cellbroadcast { class CellBroadcastParent final : public PCellBroadcastParent - , public nsICellBroadcastListener + , public nsICellBroadcastListener { public: NS_DECL_ISUPPORTS diff --git a/dom/crypto/CryptoKey.h b/dom/crypto/CryptoKey.h index 5c091fe3395..21548780cd4 100644 --- a/dom/crypto/CryptoKey.h +++ b/dom/crypto/CryptoKey.h @@ -59,8 +59,8 @@ Thus, internally, a key has the following fields: struct JsonWebKey; class CryptoKey final : public nsISupports, - public nsWrapperCache, - public nsNSSShutDownObject + public nsWrapperCache, + public nsNSSShutDownObject { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/datastore/DataStoreService.h b/dom/datastore/DataStoreService.h index 0189ba89284..e740bcfb8a3 100644 --- a/dom/datastore/DataStoreService.h +++ b/dom/datastore/DataStoreService.h @@ -28,7 +28,7 @@ class RetrieveRevisionsCounter; class RevisionAddedEnableStoreCallback; class DataStoreService final : public nsIDataStoreService - , public nsIObserver + , public nsIObserver { friend class ContentChild; friend class FirstRevisionIdCallback; diff --git a/dom/events/CustomEvent.h b/dom/events/CustomEvent.h index 2d37dd3b4a9..b9922e9fb9c 100644 --- a/dom/events/CustomEvent.h +++ b/dom/events/CustomEvent.h @@ -14,7 +14,7 @@ namespace dom { struct CustomEventInit; class CustomEvent final : public Event, - public nsIDOMCustomEvent + public nsIDOMCustomEvent { private: virtual ~CustomEvent(); diff --git a/dom/events/DOMEventTargetHelper.h b/dom/events/DOMEventTargetHelper.h index 9cddf515e89..a64311aa0dd 100644 --- a/dom/events/DOMEventTargetHelper.h +++ b/dom/events/DOMEventTargetHelper.h @@ -281,11 +281,11 @@ NS_DEFINE_STATIC_IID_ACCESSOR(DOMEventTargetHelper, using _class::RemoveEventListener; \ NS_FORWARD_NSIDOMEVENTTARGET(_class::) \ virtual mozilla::EventListenerManager* \ - GetOrCreateListenerManager() override { \ + GetOrCreateListenerManager() override { \ return _class::GetOrCreateListenerManager(); \ } \ virtual mozilla::EventListenerManager* \ - GetExistingListenerManager() const override { \ + GetExistingListenerManager() const override { \ return _class::GetExistingListenerManager(); \ } diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index 934ed029861..a4e7eea2c1e 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -52,7 +52,7 @@ struct TransferItem { { 0x9b, 0xd0, 0xf1, 0x79, 0x09, 0x69, 0xf2, 0xfb } } class DataTransfer final : public nsIDOMDataTransfer, - public nsWrapperCache + public nsWrapperCache { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_DATATRANSFER_IID) diff --git a/dom/events/IMEContentObserver.h b/dom/events/IMEContentObserver.h index f8a598f21d1..ae991e44fa7 100644 --- a/dom/events/IMEContentObserver.h +++ b/dom/events/IMEContentObserver.h @@ -32,11 +32,11 @@ class EventStateManager; // IMEContentObserver notifies widget of any text and selection changes // in the currently focused editor class IMEContentObserver final : public nsISelectionListener - , public nsStubMutationObserver - , public nsIReflowObserver - , public nsIScrollObserver - , public nsSupportsWeakReference - , public nsIEditorObserver + , public nsStubMutationObserver + , public nsIReflowObserver + , public nsIScrollObserver + , public nsSupportsWeakReference + , public nsIEditorObserver { friend class AsyncMergeableNotificationsFlusher; diff --git a/dom/events/ImageCaptureError.h b/dom/events/ImageCaptureError.h index fe5ce88b245..da908e63b33 100644 --- a/dom/events/ImageCaptureError.h +++ b/dom/events/ImageCaptureError.h @@ -21,7 +21,7 @@ namespace dom { * This object should be generated by ImageCapture object only. */ class ImageCaptureError final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/events/MessageEvent.h b/dom/events/MessageEvent.h index ac855a60ba0..6c1eeffbe25 100644 --- a/dom/events/MessageEvent.h +++ b/dom/events/MessageEvent.h @@ -34,7 +34,7 @@ class ServiceWorkerClient; * further details. */ class MessageEvent final : public Event, - public nsIDOMMessageEvent + public nsIDOMMessageEvent { public: MessageEvent(EventTarget* aOwner, diff --git a/dom/events/PaintRequest.h b/dom/events/PaintRequest.h index 97cf18c5a2d..a08f891539b 100644 --- a/dom/events/PaintRequest.h +++ b/dom/events/PaintRequest.h @@ -18,7 +18,7 @@ namespace dom { class DOMRect; class PaintRequest final : public nsIDOMPaintRequest - , public nsWrapperCache + , public nsWrapperCache { public: explicit PaintRequest(nsIDOMEvent* aParent) @@ -55,7 +55,7 @@ private: }; class PaintRequestList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent) diff --git a/dom/events/Touch.h b/dom/events/Touch.h index daacd9cadbb..8b4a0ba6630 100644 --- a/dom/events/Touch.h +++ b/dom/events/Touch.h @@ -21,8 +21,8 @@ namespace dom { class EventTarget; class Touch final : public nsISupports - , public nsWrapperCache - , public WidgetPointerHelper + , public nsWrapperCache + , public WidgetPointerHelper { public: static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal); diff --git a/dom/events/TouchEvent.h b/dom/events/TouchEvent.h index 531c4231cc5..f934d29878e 100644 --- a/dom/events/TouchEvent.h +++ b/dom/events/TouchEvent.h @@ -20,7 +20,7 @@ namespace mozilla { namespace dom { class TouchList final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/events/UIEvent.h b/dom/events/UIEvent.h index a4efc163d39..3635f5eb015 100644 --- a/dom/events/UIEvent.h +++ b/dom/events/UIEvent.h @@ -176,18 +176,18 @@ protected: #define NS_FORWARD_TO_UIEVENT \ NS_FORWARD_NSIDOMUIEVENT(UIEvent::) \ NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION \ - NS_IMETHOD DuplicatePrivateData() override \ + NS_IMETHOD DuplicatePrivateData() override \ { \ return UIEvent::DuplicatePrivateData(); \ } \ NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \ bool aSerializeInterfaceType) \ - override \ + override \ { \ UIEvent::Serialize(aMsg, aSerializeInterfaceType); \ } \ NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \ - void** aIter) override \ + void** aIter) override \ { \ return UIEvent::Deserialize(aMsg, aIter); \ } diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 777527d84bc..4a11c32e1b1 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -45,7 +45,7 @@ namespace dom { using namespace workers; class WorkerFetchResolver final : public FetchDriverObserver, - public WorkerFeature + public WorkerFeature { friend class MainThreadFetchRunnable; friend class WorkerFetchResponseEndRunnable; diff --git a/dom/fetch/FetchDriver.h b/dom/fetch/FetchDriver.h index 33ee192085e..b9cba3d935e 100644 --- a/dom/fetch/FetchDriver.h +++ b/dom/fetch/FetchDriver.h @@ -42,9 +42,9 @@ protected: }; class FetchDriver final : public nsIStreamListener, - public nsIChannelEventSink, - public nsIInterfaceRequestor, - public nsIAsyncVerifyRedirectCallback + public nsIChannelEventSink, + public nsIInterfaceRequestor, + public nsIAsyncVerifyRedirectCallback { public: NS_DECL_ISUPPORTS diff --git a/dom/fetch/Headers.h b/dom/fetch/Headers.h index 371b8f3f2b4..96eca7bb244 100644 --- a/dom/fetch/Headers.h +++ b/dom/fetch/Headers.h @@ -34,7 +34,7 @@ class OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap; * InternalHeaders object. */ class Headers final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Headers) diff --git a/dom/fetch/Request.h b/dom/fetch/Request.h index 2e07ecca381..839faa289a3 100644 --- a/dom/fetch/Request.h +++ b/dom/fetch/Request.h @@ -27,8 +27,8 @@ class Promise; class RequestOrUSVString; class Request final : public nsISupports - , public FetchBody - , public nsWrapperCache + , public FetchBody + , public nsWrapperCache { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Request) diff --git a/dom/fetch/Response.h b/dom/fetch/Response.h index 52e0cddf7ef..786736144bf 100644 --- a/dom/fetch/Response.h +++ b/dom/fetch/Response.h @@ -25,8 +25,8 @@ class InternalHeaders; class Promise; class Response final : public nsISupports - , public FetchBody - , public nsWrapperCache + , public FetchBody + , public nsWrapperCache { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Response) diff --git a/dom/fmradio/FMRadio.cpp b/dom/fmradio/FMRadio.cpp index 7867fc6cf0e..1e8c2a429fe 100644 --- a/dom/fmradio/FMRadio.cpp +++ b/dom/fmradio/FMRadio.cpp @@ -33,7 +33,7 @@ using mozilla::Preferences; BEGIN_FMRADIO_NAMESPACE class FMRadioRequest final : public FMRadioReplyRunnable - , public DOMRequest + , public DOMRequest { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/fmradio/FMRadio.h b/dom/fmradio/FMRadio.h index 71edf7fb5fc..69dd6e20a7d 100644 --- a/dom/fmradio/FMRadio.h +++ b/dom/fmradio/FMRadio.h @@ -21,11 +21,11 @@ BEGIN_FMRADIO_NAMESPACE class DOMRequest; class FMRadio final : public DOMEventTargetHelper - , public hal::SwitchObserver - , public FMRadioEventObserver - , public nsSupportsWeakReference - , public nsIAudioChannelAgentCallback - , public nsIDOMEventListener + , public hal::SwitchObserver + , public FMRadioEventObserver + , public nsSupportsWeakReference + , public nsIAudioChannelAgentCallback + , public nsIDOMEventListener { friend class FMRadioRequest; diff --git a/dom/fmradio/FMRadioService.h b/dom/fmradio/FMRadioService.h index c211200a913..82cfa14449b 100644 --- a/dom/fmradio/FMRadioService.h +++ b/dom/fmradio/FMRadioService.h @@ -148,9 +148,9 @@ enum FMRadioState }; class FMRadioService final : public IFMRadioService - , public hal::FMRadioObserver - , public hal::FMRadioRDSObserver - , public nsIObserver + , public hal::FMRadioObserver + , public hal::FMRadioRDSObserver + , public nsIObserver { friend class ReadAirplaneModeSettingTask; friend class EnableRunnable; diff --git a/dom/fmradio/ipc/FMRadioChild.h b/dom/fmradio/ipc/FMRadioChild.h index 173c36eb93a..730a5e10db3 100644 --- a/dom/fmradio/ipc/FMRadioChild.h +++ b/dom/fmradio/ipc/FMRadioChild.h @@ -23,7 +23,7 @@ BEGIN_FMRADIO_NAMESPACE * IPC channel to transfer the requests. */ class FMRadioChild final : public IFMRadioService - , public PFMRadioChild + , public PFMRadioChild { public: static FMRadioChild* Singleton(); diff --git a/dom/fmradio/ipc/FMRadioParent.h b/dom/fmradio/ipc/FMRadioParent.h index 39f36cd45e2..53f722b603d 100644 --- a/dom/fmradio/ipc/FMRadioParent.h +++ b/dom/fmradio/ipc/FMRadioParent.h @@ -16,7 +16,7 @@ BEGIN_FMRADIO_NAMESPACE class PFMRadioRequestParent; class FMRadioParent final : public PFMRadioParent - , public FMRadioEventObserver + , public FMRadioEventObserver { public: FMRadioParent(); diff --git a/dom/fmradio/ipc/FMRadioRequestParent.h b/dom/fmradio/ipc/FMRadioRequestParent.h index 857585eed33..0d1f0a2b2a1 100644 --- a/dom/fmradio/ipc/FMRadioRequestParent.h +++ b/dom/fmradio/ipc/FMRadioRequestParent.h @@ -14,7 +14,7 @@ BEGIN_FMRADIO_NAMESPACE class FMRadioRequestParent final : public PFMRadioRequestParent - , public FMRadioReplyRunnable + , public FMRadioReplyRunnable { public: FMRadioRequestParent(); diff --git a/dom/gamepad/Gamepad.h b/dom/gamepad/Gamepad.h index 62f6ac940c7..63bc12e7ad0 100644 --- a/dom/gamepad/Gamepad.h +++ b/dom/gamepad/Gamepad.h @@ -32,7 +32,7 @@ const int kRightStickXAxis = 2; const int kRightStickYAxis = 3; class Gamepad final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: Gamepad(nsISupports* aParent, diff --git a/dom/geolocation/nsGeoPosition.h b/dom/geolocation/nsGeoPosition.h index 00f2aa36299..48ed215bce1 100644 --- a/dom/geolocation/nsGeoPosition.h +++ b/dom/geolocation/nsGeoPosition.h @@ -77,7 +77,7 @@ namespace dom { class Coordinates; class Position final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { ~Position(); @@ -105,7 +105,7 @@ private: }; class Coordinates final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { ~Coordinates(); diff --git a/dom/geolocation/nsGeolocation.h b/dom/geolocation/nsGeolocation.h index 595fd3462fd..423b7bf773c 100644 --- a/dom/geolocation/nsGeolocation.h +++ b/dom/geolocation/nsGeolocation.h @@ -53,7 +53,8 @@ struct CachedPositionAndAccuracy { /** * Singleton that manages the geolocation provider */ -class nsGeolocationService final : public nsIGeolocationUpdate, public nsIObserver +class nsGeolocationService final : public nsIGeolocationUpdate, + public nsIObserver { public: @@ -124,8 +125,8 @@ namespace dom { * Can return a geolocation info */ class Geolocation final : public nsIDOMGeoGeolocation, - public nsIGeolocationUpdate, - public nsWrapperCache + public nsIGeolocationUpdate, + public nsWrapperCache { public: @@ -221,7 +222,7 @@ private: }; class PositionError final : public nsIDOMGeoPositionError, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/html/HTMLAllCollection.h b/dom/html/HTMLAllCollection.h index f2c5b95aec0..d6d71e2c824 100644 --- a/dom/html/HTMLAllCollection.h +++ b/dom/html/HTMLAllCollection.h @@ -30,7 +30,7 @@ class OwningNodeOrHTMLCollection; template struct Nullable; class HTMLAllCollection final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { ~HTMLAllCollection(); diff --git a/dom/html/HTMLAnchorElement.h b/dom/html/HTMLAnchorElement.h index 096da5245b4..8c5102d07aa 100644 --- a/dom/html/HTMLAnchorElement.h +++ b/dom/html/HTMLAnchorElement.h @@ -19,8 +19,8 @@ class EventChainPreVisitor; namespace dom { class HTMLAnchorElement final : public nsGenericHTMLElement, - public nsIDOMHTMLAnchorElement, - public Link + public nsIDOMHTMLAnchorElement, + public Link { public: using Element::GetText; diff --git a/dom/html/HTMLAreaElement.h b/dom/html/HTMLAreaElement.h index 41eb46bab53..01a2c5e229d 100644 --- a/dom/html/HTMLAreaElement.h +++ b/dom/html/HTMLAreaElement.h @@ -23,8 +23,8 @@ class EventChainPreVisitor; namespace dom { class HTMLAreaElement final : public nsGenericHTMLElement, - public nsIDOMHTMLAreaElement, - public Link + public nsIDOMHTMLAreaElement, + public Link { public: explicit HTMLAreaElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLBRElement.h b/dom/html/HTMLBRElement.h index afe2bbf9bb4..13d5e667170 100644 --- a/dom/html/HTMLBRElement.h +++ b/dom/html/HTMLBRElement.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class HTMLBRElement final : public nsGenericHTMLElement, - public nsIDOMHTMLBRElement + public nsIDOMHTMLBRElement { public: explicit HTMLBRElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLBodyElement.h b/dom/html/HTMLBodyElement.h index 60943ba82e0..4c3f5a6a6b1 100644 --- a/dom/html/HTMLBodyElement.h +++ b/dom/html/HTMLBodyElement.h @@ -35,7 +35,7 @@ public: }; class HTMLBodyElement final : public nsGenericHTMLElement, - public nsIDOMHTMLBodyElement + public nsIDOMHTMLBodyElement { public: using Element::GetText; diff --git a/dom/html/HTMLButtonElement.h b/dom/html/HTMLButtonElement.h index 324616ecf5e..d75ccbf0ff8 100644 --- a/dom/html/HTMLButtonElement.h +++ b/dom/html/HTMLButtonElement.h @@ -17,8 +17,8 @@ class EventChainPreVisitor; namespace dom { class HTMLButtonElement final : public nsGenericHTMLFormElementWithState, - public nsIDOMHTMLButtonElement, - public nsIConstraintValidation + public nsIDOMHTMLButtonElement, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/dom/html/HTMLCanvasElement.h b/dom/html/HTMLCanvasElement.h index 0ca614d3108..ea6c2f86cd5 100644 --- a/dom/html/HTMLCanvasElement.h +++ b/dom/html/HTMLCanvasElement.h @@ -42,7 +42,7 @@ enum class CanvasContextType : uint8_t { }; class HTMLCanvasElement final : public nsGenericHTMLElement, - public nsIDOMHTMLCanvasElement + public nsIDOMHTMLCanvasElement { enum { DEFAULT_CANVAS_WIDTH = 300, diff --git a/dom/html/HTMLDivElement.h b/dom/html/HTMLDivElement.h index 21392f03d56..066e565d24c 100644 --- a/dom/html/HTMLDivElement.h +++ b/dom/html/HTMLDivElement.h @@ -13,7 +13,7 @@ namespace mozilla { namespace dom { class HTMLDivElement final : public nsGenericHTMLElement, - public nsIDOMHTMLDivElement + public nsIDOMHTMLDivElement { public: explicit HTMLDivElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLFieldSetElement.h b/dom/html/HTMLFieldSetElement.h index d50fc42e851..7d9b6e7d9b8 100644 --- a/dom/html/HTMLFieldSetElement.h +++ b/dom/html/HTMLFieldSetElement.h @@ -18,8 +18,8 @@ class EventChainPreVisitor; namespace dom { class HTMLFieldSetElement final : public nsGenericHTMLFormElement, - public nsIDOMHTMLFieldSetElement, - public nsIConstraintValidation + public nsIDOMHTMLFieldSetElement, + public nsIConstraintValidation { public: using nsGenericHTMLFormElement::GetForm; diff --git a/dom/html/HTMLFormControlsCollection.h b/dom/html/HTMLFormControlsCollection.h index fde2341866b..73f86036e32 100644 --- a/dom/html/HTMLFormControlsCollection.h +++ b/dom/html/HTMLFormControlsCollection.h @@ -24,7 +24,7 @@ class OwningRadioNodeListOrElement; template struct Nullable; class HTMLFormControlsCollection final : public nsIHTMLCollection - , public nsWrapperCache + , public nsWrapperCache { public: explicit HTMLFormControlsCollection(HTMLFormElement* aForm); diff --git a/dom/html/HTMLFormElement.h b/dom/html/HTMLFormElement.h index f0547d3dfe2..f3e7600d2af 100644 --- a/dom/html/HTMLFormElement.h +++ b/dom/html/HTMLFormElement.h @@ -34,10 +34,10 @@ class HTMLFormControlsCollection; class HTMLImageElement; class HTMLFormElement final : public nsGenericHTMLElement, - public nsIDOMHTMLFormElement, - public nsIWebProgressListener, - public nsIForm, - public nsIRadioGroupContainer + public nsIDOMHTMLFormElement, + public nsIWebProgressListener, + public nsIForm, + public nsIRadioGroupContainer { friend class HTMLFormControlsCollection; diff --git a/dom/html/HTMLFrameElement.h b/dom/html/HTMLFrameElement.h index 97fc4ea4542..ac8de9c8965 100644 --- a/dom/html/HTMLFrameElement.h +++ b/dom/html/HTMLFrameElement.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class HTMLFrameElement final : public nsGenericHTMLFrameElement, - public nsIDOMHTMLFrameElement + public nsIDOMHTMLFrameElement { public: using nsGenericHTMLFrameElement::SwapFrameLoaders; diff --git a/dom/html/HTMLFrameSetElement.h b/dom/html/HTMLFrameSetElement.h index 4448dbdcfe7..170d445248f 100644 --- a/dom/html/HTMLFrameSetElement.h +++ b/dom/html/HTMLFrameSetElement.h @@ -43,7 +43,7 @@ namespace dom { class OnBeforeUnloadEventHandlerNonNull; class HTMLFrameSetElement final : public nsGenericHTMLElement, - public nsIDOMHTMLFrameSetElement + public nsIDOMHTMLFrameSetElement { public: explicit HTMLFrameSetElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLHRElement.h b/dom/html/HTMLHRElement.h index 8e46ed46856..09b7d37d6ea 100644 --- a/dom/html/HTMLHRElement.h +++ b/dom/html/HTMLHRElement.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class HTMLHRElement final : public nsGenericHTMLElement, - public nsIDOMHTMLHRElement + public nsIDOMHTMLHRElement { public: explicit HTMLHRElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLHeadingElement.h b/dom/html/HTMLHeadingElement.h index 76719a7d296..ed0092cd852 100644 --- a/dom/html/HTMLHeadingElement.h +++ b/dom/html/HTMLHeadingElement.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class HTMLHeadingElement final : public nsGenericHTMLElement, - public nsIDOMHTMLHeadingElement + public nsIDOMHTMLHeadingElement { public: explicit HTMLHeadingElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLIFrameElement.h b/dom/html/HTMLIFrameElement.h index 93b4acaf345..c67e641383b 100644 --- a/dom/html/HTMLIFrameElement.h +++ b/dom/html/HTMLIFrameElement.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class HTMLIFrameElement final : public nsGenericHTMLFrameElement - , public nsIDOMHTMLIFrameElement + , public nsIDOMHTMLIFrameElement { public: explicit HTMLIFrameElement(already_AddRefed& aNodeInfo, diff --git a/dom/html/HTMLImageElement.h b/dom/html/HTMLImageElement.h index f6c799e6063..945df6f3019 100644 --- a/dom/html/HTMLImageElement.h +++ b/dom/html/HTMLImageElement.h @@ -23,8 +23,8 @@ namespace dom { class ResponsiveImageSelector; class HTMLImageElement final : public nsGenericHTMLElement, - public nsImageLoadingContent, - public nsIDOMHTMLImageElement + public nsImageLoadingContent, + public nsIDOMHTMLImageElement { friend class HTMLSourceElement; friend class HTMLPictureElement; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 05df41c143c..d69fc41a216 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sw=2 sts=2 et tw=80: */ /* 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/. */ @@ -1692,12 +1693,18 @@ HTMLInputElement::GetValueInternal(nsAString& aValue) const case VALUE_MODE_FILENAME: if (nsContentUtils::IsCallerChrome()) { +#ifndef MOZ_CHILD_PERMISSIONS + aValue.Assign(mFirstFilePath); +#else + // XXX We'd love to assert that this can't happen, but some mochitests + // use SpecialPowers to circumvent our more sane security model. if (!mFiles.IsEmpty()) { return mFiles[0]->GetMozFullPath(aValue); } else { aValue.Truncate(); } +#endif } else { // Just return the leaf name if (mFiles.IsEmpty() || NS_FAILED(mFiles[0]->GetName(aValue))) { @@ -2647,6 +2654,19 @@ HTMLInputElement::AfterSetFiles(bool aSetValueChanged) formControlFrame->SetFormProperty(nsGkAtoms::value, readableValue); } +#ifndef MOZ_CHILD_PERMISSIONS + // Grab the full path here for any chrome callers who access our .value via a + // CPOW. This path won't be called from a CPOW meaning the potential sync IPC + // call under GetMozFullPath won't be rejected for not being urgent. + // XXX Protected by the ifndef because the blob code doesn't allow us to send + // this message in b2g. + if (mFiles.IsEmpty()) { + mFirstFilePath.Truncate(); + } else { + mFiles[0]->GetMozFullPath(mFirstFilePath); + } +#endif + UpdateFileList(); if (aSetValueChanged) { diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 1a5d25a4a02..8c648ae9fb5 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -89,13 +89,13 @@ public: }; class HTMLInputElement final : public nsGenericHTMLFormElementWithState, - public nsImageLoadingContent, - public nsIDOMHTMLInputElement, - public nsITextControlElement, - public nsIPhonetic, - public nsIDOMNSEditableElement, - public nsITimerCallback, - public nsIConstraintValidation + public nsImageLoadingContent, + public nsIDOMHTMLInputElement, + public nsITextControlElement, + public nsIPhonetic, + public nsIDOMNSEditableElement, + public nsITimerCallback, + public nsIConstraintValidation { friend class DirPickerFileListBuilderTask; @@ -1254,6 +1254,7 @@ protected: */ nsTextEditorState* mState; } mInputData; + /** * The value of the input if it is a file input. This is the list of filenames * used when uploading a file. It is vital that this is kept separate from @@ -1266,6 +1267,13 @@ protected: */ nsTArray> mFiles; +#ifndef MOZ_CHILD_PERMISSIONS + /** + * Hack for bug 1086684: Stash the .value when we're a file picker. + */ + nsString mFirstFilePath; +#endif + nsRefPtr mFileList; nsRefPtr mDirPickerFileListBuilderTask; diff --git a/dom/html/HTMLLIElement.h b/dom/html/HTMLLIElement.h index 440d345df2c..ec77c73cd73 100644 --- a/dom/html/HTMLLIElement.h +++ b/dom/html/HTMLLIElement.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class HTMLLIElement final : public nsGenericHTMLElement, - public nsIDOMHTMLLIElement + public nsIDOMHTMLLIElement { public: explicit HTMLLIElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLLabelElement.h b/dom/html/HTMLLabelElement.h index aff6901eb86..f90d43be9dd 100644 --- a/dom/html/HTMLLabelElement.h +++ b/dom/html/HTMLLabelElement.h @@ -18,7 +18,7 @@ class EventChainPostVisitor; namespace dom { class HTMLLabelElement final : public nsGenericHTMLFormElement, - public nsIDOMHTMLLabelElement + public nsIDOMHTMLLabelElement { public: explicit HTMLLabelElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h index bb05599f935..1ef429fb167 100644 --- a/dom/html/HTMLLinkElement.h +++ b/dom/html/HTMLLinkElement.h @@ -19,9 +19,9 @@ class EventChainPreVisitor; namespace dom { class HTMLLinkElement final : public nsGenericHTMLElement, - public nsIDOMHTMLLinkElement, - public nsStyleLinkElement, - public Link + public nsIDOMHTMLLinkElement, + public nsStyleLinkElement, + public Link { public: explicit HTMLLinkElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLMapElement.h b/dom/html/HTMLMapElement.h index 869cbeb8172..34afaf96419 100644 --- a/dom/html/HTMLMapElement.h +++ b/dom/html/HTMLMapElement.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { class HTMLMapElement final : public nsGenericHTMLElement, - public nsIDOMHTMLMapElement + public nsIDOMHTMLMapElement { public: explicit HTMLMapElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 27d13e53ade..1411c598e2d 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -258,9 +258,9 @@ public: * We break the reference cycle in OnStartRequest by clearing mElement. */ class HTMLMediaElement::MediaLoadListener final : public nsIStreamListener, - public nsIChannelEventSink, - public nsIInterfaceRequestor, - public nsIObserver + public nsIChannelEventSink, + public nsIInterfaceRequestor, + public nsIObserver { ~MediaLoadListener() {} diff --git a/dom/html/HTMLMenuElement.h b/dom/html/HTMLMenuElement.h index 272b436c5a5..4ffab2c173b 100644 --- a/dom/html/HTMLMenuElement.h +++ b/dom/html/HTMLMenuElement.h @@ -15,8 +15,8 @@ namespace mozilla { namespace dom { class HTMLMenuElement final : public nsGenericHTMLElement, - public nsIDOMHTMLMenuElement, - public nsIHTMLMenu + public nsIDOMHTMLMenuElement, + public nsIHTMLMenu { public: explicit HTMLMenuElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLMenuItemElement.h b/dom/html/HTMLMenuItemElement.h index b5bdcff26e5..edb0e122b58 100644 --- a/dom/html/HTMLMenuItemElement.h +++ b/dom/html/HTMLMenuItemElement.h @@ -19,7 +19,7 @@ namespace dom { class Visitor; class HTMLMenuItemElement final : public nsGenericHTMLElement, - public nsIDOMHTMLMenuItemElement + public nsIDOMHTMLMenuItemElement { public: using mozilla::dom::Element::GetText; diff --git a/dom/html/HTMLMetaElement.h b/dom/html/HTMLMetaElement.h index e8492abc003..8331f697e11 100644 --- a/dom/html/HTMLMetaElement.h +++ b/dom/html/HTMLMetaElement.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class HTMLMetaElement final : public nsGenericHTMLElement, - public nsIDOMHTMLMetaElement + public nsIDOMHTMLMetaElement { public: explicit HTMLMetaElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLObjectElement.h b/dom/html/HTMLObjectElement.h index 4de138bf877..855e6533626 100644 --- a/dom/html/HTMLObjectElement.h +++ b/dom/html/HTMLObjectElement.h @@ -17,9 +17,9 @@ namespace mozilla { namespace dom { class HTMLObjectElement final : public nsGenericHTMLFormElement - , public nsObjectLoadingContent - , public nsIDOMHTMLObjectElement - , public nsIConstraintValidation + , public nsObjectLoadingContent + , public nsIDOMHTMLObjectElement + , public nsIConstraintValidation { public: explicit HTMLObjectElement(already_AddRefed& aNodeInfo, diff --git a/dom/html/HTMLOptGroupElement.h b/dom/html/HTMLOptGroupElement.h index 310c6065094..8576f87dcca 100644 --- a/dom/html/HTMLOptGroupElement.h +++ b/dom/html/HTMLOptGroupElement.h @@ -15,7 +15,7 @@ class EventChainPreVisitor; namespace dom { class HTMLOptGroupElement final : public nsGenericHTMLElement, - public nsIDOMHTMLOptGroupElement + public nsIDOMHTMLOptGroupElement { public: explicit HTMLOptGroupElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLOptionElement.h b/dom/html/HTMLOptionElement.h index de4fc63d1d0..81447971127 100644 --- a/dom/html/HTMLOptionElement.h +++ b/dom/html/HTMLOptionElement.h @@ -18,7 +18,7 @@ namespace dom { class HTMLSelectElement; class HTMLOptionElement final : public nsGenericHTMLElement, - public nsIDOMHTMLOptionElement + public nsIDOMHTMLOptionElement { public: explicit HTMLOptionElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLOptionsCollection.h b/dom/html/HTMLOptionsCollection.h index 6175fa94a84..2b138901e6e 100644 --- a/dom/html/HTMLOptionsCollection.h +++ b/dom/html/HTMLOptionsCollection.h @@ -31,8 +31,8 @@ class HTMLSelectElement; * select.options in DOM) */ class HTMLOptionsCollection final : public nsIHTMLCollection - , public nsIDOMHTMLOptionsCollection - , public nsWrapperCache + , public nsIDOMHTMLOptionsCollection + , public nsWrapperCache { typedef HTMLOptionElementOrHTMLOptGroupElement HTMLOptionOrOptGroupElement; public: diff --git a/dom/html/HTMLOutputElement.h b/dom/html/HTMLOutputElement.h index 34c368c9d0f..68dbb57debb 100644 --- a/dom/html/HTMLOutputElement.h +++ b/dom/html/HTMLOutputElement.h @@ -15,8 +15,8 @@ namespace mozilla { namespace dom { class HTMLOutputElement final : public nsGenericHTMLFormElement, - public nsStubMutationObserver, - public nsIConstraintValidation + public nsStubMutationObserver, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/dom/html/HTMLParagraphElement.h b/dom/html/HTMLParagraphElement.h index 25f69770c3a..cea6c3c4e4e 100644 --- a/dom/html/HTMLParagraphElement.h +++ b/dom/html/HTMLParagraphElement.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class HTMLParagraphElement final : public nsGenericHTMLElement, - public nsIDOMHTMLParagraphElement + public nsIDOMHTMLParagraphElement { public: explicit HTMLParagraphElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLPictureElement.h b/dom/html/HTMLPictureElement.h index d161d317cc9..1253aabe62f 100644 --- a/dom/html/HTMLPictureElement.h +++ b/dom/html/HTMLPictureElement.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class HTMLPictureElement final : public nsGenericHTMLElement, - public nsIDOMHTMLPictureElement + public nsIDOMHTMLPictureElement { public: explicit HTMLPictureElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLPreElement.h b/dom/html/HTMLPreElement.h index 4a270ecda61..708ff0190a7 100644 --- a/dom/html/HTMLPreElement.h +++ b/dom/html/HTMLPreElement.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class HTMLPreElement final : public nsGenericHTMLElement, - public nsIDOMHTMLPreElement + public nsIDOMHTMLPreElement { public: explicit HTMLPreElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLPropertiesCollection.h b/dom/html/HTMLPropertiesCollection.h index 0c6cbbf0797..ff40ea0c237 100644 --- a/dom/html/HTMLPropertiesCollection.h +++ b/dom/html/HTMLPropertiesCollection.h @@ -49,8 +49,8 @@ protected: }; class HTMLPropertiesCollection final : public nsIHTMLCollection, - public nsStubMutationObserver, - public nsWrapperCache + public nsStubMutationObserver, + public nsWrapperCache { friend class PropertyNodeList; friend class PropertyStringList; @@ -149,7 +149,7 @@ protected: }; class PropertyNodeList final : public nsINodeList, - public nsStubMutationObserver + public nsStubMutationObserver { public: PropertyNodeList(HTMLPropertiesCollection* aCollection, diff --git a/dom/html/HTMLScriptElement.h b/dom/html/HTMLScriptElement.h index 7c1c44fd9d2..94c721731b8 100644 --- a/dom/html/HTMLScriptElement.h +++ b/dom/html/HTMLScriptElement.h @@ -16,8 +16,8 @@ namespace mozilla { namespace dom { class HTMLScriptElement final : public nsGenericHTMLElement, - public nsIDOMHTMLScriptElement, - public nsScriptElement + public nsIDOMHTMLScriptElement, + public nsScriptElement { public: using Element::GetText; diff --git a/dom/html/HTMLSelectElement.h b/dom/html/HTMLSelectElement.h index b9c6e243f1c..32859345fba 100644 --- a/dom/html/HTMLSelectElement.h +++ b/dom/html/HTMLSelectElement.h @@ -113,8 +113,8 @@ private: * Implementation of <select> */ class HTMLSelectElement final : public nsGenericHTMLFormElementWithState, - public nsIDOMHTMLSelectElement, - public nsIConstraintValidation + public nsIDOMHTMLSelectElement, + public nsIConstraintValidation { public: /** diff --git a/dom/html/HTMLShadowElement.h b/dom/html/HTMLShadowElement.h index 6800dd46ba0..1feac60beef 100644 --- a/dom/html/HTMLShadowElement.h +++ b/dom/html/HTMLShadowElement.h @@ -12,7 +12,7 @@ namespace mozilla { namespace dom { class HTMLShadowElement final : public nsGenericHTMLElement, - public nsStubMutationObserver + public nsStubMutationObserver { public: explicit HTMLShadowElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLSharedElement.h b/dom/html/HTMLSharedElement.h index dc46635f645..048d2c9846f 100644 --- a/dom/html/HTMLSharedElement.h +++ b/dom/html/HTMLSharedElement.h @@ -22,11 +22,11 @@ namespace mozilla { namespace dom { class HTMLSharedElement final : public nsGenericHTMLElement, - public nsIDOMHTMLBaseElement, - public nsIDOMHTMLDirectoryElement, - public nsIDOMHTMLQuoteElement, - public nsIDOMHTMLHeadElement, - public nsIDOMHTMLHtmlElement + public nsIDOMHTMLBaseElement, + public nsIDOMHTMLDirectoryElement, + public nsIDOMHTMLQuoteElement, + public nsIDOMHTMLHeadElement, + public nsIDOMHTMLHtmlElement { public: explicit HTMLSharedElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLSharedListElement.h b/dom/html/HTMLSharedListElement.h index 5cb7dccf78e..acb88f1f0be 100644 --- a/dom/html/HTMLSharedListElement.h +++ b/dom/html/HTMLSharedListElement.h @@ -16,8 +16,8 @@ namespace mozilla { namespace dom { class HTMLSharedListElement final : public nsGenericHTMLElement, - public nsIDOMHTMLOListElement, - public nsIDOMHTMLUListElement + public nsIDOMHTMLOListElement, + public nsIDOMHTMLUListElement { public: explicit HTMLSharedListElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLSharedObjectElement.h b/dom/html/HTMLSharedObjectElement.h index 89e61041a70..6d3071146de 100644 --- a/dom/html/HTMLSharedObjectElement.h +++ b/dom/html/HTMLSharedObjectElement.h @@ -19,9 +19,9 @@ namespace mozilla { namespace dom { class HTMLSharedObjectElement final : public nsGenericHTMLElement - , public nsObjectLoadingContent - , public nsIDOMHTMLAppletElement - , public nsIDOMHTMLEmbedElement + , public nsObjectLoadingContent + , public nsIDOMHTMLAppletElement + , public nsIDOMHTMLEmbedElement { public: explicit HTMLSharedObjectElement(already_AddRefed& aNodeInfo, diff --git a/dom/html/HTMLSourceElement.h b/dom/html/HTMLSourceElement.h index f98db495f48..34ddc82c1cd 100644 --- a/dom/html/HTMLSourceElement.h +++ b/dom/html/HTMLSourceElement.h @@ -19,7 +19,7 @@ namespace dom { class ResponsiveImageSelector; class HTMLSourceElement final : public nsGenericHTMLElement, - public nsIDOMHTMLSourceElement + public nsIDOMHTMLSourceElement { public: explicit HTMLSourceElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLStyleElement.h b/dom/html/HTMLStyleElement.h index eadd51871ac..63e748db796 100644 --- a/dom/html/HTMLStyleElement.h +++ b/dom/html/HTMLStyleElement.h @@ -18,9 +18,9 @@ namespace mozilla { namespace dom { class HTMLStyleElement final : public nsGenericHTMLElement, - public nsIDOMHTMLStyleElement, - public nsStyleLinkElement, - public nsStubMutationObserver + public nsIDOMHTMLStyleElement, + public nsStyleLinkElement, + public nsStubMutationObserver { public: explicit HTMLStyleElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLTableCaptionElement.h b/dom/html/HTMLTableCaptionElement.h index 612566d2ec0..15f41d8ef40 100644 --- a/dom/html/HTMLTableCaptionElement.h +++ b/dom/html/HTMLTableCaptionElement.h @@ -13,7 +13,7 @@ namespace mozilla { namespace dom { class HTMLTableCaptionElement final : public nsGenericHTMLElement, - public nsIDOMHTMLTableCaptionElement + public nsIDOMHTMLTableCaptionElement { public: explicit HTMLTableCaptionElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLTableCellElement.h b/dom/html/HTMLTableCellElement.h index eb8fe3b060e..d0da453f434 100644 --- a/dom/html/HTMLTableCellElement.h +++ b/dom/html/HTMLTableCellElement.h @@ -17,7 +17,7 @@ namespace dom { class HTMLTableElement; class HTMLTableCellElement final : public nsGenericHTMLElement, - public nsIDOMHTMLTableCellElement + public nsIDOMHTMLTableCellElement { public: explicit HTMLTableCellElement(already_AddRefed& aNodeInfo) diff --git a/dom/html/HTMLTableElement.h b/dom/html/HTMLTableElement.h index 1d8fa067d08..1907a22b12c 100644 --- a/dom/html/HTMLTableElement.h +++ b/dom/html/HTMLTableElement.h @@ -19,7 +19,7 @@ namespace dom { class TableRowsCollection; class HTMLTableElement final : public nsGenericHTMLElement, - public nsIDOMHTMLTableElement + public nsIDOMHTMLTableElement { public: explicit HTMLTableElement(already_AddRefed& aNodeInfo); diff --git a/dom/html/HTMLTextAreaElement.h b/dom/html/HTMLTextAreaElement.h index f382a172739..b871184b419 100644 --- a/dom/html/HTMLTextAreaElement.h +++ b/dom/html/HTMLTextAreaElement.h @@ -36,11 +36,11 @@ class EventStates; namespace dom { class HTMLTextAreaElement final : public nsGenericHTMLFormElementWithState, - public nsIDOMHTMLTextAreaElement, - public nsITextControlElement, - public nsIDOMNSEditableElement, - public nsStubMutationObserver, - public nsIConstraintValidation + public nsIDOMHTMLTextAreaElement, + public nsITextControlElement, + public nsIDOMNSEditableElement, + public nsStubMutationObserver, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/dom/html/HTMLTitleElement.h b/dom/html/HTMLTitleElement.h index 9c716fbfd0e..81ef2be8e9d 100644 --- a/dom/html/HTMLTitleElement.h +++ b/dom/html/HTMLTitleElement.h @@ -17,8 +17,8 @@ class ErrorResult; namespace dom { class HTMLTitleElement final : public nsGenericHTMLElement, - public nsIDOMHTMLTitleElement, - public nsStubMutationObserver + public nsIDOMHTMLTitleElement, + public nsStubMutationObserver { public: using Element::GetText; diff --git a/dom/html/ImageDocument.h b/dom/html/ImageDocument.h index 8f404ca9750..c8564dd9588 100644 --- a/dom/html/ImageDocument.h +++ b/dom/html/ImageDocument.h @@ -15,9 +15,9 @@ namespace mozilla { namespace dom { class ImageDocument final : public MediaDocument, - public nsIImageDocument, - public imgINotificationObserver, - public nsIDOMEventListener + public nsIImageDocument, + public imgINotificationObserver, + public nsIDOMEventListener { public: ImageDocument(); diff --git a/dom/html/MediaError.h b/dom/html/MediaError.h index aea0b00e8d5..f0d00a5a511 100644 --- a/dom/html/MediaError.h +++ b/dom/html/MediaError.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class MediaError final : public nsIDOMMediaError, - public nsWrapperCache + public nsWrapperCache { ~MediaError() {} diff --git a/dom/html/PluginDocument.cpp b/dom/html/PluginDocument.cpp index 94dd437bbc1..646a625cfb7 100644 --- a/dom/html/PluginDocument.cpp +++ b/dom/html/PluginDocument.cpp @@ -23,7 +23,7 @@ namespace mozilla { namespace dom { class PluginDocument final : public MediaDocument - , public nsIPluginDocument + , public nsIPluginDocument { public: PluginDocument(); diff --git a/dom/html/UndoManager.h b/dom/html/UndoManager.h index 6b9029a9b81..b56b62d0eda 100644 --- a/dom/html/UndoManager.h +++ b/dom/html/UndoManager.h @@ -26,7 +26,7 @@ class DOMTransaction; class DOMTransactionCallback; class UndoManager final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class TxnScopeGuard; public: diff --git a/dom/html/ValidityState.h b/dom/html/ValidityState.h index 25effb42144..9e37df9b693 100644 --- a/dom/html/ValidityState.h +++ b/dom/html/ValidityState.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class ValidityState final : public nsIDOMValidityState, - public nsWrapperCache + public nsWrapperCache { ~ValidityState() {} diff --git a/dom/html/nsHTMLDNSPrefetch.h b/dom/html/nsHTMLDNSPrefetch.h index 918836ef5c6..e2110bed83a 100644 --- a/dom/html/nsHTMLDNSPrefetch.h +++ b/dom/html/nsHTMLDNSPrefetch.h @@ -82,8 +82,8 @@ public: }; class nsDeferrals final: public nsIWebProgressListener - , public nsSupportsWeakReference - , public nsIObserver + , public nsSupportsWeakReference + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index f4e3f160b5a..d35378921a9 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -199,7 +199,7 @@ private: }; class nsTextInputSelectionImpl final : public nsSupportsWeakReference - , public nsISelectionController + , public nsISelectionController { ~nsTextInputSelectionImpl(){} diff --git a/dom/indexedDB/IDBFileHandle.h b/dom/indexedDB/IDBFileHandle.h index c08b7649821..51f2b707e30 100644 --- a/dom/indexedDB/IDBFileHandle.h +++ b/dom/indexedDB/IDBFileHandle.h @@ -29,9 +29,9 @@ namespace indexedDB { class IDBMutableFile; class IDBFileHandle final : public DOMEventTargetHelper, - public nsIRunnable, - public FileHandleBase, - public nsSupportsWeakReference + public nsIRunnable, + public FileHandleBase, + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/indexedDB/IDBFileRequest.h b/dom/indexedDB/IDBFileRequest.h index afad5c0be6d..8b5c6c9ed6b 100644 --- a/dom/indexedDB/IDBFileRequest.h +++ b/dom/indexedDB/IDBFileRequest.h @@ -26,7 +26,7 @@ namespace indexedDB { class IDBFileHandle; class IDBFileRequest final : public DOMRequest, - public FileRequestBase + public FileRequestBase { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/ipc/ContentBridgeChild.h b/dom/ipc/ContentBridgeChild.h index 5f24c952d59..ea0c2b9687f 100644 --- a/dom/ipc/ContentBridgeChild.h +++ b/dom/ipc/ContentBridgeChild.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class ContentBridgeChild final : public PContentBridgeChild - , public nsIContentChild + , public nsIContentChild { public: explicit ContentBridgeChild(Transport* aTransport); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 1ab7538507c..de8a8d9bc1c 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -243,7 +243,7 @@ using namespace mozilla::widget; #ifdef ENABLE_TESTS class BackgroundTester final : public nsIIPCBackgroundChildCreateCallback, - public nsIObserver + public nsIObserver { static uint32_t sCallbackCount; diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 24272705974..339e173e47a 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -67,11 +67,11 @@ class TabContext; class ContentBridgeParent; class ContentParent final : public PContentParent - , public nsIContentParent - , public nsIObserver - , public nsIDOMGeoPositionCallback - , public nsIDOMGeoPositionErrorCallback - , public mozilla::LinkedListElement + , public nsIContentParent + , public nsIObserver + , public nsIDOMGeoPositionCallback + , public nsIDOMGeoPositionErrorCallback + , public mozilla::LinkedListElement { typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost; typedef mozilla::ipc::OptionalURIParams OptionalURIParams; diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 1ca2182d08a..06203281ce4 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -226,19 +226,19 @@ protected: }; class TabChild final : public TabChildBase, - public PBrowserChild, - public nsIWebBrowserChrome2, - public nsIEmbeddingSiteWindow, - public nsIWebBrowserChromeFocus, - public nsIInterfaceRequestor, - public nsIWindowProvider, - public nsIDOMEventListener, - public nsIWebProgressListener, - public nsSupportsWeakReference, - public nsITabChild, - public nsIObserver, - public TabContext, - public nsITooltipListener + public PBrowserChild, + public nsIWebBrowserChrome2, + public nsIEmbeddingSiteWindow, + public nsIWebBrowserChromeFocus, + public nsIInterfaceRequestor, + public nsIWindowProvider, + public nsIDOMEventListener, + public nsIWebProgressListener, + public nsSupportsWeakReference, + public nsITabChild, + public nsIObserver, + public TabContext, + public nsITooltipListener { typedef mozilla::dom::ClonedMessageData ClonedMessageData; typedef mozilla::layout::RenderFrameChild RenderFrameChild; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 574eb3799bb..a7ad4533743 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2796,9 +2796,9 @@ TabParent::HandleEvent(nsIDOMEvent* aEvent) } class FakeChannel final : public nsIChannel, - public nsIAuthPromptCallback, - public nsIInterfaceRequestor, - public nsILoadContext + public nsIAuthPromptCallback, + public nsIInterfaceRequestor, + public nsILoadContext { public: FakeChannel(const nsCString& aUri, uint64_t aCallbackId, Element* aElement) diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 29def19955c..48f62b6a573 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -148,10 +148,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'): if CONFIG['MOZ_TOOLKIT_SEARCH']: DEFINES['MOZ_TOOLKIT_SEARCH'] = True -for var in ('MOZ_PERMISSIONS', 'MOZ_CHILD_PERMISSIONS'): - if CONFIG[var]: - DEFINES[var] = True - JAR_MANIFESTS += ['jar.mn'] BROWSER_CHROME_MANIFESTS += ['tests/browser.ini'] diff --git a/dom/ipc/tests/file_bug1086684.html b/dom/ipc/tests/file_bug1086684.html new file mode 100644 index 00000000000..95db6f387de --- /dev/null +++ b/dom/ipc/tests/file_bug1086684.html @@ -0,0 +1,16 @@ + + + + + Test for Bug 1086684 + + + +Mozilla Bug 1086684 +
+ +
+ + diff --git a/dom/ipc/tests/mochitest.ini b/dom/ipc/tests/mochitest.ini index ffa4de1b05c..52780cc5dcf 100644 --- a/dom/ipc/tests/mochitest.ini +++ b/dom/ipc/tests/mochitest.ini @@ -1,9 +1,16 @@ +[DEFAULT] +support-files = + file_bug1086684.html + [test_blob_sliced_from_child_process.html] # This test is only supposed to run in the main process. skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s [test_blob_sliced_from_parent_process.html] # This test is only supposed to run in the main process. skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s +[test_bug1086684.html] +# This test is only supposed to run in the main process +skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s || toolkit == 'android' [test_cpow_cookies.html] skip-if = buildapp == 'b2g' || buildapp == 'mulet' [test_NuwaProcessCreation.html] diff --git a/dom/ipc/tests/test_bug1086684.html b/dom/ipc/tests/test_bug1086684.html new file mode 100644 index 00000000000..227191e1894 --- /dev/null +++ b/dom/ipc/tests/test_bug1086684.html @@ -0,0 +1,106 @@ + + + + Test for recursive CPOW-getting-cookie bug + + + + + + + + diff --git a/dom/mathml/nsMathMLElement.h b/dom/mathml/nsMathMLElement.h index d55f9cf3d8a..ac387c6c55e 100644 --- a/dom/mathml/nsMathMLElement.h +++ b/dom/mathml/nsMathMLElement.h @@ -26,8 +26,8 @@ class EventChainPreVisitor; * The base class for MathML elements. */ class nsMathMLElement final : public nsMathMLElementBase, - public nsIDOMElement, - public mozilla::dom::Link + public nsIDOMElement, + public mozilla::dom::Link { public: explicit nsMathMLElement(already_AddRefed& aNodeInfo); diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index 27454635e0c..1c19c72f361 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -54,9 +54,9 @@ public: // Returns true if the decoder is shut down. virtual bool IsShutdown() const = 0; - virtual bool OnStateMachineThread() const = 0; + virtual bool OnStateMachineTaskQueue() const = 0; - virtual bool OnDecodeThread() const = 0; + virtual bool OnDecodeTaskQueue() const = 0; // Get the current MediaResource being used. Its URI will be returned // by currentSrc. Returns what was passed to Load(), if Load() has been called. diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 065ca568d31..2499e6bb0ea 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -67,7 +67,8 @@ static const uint32_t FREE_BLOCK_SCAN_LIMIT = 16; static MediaCache* gMediaCache; class MediaCacheFlusher final : public nsIObserver, - public nsSupportsWeakReference { + public nsSupportsWeakReference +{ MediaCacheFlusher() {} ~MediaCacheFlusher(); public: diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 0042eda5aad..06708535133 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -830,7 +830,7 @@ void MediaDecoder::QueueMetadata(int64_t aPublishTime, nsAutoPtr aInfo, nsAutoPtr aTags) { - NS_ASSERTION(OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnDecodeTaskQueue()); GetReentrantMonitor().AssertCurrentThreadIn(); mDecoderStateMachine->QueueMetadata(aPublishTime, aInfo, aTags); } @@ -1093,7 +1093,7 @@ MediaDecoder::GetStatistics() double MediaDecoder::ComputePlaybackRate(bool* aReliable) { GetReentrantMonitor().AssertCurrentThreadIn(); - MOZ_ASSERT(NS_IsMainThread() || OnStateMachineThread() || OnDecodeThread()); + MOZ_ASSERT(NS_IsMainThread() || OnStateMachineTaskQueue() || OnDecodeTaskQueue()); int64_t length = mResource ? mResource->GetLength() : -1; if (mDuration >= 0 && length >= 0) { @@ -1105,7 +1105,7 @@ double MediaDecoder::ComputePlaybackRate(bool* aReliable) void MediaDecoder::UpdatePlaybackRate() { - MOZ_ASSERT(NS_IsMainThread() || OnStateMachineThread()); + MOZ_ASSERT(NS_IsMainThread() || OnStateMachineTaskQueue()); GetReentrantMonitor().AssertCurrentThreadIn(); if (!mResource) return; @@ -1506,7 +1506,7 @@ void MediaDecoder::Resume(bool aForceBuffering) void MediaDecoder::StopProgressUpdates() { - MOZ_ASSERT(OnStateMachineThread() || OnDecodeThread()); + MOZ_ASSERT(OnStateMachineTaskQueue() || OnDecodeTaskQueue()); GetReentrantMonitor().AssertCurrentThreadIn(); mIgnoreProgressData = true; if (mResource) { @@ -1516,7 +1516,7 @@ void MediaDecoder::StopProgressUpdates() void MediaDecoder::StartProgressUpdates() { - MOZ_ASSERT(OnStateMachineThread() || OnDecodeThread()); + MOZ_ASSERT(OnStateMachineTaskQueue() || OnDecodeTaskQueue()); GetReentrantMonitor().AssertCurrentThreadIn(); mIgnoreProgressData = false; if (mResource) { @@ -1538,9 +1538,9 @@ void MediaDecoder::UpdatePlaybackOffset(int64_t aOffset) mPlaybackPosition = aOffset; } -bool MediaDecoder::OnStateMachineThread() const +bool MediaDecoder::OnStateMachineTaskQueue() const { - return mDecoderStateMachine->OnStateMachineThread(); + return mDecoderStateMachine->OnTaskQueue(); } void MediaDecoder::SetPlaybackRate(double aPlaybackRate) @@ -1576,9 +1576,9 @@ void MediaDecoder::SetPreservesPitch(bool aPreservesPitch) } } -bool MediaDecoder::OnDecodeThread() const { +bool MediaDecoder::OnDecodeTaskQueue() const { NS_WARN_IF_FALSE(mDecoderStateMachine, "mDecoderStateMachine is null"); - return mDecoderStateMachine ? mDecoderStateMachine->OnDecodeThread() : false; + return mDecoderStateMachine ? mDecoderStateMachine->OnDecodeTaskQueue() : false; } ReentrantMonitor& MediaDecoder::GetReentrantMonitor() { diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 441b2d2173b..45f2ce23f6b 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -668,9 +668,9 @@ public: // has changed. void DurationChanged(); - bool OnStateMachineThread() const override; + bool OnStateMachineTaskQueue() const override; - bool OnDecodeThread() const override; + bool OnDecodeTaskQueue() const override; // Returns the monitor for other threads to synchronise access to // state. diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index a79f86c4e53..c150aca94e9 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -195,7 +195,7 @@ MediaDecoderReader::CallReadMetadata() { typedef ReadMetadataFailureReason Reason; - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn(); DECODER_LOG("MediaDecoderReader::CallReadMetadata"); @@ -373,7 +373,7 @@ MediaDecoderReader::BreakCycles() nsRefPtr MediaDecoderReader::Shutdown() { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); mShutdown = true; mBaseAudioPromise.RejectIfExists(END_OF_STREAM, __func__); diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index e72f3fa77c1..08fe4551497 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -112,7 +112,7 @@ public: MediaTaskQueue* EnsureTaskQueue(); - virtual bool OnDecodeThread() + virtual bool OnTaskQueue() { return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn(); } diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index c1db8700526..46c4af58260 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -269,7 +269,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, #ifdef XP_WIN // Ensure high precision timers are enabled on Windows, otherwise the state - // machine thread isn't woken up at reliable intervals to set the next frame, + // machine isn't woken up at reliable intervals to set the next frame, // and we drop frames while painting. Note that multiple calls to this // function per-process is OK, provided each call is matched by a corresponding // timeEndPeriod() call. @@ -312,7 +312,7 @@ bool MediaDecoderStateMachine::HaveNextFrameData() { } int64_t MediaDecoderStateMachine::GetDecodedAudioDuration() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); int64_t audioDecoded = AudioQueue().Duration(); if (mAudioEndTime != -1) { @@ -325,7 +325,7 @@ void MediaDecoderStateMachine::SendStreamAudio(AudioData* aAudio, DecodedStreamData* aStream, AudioSegment* aOutput) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); // This logic has to mimic AudioSink closely to make sure we write @@ -390,7 +390,7 @@ static void WriteVideoToMediaStream(MediaStream* aStream, void MediaDecoderStateMachine::SendStreamData() { - MOZ_ASSERT(OnStateMachineThread(), "Should be on state machine thread"); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); MOZ_ASSERT(!mAudioSink, "Should've been stopped in RunStateMachine()"); @@ -710,7 +710,7 @@ MediaDecoderStateMachine::IsVideoSeekComplete() void MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); nsRefPtr audio(aAudioSample); MOZ_ASSERT(audio); @@ -831,7 +831,7 @@ void MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType, MediaDecoderReader::NotDecodedReason aReason) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); SAMPLE_LOG("OnNotDecoded (aType=%u, aReason=%u)", aType, aReason); bool isAudio = aType == MediaData::AUDIO_DATA; @@ -933,7 +933,7 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType, void MediaDecoderStateMachine::MaybeFinishDecodeFirstFrame() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); if ((IsAudioDecoding() && AudioQueue().GetSize() == 0) || (IsVideoDecoding() && VideoQueue().GetSize() == 0)) { @@ -947,7 +947,7 @@ MediaDecoderStateMachine::MaybeFinishDecodeFirstFrame() void MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); nsRefPtr video(aVideoSample); mVideoDataRequest.Complete(); @@ -1054,7 +1054,7 @@ MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) void MediaDecoderStateMachine::CheckIfSeekComplete() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); const bool videoSeekComplete = IsVideoSeekComplete(); @@ -1152,7 +1152,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoderStateMachine* aCloneDonor) void MediaDecoderStateMachine::StopPlayback() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); DECODER_LOG("StopPlayback()"); AssertCurrentThreadInMonitor(); @@ -1210,7 +1210,7 @@ void MediaDecoderStateMachine::MaybeStartPlayback() void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); SAMPLE_LOG("UpdatePlaybackPositionInternal(%lld) (mStartTime=%lld)", aTime, mStartTime); AssertCurrentThreadInMonitor(); @@ -1321,21 +1321,11 @@ void MediaDecoderStateMachine::SetAudioCaptured() double MediaDecoderStateMachine::GetCurrentTime() const { - NS_ASSERTION(NS_IsMainThread() || - OnStateMachineThread() || - OnDecodeThread(), - "Should be on main, decode, or state machine thread."); - return static_cast(mCurrentFrameTime) / static_cast(USECS_PER_S); } int64_t MediaDecoderStateMachine::GetCurrentTimeUs() const { - NS_ASSERTION(NS_IsMainThread() || - OnStateMachineThread() || - OnDecodeThread(), - "Should be on main, decode, or state machine thread."); - return mCurrentFrameTime; } @@ -1377,8 +1367,7 @@ private: void MediaDecoderStateMachine::SetDuration(int64_t aDuration) { - NS_ASSERTION(NS_IsMainThread() || OnDecodeThread(), - "Should be on main or decode thread."); + MOZ_ASSERT(NS_IsMainThread() || OnDecodeTaskQueue()); AssertCurrentThreadInMonitor(); if (aDuration < 0) { @@ -1430,7 +1419,7 @@ void MediaDecoderStateMachine::UpdateEstimatedDuration(int64_t aDuration) void MediaDecoderStateMachine::SetMediaEndTime(int64_t aEndTime) { - NS_ASSERTION(OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnDecodeTaskQueue()); AssertCurrentThreadInMonitor(); mEndTime = aEndTime; @@ -1450,7 +1439,7 @@ bool MediaDecoderStateMachine::IsDormantNeeded() void MediaDecoderStateMachine::SetDormant(bool aDormant) { - MOZ_ASSERT(OnStateMachineThread(), "Should be on state machine thread."); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (IsShutdown()) { @@ -1536,7 +1525,7 @@ void MediaDecoderStateMachine::Shutdown() void MediaDecoderStateMachine::StartDecoding() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (mState == DECODER_STATE_DECODING) { return; @@ -1562,7 +1551,7 @@ void MediaDecoderStateMachine::StartDecoding() void MediaDecoderStateMachine::NotifyWaitingForResourcesStatusChanged() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); DECODER_LOG("NotifyWaitingForResourcesStatusChanged"); @@ -1579,7 +1568,7 @@ void MediaDecoderStateMachine::NotifyWaitingForResourcesStatusChanged() void MediaDecoderStateMachine::PlayInternal() { - NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread."); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); // Once we start playing, we don't want to minimize our prerolling, as we @@ -1599,7 +1588,7 @@ void MediaDecoderStateMachine::PlayInternal() // if the main thread invokes Play() and then Seek(), the seek will initiate // synchronously on the main thread, and the asynchronous PlayInternal task // will arrive when it's no longer valid. The proper thing to do is to move - // all state transitions to the state machine thread, but for now we just + // all state transitions to the state machine task queue, but for now we just // make sure that none of the possible main-thread state transitions (Seek(), // SetDormant(), and Shutdown()) have not occurred. if (mState != DECODER_STATE_DECODING && mState != DECODER_STATE_BUFFERING && @@ -1652,7 +1641,7 @@ void MediaDecoderStateMachine::NotifyDataArrived(const char* aBuffer, nsRefPtr MediaDecoderStateMachine::Seek(SeekTarget aTarget) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); mDecodingFrozenAtStateDecoding = false; @@ -1690,7 +1679,7 @@ MediaDecoderStateMachine::Seek(SeekTarget aTarget) void MediaDecoderStateMachine::StopAudioThread() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); if (mStopAudioThread) { @@ -1733,7 +1722,7 @@ MediaDecoderStateMachine::EnqueueDecodeFirstFrameTask() void MediaDecoderStateMachine::SetReaderIdle() { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnDecodeTaskQueue()); DECODER_LOG("Invoking SetReaderIdle()"); mReader->SetIdle(); } @@ -1809,7 +1798,7 @@ MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded() void MediaDecoderStateMachine::InitiateSeek() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); mCurrentSeek.RejectIfExists(__func__); @@ -1874,7 +1863,7 @@ MediaDecoderStateMachine::InitiateSeek() nsresult MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (IsShutdown()) { @@ -1891,7 +1880,7 @@ MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded() nsresult MediaDecoderStateMachine::EnsureAudioDecodeTaskQueued() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); SAMPLE_LOG("EnsureAudioDecodeTaskQueued isDecoding=%d status=%s", @@ -1924,7 +1913,7 @@ MediaDecoderStateMachine::EnsureAudioDecodeTaskQueued() nsresult MediaDecoderStateMachine::DispatchVideoDecodeTaskIfNeeded() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (IsShutdown()) { @@ -1941,7 +1930,7 @@ MediaDecoderStateMachine::DispatchVideoDecodeTaskIfNeeded() nsresult MediaDecoderStateMachine::EnsureVideoDecodeTaskQueued() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); SAMPLE_LOG("EnsureVideoDecodeTaskQueued isDecoding=%d status=%s", @@ -1983,7 +1972,7 @@ MediaDecoderStateMachine::EnsureVideoDecodeTaskQueued() nsresult MediaDecoderStateMachine::StartAudioThread() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); if (mAudioCaptured) { NS_ASSERTION(mStopAudioThread, "mStopAudioThread must always be true if audio is captured"); @@ -2090,7 +2079,7 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs) void MediaDecoderStateMachine::DecodeError() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (IsShutdown()) { // Already shutdown. @@ -2118,7 +2107,7 @@ void MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata) { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA); mMetadataRequest.Complete(); @@ -2158,7 +2147,7 @@ void MediaDecoderStateMachine::OnMetadataNotRead(ReadMetadataFailureReason aReason) { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA); mMetadataRequest.Complete(); @@ -2202,7 +2191,7 @@ MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent() void MediaDecoderStateMachine::CallDecodeFirstFrame() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (mState != DECODER_STATE_DECODING_FIRSTFRAME) { return; @@ -2216,7 +2205,7 @@ MediaDecoderStateMachine::CallDecodeFirstFrame() nsresult MediaDecoderStateMachine::DecodeFirstFrame() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); MOZ_ASSERT(mState == DECODER_STATE_DECODING_FIRSTFRAME); DECODER_LOG("DecodeFirstFrame started"); @@ -2268,7 +2257,7 @@ nsresult MediaDecoderStateMachine::FinishDecodeFirstFrame() { AssertCurrentThreadInMonitor(); - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); DECODER_LOG("FinishDecodeFirstFrame"); if (IsShutdown()) { @@ -2344,7 +2333,7 @@ void MediaDecoderStateMachine::OnSeekCompleted(int64_t aTime) { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); mSeekRequest.Complete(); // We must decode the first samples of active streams, so we can determine @@ -2358,7 +2347,7 @@ void MediaDecoderStateMachine::OnSeekFailed(nsresult aResult) { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); mSeekRequest.Complete(); MOZ_ASSERT(NS_FAILED(aResult), "Cancels should also disconnect mSeekRequest"); DecodeError(); @@ -2367,7 +2356,7 @@ MediaDecoderStateMachine::OnSeekFailed(nsresult aResult) void MediaDecoderStateMachine::SeekCompleted() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (mState != DECODER_STATE_SEEKING) { @@ -2479,7 +2468,7 @@ private: void MediaDecoderStateMachine::ShutdownReader() { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnDecodeTaskQueue()); mReader->Shutdown()->Then(TaskQueue(), __func__, this, &MediaDecoderStateMachine::FinishShutdown, &MediaDecoderStateMachine::FinishShutdown); @@ -2488,7 +2477,7 @@ MediaDecoderStateMachine::ShutdownReader() void MediaDecoderStateMachine::FinishShutdown() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); // The reader's listeners hold references to the state machine, @@ -2527,10 +2516,10 @@ MediaDecoderStateMachine::FinishShutdown() nsresult MediaDecoderStateMachine::RunStateMachine() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - mDelayedScheduler.Reset(); // Must happen on state machine thread. + mDelayedScheduler.Reset(); // Must happen on state machine task queue. mDispatchedStateMachine = false; // If audio is being captured, stop the audio sink if it's running @@ -2730,7 +2719,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine() void MediaDecoderStateMachine::Reset() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); DECODER_LOG("MediaDecoderStateMachine::Reset"); @@ -2776,7 +2765,7 @@ MediaDecoderStateMachine::Reset() void MediaDecoderStateMachine::RenderVideoFrame(VideoData* aData, TimeStamp aTarget) { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn(); if (aData->mDuplicate) { @@ -2881,7 +2870,7 @@ int64_t MediaDecoderStateMachine::GetClock() const void MediaDecoderStateMachine::AdvanceFrame() { - NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread."); + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); NS_ASSERTION(!HasAudio() || mAudioStartTime != -1, "Should know audio start time if we have audio."); @@ -3305,9 +3294,9 @@ void MediaDecoderStateMachine::ScheduleStateMachineIn(int64_t aMicroseconds) { AssertCurrentThreadInMonitor(); - MOZ_ASSERT(OnStateMachineThread()); // mDelayedScheduler.Ensure() may Disconnect() + MOZ_ASSERT(OnTaskQueue()); // mDelayedScheduler.Ensure() may Disconnect() // the promise, which must happen on the state - // machine thread. + // machine task queue. MOZ_ASSERT(aMicroseconds > 0); if (mState == DECODER_STATE_SHUTDOWN) { NS_WARNING("Refusing to schedule shutdown state machine"); @@ -3330,12 +3319,12 @@ MediaDecoderStateMachine::ScheduleStateMachineIn(int64_t aMicroseconds) mDelayedScheduler.Ensure(target); } -bool MediaDecoderStateMachine::OnDecodeThread() const +bool MediaDecoderStateMachine::OnDecodeTaskQueue() const { return !DecodeTaskQueue() || DecodeTaskQueue()->IsCurrentThreadIn(); } -bool MediaDecoderStateMachine::OnStateMachineThread() const +bool MediaDecoderStateMachine::OnTaskQueue() const { return TaskQueue()->IsCurrentThreadIn(); } @@ -3402,7 +3391,7 @@ void MediaDecoderStateMachine::QueueMetadata(int64_t aPublishTime, nsAutoPtr aInfo, nsAutoPtr aTags) { - NS_ASSERTION(OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnDecodeTaskQueue()); AssertCurrentThreadInMonitor(); TimedMetadata* metadata = new TimedMetadata; metadata->mPublishTime = aPublishTime; @@ -3438,7 +3427,7 @@ void MediaDecoderStateMachine::OnAudioSinkComplete() void MediaDecoderStateMachine::OnAudioSinkError() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); // AudioSink not used with captured streams, so ignore errors in this case. if (mAudioCaptured) { diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 3a0b821a53d..51b9b9b7a45 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -202,8 +202,8 @@ public: // Functions used by assertions to ensure we're calling things // on the appropriate threads. - bool OnDecodeThread() const; - bool OnStateMachineThread() const; + bool OnDecodeTaskQueue() const; + bool OnTaskQueue() const; MediaDecoderOwner::NextFrameStatus GetNextFrameStatus(); @@ -330,7 +330,7 @@ public: void OnDelayedSchedule() { - MOZ_ASSERT(OnStateMachineThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); mDelayedScheduler.CompleteRequest(); ScheduleStateMachine(); @@ -756,8 +756,7 @@ protected: void Reset() { - MOZ_ASSERT(mSelf->OnStateMachineThread(), - "Must be on state machine queue to disconnect"); + MOZ_ASSERT(mSelf->OnTaskQueue(), "Must be on state machine queue to disconnect"); if (IsScheduled()) { mRequest.Disconnect(); mTarget = TimeStamp(); diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 9b9ff9d220a..e902e1e68ed 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -545,7 +545,7 @@ typedef void (*WindowListenerCallback)(MediaManager *aThis, void *aData); class MediaManager final : public nsIMediaManagerService, - public nsIObserver + public nsIObserver { public: static already_AddRefed GetInstance(); diff --git a/dom/media/MediaRecorder.h b/dom/media/MediaRecorder.h index 2b32687165f..8ad14fdafa6 100644 --- a/dom/media/MediaRecorder.h +++ b/dom/media/MediaRecorder.h @@ -39,7 +39,7 @@ class AudioNode; */ class MediaRecorder final : public DOMEventTargetHelper, - public nsIDocumentActivity + public nsIDocumentActivity { class Session; diff --git a/dom/media/MediaResource.h b/dom/media/MediaResource.h index c3c5dc5e99b..b15af5db915 100644 --- a/dom/media/MediaResource.h +++ b/dom/media/MediaResource.h @@ -631,8 +631,8 @@ public: } class Listener final : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink + public nsIInterfaceRequestor, + public nsIChannelEventSink { ~Listener() {} public: diff --git a/dom/media/MediaStreamError.h b/dom/media/MediaStreamError.h index 65fc9da1180..411ac0479d6 100644 --- a/dom/media/MediaStreamError.h +++ b/dom/media/MediaStreamError.h @@ -41,7 +41,7 @@ protected: }; class MediaMgrError final : public nsISupports, - public BaseMediaMgrError + public BaseMediaMgrError { public: explicit MediaMgrError(const nsAString& aName, @@ -57,8 +57,8 @@ private: namespace dom { class MediaStreamError final : public nsISupports, - public BaseMediaMgrError, - public nsWrapperCache + public BaseMediaMgrError, + public nsWrapperCache { public: MediaStreamError(nsPIDOMWindow* aParent, diff --git a/dom/media/RTCIdentityProviderRegistrar.h b/dom/media/RTCIdentityProviderRegistrar.h index 38a0de5b716..18dca0c1713 100644 --- a/dom/media/RTCIdentityProviderRegistrar.h +++ b/dom/media/RTCIdentityProviderRegistrar.h @@ -21,7 +21,7 @@ namespace dom { class RTCIdentityProvider; class RTCIdentityProviderRegistrar final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/media/RtspMediaResource.h b/dom/media/RtspMediaResource.h index 260c2fa4421..8bebd9d49e2 100644 --- a/dom/media/RtspMediaResource.h +++ b/dom/media/RtspMediaResource.h @@ -209,7 +209,7 @@ public: // data arrival. The Revoke function releases the reference when // RtspMediaResource::OnDisconnected is called. class Listener final : public nsIInterfaceRequestor, - public nsIStreamingProtocolListener + public nsIStreamingProtocolListener { ~Listener() {} public: diff --git a/dom/media/TextTrackCueList.h b/dom/media/TextTrackCueList.h index 24ecd920196..da71a8d1864 100644 --- a/dom/media/TextTrackCueList.h +++ b/dom/media/TextTrackCueList.h @@ -19,7 +19,7 @@ namespace dom { class TextTrackCue; class TextTrackCueList final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/media/TextTrackRegion.h b/dom/media/TextTrackRegion.h index d24abe59d01..c6f5c7cce93 100644 --- a/dom/media/TextTrackRegion.h +++ b/dom/media/TextTrackRegion.h @@ -22,7 +22,7 @@ class GlobalObject; class TextTrack; class TextTrackRegion final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: diff --git a/dom/media/WebVTTListener.h b/dom/media/WebVTTListener.h index 94604983d79..5be9ceae439 100644 --- a/dom/media/WebVTTListener.h +++ b/dom/media/WebVTTListener.h @@ -21,9 +21,9 @@ namespace dom { class HTMLTrackElement; class WebVTTListener final : public nsIWebVTTListener, - public nsIStreamListener, - public nsIChannelEventSink, - public nsIInterfaceRequestor + public nsIStreamListener, + public nsIChannelEventSink, + public nsIInterfaceRequestor { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIWEBVTTLISTENER diff --git a/dom/media/android/AndroidMediaReader.cpp b/dom/media/android/AndroidMediaReader.cpp index 03b7edb2f5d..50a33007e9b 100644 --- a/dom/media/android/AndroidMediaReader.cpp +++ b/dom/media/android/AndroidMediaReader.cpp @@ -43,7 +43,7 @@ nsresult AndroidMediaReader::Init(MediaDecoderReader* aCloneDonor) nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!mPlugin) { mPlugin = GetAndroidMediaPluginHost()->CreateDecoder(mDecoder->GetResource(), mType); @@ -289,7 +289,7 @@ bool AndroidMediaReader::DecodeVideoFrame(bool &aKeyframeSkip, bool AndroidMediaReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // This is the approximate byte position in the stream. int64_t pos = mDecoder->GetResource()->Tell(); @@ -322,7 +322,7 @@ bool AndroidMediaReader::DecodeAudioData() nsRefPtr AndroidMediaReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mHasAudio && mHasVideo) { // The decoder seeks/demuxes audio and video streams separately. So if diff --git a/dom/media/apple/AppleMP3Reader.cpp b/dom/media/apple/AppleMP3Reader.cpp index 234cd3a026d..e01d3295de2 100644 --- a/dom/media/apple/AppleMP3Reader.cpp +++ b/dom/media/apple/AppleMP3Reader.cpp @@ -280,7 +280,7 @@ AppleMP3Reader::AudioSampleCallback(UInt32 aNumBytes, bool AppleMP3Reader::DecodeAudioData() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); // Read AUDIO_READ_BYTES if we can char bytes[AUDIO_READ_BYTES]; @@ -314,7 +314,7 @@ bool AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -322,14 +322,14 @@ AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip, bool AppleMP3Reader::HasAudio() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return mStreamReady; } bool AppleMP3Reader::HasVideo() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -369,7 +369,7 @@ nsresult AppleMP3Reader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); *aTags = nullptr; @@ -495,7 +495,7 @@ AppleMP3Reader::SetupDecoder() nsRefPtr AppleMP3Reader::Seek(int64_t aTime, int64_t aEndTime) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread"); + MOZ_ASSERT(OnTaskQueue()); // Find the exact frame/packet that contains |aTime|. mCurrentAudioFrame = aTime * mAudioSampleRate / USECS_PER_S; diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index 49532899420..54c76db1cfb 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -104,7 +104,7 @@ nsresult DirectShowReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; nsresult rv; @@ -245,7 +245,7 @@ UnsignedByteToAudioSample(uint8_t aValue) bool DirectShowReader::Finish(HRESULT aStatus) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); LOG("DirectShowReader::Finish(0x%x)", aStatus); // Notify the filter graph of end of stream. @@ -302,7 +302,7 @@ private: bool DirectShowReader::DecodeAudioData() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; SampleSink* sink = mAudioSinkFilter->GetSampleSink(); @@ -349,21 +349,21 @@ bool DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } bool DirectShowReader::HasAudio() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return true; } bool DirectShowReader::HasVideo() { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -382,7 +382,7 @@ nsresult DirectShowReader::SeekInternal(int64_t aTargetUs) { HRESULT hr; - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");\ + MOZ_ASSERT(OnTaskQueue()); LOG("DirectShowReader::Seek() target=%lld", aTargetUs); diff --git a/dom/media/eme/MediaKeyStatusMap.h b/dom/media/eme/MediaKeyStatusMap.h index db41b42836c..b82b5958430 100644 --- a/dom/media/eme/MediaKeyStatusMap.h +++ b/dom/media/eme/MediaKeyStatusMap.h @@ -24,7 +24,7 @@ namespace dom { class ArrayBufferViewOrArrayBuffer; class MediaKeyStatusMap final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/media/eme/MediaKeySystemAccess.h b/dom/media/eme/MediaKeySystemAccess.h index 48405132df4..ba3751763ae 100644 --- a/dom/media/eme/MediaKeySystemAccess.h +++ b/dom/media/eme/MediaKeySystemAccess.h @@ -22,7 +22,7 @@ namespace mozilla { namespace dom { class MediaKeySystemAccess final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index b2d2efb3d02..0cc99e32549 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -409,7 +409,7 @@ public: EventDispatcher::DispatchDOMEvent(parentWindow, nullptr, event, nullptr, nullptr); } - virtual bool IsStillValid() + virtual bool IsStillValid() override { nsCOMPtr parentWindow; nsCOMPtr document; diff --git a/dom/media/gmp/GMPAudioDecoderParent.h b/dom/media/gmp/GMPAudioDecoderParent.h index 30dad915b09..66fc4da94e5 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.h +++ b/dom/media/gmp/GMPAudioDecoderParent.h @@ -19,7 +19,7 @@ namespace gmp { class GMPParent; class GMPAudioDecoderParent final : public GMPAudioDecoderProxy - , public PGMPAudioDecoderParent + , public PGMPAudioDecoderParent { public: NS_INLINE_DECL_REFCOUNTING(GMPAudioDecoderParent) diff --git a/dom/media/gmp/GMPVideoDecoderParent.h b/dom/media/gmp/GMPVideoDecoderParent.h index 23c4d706c56..42bcac1d0de 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.h +++ b/dom/media/gmp/GMPVideoDecoderParent.h @@ -21,8 +21,8 @@ namespace gmp { class GMPParent; class GMPVideoDecoderParent final : public PGMPVideoDecoderParent - , public GMPVideoDecoderProxy - , public GMPSharedMemManager + , public GMPVideoDecoderProxy + , public GMPSharedMemManager { public: NS_INLINE_DECL_REFCOUNTING(GMPVideoDecoderParent) diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp index 45b7dc52b7f..f82eb0acd65 100644 --- a/dom/media/gstreamer/GStreamerReader.cpp +++ b/dom/media/gstreamer/GStreamerReader.cpp @@ -366,7 +366,7 @@ GStreamerReader::GetDataLength() nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult ret = NS_OK; /* @@ -638,7 +638,7 @@ nsresult GStreamerReader::ResetDecode() bool GStreamerReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); GstBuffer *buffer = nullptr; @@ -724,7 +724,7 @@ bool GStreamerReader::DecodeAudioData() bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); GstBuffer *buffer = nullptr; @@ -844,7 +844,7 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip, nsRefPtr GStreamerReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); gint64 seekPos = aTarget * GST_USECOND; LOG(PR_LOG_DEBUG, "%p About to seek to %" GST_TIME_FORMAT, diff --git a/dom/media/mediasource/MediaSourceReader.cpp b/dom/media/mediasource/MediaSourceReader.cpp index 00ea8a8f426..efe4c9ee10f 100644 --- a/dom/media/mediasource/MediaSourceReader.cpp +++ b/dom/media/mediasource/MediaSourceReader.cpp @@ -141,7 +141,7 @@ MediaSourceReader::SizeOfAudioQueueInFrames() nsRefPtr MediaSourceReader::RequestAudioData() { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty(), "No sample requests allowed while seeking"); MOZ_DIAGNOSTIC_ASSERT(mAudioPromise.IsEmpty(), "No duplicate sample requests"); nsRefPtr p = mAudioPromise.Ensure(__func__); @@ -305,7 +305,7 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason) nsRefPtr MediaSourceReader::RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThreshold) { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty(), "No sample requests allowed while seeking"); MOZ_DIAGNOSTIC_ASSERT(mVideoPromise.IsEmpty(), "No duplicate sample requests"); nsRefPtr p = mVideoPromise.Ensure(__func__); @@ -840,7 +840,7 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aIgnored /* Used only for ogg whi nsresult MediaSourceReader::ResetDecode() { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); MSE_DEBUG(""); @@ -1036,7 +1036,7 @@ MediaSourceReader::GetBuffered(dom::TimeRanges* aBuffered) nsRefPtr MediaSourceReader::WaitForData(MediaData::Type aType) { - MOZ_ASSERT(OnDecodeThread()); + MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); nsRefPtr p = WaitPromise(aType).Ensure(__func__); MaybeNotifyHaveData(); diff --git a/dom/media/mediasource/SourceBufferDecoder.cpp b/dom/media/mediasource/SourceBufferDecoder.cpp index b511a309254..aea12031bbf 100644 --- a/dom/media/mediasource/SourceBufferDecoder.cpp +++ b/dom/media/mediasource/SourceBufferDecoder.cpp @@ -156,19 +156,19 @@ SourceBufferDecoder::GetReentrantMonitor() } bool -SourceBufferDecoder::OnStateMachineThread() const +SourceBufferDecoder::OnStateMachineTaskQueue() const { - return mParentDecoder->OnStateMachineThread(); + return mParentDecoder->OnStateMachineTaskQueue(); } bool -SourceBufferDecoder::OnDecodeThread() const +SourceBufferDecoder::OnDecodeTaskQueue() const { // During initialization we run on our TrackBuffer's task queue. if (mTaskQueue) { return mTaskQueue->IsCurrentThreadIn(); } - return mParentDecoder->OnDecodeThread(); + return mParentDecoder->OnDecodeTaskQueue(); } SourceBufferResource* diff --git a/dom/media/mediasource/SourceBufferDecoder.h b/dom/media/mediasource/SourceBufferDecoder.h index c63b1cefb58..1cebba9aa7d 100644 --- a/dom/media/mediasource/SourceBufferDecoder.h +++ b/dom/media/mediasource/SourceBufferDecoder.h @@ -40,8 +40,8 @@ public: virtual bool IsMediaSeekable() final override; virtual bool IsShutdown() const final override; virtual bool IsTransportSeekable() final override; - virtual bool OnDecodeThread() const final override; - virtual bool OnStateMachineThread() const final override; + virtual bool OnDecodeTaskQueue() const final override; + virtual bool OnStateMachineTaskQueue() const final override; virtual int64_t GetMediaDuration() final override; virtual layers::ImageContainer* GetImageContainer() final override; virtual MediaDecoderOwner* GetOwner() final override; @@ -114,7 +114,7 @@ public: virtual CDMProxy* GetCDMProxy() override { - MOZ_ASSERT(OnDecodeThread() || NS_IsMainThread()); + MOZ_ASSERT(OnDecodeTaskQueue() || NS_IsMainThread()); ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); return mCDMProxy; } diff --git a/dom/media/mediasource/TrackBuffer.cpp b/dom/media/mediasource/TrackBuffer.cpp index 1909e39c168..c51ee4a05c7 100644 --- a/dom/media/mediasource/TrackBuffer.cpp +++ b/dom/media/mediasource/TrackBuffer.cpp @@ -874,7 +874,7 @@ TrackBuffer::AbortAppendData() const nsTArray>& TrackBuffer::Decoders() { - // XXX assert OnDecodeThread + // XXX assert OnDecodeTaskQueue return mInitializedDecoders; } diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index cb7b0329d35..e0a01f20e8a 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -165,7 +165,7 @@ nsresult OggReader::ResetDecode() nsresult OggReader::ResetDecode(bool start) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult res = NS_OK; if (NS_FAILED(MediaDecoderReader::ResetDecode())) { @@ -369,7 +369,7 @@ void OggReader::SetupMediaTracksInfo(const nsTArray& aSerials) nsresult OggReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // We read packets until all bitstreams have read all their header packets. // We record the offset of the first non-header page so that we know @@ -671,7 +671,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { bool OggReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); DebugOnly haveCodecState = mVorbisState != nullptr || mOpusState != nullptr; NS_ASSERTION(haveCodecState, "Need audio codec state to decode audio"); @@ -895,7 +895,7 @@ nsresult OggReader::DecodeTheora(ogg_packet* aPacket, int64_t aTimeThreshold) bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -941,7 +941,7 @@ bool OggReader::DecodeVideoFrame(bool &aKeyframeSkip, bool OggReader::ReadOggPage(ogg_page* aPage) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int ret = 0; while((ret = ogg_sync_pageseek(&mOggState, aPage)) <= 0) { @@ -975,7 +975,7 @@ bool OggReader::ReadOggPage(ogg_page* aPage) ogg_packet* OggReader::NextOggPacket(OggCodecState* aCodecState) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!aCodecState || !aCodecState->mActive) { return nullptr; @@ -1018,7 +1018,7 @@ GetChecksum(ogg_page* page) int64_t OggReader::RangeStartTime(int64_t aOffset) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ENSURE_TRUE(resource != nullptr, 0); nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset); @@ -1040,8 +1040,7 @@ struct nsAutoOggSyncState { int64_t OggReader::RangeEndTime(int64_t aEndOffset) { - NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(), - "Should be on state machine or decode thread."); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ENSURE_TRUE(resource != nullptr, -1); @@ -1181,7 +1180,7 @@ int64_t OggReader::RangeEndTime(int64_t aStartOffset, nsresult OggReader::GetSeekRanges(nsTArray& aRanges) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); AutoPinned resource(mDecoder->GetResource()); nsTArray cached; nsresult res = resource->GetCachedRanges(cached); @@ -1221,7 +1220,7 @@ OggReader::SelectSeekRange(const nsTArray& ranges, int64_t aEndTime, bool aExact) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int64_t so = 0; int64_t eo = mDecoder->GetResource()->GetLength(); int64_t st = aStartTime; @@ -1437,7 +1436,7 @@ OggReader::Seek(int64_t aTarget, int64_t aEndTime) nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mIsChained) return NS_ERROR_FAILURE; LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); @@ -1594,7 +1593,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, const SeekRange& aRange, uint32_t aFuzz) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsresult res; MediaResource* resource = mDecoder->GetResource(); @@ -1966,8 +1965,7 @@ nsresult OggReader::GetBuffered(dom::TimeRanges* aBuffered) VideoData* OggReader::FindStartTime(int64_t& aOutStartTime) { - NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(), - "Should be on state machine or decode thread."); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); // Extract the start times of the bitstreams in order to calculate // the duration. diff --git a/dom/media/omx/MediaCodecReader.cpp b/dom/media/omx/MediaCodecReader.cpp index 8af195c78da..900eb708c04 100644 --- a/dom/media/omx/MediaCodecReader.cpp +++ b/dom/media/omx/MediaCodecReader.cpp @@ -658,7 +658,7 @@ nsresult MediaCodecReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (!ReallocateResources()) { return NS_ERROR_FAILURE; @@ -1031,7 +1031,7 @@ MediaCodecReader::DecodeVideoFrameSync(int64_t aTimeThreshold) nsRefPtr MediaCodecReader::Seek(int64_t aTime, int64_t aEndTime) { - MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); mVideoTrack.mSeekTimeUs = aTime; mAudioTrack.mSeekTimeUs = aTime; diff --git a/dom/media/omx/MediaOmxCommonReader.cpp b/dom/media/omx/MediaOmxCommonReader.cpp index 93a1ef38a6d..103a2e98132 100644 --- a/dom/media/omx/MediaOmxCommonReader.cpp +++ b/dom/media/omx/MediaOmxCommonReader.cpp @@ -44,7 +44,7 @@ MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder) #ifdef MOZ_AUDIO_OFFLOAD void MediaOmxCommonReader::CheckAudioOffload() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); char offloadProp[128]; property_get("audio.offload.disable", offloadProp, "0"); diff --git a/dom/media/omx/MediaOmxReader.cpp b/dom/media/omx/MediaOmxReader.cpp index e6bef2af2c8..5e85fd94163 100644 --- a/dom/media/omx/MediaOmxReader.cpp +++ b/dom/media/omx/MediaOmxReader.cpp @@ -255,7 +255,7 @@ void MediaOmxReader::PreReadMetadata() nsresult MediaOmxReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); *aTags = nullptr; @@ -365,7 +365,7 @@ MediaOmxReader::IsMediaSeekable() bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); // Record number of frames decoded and parsed. Automatically update the @@ -509,7 +509,7 @@ void MediaOmxReader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, in bool MediaOmxReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); // This is the approximate byte position in the stream. @@ -544,7 +544,7 @@ bool MediaOmxReader::DecodeAudioData() nsRefPtr MediaOmxReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); EnsureActive(); VideoFrameContainer* container = mDecoder->GetVideoFrameContainer(); diff --git a/dom/media/raw/RawReader.cpp b/dom/media/raw/RawReader.cpp index d73a7a5c8cd..b2b874f29fb 100644 --- a/dom/media/raw/RawReader.cpp +++ b/dom/media/raw/RawReader.cpp @@ -39,8 +39,7 @@ nsresult RawReader::ResetDecode() nsresult RawReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource* resource = mDecoder->GetResource(); NS_ASSERTION(resource, "Decoder has no media resource"); @@ -121,8 +120,7 @@ RawReader::IsMediaSeekable() bool RawReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(), - "Should be on state machine thread or decode thread."); + MOZ_ASSERT(OnTaskQueue() || mDecoder->OnStateMachineTaskQueue()); return false; } @@ -152,8 +150,7 @@ bool RawReader::ReadFromResource(MediaResource *aResource, uint8_t* aBuf, bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -246,8 +243,7 @@ RawReader::Seek(int64_t aTime, int64_t aEndTime) nsresult RawReader::SeekInternal(int64_t aTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); MediaResource *resource = mDecoder->GetResource(); NS_ASSERTION(resource, "Decoder has no media resource"); diff --git a/dom/media/systemservices/LoadManager.h b/dom/media/systemservices/LoadManager.h index 7df86666604..d2e5c4e9ead 100644 --- a/dom/media/systemservices/LoadManager.h +++ b/dom/media/systemservices/LoadManager.h @@ -73,7 +73,7 @@ private: }; class LoadManager final : public webrtc::CPULoadStateCallbackInvoker, - public webrtc::CpuOveruseObserver + public webrtc::CpuOveruseObserver { public: explicit LoadManager(LoadManagerSingleton* aManager) diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index 4d385cd9632..70bafdbc1e2 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -128,7 +128,7 @@ nsresult WaveReader::Init(MediaDecoderReader* aCloneDonor) nsresult WaveReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); bool loaded = LoadRIFFChunk(); if (!loaded) { @@ -192,7 +192,7 @@ SignedShortToAudioSample(int16_t aValue) bool WaveReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int64_t pos = GetPosition() - mWavePCMOffset; int64_t len = GetDataLength(); @@ -252,7 +252,7 @@ bool WaveReader::DecodeAudioData() bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return false; } @@ -260,7 +260,7 @@ bool WaveReader::DecodeVideoFrame(bool &aKeyframeSkip, nsRefPtr WaveReader::Seek(int64_t aTarget, int64_t aEndTime) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); if (NS_FAILED(ResetDecode())) { diff --git a/dom/media/webaudio/AudioContext.h b/dom/media/webaudio/AudioContext.h index f9f751f4b81..ed9a7fe55bd 100644 --- a/dom/media/webaudio/AudioContext.h +++ b/dom/media/webaudio/AudioContext.h @@ -65,7 +65,7 @@ class PeriodicWave; class Promise; class AudioContext final : public DOMEventTargetHelper, - public nsIMemoryReporter + public nsIMemoryReporter { AudioContext(nsPIDOMWindow* aParentWindow, bool aIsOffline, diff --git a/dom/media/webaudio/AudioDestinationNode.h b/dom/media/webaudio/AudioDestinationNode.h index 58d5a7dc26d..3aafe9ec423 100644 --- a/dom/media/webaudio/AudioDestinationNode.h +++ b/dom/media/webaudio/AudioDestinationNode.h @@ -20,9 +20,9 @@ class AudioContext; class EventProxyHandler; class AudioDestinationNode final : public AudioNode - , public nsIDOMEventListener - , public nsIAudioChannelAgentCallback - , public MainThreadMediaStreamListener + , public nsIDOMEventListener + , public nsIAudioChannelAgentCallback + , public MainThreadMediaStreamListener { public: // This node type knows what MediaStreamGraph to use based on diff --git a/dom/media/webaudio/AudioParam.h b/dom/media/webaudio/AudioParam.h index 52f9260eee6..2e5b6f5c1d3 100644 --- a/dom/media/webaudio/AudioParam.h +++ b/dom/media/webaudio/AudioParam.h @@ -21,7 +21,7 @@ namespace mozilla { namespace dom { class AudioParam final : public nsWrapperCache, - public AudioParamTimeline + public AudioParamTimeline { virtual ~AudioParam(); diff --git a/dom/media/webaudio/BufferDecoder.cpp b/dom/media/webaudio/BufferDecoder.cpp index 01f5b61c761..78f09de23ed 100644 --- a/dom/media/webaudio/BufferDecoder.cpp +++ b/dom/media/webaudio/BufferDecoder.cpp @@ -57,14 +57,14 @@ BufferDecoder::IsShutdown() const } bool -BufferDecoder::OnStateMachineThread() const +BufferDecoder::OnStateMachineTaskQueue() const { // BufferDecoder doesn't have the concept of a state machine. return true; } bool -BufferDecoder::OnDecodeThread() const +BufferDecoder::OnDecodeTaskQueue() const { MOZ_ASSERT(mTaskQueueIdentity, "Forgot to call BeginDecoding?"); return mTaskQueueIdentity->IsCurrentThreadIn(); diff --git a/dom/media/webaudio/BufferDecoder.h b/dom/media/webaudio/BufferDecoder.h index ecaeb3db8b7..2549c47fc18 100644 --- a/dom/media/webaudio/BufferDecoder.h +++ b/dom/media/webaudio/BufferDecoder.h @@ -34,9 +34,9 @@ public: virtual bool IsShutdown() const final override; - virtual bool OnStateMachineThread() const final override; + virtual bool OnStateMachineTaskQueue() const final override; - virtual bool OnDecodeThread() const final override; + virtual bool OnDecodeTaskQueue() const final override; virtual MediaResource* GetResource() const final override; diff --git a/dom/media/webm/IntelWebMVideoDecoder.cpp b/dom/media/webm/IntelWebMVideoDecoder.cpp index e4c7ad5f972..809ade33458 100644 --- a/dom/media/webm/IntelWebMVideoDecoder.cpp +++ b/dom/media/webm/IntelWebMVideoDecoder.cpp @@ -353,7 +353,7 @@ IntelWebMVideoDecoder::DecodeVideoFrame(bool& aKeyframeSkip, NS_ENSURE_SUCCESS(rv, false); } - NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(mReader->OnTaskQueue()); bool rv = Decode(); { // Report the number of "decoded" frames as the difference in the diff --git a/dom/media/webm/SoftwareWebMVideoDecoder.cpp b/dom/media/webm/SoftwareWebMVideoDecoder.cpp index b1a9ade38a3..b2a9b617a91 100644 --- a/dom/media/webm/SoftwareWebMVideoDecoder.cpp +++ b/dom/media/webm/SoftwareWebMVideoDecoder.cpp @@ -74,8 +74,7 @@ bool SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mReader->GetDecoder()->OnDecodeThread(), - "Should be on decode thread."); + MOZ_ASSERT(mReader->OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 73f05e3644d..f164d75b36a 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -329,7 +329,10 @@ void WebMReader::Cleanup() nsresult WebMReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + // We can't use OnTaskQueue() here because of the wacky initialization task + // queue that TrackBuffer uses. We should be able to fix this when we do + // bug 1148234. + MOZ_ASSERT(mDecoder->OnDecodeTaskQueue()); nestegg_io io; io.read = webm_read; @@ -583,7 +586,7 @@ bool WebMReader::InitOpusDecoder() bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); int r = 0; unsigned int count = 0; @@ -931,7 +934,7 @@ nsReturnRef WebMReader::NextPacket(TrackType aTrackType) bool WebMReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); nsAutoRef holder(NextPacket(AUDIO)); if (!holder) { @@ -1064,7 +1067,7 @@ WebMReader::Seek(int64_t aTarget, int64_t aEndTime) nsresult WebMReader::SeekInternal(int64_t aTarget) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); if (mVideoDecoder) { nsresult rv = mVideoDecoder->Flush(); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/media/webm/WebMReader.h b/dom/media/webm/WebMReader.h index a95b92af569..360bd5fc244 100644 --- a/dom/media/webm/WebMReader.h +++ b/dom/media/webm/WebMReader.h @@ -143,13 +143,13 @@ public: virtual bool HasAudio() override { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasAudio; } virtual bool HasVideo() override { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasVideo; } diff --git a/dom/media/webspeech/recognition/SpeechGrammar.h b/dom/media/webspeech/recognition/SpeechGrammar.h index 75f33884a64..70453e513f7 100644 --- a/dom/media/webspeech/recognition/SpeechGrammar.h +++ b/dom/media/webspeech/recognition/SpeechGrammar.h @@ -22,7 +22,7 @@ namespace dom { class GlobalObject; class SpeechGrammar final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechGrammar(nsISupports* aParent); diff --git a/dom/media/webspeech/recognition/SpeechGrammarList.h b/dom/media/webspeech/recognition/SpeechGrammarList.h index acfbce269c1..a821ab9817d 100644 --- a/dom/media/webspeech/recognition/SpeechGrammarList.h +++ b/dom/media/webspeech/recognition/SpeechGrammarList.h @@ -26,7 +26,7 @@ class SpeechGrammar; template class Optional; class SpeechGrammarList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechGrammarList(nsISupports* aParent, nsISpeechRecognitionService* aRecognitionService); diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index 41d30cb0e60..98d4f30f6a3 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -56,8 +56,8 @@ PRLogModuleInfo* GetSpeechRecognitionLog(); already_AddRefed GetSpeechRecognitionService(); class SpeechRecognition final : public DOMEventTargetHelper, - public nsIObserver, - public SupportsWeakPtr + public nsIObserver, + public SupportsWeakPtr { public: MOZ_DECLARE_REFCOUNTED_TYPENAME(SpeechRecognition) diff --git a/dom/media/webspeech/recognition/SpeechRecognitionAlternative.h b/dom/media/webspeech/recognition/SpeechRecognitionAlternative.h index a788ce0c104..b1df9e1d305 100644 --- a/dom/media/webspeech/recognition/SpeechRecognitionAlternative.h +++ b/dom/media/webspeech/recognition/SpeechRecognitionAlternative.h @@ -21,7 +21,7 @@ namespace dom { class SpeechRecognition; class SpeechRecognitionAlternative final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechRecognitionAlternative(SpeechRecognition* aParent); diff --git a/dom/media/webspeech/recognition/SpeechRecognitionResult.h b/dom/media/webspeech/recognition/SpeechRecognitionResult.h index 0bc93662a77..cf1545721b2 100644 --- a/dom/media/webspeech/recognition/SpeechRecognitionResult.h +++ b/dom/media/webspeech/recognition/SpeechRecognitionResult.h @@ -22,7 +22,7 @@ namespace mozilla { namespace dom { class SpeechRecognitionResult final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechRecognitionResult(SpeechRecognition* aParent); diff --git a/dom/media/webspeech/recognition/SpeechRecognitionResultList.h b/dom/media/webspeech/recognition/SpeechRecognitionResultList.h index 3c1855012c2..861974956ca 100644 --- a/dom/media/webspeech/recognition/SpeechRecognitionResultList.h +++ b/dom/media/webspeech/recognition/SpeechRecognitionResultList.h @@ -23,7 +23,7 @@ namespace dom { class SpeechRecognition; class SpeechRecognitionResultList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechRecognitionResultList(SpeechRecognition* aParent); diff --git a/dom/media/webspeech/synth/SpeechSynthesis.h b/dom/media/webspeech/synth/SpeechSynthesis.h index 245f5003425..4b779f9616e 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.h +++ b/dom/media/webspeech/synth/SpeechSynthesis.h @@ -24,7 +24,7 @@ namespace dom { class nsSpeechTask; class SpeechSynthesis final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: explicit SpeechSynthesis(nsPIDOMWindow* aParent); diff --git a/dom/media/webspeech/synth/SpeechSynthesisVoice.h b/dom/media/webspeech/synth/SpeechSynthesisVoice.h index 994fba7d2f6..f55695d55b7 100644 --- a/dom/media/webspeech/synth/SpeechSynthesisVoice.h +++ b/dom/media/webspeech/synth/SpeechSynthesisVoice.h @@ -21,7 +21,7 @@ class nsSynthVoiceRegistry; class SpeechSynthesis; class SpeechSynthesisVoice final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class nsSynthVoiceRegistry; friend class SpeechSynthesis; diff --git a/dom/media/wmf/WMFByteStream.h b/dom/media/wmf/WMFByteStream.h index 45a9a119d5d..9e8a4a6f4e4 100644 --- a/dom/media/wmf/WMFByteStream.h +++ b/dom/media/wmf/WMFByteStream.h @@ -34,7 +34,7 @@ class SharedThreadPool; // For details see the test code at: // https://github.com/cpearce/IMFByteStreamBehaviour/ class WMFByteStream final : public IMFByteStream - , public IMFAttributes + , public IMFAttributes { ~WMFByteStream(); diff --git a/dom/media/wmf/WMFReader.cpp b/dom/media/wmf/WMFReader.cpp index fffa886603c..d442c377884 100644 --- a/dom/media/wmf/WMFReader.cpp +++ b/dom/media/wmf/WMFReader.cpp @@ -154,14 +154,14 @@ WMFReader::Init(MediaDecoderReader* aCloneDonor) bool WMFReader::HasAudio() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasAudio; } bool WMFReader::HasVideo() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); return mHasVideo; } @@ -507,7 +507,7 @@ nsresult WMFReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); DECODER_LOG("WMFReader::ReadMetadata()"); HRESULT hr; @@ -575,7 +575,7 @@ WMFReader::IsMediaSeekable() bool WMFReader::DecodeAudioData() { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); HRESULT hr; hr = mSourceReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM, @@ -804,7 +804,7 @@ bool WMFReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); // Record number of frames decoded and parsed. Automatically update the // stats counters using the AutoNotifyDecoded stack-based class. @@ -909,7 +909,7 @@ WMFReader::SeekInternal(int64_t aTargetUs) { DECODER_LOG("WMFReader::Seek() %lld", aTargetUs); - NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); + MOZ_ASSERT(OnTaskQueue()); #ifdef DEBUG bool canSeek = false; GetSourceReaderCanSeek(mSourceReader, canSeek); diff --git a/dom/mobileconnection/MobileCellInfo.h b/dom/mobileconnection/MobileCellInfo.h index efb0e728180..962a9baff1b 100644 --- a/dom/mobileconnection/MobileCellInfo.h +++ b/dom/mobileconnection/MobileCellInfo.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class MobileCellInfo final : public nsIMobileCellInfo - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_NSIMOBILECELLINFO diff --git a/dom/mobileconnection/MobileConnectionArray.h b/dom/mobileconnection/MobileConnectionArray.h index 7846d4e1f0e..39e91d11c28 100644 --- a/dom/mobileconnection/MobileConnectionArray.h +++ b/dom/mobileconnection/MobileConnectionArray.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class MobileConnectionArray final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/mobileconnection/MobileConnectionInfo.h b/dom/mobileconnection/MobileConnectionInfo.h index 4615d4e7779..c0095bbfdef 100644 --- a/dom/mobileconnection/MobileConnectionInfo.h +++ b/dom/mobileconnection/MobileConnectionInfo.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { class MobileConnectionInfo final : public nsIMobileConnectionInfo - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_NSIMOBILECONNECTIONINFO diff --git a/dom/mobileconnection/MobileNetworkInfo.h b/dom/mobileconnection/MobileNetworkInfo.h index 3f7a26fb07e..7486fd297f2 100644 --- a/dom/mobileconnection/MobileNetworkInfo.h +++ b/dom/mobileconnection/MobileNetworkInfo.h @@ -18,7 +18,7 @@ namespace dom { class GlobalObject; class MobileNetworkInfo final : public nsIMobileNetworkInfo - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_NSIMOBILENETWORKINFO diff --git a/dom/mobileconnection/ipc/MobileConnectionChild.h b/dom/mobileconnection/ipc/MobileConnectionChild.h index f696ac4065e..ef7d9331f75 100644 --- a/dom/mobileconnection/ipc/MobileConnectionChild.h +++ b/dom/mobileconnection/ipc/MobileConnectionChild.h @@ -26,7 +26,7 @@ namespace mobileconnection { * be created and each instance represents a sim slot. */ class MobileConnectionChild final : public PMobileConnectionChild - , public nsIMobileConnection + , public nsIMobileConnection { public: NS_DECL_ISUPPORTS diff --git a/dom/mobilemessage/MobileMessageManager.h b/dom/mobilemessage/MobileMessageManager.h index 0bc30982df0..5e3da5d55b0 100644 --- a/dom/mobilemessage/MobileMessageManager.h +++ b/dom/mobilemessage/MobileMessageManager.h @@ -26,7 +26,7 @@ class OwningLongOrMozSmsMessageOrMozMmsMessage; struct SmsSendParameters; class MobileMessageManager final : public DOMEventTargetHelper - , public nsIObserver + , public nsIObserver { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/mobilemessage/ipc/SmsIPCService.h b/dom/mobilemessage/ipc/SmsIPCService.h index 5ac84596dd5..c8884a1ae52 100644 --- a/dom/mobilemessage/ipc/SmsIPCService.h +++ b/dom/mobilemessage/ipc/SmsIPCService.h @@ -19,9 +19,9 @@ namespace mobilemessage { class PSmsChild; class SmsIPCService final : public nsISmsService - , public nsIMmsService - , public nsIMobileMessageDatabaseService - , public nsIObserver + , public nsIMmsService + , public nsIMobileMessageDatabaseService + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/dom/network/Connection.h b/dom/network/Connection.h index dc761d69364..24bb566a176 100644 --- a/dom/network/Connection.h +++ b/dom/network/Connection.h @@ -23,8 +23,8 @@ namespace dom { namespace network { class Connection final : public DOMEventTargetHelper - , public NetworkObserver - , public nsINetworkProperties + , public NetworkObserver + , public nsINetworkProperties { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/network/UDPSocket.h b/dom/network/UDPSocket.h index 8b157112d3c..fd27bd6af3f 100644 --- a/dom/network/UDPSocket.h +++ b/dom/network/UDPSocket.h @@ -25,8 +25,8 @@ struct UDPOptions; class StringOrBlobOrArrayBufferOrArrayBufferView; class UDPSocket final : public DOMEventTargetHelper - , public nsIUDPSocketListener - , public nsIUDPSocketInternal + , public nsIUDPSocketListener + , public nsIUDPSocketInternal { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/nfc/MozNDEFRecord.h b/dom/nfc/MozNDEFRecord.h index a12c47112f2..bddcabb2b22 100644 --- a/dom/nfc/MozNDEFRecord.h +++ b/dom/nfc/MozNDEFRecord.h @@ -31,7 +31,7 @@ namespace dom { class MozNDEFRecordOptions; class MozNDEFRecord final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/nfc/gonk/NfcService.h b/dom/nfc/gonk/NfcService.h index 4066dccf873..56e2150f249 100644 --- a/dom/nfc/gonk/NfcService.h +++ b/dom/nfc/gonk/NfcService.h @@ -19,7 +19,7 @@ class NfcEventOptions; } // namespace dom class NfcService final : public nsINfcService, - public mozilla::ipc::NfcSocketListener + public mozilla::ipc::NfcSocketListener { public: NS_DECL_ISUPPORTS diff --git a/dom/notification/DesktopNotification.h b/dom/notification/DesktopNotification.h index f4fffd32c33..43ebdf9d381 100644 --- a/dom/notification/DesktopNotification.h +++ b/dom/notification/DesktopNotification.h @@ -35,7 +35,7 @@ class DesktopNotification; * Object hangs off of the navigator object and hands out DesktopNotification objects */ class DesktopNotificationCenter final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/offline/nsDOMOfflineResourceList.h b/dom/offline/nsDOMOfflineResourceList.h index 0359ecd8cb2..7c5c8cfaeef 100644 --- a/dom/offline/nsDOMOfflineResourceList.h +++ b/dom/offline/nsDOMOfflineResourceList.h @@ -35,10 +35,10 @@ class DOMStringList; } // namespace mozilla class nsDOMOfflineResourceList final : public mozilla::DOMEventTargetHelper, - public nsIDOMOfflineResourceList, - public nsIObserver, - public nsIOfflineCacheUpdateObserver, - public nsSupportsWeakReference + public nsIDOMOfflineResourceList, + public nsIObserver, + public nsIOfflineCacheUpdateObserver, + public nsSupportsWeakReference { typedef mozilla::ErrorResult ErrorResult; diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h index 81d388213a8..7e0727017ee 100644 --- a/dom/plugins/base/nsPluginHost.h +++ b/dom/plugins/base/nsPluginHost.h @@ -71,9 +71,9 @@ public: }; class nsPluginHost final : public nsIPluginHost, - public nsIObserver, - public nsITimerCallback, - public nsSupportsWeakReference + public nsIObserver, + public nsITimerCallback, + public nsSupportsWeakReference { friend class nsPluginTag; virtual ~nsPluginHost(); diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index cae18bef644..01c71cf72ed 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -50,9 +50,9 @@ class gfxXlibSurface; #endif class nsPluginInstanceOwner final : public nsIPluginInstanceOwner, - public nsIDOMEventListener, - public nsIPrivacyTransitionObserver, - public nsSupportsWeakReference + public nsIDOMEventListener, + public nsIPrivacyTransitionObserver, + public nsSupportsWeakReference { public: nsPluginInstanceOwner(); diff --git a/dom/plugins/ipc/COMMessageFilter.cpp b/dom/plugins/ipc/COMMessageFilter.cpp deleted file mode 100644 index c50c94c2165..00000000000 --- a/dom/plugins/ipc/COMMessageFilter.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* 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/. */ - -#include "base/basictypes.h" - -#include "COMMessageFilter.h" -#include "base/message_loop.h" -#include "mozilla/plugins/PluginModuleChild.h" - -#include - -namespace mozilla { -namespace plugins { - -HRESULT -COMMessageFilter::QueryInterface(REFIID riid, void** ppv) -{ - if (riid == IID_IUnknown || riid == IID_IMessageFilter) { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - return E_NOINTERFACE; -} - -DWORD COMMessageFilter::AddRef() -{ - ++mRefCnt; - return mRefCnt; -} - -DWORD COMMessageFilter::Release() -{ - DWORD r = --mRefCnt; - if (0 == r) - delete this; - return r; -} - -DWORD -COMMessageFilter::HandleInComingCall(DWORD dwCallType, - HTASK htaskCaller, - DWORD dwTickCount, - LPINTERFACEINFO lpInterfaceInfo) -{ - if (mPreviousFilter) - return mPreviousFilter->HandleInComingCall(dwCallType, htaskCaller, - dwTickCount, lpInterfaceInfo); - return SERVERCALL_ISHANDLED; -} - -DWORD -COMMessageFilter::RetryRejectedCall(HTASK htaskCallee, - DWORD dwTickCount, - DWORD dwRejectType) -{ - if (mPreviousFilter) - return mPreviousFilter->RetryRejectedCall(htaskCallee, dwTickCount, - dwRejectType); - return -1; -} - -DWORD -COMMessageFilter::MessagePending(HTASK htaskCallee, - DWORD dwTickCount, - DWORD dwPendingType) -{ - mPlugin->FlushPendingInterruptQueue(); - if (mPreviousFilter) - return mPreviousFilter->MessagePending(htaskCallee, dwTickCount, - dwPendingType); - return PENDINGMSG_WAITNOPROCESS; -} - -void -COMMessageFilter::Initialize(PluginModuleChild* module) -{ - nsRefPtr f = new COMMessageFilter(module); - ::CoRegisterMessageFilter(f, getter_AddRefs(f->mPreviousFilter)); -} - -} // namespace plugins -} // namespace mozilla diff --git a/dom/plugins/ipc/COMMessageFilter.h b/dom/plugins/ipc/COMMessageFilter.h deleted file mode 100644 index cefbc18dd13..00000000000 --- a/dom/plugins/ipc/COMMessageFilter.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_plugins_COMMessageFilter_h -#define mozilla_plugins_COMMessageFilter_h - -#include -#include "nsISupportsImpl.h" -#include "nsAutoPtr.h" - -namespace mozilla { -namespace plugins { - -class PluginModuleChild; - -class COMMessageFilter final : public IMessageFilter -{ -public: - static void Initialize(PluginModuleChild* plugin); - - COMMessageFilter(PluginModuleChild* plugin) - : mPlugin(plugin) - { } - - HRESULT WINAPI QueryInterface(REFIID riid, void** ppv); - DWORD WINAPI AddRef(); - DWORD WINAPI Release(); - - DWORD WINAPI HandleInComingCall(DWORD dwCallType, - HTASK htaskCaller, - DWORD dwTickCount, - LPINTERFACEINFO lpInterfaceInfo); - DWORD WINAPI RetryRejectedCall(HTASK htaskCallee, - DWORD dwTickCount, - DWORD dwRejectType); - DWORD WINAPI MessagePending(HTASK htaskCallee, - DWORD dwTickCount, - DWORD dwPendingType); - -private: - nsAutoRefCnt mRefCnt; - PluginModuleChild* mPlugin; - nsRefPtr mPreviousFilter; -}; - -} // namespace plugins -} // namespace mozilla - -#endif // COMMessageFilter_h diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index d27eaa21022..af413f75c1f 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -42,7 +42,6 @@ #include "nsNPAPIPlugin.h" #ifdef XP_WIN -#include "COMMessageFilter.h" #include "nsWindowsDllInterceptor.h" #include "mozilla/widget/AudioSession.h" #endif @@ -264,10 +263,6 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename, MessageLoop* aIOLoop, IPC::Channel* aChannel) { -#ifdef XP_WIN - COMMessageFilter::Initialize(this); -#endif - NS_ASSERTION(aChannel, "need a channel"); if (!InitGraphics()) diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 77965e6486b..01f0fcf832a 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -2901,7 +2901,7 @@ PluginModuleChromeParent::OnCrash(DWORD processID) #ifdef MOZ_ENABLE_PROFILER_SPS class PluginProfilerObserver final : public nsIObserver, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build index 08782e1c51e..4d4aa99b0e2 100644 --- a/dom/plugins/ipc/moz.build +++ b/dom/plugins/ipc/moz.build @@ -50,7 +50,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'PluginSurfaceParent.h', ] UNIFIED_SOURCES += [ - 'COMMessageFilter.cpp', 'PluginHangUIParent.cpp', 'PluginSurfaceParent.cpp', ] diff --git a/dom/power/PowerManager.h b/dom/power/PowerManager.h index de6f8ea5be3..7fb3e81ce77 100644 --- a/dom/power/PowerManager.h +++ b/dom/power/PowerManager.h @@ -22,7 +22,7 @@ class ErrorResult; namespace dom { class PowerManager final : public nsIDOMMozWakeLockListener - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/presentation/PresentationDeviceManager.h b/dom/presentation/PresentationDeviceManager.h index 4f4645a2675..908bf34555b 100644 --- a/dom/presentation/PresentationDeviceManager.h +++ b/dom/presentation/PresentationDeviceManager.h @@ -16,9 +16,9 @@ namespace mozilla { namespace dom { class PresentationDeviceManager final : public nsIPresentationDeviceManager - , public nsIPresentationDeviceListener - , public nsIPresentationDeviceEventListener - , public nsIObserver + , public nsIPresentationDeviceListener + , public nsIPresentationDeviceEventListener + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/dom/promise/PromiseCallback.cpp b/dom/promise/PromiseCallback.cpp index 81b8b4e423a..e24c22694ac 100644 --- a/dom/promise/PromiseCallback.cpp +++ b/dom/promise/PromiseCallback.cpp @@ -265,7 +265,6 @@ WrapperPromiseCallback::Call(JSContext* aCx, } // We're back in aValue's compartment here. - JS::Rooted stack(aCx, JS_GetEmptyString(JS_GetRuntime(aCx))); JS::Rooted fn(aCx, JS_NewStringCopyZ(aCx, fileName)); if (!fn) { // Out of memory. Promise will stay unresolved. @@ -283,7 +282,7 @@ WrapperPromiseCallback::Call(JSContext* aCx, } JS::Rooted typeError(aCx); - if (!JS::CreateError(aCx, JSEXN_TYPEERR, stack, fn, lineNumber, 0, + if (!JS::CreateError(aCx, JSEXN_TYPEERR, JS::NullPtr(), fn, lineNumber, 0, nullptr, message, &typeError)) { // Out of memory. Promise will stay unresolved. JS_ClearPendingException(aCx); diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index 2e085c91817..1183cf443d0 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -263,8 +263,8 @@ private: // thread. When on the main thread the runnable will call the callback and then // notify the QuotaManager that the job has been completed. class AsyncUsageRunnable final : public UsageInfo, - public nsRunnable, - public nsIQuotaRequest + public nsRunnable, + public nsIQuotaRequest { enum CallbackState { // Not yet run. diff --git a/dom/quota/QuotaManager.h b/dom/quota/QuotaManager.h index 36059be4ae2..34c9cd6b9aa 100644 --- a/dom/quota/QuotaManager.h +++ b/dom/quota/QuotaManager.h @@ -69,7 +69,7 @@ struct OriginParams }; class QuotaManager final : public nsIQuotaManager, - public nsIObserver + public nsIObserver { friend class AsyncUsageRunnable; friend class CollectOriginsHelper; diff --git a/dom/quota/nsIOfflineStorage.h b/dom/quota/nsIOfflineStorage.h index d1bbabc89d2..987528590f3 100644 --- a/dom/quota/nsIOfflineStorage.h +++ b/dom/quota/nsIOfflineStorage.h @@ -86,19 +86,19 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIOfflineStorage, NS_OFFLINESTORAGE_IID) #define NS_DECL_NSIOFFLINESTORAGE \ NS_IMETHOD_(const nsACString&) \ - Id() override; \ + Id() override; \ \ NS_IMETHOD_(Client*) \ - GetClient() override; \ + GetClient() override; \ \ NS_IMETHOD_(bool) \ - IsOwnedByProcess(ContentParent* aOwner) override; \ + IsOwnedByProcess(ContentParent* aOwner) override; \ \ NS_IMETHOD_(const nsACString&) \ - Origin() override; \ + Origin() override; \ \ NS_IMETHOD_(nsresult) \ - Close() override; \ + Close() override; \ \ NS_IMETHOD_(void) \ Invalidate() override; diff --git a/dom/requestsync/RequestSyncWifiService.h b/dom/requestsync/RequestSyncWifiService.h index a42f4658b70..3b93f9f45df 100644 --- a/dom/requestsync/RequestSyncWifiService.h +++ b/dom/requestsync/RequestSyncWifiService.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class RequestSyncWifiService final : public nsISupports - , public NetworkObserver + , public NetworkObserver { public: NS_DECL_ISUPPORTS diff --git a/dom/security/nsCORSListenerProxy.cpp b/dom/security/nsCORSListenerProxy.cpp index 87949d882e7..8a6b1fd21df 100644 --- a/dom/security/nsCORSListenerProxy.cpp +++ b/dom/security/nsCORSListenerProxy.cpp @@ -917,8 +917,8 @@ nsCORSListenerProxy::UpdateChannel(nsIChannel* aChannel, bool aAllowDataURI) // Class used as streamlistener and notification callback when // doing the initial OPTIONS request for a CORS check class nsCORSPreflightListener final : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink + public nsIInterfaceRequestor, + public nsIChannelEventSink { public: nsCORSPreflightListener(nsIChannel* aOuterChannel, diff --git a/dom/security/nsCORSListenerProxy.h b/dom/security/nsCORSListenerProxy.h index c7aa804b9ce..214c144883b 100644 --- a/dom/security/nsCORSListenerProxy.h +++ b/dom/security/nsCORSListenerProxy.h @@ -30,9 +30,9 @@ NS_StartCORSPreflight(nsIChannel* aRequestChannel, nsIChannel** aPreflightChannel); class nsCORSListenerProxy final : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink, - public nsIAsyncVerifyRedirectCallback + public nsIInterfaceRequestor, + public nsIChannelEventSink, + public nsIAsyncVerifyRedirectCallback { public: nsCORSListenerProxy(nsIStreamListener* aOuter, diff --git a/dom/security/nsCSPContext.h b/dom/security/nsCSPContext.h index fabc486c491..9f38b1abe32 100644 --- a/dom/security/nsCSPContext.h +++ b/dom/security/nsCSPContext.h @@ -99,7 +99,7 @@ class CSPViolationReportListener : public nsIStreamListener // redirects, per the spec. hence, we implement an nsIChannelEventSink // with an object so we can tell XHR to abort if a redirect happens. class CSPReportRedirectSink final : public nsIChannelEventSink, - public nsIInterfaceRequestor + public nsIInterfaceRequestor { public: NS_DECL_NSICHANNELEVENTSINK diff --git a/dom/smil/TimeEvent.h b/dom/smil/TimeEvent.h index 040c8d97361..647931c4869 100644 --- a/dom/smil/TimeEvent.h +++ b/dom/smil/TimeEvent.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class TimeEvent final : public Event, - public nsIDOMTimeEvent + public nsIDOMTimeEvent { public: TimeEvent(EventTarget* aOwner, diff --git a/dom/smil/nsSMILAnimationController.h b/dom/smil/nsSMILAnimationController.h index c7041322f7a..2c13e407456 100644 --- a/dom/smil/nsSMILAnimationController.h +++ b/dom/smil/nsSMILAnimationController.h @@ -42,7 +42,7 @@ class SVGAnimationElement; // here, at the document level. // class nsSMILAnimationController final : public nsSMILTimeContainer, - public nsARefreshObserver + public nsARefreshObserver { public: explicit nsSMILAnimationController(nsIDocument* aDoc); diff --git a/dom/storage/DOMStorageIPC.h b/dom/storage/DOMStorageIPC.h index 004ca1d85ee..ad17e80201b 100644 --- a/dom/storage/DOMStorageIPC.h +++ b/dom/storage/DOMStorageIPC.h @@ -23,7 +23,7 @@ class DOMLocalStorageManager; // and expects asynchronous answers. Those are then transparently // forwarded back to consumers on the child process. class DOMStorageDBChild final : public DOMStorageDBBridge - , public PStorageChild + , public PStorageChild { virtual ~DOMStorageDBChild(); @@ -107,7 +107,7 @@ private: // Also responsible for forwardning all chrome operation notifications // such as cookie cleaning etc to the child process. class DOMStorageDBParent final : public PStorageParent - , public DOMStorageObserverSink + , public DOMStorageObserverSink { virtual ~DOMStorageDBParent(); diff --git a/dom/svg/DOMSVGAnimatedNumberList.h b/dom/svg/DOMSVGAnimatedNumberList.h index 966c8ef919b..a8197ece3bf 100644 --- a/dom/svg/DOMSVGAnimatedNumberList.h +++ b/dom/svg/DOMSVGAnimatedNumberList.h @@ -35,7 +35,7 @@ class SVGNumberList; * weak refs). */ class DOMSVGAnimatedNumberList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class DOMSVGNumberList; diff --git a/dom/svg/DOMSVGLength.h b/dom/svg/DOMSVGLength.h index 3c99e3c8eae..3567a57420a 100644 --- a/dom/svg/DOMSVGLength.h +++ b/dom/svg/DOMSVGLength.h @@ -75,7 +75,7 @@ class ErrorResult; * https://bugzilla.mozilla.org/show_bug.cgi?id=571734 */ class DOMSVGLength final : public nsIDOMSVGLength, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangeLengthNotifier; diff --git a/dom/svg/DOMSVGLengthList.h b/dom/svg/DOMSVGLengthList.h index 088a7b9ea52..2baf54c022a 100644 --- a/dom/svg/DOMSVGLengthList.h +++ b/dom/svg/DOMSVGLengthList.h @@ -39,7 +39,7 @@ class DOMSVGLength; * Our DOM items are created lazily on demand as and when script requests them. */ class DOMSVGLengthList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangeLengthListNotifier; friend class DOMSVGLength; diff --git a/dom/svg/DOMSVGNumber.h b/dom/svg/DOMSVGNumber.h index f3239505278..0663972a983 100644 --- a/dom/svg/DOMSVGNumber.h +++ b/dom/svg/DOMSVGNumber.h @@ -34,7 +34,7 @@ namespace mozilla { * See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too. */ class DOMSVGNumber final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { friend class AutoChangeNumberNotifier; diff --git a/dom/svg/DOMSVGNumberList.h b/dom/svg/DOMSVGNumberList.h index 75adc31b593..d271cabfc10 100644 --- a/dom/svg/DOMSVGNumberList.h +++ b/dom/svg/DOMSVGNumberList.h @@ -39,7 +39,7 @@ class DOMSVGNumber; * Our DOM items are created lazily on demand as and when script requests them. */ class DOMSVGNumberList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangeNumberListNotifier; friend class DOMSVGNumber; diff --git a/dom/svg/DOMSVGPathSeg.h b/dom/svg/DOMSVGPathSeg.h index 1a499e562dc..77543169778 100644 --- a/dom/svg/DOMSVGPathSeg.h +++ b/dom/svg/DOMSVGPathSeg.h @@ -42,25 +42,25 @@ namespace mozilla { } \ /* From DOMSVGPathSeg: */ \ virtual uint32_t \ - Type() const override \ + Type() const override \ { \ return segType; \ } \ virtual DOMSVGPathSeg* \ - Clone() override \ + Clone() override \ { \ /* InternalItem() + 1, because we're skipping the encoded seg type */ \ float *args = IsInList() ? InternalItem() + 1 : mArgs; \ return new DOMSVGPathSeg##segName(args); \ } \ virtual float* \ - PtrToMemberArgs() override \ + PtrToMemberArgs() override \ { \ return mArgs; \ } \ \ virtual JSObject* \ - WrapObject(JSContext* aCx, JS::Handle aGivenProto) override \ + WrapObject(JSContext* aCx, JS::Handle aGivenProto) override \ { \ return dom::SVGPathSeg##segName##Binding::Wrap(aCx, this, aGivenProto); \ } diff --git a/dom/svg/DOMSVGPathSegList.h b/dom/svg/DOMSVGPathSegList.h index a50338afdf2..e7c40c47e77 100644 --- a/dom/svg/DOMSVGPathSegList.h +++ b/dom/svg/DOMSVGPathSegList.h @@ -47,7 +47,7 @@ class SVGAnimatedPathSegList; * Our DOM items are created lazily on demand as and when script requests them. */ class DOMSVGPathSegList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangePathSegListNotifier; friend class DOMSVGPathSeg; diff --git a/dom/svg/DOMSVGPointList.h b/dom/svg/DOMSVGPointList.h index 511b17a2f98..27aea1e6f4c 100644 --- a/dom/svg/DOMSVGPointList.h +++ b/dom/svg/DOMSVGPointList.h @@ -48,7 +48,7 @@ class SVGAnimatedPointList; * Our DOM items are created lazily on demand as and when script requests them. */ class DOMSVGPointList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangePointListNotifier; friend class nsISVGPoint; diff --git a/dom/svg/DOMSVGStringList.h b/dom/svg/DOMSVGStringList.h index f6b82c25b82..3793470bd8a 100644 --- a/dom/svg/DOMSVGStringList.h +++ b/dom/svg/DOMSVGStringList.h @@ -44,7 +44,7 @@ class SVGStringList; * string each time any given item is requested. */ class DOMSVGStringList final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { friend class AutoChangeStringListNotifier; diff --git a/dom/svg/DOMSVGTransformList.h b/dom/svg/DOMSVGTransformList.h index f493e8c51aa..8ffa7b64034 100644 --- a/dom/svg/DOMSVGTransformList.h +++ b/dom/svg/DOMSVGTransformList.h @@ -34,7 +34,7 @@ class SVGTransform; * See the architecture comment in SVGAnimatedTransformList.h. */ class DOMSVGTransformList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class AutoChangeTransformListNotifier; friend class dom::SVGTransform; diff --git a/dom/svg/SVGAElement.h b/dom/svg/SVGAElement.h index 1c7bf379756..00b0ccea3b8 100644 --- a/dom/svg/SVGAElement.h +++ b/dom/svg/SVGAElement.h @@ -23,7 +23,7 @@ namespace dom { typedef SVGGraphicsElement SVGAElementBase; class SVGAElement final : public SVGAElementBase, - public Link + public Link { protected: explicit SVGAElement(already_AddRefed& aNodeInfo); diff --git a/dom/svg/SVGAnimatedPreserveAspectRatio.h b/dom/svg/SVGAnimatedPreserveAspectRatio.h index 5536a93bd23..b096d7fb3d3 100644 --- a/dom/svg/SVGAnimatedPreserveAspectRatio.h +++ b/dom/svg/SVGAnimatedPreserveAspectRatio.h @@ -112,7 +112,7 @@ public: namespace dom { class DOMSVGAnimatedPreserveAspectRatio final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { ~DOMSVGAnimatedPreserveAspectRatio(); diff --git a/dom/svg/SVGMPathElement.h b/dom/svg/SVGMPathElement.h index b36d4c279d1..310f383b881 100644 --- a/dom/svg/SVGMPathElement.h +++ b/dom/svg/SVGMPathElement.h @@ -21,7 +21,7 @@ namespace dom { class SVGPathElement; class SVGMPathElement final : public SVGMPathElementBase, - public nsStubMutationObserver + public nsStubMutationObserver { protected: friend nsresult (::NS_NewSVGMPathElement(nsIContent **aResult, diff --git a/dom/svg/SVGPreserveAspectRatio.h b/dom/svg/SVGPreserveAspectRatio.h index 7dc3bc1b6cc..3305b397299 100644 --- a/dom/svg/SVGPreserveAspectRatio.h +++ b/dom/svg/SVGPreserveAspectRatio.h @@ -113,7 +113,7 @@ private: namespace dom { class DOMSVGPreserveAspectRatio final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/svg/SVGScriptElement.h b/dom/svg/SVGScriptElement.h index 9f40bec07b3..4e40e7cf5ae 100644 --- a/dom/svg/SVGScriptElement.h +++ b/dom/svg/SVGScriptElement.h @@ -24,7 +24,7 @@ namespace dom { typedef nsSVGElement SVGScriptElementBase; class SVGScriptElement final : public SVGScriptElementBase, - public nsScriptElement + public nsScriptElement { protected: friend nsresult (::NS_NewSVGScriptElement(nsIContent **aResult, diff --git a/dom/svg/SVGStyleElement.h b/dom/svg/SVGStyleElement.h index c1b5c203895..e495dd114d0 100644 --- a/dom/svg/SVGStyleElement.h +++ b/dom/svg/SVGStyleElement.h @@ -20,8 +20,8 @@ namespace mozilla { namespace dom { class SVGStyleElement final : public SVGStyleElementBase, - public nsStyleLinkElement, - public nsStubMutationObserver + public nsStyleLinkElement, + public nsStubMutationObserver { protected: friend nsresult (::NS_NewSVGStyleElement(nsIContent **aResult, diff --git a/dom/svg/SVGSymbolElement.h b/dom/svg/SVGSymbolElement.h index 7a45aa25d01..187b629dd75 100644 --- a/dom/svg/SVGSymbolElement.h +++ b/dom/svg/SVGSymbolElement.h @@ -20,7 +20,7 @@ namespace dom { typedef nsSVGElement SVGSymbolElementBase; class SVGSymbolElement final : public SVGSymbolElementBase, - public SVGTests + public SVGTests { protected: friend nsresult (::NS_NewSVGSymbolElement(nsIContent **aResult, diff --git a/dom/svg/SVGTitleElement.h b/dom/svg/SVGTitleElement.h index 3153cb608c9..5ee6bfcc29a 100644 --- a/dom/svg/SVGTitleElement.h +++ b/dom/svg/SVGTitleElement.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { class SVGTitleElement final : public SVGTitleElementBase, - public nsStubMutationObserver + public nsStubMutationObserver { protected: friend nsresult (::NS_NewSVGTitleElement(nsIContent **aResult, diff --git a/dom/svg/SVGUseElement.h b/dom/svg/SVGUseElement.h index 4eef3e665d7..a1029372dab 100644 --- a/dom/svg/SVGUseElement.h +++ b/dom/svg/SVGUseElement.h @@ -30,7 +30,7 @@ namespace dom { typedef SVGGraphicsElement SVGUseElementBase; class SVGUseElement final : public SVGUseElementBase, - public nsStubMutationObserver + public nsStubMutationObserver { friend class ::nsSVGUseFrame; protected: diff --git a/dom/system/gonk/AudioManager.h b/dom/system/gonk/AudioManager.h index e3381adaec2..02fc94ea8f2 100644 --- a/dom/system/gonk/AudioManager.h +++ b/dom/system/gonk/AudioManager.h @@ -39,7 +39,7 @@ namespace gonk { class RecoverTask; class AudioChannelVolInitCallback; class AudioManager final : public nsIAudioManager - , public nsIObserver + , public nsIObserver { public: static already_AddRefed GetInstance(); diff --git a/dom/system/gonk/SystemWorkerManager.h b/dom/system/gonk/SystemWorkerManager.h index 46177f892fb..d5b4a33a815 100644 --- a/dom/system/gonk/SystemWorkerManager.h +++ b/dom/system/gonk/SystemWorkerManager.h @@ -37,8 +37,8 @@ namespace dom { namespace gonk { class SystemWorkerManager final : public nsIObserver, - public nsIInterfaceRequestor, - public nsISystemWorkerManager + public nsIInterfaceRequestor, + public nsISystemWorkerManager { public: NS_DECL_ISUPPORTS diff --git a/dom/system/gonk/nsVolumeMountLock.h b/dom/system/gonk/nsVolumeMountLock.h index c61183b37aa..40be5780058 100644 --- a/dom/system/gonk/nsVolumeMountLock.h +++ b/dom/system/gonk/nsVolumeMountLock.h @@ -26,8 +26,8 @@ namespace system { */ class nsVolumeMountLock final : public nsIVolumeMountLock, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/dom/system/gonk/nsVolumeService.h b/dom/system/gonk/nsVolumeService.h index e5fe6ec181b..c393cec74af 100644 --- a/dom/system/gonk/nsVolumeService.h +++ b/dom/system/gonk/nsVolumeService.h @@ -32,7 +32,7 @@ class Volume; */ class nsVolumeService final : public nsIVolumeService, - public nsIDOMMozWakeLockListener + public nsIDOMMozWakeLockListener { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/dom/telephony/CallsList.h b/dom/telephony/CallsList.h index 0c158065d1c..81f40751298 100644 --- a/dom/telephony/CallsList.h +++ b/dom/telephony/CallsList.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class CallsList final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { nsRefPtr mTelephony; nsRefPtr mGroup; diff --git a/dom/telephony/MMICall.h b/dom/telephony/MMICall.h index f263448f80c..d7b5b1989b2 100644 --- a/dom/telephony/MMICall.h +++ b/dom/telephony/MMICall.h @@ -25,7 +25,7 @@ namespace mozilla { namespace dom { class MMICall final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/telephony/Telephony.h b/dom/telephony/Telephony.h index c8dce339fc8..db1d0933341 100644 --- a/dom/telephony/Telephony.h +++ b/dom/telephony/Telephony.h @@ -31,7 +31,7 @@ class TelephonyDialCallback; class OwningTelephonyCallOrTelephonyCallGroup; class Telephony final : public DOMEventTargetHelper, - private nsITelephonyListener + private nsITelephonyListener { /** * Class Telephony doesn't actually expose nsITelephonyListener. diff --git a/dom/telephony/TelephonyCallId.h b/dom/telephony/TelephonyCallId.h index c54c8f6ffc2..bd8d020d1c1 100644 --- a/dom/telephony/TelephonyCallId.h +++ b/dom/telephony/TelephonyCallId.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { class TelephonyCallId final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/telephony/TelephonyDialCallback.h b/dom/telephony/TelephonyDialCallback.h index aa0559bf49e..721364d76b6 100644 --- a/dom/telephony/TelephonyDialCallback.h +++ b/dom/telephony/TelephonyDialCallback.h @@ -24,7 +24,7 @@ namespace dom { namespace telephony { class TelephonyDialCallback final : public TelephonyCallback, - public nsITelephonyDialCallback + public nsITelephonyDialCallback { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/telephony/USSDSession.h b/dom/telephony/USSDSession.h index 6e1f15685e7..c8ba998dff1 100644 --- a/dom/telephony/USSDSession.h +++ b/dom/telephony/USSDSession.h @@ -24,7 +24,7 @@ namespace mozilla { namespace dom { class USSDSession final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/telephony/ipc/TelephonyIPCService.h b/dom/telephony/ipc/TelephonyIPCService.h index 84bddd313e8..72d26d311ea 100644 --- a/dom/telephony/ipc/TelephonyIPCService.h +++ b/dom/telephony/ipc/TelephonyIPCService.h @@ -17,8 +17,8 @@ class IPCTelephonyRequest; class PTelephonyChild; class TelephonyIPCService final : public nsITelephonyService - , public nsITelephonyListener - , public nsIObserver + , public nsITelephonyListener + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/dom/tests/browser/browser_ConsoleAPITests.js b/dom/tests/browser/browser_ConsoleAPITests.js index 17ebebc8a92..0268d2a137e 100644 --- a/dom/tests/browser/browser_ConsoleAPITests.js +++ b/dom/tests/browser/browser_ConsoleAPITests.js @@ -171,10 +171,10 @@ function testConsoleGroup(aMessageObject) { function startTraceTest() { gLevel = "trace"; gArgs = [ - {columnNumber: 8, filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 6}, - {columnNumber: 15, filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 11}, - {columnNumber: 15, filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 15}, - {columnNumber: 0, filename: TEST_URI, functionName: "onclick", language: 2, lineNumber: 1} + {columnNumber: 9, filename: TEST_URI, functionName: "window.foobar585956c", language: 2, lineNumber: 6}, + {columnNumber: 16, filename: TEST_URI, functionName: "foobar585956b", language: 2, lineNumber: 11}, + {columnNumber: 16, filename: TEST_URI, functionName: "foobar585956a", language: 2, lineNumber: 15}, + {columnNumber: 1, filename: TEST_URI, functionName: "onclick", language: 2, lineNumber: 1} ]; let button = gWindow.document.getElementById("test-trace"); diff --git a/dom/time/TimeManager.h b/dom/time/TimeManager.h index b7bc189b760..a1879ec5cd5 100644 --- a/dom/time/TimeManager.h +++ b/dom/time/TimeManager.h @@ -18,7 +18,7 @@ class Date; namespace time { class TimeManager final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal) diff --git a/dom/tv/TVProgram.h b/dom/tv/TVProgram.h index c66c940bce5..be834c22c14 100644 --- a/dom/tv/TVProgram.h +++ b/dom/tv/TVProgram.h @@ -17,7 +17,7 @@ namespace dom { class TVChannel; class TVProgram final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/voicemail/Voicemail.h b/dom/voicemail/Voicemail.h index a3a61a9b40f..045528fa4e2 100644 --- a/dom/voicemail/Voicemail.h +++ b/dom/voicemail/Voicemail.h @@ -23,7 +23,7 @@ namespace dom { class VoicemailStatus; class Voicemail final : public DOMEventTargetHelper, - private nsIVoicemailListener + private nsIVoicemailListener { /** * Class Voicemail doesn't actually expose nsIVoicemailListener. Instead, it diff --git a/dom/voicemail/VoicemailStatus.h b/dom/voicemail/VoicemailStatus.h index 9b31f3c1e81..b423adc5958 100644 --- a/dom/voicemail/VoicemailStatus.h +++ b/dom/voicemail/VoicemailStatus.h @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { class VoicemailStatus final : public nsISupports - , public nsWrapperCache + , public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/voicemail/ipc/VoicemailIPCService.h b/dom/voicemail/ipc/VoicemailIPCService.h index 350cfba212e..7cf5f704187 100644 --- a/dom/voicemail/ipc/VoicemailIPCService.h +++ b/dom/voicemail/ipc/VoicemailIPCService.h @@ -17,7 +17,7 @@ namespace dom { namespace voicemail { class VoicemailIPCService final : public PVoicemailChild - , public nsIVoicemailService + , public nsIVoicemailService { public: NS_DECL_ISUPPORTS diff --git a/dom/voicemail/ipc/VoicemailParent.h b/dom/voicemail/ipc/VoicemailParent.h index 16eeb202113..c980665580a 100644 --- a/dom/voicemail/ipc/VoicemailParent.h +++ b/dom/voicemail/ipc/VoicemailParent.h @@ -19,7 +19,7 @@ namespace dom { namespace voicemail { class VoicemailParent final : public PVoicemailParent - , public nsIVoicemailListener + , public nsIVoicemailListener { public: NS_DECL_ISUPPORTS diff --git a/dom/wifi/WifiCertService.h b/dom/wifi/WifiCertService.h index 8ef1347266c..8621b93d0ec 100644 --- a/dom/wifi/WifiCertService.h +++ b/dom/wifi/WifiCertService.h @@ -16,7 +16,7 @@ namespace mozilla { namespace dom { class WifiCertService final : public nsIWifiCertService, - public nsNSSShutDownObject + public nsNSSShutDownObject { public: NS_DECL_ISUPPORTS diff --git a/dom/workers/DataStore.h b/dom/workers/DataStore.h index a9fff64ed11..d18414cb2f9 100644 --- a/dom/workers/DataStore.h +++ b/dom/workers/DataStore.h @@ -99,7 +99,7 @@ private: }; class DataStoreChangeEventProxy final : public nsIDOMEventListener - , public WorkerFeature + , public WorkerFeature { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 8b51466a662..a48294d0e6e 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -222,8 +222,8 @@ private: }; class ScriptLoaderRunnable final : public WorkerFeature, - public nsIRunnable, - public nsIStreamLoaderObserver + public nsIRunnable, + public nsIStreamLoaderObserver { friend class ScriptExecutorRunnable; diff --git a/dom/workers/ServiceWorkerClients.h b/dom/workers/ServiceWorkerClients.h index 203fd1898d5..08c4bba94a9 100644 --- a/dom/workers/ServiceWorkerClients.h +++ b/dom/workers/ServiceWorkerClients.h @@ -20,7 +20,7 @@ namespace dom { namespace workers { class ServiceWorkerClients final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 96ab04a5787..7c13f2fe0cc 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -380,8 +380,6 @@ public: JSContext* cx = jsapi.cx(); - JS::Rooted stack(cx, JS_GetEmptyString(JS_GetRuntime(cx))); - JS::Rooted fnval(cx); if (!ToJSValue(cx, aErrorDesc.mFilename, &fnval)) { JS_ClearPendingException(cx); @@ -399,7 +397,7 @@ public: JS::Rooted msg(cx, msgval.toString()); JS::Rooted error(cx); - if (!JS::CreateError(cx, JSEXN_ERR, stack, fn, aErrorDesc.mLineno, + if (!JS::CreateError(cx, JSEXN_ERR, JS::NullPtr(), fn, aErrorDesc.mLineno, aErrorDesc.mColno, nullptr, msg, &error)) { JS_ClearPendingException(cx); mPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); @@ -484,7 +482,7 @@ GetRequiredScopeStringPrefix(const nsACString& aScriptSpec, nsACString& aPrefix) } // anonymous namespace class ServiceWorkerRegisterJob final : public ServiceWorkerJob, - public nsIStreamLoaderObserver + public nsIStreamLoaderObserver { friend class ContinueInstallTask; diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 2958eaaca2c..506e41b058f 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -613,8 +613,8 @@ private: }; class WorkerScopeUnregisterRunnable final : public nsRunnable - , public nsIServiceWorkerUnregisterCallback - , public WorkerFeature + , public nsIServiceWorkerUnregisterCallback + , public WorkerFeature { WorkerPrivate* mWorkerPrivate; nsString mScope; diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 17450132701..ab165e197eb 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -236,7 +236,7 @@ public: }; class WorkerDebuggerGlobalScope final : public DOMEventTargetHelper, - public nsIGlobalObject + public nsIGlobalObject { WorkerPrivate* mWorkerPrivate; diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 481e7ef40f7..8e7a836c66a 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -315,7 +315,7 @@ private: }; class LoadStartDetectionRunnable final : public nsRunnable, - public nsIDOMEventListener + public nsIDOMEventListener { WorkerPrivate* mWorkerPrivate; nsRefPtr mProxy; diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 07dfcec7891..a12dc19caf1 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -29,7 +29,7 @@ class XMLHttpRequestUpload; class WorkerPrivate; class XMLHttpRequest final: public nsXHREventTarget, - public WorkerFeature + public WorkerFeature { public: struct StateData diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index ea230160164..a4ee79bc160 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -168,7 +168,7 @@ public: // asynchronous parsing of URLs /* Header file */ class nsXBLStreamListener final : public nsIStreamListener, - public nsIDOMEventListener + public nsIDOMEventListener { public: NS_DECL_ISUPPORTS diff --git a/dom/xml/CDATASection.h b/dom/xml/CDATASection.h index cd19fdfb445..4f45aebbca9 100644 --- a/dom/xml/CDATASection.h +++ b/dom/xml/CDATASection.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class CDATASection final : public Text, - public nsIDOMCDATASection + public nsIDOMCDATASection { private: void Init() diff --git a/dom/xslt/xpath/XPathResult.h b/dom/xslt/xpath/XPathResult.h index b74380eacd4..268e21df982 100644 --- a/dom/xslt/xpath/XPathResult.h +++ b/dom/xslt/xpath/XPathResult.h @@ -45,8 +45,8 @@ namespace dom { * A class for evaluating an XPath expression string */ class XPathResult final : public nsIXPathResult, - public nsStubMutationObserver, - public nsWrapperCache + public nsStubMutationObserver, + public nsWrapperCache { ~XPathResult(); diff --git a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp index 3ef40f9fb15..3753aa11b77 100644 --- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp +++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp @@ -65,9 +65,9 @@ getSpec(nsIChannel* aChannel, nsAString& aSpec) } class txStylesheetSink final : public nsIXMLContentSink, - public nsIExpatSink, - public nsIStreamListener, - public nsIInterfaceRequestor + public nsIExpatSink, + public nsIStreamListener, + public nsIInterfaceRequestor { public: txStylesheetSink(txStylesheetCompiler* aCompiler, nsIParser* aParser); diff --git a/dom/xslt/xslt/txMozillaXMLOutput.h b/dom/xslt/xslt/txMozillaXMLOutput.h index e2dc6dd9af3..75732d596f3 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.h +++ b/dom/xslt/xslt/txMozillaXMLOutput.h @@ -29,7 +29,7 @@ class nsIDocument; class nsINode; class txTransformNotifier final : public nsIScriptLoaderObserver, - public nsICSSLoaderObserver + public nsICSSLoaderObserver { public: txTransformNotifier(); diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.h b/dom/xslt/xslt/txMozillaXSLTProcessor.h index febca578df1..11ab8b2c3d5 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.h +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.h @@ -50,10 +50,10 @@ class GlobalObject; * txMozillaXSLTProcessor is a front-end to the XSLT Processor. */ class txMozillaXSLTProcessor final : public nsIXSLTProcessor, - public nsIXSLTProcessorPrivate, - public nsIDocumentTransformer, - public nsStubMutationObserver, - public nsWrapperCache + public nsIXSLTProcessorPrivate, + public nsIDocumentTransformer, + public nsStubMutationObserver, + public nsWrapperCache { public: /** diff --git a/dom/xslt/xslt/txStylesheetCompiler.h b/dom/xslt/xslt/txStylesheetCompiler.h index 7416f7e6d05..8bbd45dc91f 100644 --- a/dom/xslt/xslt/txStylesheetCompiler.h +++ b/dom/xslt/xslt/txStylesheetCompiler.h @@ -187,7 +187,7 @@ struct txStylesheetAttr }; class txStylesheetCompiler final : private txStylesheetCompilerState, - public txACompileObserver + public txACompileObserver { public: friend class txStylesheetCompilerState; diff --git a/dom/xul/XULDocument.h b/dom/xul/XULDocument.h index d411168d701..ef7100259da 100644 --- a/dom/xul/XULDocument.h +++ b/dom/xul/XULDocument.h @@ -87,11 +87,11 @@ namespace mozilla { namespace dom { class XULDocument final : public XMLDocument, - public nsIXULDocument, - public nsIDOMXULDocument, - public nsIStreamLoaderObserver, - public nsICSSLoaderObserver, - public nsIOffThreadScriptReceiver + public nsIXULDocument, + public nsIDOMXULDocument, + public nsIStreamLoaderObserver, + public nsICSSLoaderObserver, + public nsIOffThreadScriptReceiver { public: XULDocument(); diff --git a/dom/xul/nsXULContentSink.h b/dom/xul/nsXULContentSink.h index 2d61cd10d9b..793685ddd4f 100644 --- a/dom/xul/nsXULContentSink.h +++ b/dom/xul/nsXULContentSink.h @@ -23,7 +23,7 @@ class nsXULPrototypeElement; class nsXULPrototypeNode; class XULContentSinkImpl final : public nsIXMLContentSink, - public nsIExpatSink + public nsIExpatSink { public: XULContentSinkImpl(); diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index bba1854cf78..dee3cd51f8e 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -124,7 +124,7 @@ uint32_t nsXULPrototypeAttribute::gNumCacheFills; #endif class nsXULElementTearoff final : public nsIDOMElementCSSInlineStyle, - public nsIFrameLoaderOwner + public nsIFrameLoaderOwner { ~nsXULElementTearoff() {} diff --git a/dom/xul/nsXULElement.h b/dom/xul/nsXULElement.h index d6e6c3b1bbd..66b3a3849ba 100644 --- a/dom/xul/nsXULElement.h +++ b/dom/xul/nsXULElement.h @@ -368,7 +368,7 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 3); class nsScriptEventHandlerOwnerTearoff; class nsXULElement final : public nsStyledElement, - public nsIDOMXULElement + public nsIDOMXULElement { public: explicit nsXULElement(already_AddRefed aNodeInfo); diff --git a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.h b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.h index 7040ed46257..aaa4691e571 100644 --- a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.h +++ b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.h @@ -41,7 +41,7 @@ class nsXULTemplateResultRDF; * An object that generates results from a query on an RDF graph */ class nsXULTemplateQueryProcessorRDF final : public nsIXULTemplateQueryProcessor, - public nsIRDFObserver + public nsIRDFObserver { public: typedef nsTArray > ResultArray; diff --git a/dom/xul/templates/nsXULTemplateQueryProcessorXML.h b/dom/xul/templates/nsXULTemplateQueryProcessorXML.h index 0d79914bfd3..8d2d6bd8e03 100644 --- a/dom/xul/templates/nsXULTemplateQueryProcessorXML.h +++ b/dom/xul/templates/nsXULTemplateQueryProcessorXML.h @@ -119,7 +119,7 @@ public: }; class nsXULTemplateQueryProcessorXML final : public nsIXULTemplateQueryProcessor, - public nsIDOMEventListener + public nsIDOMEventListener { public: diff --git a/editor/composer/nsEditingSession.h b/editor/composer/nsEditingSession.h index a6f17f184bf..2351ad4ea85 100644 --- a/editor/composer/nsEditingSession.h +++ b/editor/composer/nsEditingSession.h @@ -44,8 +44,8 @@ class nsIEditor; class nsIWebProgress; class nsEditingSession final : public nsIEditingSession, - public nsIWebProgressListener, - public nsSupportsWeakReference + public nsIWebProgressListener, + public nsSupportsWeakReference { public: diff --git a/editor/libeditor/nsHTMLEditor.h b/editor/libeditor/nsHTMLEditor.h index e582cc1969b..206a5424d19 100644 --- a/editor/libeditor/nsHTMLEditor.h +++ b/editor/libeditor/nsHTMLEditor.h @@ -65,14 +65,14 @@ struct IMEState; * Use to edit HTML document represented as a DOM tree. */ class nsHTMLEditor final : public nsPlaintextEditor, - public nsIHTMLEditor, - public nsIHTMLObjectResizer, - public nsIHTMLAbsPosEditor, - public nsITableEditor, - public nsIHTMLInlineTableEditor, - public nsIEditorStyleSheets, - public nsICSSLoaderObserver, - public nsStubMutationObserver + public nsIHTMLEditor, + public nsIHTMLObjectResizer, + public nsIHTMLAbsPosEditor, + public nsITableEditor, + public nsIHTMLInlineTableEditor, + public nsIEditorStyleSheets, + public nsICSSLoaderObserver, + public nsStubMutationObserver { typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType; diff --git a/editor/txmgr/nsTransactionManager.h b/editor/txmgr/nsTransactionManager.h index d1fb164be9b..2b244f48271 100644 --- a/editor/txmgr/nsTransactionManager.h +++ b/editor/txmgr/nsTransactionManager.h @@ -24,7 +24,7 @@ class nsTransactionItem; * */ class nsTransactionManager final : public nsITransactionManager - , public nsSupportsWeakReference + , public nsSupportsWeakReference { private: diff --git a/editor/txtsvc/nsTextServicesDocument.h b/editor/txtsvc/nsTextServicesDocument.h index 782592ba89a..b41941f18ba 100644 --- a/editor/txtsvc/nsTextServicesDocument.h +++ b/editor/txtsvc/nsTextServicesDocument.h @@ -33,7 +33,7 @@ class nsString; * */ class nsTextServicesDocument final : public nsITextServicesDocument, - public nsIEditActionListener + public nsIEditActionListener { private: static nsIAtom *sAAtom; diff --git a/embedding/browser/nsDocShellTreeOwner.h b/embedding/browser/nsDocShellTreeOwner.h index e1666ad1c73..fc87bd8e92d 100644 --- a/embedding/browser/nsDocShellTreeOwner.h +++ b/embedding/browser/nsDocShellTreeOwner.h @@ -61,12 +61,12 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsICDocShellTreeOwner, NS_ICDOCSHELLTREEOWNER_IID) class nsDocShellTreeOwner final : public nsIDocShellTreeOwner, - public nsIBaseWindow, - public nsIInterfaceRequestor, - public nsIWebProgressListener, - public nsIDOMEventListener, - public nsICDocShellTreeOwner, - public nsSupportsWeakReference + public nsIBaseWindow, + public nsIInterfaceRequestor, + public nsIWebProgressListener, + public nsIDOMEventListener, + public nsICDocShellTreeOwner, + public nsSupportsWeakReference { friend class nsWebBrowser; friend class nsCommandHandler; diff --git a/embedding/browser/nsWebBrowser.h b/embedding/browser/nsWebBrowser.h index a9efbd1841a..88eeb413faf 100644 --- a/embedding/browser/nsWebBrowser.h +++ b/embedding/browser/nsWebBrowser.h @@ -73,19 +73,19 @@ public: class nsWebBrowser final : public nsIWebBrowser, - public nsIWebNavigation, - public nsIWebBrowserSetup, - public nsIDocShellTreeItem, - public nsIBaseWindow, - public nsIScrollable, - public nsITextScroll, - public nsIInterfaceRequestor, - public nsIWebBrowserPersist, - public nsIWebBrowserFocus, - public nsIWebProgressListener, - public nsIWebBrowserStream, - public nsIWidgetListener, - public nsSupportsWeakReference + public nsIWebNavigation, + public nsIWebBrowserSetup, + public nsIDocShellTreeItem, + public nsIBaseWindow, + public nsIScrollable, + public nsITextScroll, + public nsIInterfaceRequestor, + public nsIWebBrowserPersist, + public nsIWebBrowserFocus, + public nsIWebProgressListener, + public nsIWebBrowserStream, + public nsIWidgetListener, + public nsSupportsWeakReference { friend class nsDocShellTreeOwner; public: diff --git a/embedding/components/printingui/ipc/PrintProgressDialogChild.h b/embedding/components/printingui/ipc/PrintProgressDialogChild.h index c431f89e711..b0a7105d7ab 100644 --- a/embedding/components/printingui/ipc/PrintProgressDialogChild.h +++ b/embedding/components/printingui/ipc/PrintProgressDialogChild.h @@ -15,8 +15,8 @@ namespace mozilla { namespace embedding { class PrintProgressDialogChild final : public PPrintProgressDialogChild, - public nsIWebProgressListener, - public nsIPrintProgressParams + public nsIWebProgressListener, + public nsIPrintProgressParams { NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER diff --git a/embedding/components/printingui/ipc/PrintProgressDialogParent.h b/embedding/components/printingui/ipc/PrintProgressDialogParent.h index 1c1bb5e5b9a..540609162a8 100644 --- a/embedding/components/printingui/ipc/PrintProgressDialogParent.h +++ b/embedding/components/printingui/ipc/PrintProgressDialogParent.h @@ -14,7 +14,7 @@ class nsIWebProgressListener; namespace mozilla { namespace embedding { class PrintProgressDialogParent final : public PPrintProgressDialogParent, - public nsIObserver + public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/extensions/cookie/nsPermissionManager.h b/extensions/cookie/nsPermissionManager.h index 5a2eb6936b4..3b4252015ef 100644 --- a/extensions/cookie/nsPermissionManager.h +++ b/extensions/cookie/nsPermissionManager.h @@ -29,8 +29,8 @@ class mozIStorageAsyncStatement; //////////////////////////////////////////////////////////////////////////////// class nsPermissionManager final : public nsIPermissionManager, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { public: class PermissionEntry diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 26e961ca1e1..83a8d150ddc 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -883,7 +883,7 @@ mount_operation_ask_password (GMountOperation *mount_op, //----------------------------------------------------------------------------- class nsGIOProtocolHandler final : public nsIProtocolHandler - , public nsIObserver + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/extensions/permissions/nsContentBlocker.h b/extensions/permissions/nsContentBlocker.h index 40a355cc613..88030095209 100644 --- a/extensions/permissions/nsContentBlocker.h +++ b/extensions/permissions/nsContentBlocker.h @@ -16,8 +16,8 @@ class nsIPrefBranch; //////////////////////////////////////////////////////////////////////////////// class nsContentBlocker final : public nsIContentPolicy, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { public: diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.h b/extensions/spellcheck/hunspell/src/mozHunspell.h index bfe9c25b7f7..203766d8997 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.h +++ b/extensions/spellcheck/hunspell/src/mozHunspell.h @@ -82,9 +82,9 @@ { 0xa6, 0x89, 0x88, 0x66, 0x92, 0xa9, 0x7f, 0xe7 } } class mozHunspell final : public mozISpellCheckingEngine, - public nsIObserver, - public nsSupportsWeakReference, - public nsIMemoryReporter + public nsIObserver, + public nsSupportsWeakReference, + public nsIMemoryReporter { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.h b/extensions/spellcheck/src/mozInlineSpellChecker.h index 000ee1bfda1..ad4317cf6ea 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.h +++ b/extensions/spellcheck/src/mozInlineSpellChecker.h @@ -117,9 +117,9 @@ protected: }; class mozInlineSpellChecker final : public nsIInlineSpellChecker, - public nsIEditActionListener, - public nsIDOMEventListener, - public nsSupportsWeakReference + public nsIEditActionListener, + public nsIDOMEventListener, + public nsSupportsWeakReference { private: friend class mozInlineSpellStatus; diff --git a/extensions/spellcheck/src/mozPersonalDictionary.h b/extensions/spellcheck/src/mozPersonalDictionary.h index 6dde1620592..b169ebe96ca 100644 --- a/extensions/spellcheck/src/mozPersonalDictionary.h +++ b/extensions/spellcheck/src/mozPersonalDictionary.h @@ -27,8 +27,8 @@ class mozPersonalDictionaryLoader; class mozPersonalDictionary final : public mozIPersonalDictionary, - public nsIObserver, - public nsSupportsWeakReference + public nsIObserver, + public nsSupportsWeakReference { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/gfx/2d/ExtendInputEffectD2D1.h b/gfx/2d/ExtendInputEffectD2D1.h index 09306389799..724c6a71e3c 100644 --- a/gfx/2d/ExtendInputEffectD2D1.h +++ b/gfx/2d/ExtendInputEffectD2D1.h @@ -34,7 +34,7 @@ enum { // (which can transform transparent pixels into non-transparent ones, but only // inside their input effect's output rect). class ExtendInputEffectD2D1 final : public ID2D1EffectImpl - , public ID2D1DrawTransform + , public ID2D1DrawTransform { public: // ID2D1EffectImpl diff --git a/gfx/2d/RadialGradientEffectD2D1.h b/gfx/2d/RadialGradientEffectD2D1.h index ac8d433dcd0..a902588d110 100644 --- a/gfx/2d/RadialGradientEffectD2D1.h +++ b/gfx/2d/RadialGradientEffectD2D1.h @@ -39,7 +39,7 @@ enum { }; class RadialGradientEffectD2D1 final : public ID2D1EffectImpl - , public ID2D1DrawTransform + , public ID2D1DrawTransform { public: // ID2D1EffectImpl diff --git a/gfx/layers/client/ClientPaintedLayer.h b/gfx/layers/client/ClientPaintedLayer.h index 5b8e4de0b1c..b8f2b749616 100644 --- a/gfx/layers/client/ClientPaintedLayer.h +++ b/gfx/layers/client/ClientPaintedLayer.h @@ -28,7 +28,7 @@ class ShadowableLayer; class SpecificLayerAttributes; class ClientPaintedLayer : public PaintedLayer, - public ClientLayer { + public ClientLayer { public: typedef RotatedContentBuffer::PaintState PaintState; typedef RotatedContentBuffer::ContentType ContentType; diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index 1492d128609..57999a2badd 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -36,7 +36,7 @@ class SpecificLayerAttributes; * There is no ContentClient for tiled layers. There is a ContentHost, however. */ class ClientTiledPaintedLayer : public PaintedLayer, - public ClientLayer + public ClientLayer { typedef PaintedLayer Base; diff --git a/gfx/layers/client/ContentClient.h b/gfx/layers/client/ContentClient.h index a8a28ebc2d0..5778ec98dd9 100644 --- a/gfx/layers/client/ContentClient.h +++ b/gfx/layers/client/ContentClient.h @@ -129,7 +129,7 @@ public: // thin wrapper around RotatedContentBuffer, for on-mtc class ContentClientBasic final : public ContentClient - , protected RotatedContentBuffer + , protected RotatedContentBuffer { public: ContentClientBasic(); diff --git a/gfx/layers/composite/PaintedLayerComposite.h b/gfx/layers/composite/PaintedLayerComposite.h index 9761872cc34..564ea4e8fc6 100644 --- a/gfx/layers/composite/PaintedLayerComposite.h +++ b/gfx/layers/composite/PaintedLayerComposite.h @@ -34,7 +34,7 @@ class ContentHost; class TiledLayerComposer; class PaintedLayerComposite : public PaintedLayer, - public LayerComposite + public LayerComposite { public: explicit PaintedLayerComposite(LayerManagerComposite *aManager); diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index f901a91dae0..2015d872874 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -1506,7 +1506,7 @@ CompositorParent::RequestNotifyLayerTreeCleared(uint64_t aLayersId, CompositorUp * CompositorParent it's associated with. */ class CrossProcessCompositorParent final : public PCompositorParent, - public ShadowLayersManager + public ShadowLayersManager { friend class CompositorParent; diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 411ebc5ac24..0011a479cc5 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -143,7 +143,7 @@ protected: }; class CompositorParent final : public PCompositorParent, - public ShadowLayersManager + public ShadowLayersManager { NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorParent) friend class CompositorVsyncObserver; diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index 7042c046663..0815438f2a6 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -102,8 +102,8 @@ bool InImageBridgeChildThread(); * CompositableHost with an AsyncID). */ class ImageBridgeChild final : public PImageBridgeChild - , public CompositableForwarder - , public AsyncTransactionTrackersHolder + , public CompositableForwarder + , public AsyncTransactionTrackersHolder { friend class ImageContainer; typedef InfallibleTArray AsyncParentMessageArray; diff --git a/gfx/layers/ipc/ImageBridgeParent.h b/gfx/layers/ipc/ImageBridgeParent.h index e504481960f..21c250e5fb9 100644 --- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -38,7 +38,7 @@ namespace layers { * interesting stuff is in ImageContainerParent. */ class ImageBridgeParent final : public PImageBridgeParent, - public CompositableParentManager + public CompositableParentManager { public: typedef InfallibleTArray EditArray; diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index db41be690fa..01129fa841e 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -185,8 +185,8 @@ protected: * GL texture(s). */ class TextureImageTextureSourceOGL final : public DataTextureSource - , public TextureSourceOGL - , public BigImageIterator + , public TextureSourceOGL + , public BigImageIterator { public: explicit TextureImageTextureSourceOGL(CompositorOGL *aCompositor, diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 5c664567610..515cb6e6982 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -336,23 +336,23 @@ void nsRegion::SimplifyOutwardByArea(uint32_t aThreshold) // merge the rects into tmpRect rect = MergeRects(topRects, topRectsEnd, bottomRects, bottomRectsEnd, tmpRect); + // set topRects to where the newly merged rects will be so that we use them + // as our next set of topRects + topRects = destRect; // copy the merged rects back into the destination topRectsEnd = CopyRow(destRect, tmpRect, rect); - topRects = destRect; - bottomRects = bottomRectsEnd; - destRect = topRects; } else { // copy the unmerged rects destRect = CopyRow(destRect, topRects, topRectsEnd); topRects = bottomRects; topRectsEnd = bottomRectsEnd; - bottomRects = bottomRectsEnd; if (bottomRectsEnd == end) { // copy the last row when we are done topRectsEnd = CopyRow(destRect, topRects, topRectsEnd); } } + bottomRects = bottomRectsEnd; } while (bottomRectsEnd != end); diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index e85fcdf8c99..df0d60d1980 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -46,7 +46,7 @@ using namespace mozilla::gfx; static FT_Library gPlatformFTLibrary = nullptr; class FreetypeReporter final : public nsIMemoryReporter, - public CountingAllocatorBase + public CountingAllocatorBase { private: ~FreetypeReporter() {} diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 6e8f05a930e..1d3a4f0f233 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -144,7 +144,7 @@ using namespace mozilla::gfx; /* Class to listen for pref changes so that chrome code can dynamically force sRGB as an output profile. See Bug #452125. */ class SRGBOverrideObserver final : public nsIObserver, - public nsSupportsWeakReference + public nsSupportsWeakReference { ~SRGBOverrideObserver() {} public: diff --git a/image/decoders/icon/nsIconURI.h b/image/decoders/icon/nsIconURI.h index 94e20baf33a..dc4820dcb3f 100644 --- a/image/decoders/icon/nsIconURI.h +++ b/image/decoders/icon/nsIconURI.h @@ -13,7 +13,7 @@ #include "nsIIPCSerializableURI.h" class nsMozIconURI final : public nsIMozIconURI - , public nsIIPCSerializableURI + , public nsIIPCSerializableURI { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/image/src/RasterImage.h b/image/src/RasterImage.h index d1d75719119..2c831b59463 100644 --- a/image/src/RasterImage.h +++ b/image/src/RasterImage.h @@ -146,10 +146,10 @@ DecodeFlags(uint32_t aFlags) } class RasterImage final : public ImageResource - , public nsIProperties - , public SupportsWeakPtr + , public nsIProperties + , public SupportsWeakPtr #ifdef DEBUG - , public imgIContainerDebug + , public imgIContainerDebug #endif { // (no public constructor - use ImageFactory) diff --git a/image/src/SVGDocumentWrapper.h b/image/src/SVGDocumentWrapper.h index 2929e25e2d9..d8e571d2d48 100644 --- a/image/src/SVGDocumentWrapper.h +++ b/image/src/SVGDocumentWrapper.h @@ -36,8 +36,8 @@ class SVGSVGElement; namespace image { class SVGDocumentWrapper final : public nsIStreamListener, - public nsIObserver, - nsSupportsWeakReference + public nsIObserver, + nsSupportsWeakReference { public: SVGDocumentWrapper(); diff --git a/image/src/VectorImage.h b/image/src/VectorImage.h index 81efd58cb0d..249ce3be639 100644 --- a/image/src/VectorImage.h +++ b/image/src/VectorImage.h @@ -27,7 +27,7 @@ class SVGLoadEventListener; class SVGParseCompleteListener; class VectorImage final : public ImageResource, - public nsIStreamListener + public nsIStreamListener { public: NS_DECL_ISUPPORTS diff --git a/image/src/imgLoader.h b/image/src/imgLoader.h index 66d1d8b90dd..079dbdd4bae 100644 --- a/image/src/imgLoader.h +++ b/image/src/imgLoader.h @@ -212,10 +212,10 @@ enum class AcceptedMimeTypes : uint8_t { }; class imgLoader final : public imgILoader, - public nsIContentSniffer, - public imgICache, - public nsSupportsWeakReference, - public nsIObserver + public nsIContentSniffer, + public imgICache, + public nsSupportsWeakReference, + public nsIObserver { virtual ~imgLoader(); diff --git a/image/src/imgRequest.h b/image/src/imgRequest.h index c3bf3a155b8..19a4073f227 100644 --- a/image/src/imgRequest.h +++ b/image/src/imgRequest.h @@ -43,10 +43,10 @@ class ProgressTracker; struct NewPartResult; class imgRequest final : public nsIStreamListener, - public nsIThreadRetargetableStreamListener, - public nsIChannelEventSink, - public nsIInterfaceRequestor, - public nsIAsyncVerifyRedirectCallback + public nsIThreadRetargetableStreamListener, + public nsIChannelEventSink, + public nsIInterfaceRequestor, + public nsIAsyncVerifyRedirectCallback { typedef mozilla::image::Image Image; typedef mozilla::image::ImageURL ImageURL; diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index ecc6c4546a3..68406a3a0c8 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -191,7 +191,7 @@ BluetoothDaemonPDUConsumer::~BluetoothDaemonPDUConsumer() // class BluetoothDaemonConnectionIO final : public UnixSocketWatcher - , public ConnectionOrientedSocketIO + , public ConnectionOrientedSocketIO { public: BluetoothDaemonConnectionIO(MessageLoop* aIOLoop, int aFd, diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index 7d52e9a4dce..48d9398c175 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -42,7 +42,7 @@ namespace mozilla { namespace ipc { class DoWorkRunnable final : public nsICancelableRunnable, - public nsITimerCallback + public nsITimerCallback { public: explicit DoWorkRunnable(MessagePump* aPump) diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index 59473c8a980..3564461ffb5 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -104,6 +104,7 @@ HHOOK gDeferredGetMsgHook = nullptr; HHOOK gDeferredCallWndProcHook = nullptr; DWORD gUIThreadId = 0; +HWND gCOMWindow = 0; // WM_GETOBJECT id pulled from uia headers #define MOZOBJID_UIAROOT -25 @@ -340,13 +341,15 @@ ProcessOrDeferMessage(HWND hwnd, case WM_GETOBJECT: { if (!::GetPropW(hwnd, k3rdPartyWindowProp)) { DWORD objId = static_cast(lParam); - WNDPROC oldWndProc = (WNDPROC)GetProp(hwnd, kOldWndProcProp); - if ((objId == OBJID_CLIENT || objId == MOZOBJID_UIAROOT) && oldWndProc) { - return CallWindowProcW(oldWndProc, hwnd, uMsg, wParam, lParam); + if ((objId == OBJID_CLIENT || objId == MOZOBJID_UIAROOT)) { + WNDPROC oldWndProc = (WNDPROC)GetProp(hwnd, kOldWndProcProp); + if (oldWndProc) { + return CallWindowProcW(oldWndProc, hwnd, uMsg, wParam, lParam); + } } } - break; - } + return DefWindowProc(hwnd, uMsg, wParam, lParam); + } #endif // ACCESSIBILITY default: { @@ -647,7 +650,10 @@ InitUIThread() // on startup. if (!gUIThreadId) { gUIThreadId = GetCurrentThreadId(); + + CoInitialize(nullptr); } + MOZ_ASSERT(gUIThreadId); MOZ_ASSERT(gUIThreadId == GetCurrentThreadId(), "Called InitUIThread multiple times on different threads!"); @@ -804,6 +810,21 @@ IsTimeoutExpired(PRIntervalTime aStart, PRIntervalTime aTimeout) (aTimeout <= (PR_IntervalNow() - aStart)); } +HWND +FindCOMWindow() +{ + MOZ_ASSERT(gUIThreadId); + + HWND last = 0; + while ((last = FindWindowExW(HWND_MESSAGE, last, L"OleMainThreadWndClass", NULL))) { + if (GetWindowThreadProcessId(last, NULL) == gUIThreadId) { + return last; + } + } + + return (HWND)0; +} + bool MessageChannel::WaitForSyncNotify() { @@ -844,6 +865,12 @@ MessageChannel::WaitForSyncNotify() MonitorAutoUnlock unlock(*mMonitor); + MOZ_ASSERT_IF(gCOMWindow, FindCOMWindow() == gCOMWindow); + + if (!gCOMWindow) { + gCOMWindow = FindCOMWindow(); + } + bool timedout = false; UINT_PTR timerId = 0; @@ -912,11 +939,20 @@ MessageChannel::WaitForSyncNotify() bool haveSentMessagesPending = (HIWORD(GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE) != 0; - // This PeekMessage call will actually process all "nonqueued" messages - // that are pending before returning. If we have "nonqueued" messages - // pending then we should have switched out all the window procedures - // above. In that case this PeekMessage call won't actually cause any - // mozilla code (or plugin code) to run. + // Either of the PeekMessage calls below will actually process all + // "nonqueued" messages that are pending before returning. If we have + // "nonqueued" messages pending then we should have switched out all the + // window procedures above. In that case this PeekMessage call won't + // actually cause any mozilla code (or plugin code) to run. + + // We have to manually pump all COM messages *after* looking at the queue + // queue status but before yielding our thread below. + if (gCOMWindow) { + if (PeekMessageW(&msg, gCOMWindow, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + ::DispatchMessageW(&msg); + } + } // If the following PeekMessage call fails to return a message for us (and // returns false) and we didn't run any "nonqueued" messages then we must @@ -978,6 +1014,12 @@ MessageChannel::WaitForInterruptNotify() MonitorAutoUnlock unlock(*mMonitor); + MOZ_ASSERT_IF(gCOMWindow, FindCOMWindow() == gCOMWindow); + + if (!gCOMWindow) { + gCOMWindow = FindCOMWindow(); + } + bool timedout = false; UINT_PTR timerId = 0; @@ -1067,6 +1109,14 @@ MessageChannel::WaitForInterruptNotify() bool haveSentMessagesPending = (HIWORD(GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE) != 0; + // Run all COM messages *after* looking at the queue status. + if (gCOMWindow) { + if (PeekMessageW(&msg, gCOMWindow, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + ::DispatchMessageW(&msg); + } + } + // PeekMessage markes the messages as "old" so that they don't wake up // MsgWaitForMultipleObjects every time. if (!PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE) && diff --git a/ipc/glue/nsIIPCBackgroundChildCreateCallback.h b/ipc/glue/nsIIPCBackgroundChildCreateCallback.h index ca85a20ed21..8050cc5d38b 100644 --- a/ipc/glue/nsIIPCBackgroundChildCreateCallback.h +++ b/ipc/glue/nsIIPCBackgroundChildCreateCallback.h @@ -47,24 +47,24 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCBackgroundChildCreateCallback, #define NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK \ virtual void \ - ActorCreated(mozilla::ipc::PBackgroundChild*) override; \ + ActorCreated(mozilla::ipc::PBackgroundChild*) override; \ virtual void \ ActorFailed() override; #define NS_FORWARD_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ virtual void \ - ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \ + ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \ { _to ActorCreated(aActor); } \ virtual void \ - ActorFailed() override \ + ActorFailed() override \ { _to ActorFailed(); } #define NS_FORWARD_SAFE_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ virtual void \ - ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \ + ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \ { if (_to) { _to->ActorCreated(aActor); } } \ virtual void \ - ActorFailed() override \ + ActorFailed() override \ { if (_to) { _to->ActorFailed(); } } #endif // mozilla_ipc_nsiipcbackgroundchildcreatecallback_h diff --git a/ipc/glue/nsIIPCSerializableInputStream.h b/ipc/glue/nsIIPCSerializableInputStream.h index 88f296b7e37..0c4b48162ca 100644 --- a/ipc/glue/nsIIPCSerializableInputStream.h +++ b/ipc/glue/nsIIPCSerializableInputStream.h @@ -46,7 +46,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, #define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \ virtual void \ Serialize(mozilla::ipc::InputStreamParams&, \ - FileDescriptorArray&) override; \ + FileDescriptorArray&) override; \ \ virtual bool \ Deserialize(const mozilla::ipc::InputStreamParams&, \ @@ -55,14 +55,14 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ virtual void \ Serialize(mozilla::ipc::InputStreamParams& aParams, \ - FileDescriptorArray& aFileDescriptors) override \ + FileDescriptorArray& aFileDescriptors) override \ { \ _to Serialize(aParams, aFileDescriptors); \ } \ \ virtual bool \ Deserialize(const mozilla::ipc::InputStreamParams& aParams, \ - const FileDescriptorArray& aFileDescriptors) override \ + const FileDescriptorArray& aFileDescriptors) override \ { \ return _to Deserialize(aParams, aFileDescriptors); \ } @@ -70,7 +70,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ virtual void \ Serialize(mozilla::ipc::InputStreamParams& aParams, \ - FileDescriptorArray& aFileDescriptors) override \ + FileDescriptorArray& aFileDescriptors) override \ { \ if (_to) { \ _to->Serialize(aParams, aFileDescriptors); \ @@ -79,7 +79,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, \ virtual bool \ Deserialize(const mozilla::ipc::InputStreamParams& aParams, \ - const FileDescriptorArray& aFileDescriptors) override \ + const FileDescriptorArray& aFileDescriptors) override \ { \ return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \ } diff --git a/ipc/unixsocket/ListenSocket.cpp b/ipc/unixsocket/ListenSocket.cpp index 4e96a34bec2..2257e36af2d 100644 --- a/ipc/unixsocket/ListenSocket.cpp +++ b/ipc/unixsocket/ListenSocket.cpp @@ -21,7 +21,7 @@ namespace ipc { // class ListenSocketIO final : public UnixSocketWatcher - , protected SocketIOBase + , protected SocketIOBase { public: class ListenTask; diff --git a/ipc/unixsocket/StreamSocket.cpp b/ipc/unixsocket/StreamSocket.cpp index 8c3f8c6f17e..22e9f9e38a7 100644 --- a/ipc/unixsocket/StreamSocket.cpp +++ b/ipc/unixsocket/StreamSocket.cpp @@ -21,8 +21,8 @@ namespace ipc { // class StreamSocketIO final : public UnixSocketWatcher - , protected SocketIOBase - , public ConnectionOrientedSocketIO + , protected SocketIOBase + , public ConnectionOrientedSocketIO { public: class ConnectTask; diff --git a/ipc/unixsocket/UnixSocket.cpp b/ipc/unixsocket/UnixSocket.cpp index cabda175044..1e0df9284dd 100644 --- a/ipc/unixsocket/UnixSocket.cpp +++ b/ipc/unixsocket/UnixSocket.cpp @@ -20,7 +20,7 @@ namespace ipc { // class UnixSocketConsumerIO final : public UnixSocketWatcher - , protected SocketIOBase + , protected SocketIOBase { public: UnixSocketConsumerIO(MessageLoop* mIOLoop, diff --git a/js/ipc/JavaScriptBase.h b/js/ipc/JavaScriptBase.h index e8f7a134d51..6b616b9a8ee 100644 --- a/js/ipc/JavaScriptBase.h +++ b/js/ipc/JavaScriptBase.h @@ -92,7 +92,7 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base bool *result) { return Answer::RecvObjectClassIs(ObjectId::deserialize(objId), classValue, result); } - bool RecvClassName(const uint64_t &objId, nsString *result) { + bool RecvClassName(const uint64_t &objId, nsCString *result) { return Answer::RecvClassName(ObjectId::deserialize(objId), result); } bool RecvGetPrototype(const uint64_t &objId, ReturnStatus *rs, ObjectOrNullVariant *result) { @@ -181,7 +181,7 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base bool *result) { return Base::SendObjectClassIs(objId.serialize(), classValue, result); } - bool SendClassName(const ObjectId &objId, nsString *result) { + bool SendClassName(const ObjectId &objId, nsCString *result) { return Base::SendClassName(objId.serialize(), result); } bool SendGetPrototype(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *result) { diff --git a/js/ipc/PJavaScript.ipdl b/js/ipc/PJavaScript.ipdl index 4f000fdf288..d8599cffe71 100644 --- a/js/ipc/PJavaScript.ipdl +++ b/js/ipc/PJavaScript.ipdl @@ -39,7 +39,7 @@ both: prio(high) sync CallOrConstruct(uint64_t objId, JSParam[] argv, bool construct) returns (ReturnStatus rs, JSVariant result, JSParam[] outparams); prio(high) sync HasInstance(uint64_t objId, JSVariant v) returns (ReturnStatus rs, bool has); prio(high) sync ObjectClassIs(uint64_t objId, uint32_t classValue) returns (bool result); - prio(high) sync ClassName(uint64_t objId) returns (nsString name); + prio(high) sync ClassName(uint64_t objId) returns (nsCString name); prio(high) sync GetPrototype(uint64_t objId) returns (ReturnStatus rs, ObjectOrNullVariant result); prio(high) sync RegExpToShared(uint64_t objId) returns (ReturnStatus rs, nsString source, uint32_t flags); diff --git a/js/ipc/WrapperAnswer.cpp b/js/ipc/WrapperAnswer.cpp index f1ec789354f..ec73e419f9a 100644 --- a/js/ipc/WrapperAnswer.cpp +++ b/js/ipc/WrapperAnswer.cpp @@ -513,7 +513,7 @@ WrapperAnswer::RecvObjectClassIs(const ObjectId &objId, const uint32_t &classVal } bool -WrapperAnswer::RecvClassName(const ObjectId &objId, nsString *name) +WrapperAnswer::RecvClassName(const ObjectId &objId, nsCString *name) { AutoJSAPI jsapi; if (NS_WARN_IF(!jsapi.Init(scopeForTargetObjects()))) @@ -528,7 +528,7 @@ WrapperAnswer::RecvClassName(const ObjectId &objId, nsString *name) LOG("%s.className()", ReceiverObj(objId)); - *name = NS_ConvertASCIItoUTF16(js::ObjectClassName(cx, obj)); + *name = js::ObjectClassName(cx, obj); return true; } diff --git a/js/ipc/WrapperAnswer.h b/js/ipc/WrapperAnswer.h index d1a220bcc42..5346b252961 100644 --- a/js/ipc/WrapperAnswer.h +++ b/js/ipc/WrapperAnswer.h @@ -48,7 +48,7 @@ class WrapperAnswer : public virtual JavaScriptShared bool RecvHasInstance(const ObjectId &objId, const JSVariant &v, ReturnStatus *rs, bool *bp); bool RecvObjectClassIs(const ObjectId &objId, const uint32_t &classValue, bool *result); - bool RecvClassName(const ObjectId &objId, nsString *result); + bool RecvClassName(const ObjectId &objId, nsCString *result); bool RecvGetPrototype(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *result); bool RecvRegExpToShared(const ObjectId &objId, ReturnStatus *rs, nsString *source, uint32_t *flags); diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index f0ba66954fd..a9b4696adcf 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -33,6 +33,9 @@ struct AuxCPOWData // however they see fit. nsCString objectTag; + // The class name for WrapperOwner::className, below. + nsCString className; + AuxCPOWData(ObjectId id, bool isCallable, bool isConstructor, @@ -750,15 +753,17 @@ CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) const const char * WrapperOwner::className(JSContext *cx, HandleObject proxy) { - ObjectId objId = idOf(proxy); + AuxCPOWData *data = AuxCPOWDataOf(proxy); + if (data->className.IsEmpty()) { + ObjectId objId = idOf(proxy); - nsString name; - if (!SendClassName(objId, &name)) - return ""; + if (!SendClassName(objId, &data->className)) + return ""; - LOG_STACK(); + LOG_STACK(); + } - return ToNewCString(name); + return data->className.get(); } bool diff --git a/js/ipc/WrapperOwner.h b/js/ipc/WrapperOwner.h index 00afe20fbf0..499972c5113 100644 --- a/js/ipc/WrapperOwner.h +++ b/js/ipc/WrapperOwner.h @@ -140,7 +140,7 @@ class WrapperOwner : public virtual JavaScriptShared ReturnStatus *rs, bool *bp) = 0; virtual bool SendObjectClassIs(const ObjectId &objId, const uint32_t &classValue, bool *result) = 0; - virtual bool SendClassName(const ObjectId &objId, nsString *result) = 0; + virtual bool SendClassName(const ObjectId &objId, nsCString *result) = 0; virtual bool SendGetPrototype(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *result) = 0; virtual bool SendRegExpToShared(const ObjectId &objId, ReturnStatus *rs, nsString *source, uint32_t *flags) = 0; diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index d25bd92e945..ef5fa72f02b 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -3841,7 +3841,7 @@ CheckTypeAnnotation(ModuleCompiler &m, ParseNode *coercionNode, AsmJSCoercion *c default:; } - return m.fail(coercionNode, "must be of the form +x, fround(x), simdType(x) or x|0"); + return m.fail(coercionNode, "must be of the form +x, x|0, fround(x), or a SIMD check(x)"); } static bool @@ -4458,9 +4458,12 @@ FoldMaskedArrayIndex(FunctionCompiler &f, ParseNode **indexExpr, int32_t *mask, return false; } +static const int32_t NoMask = -1; + static bool CheckArrayAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, - Scalar::Type *viewType, MDefinition **def, NeedsBoundsCheck *needsBoundsCheck) + Scalar::Type *viewType, MDefinition **def, NeedsBoundsCheck *needsBoundsCheck, + int32_t *mask) { *needsBoundsCheck = NEEDS_BOUNDS_CHECK; @@ -4486,6 +4489,7 @@ CheckArrayAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, f.m().minHeapLength(), f.m().module().maxHeapLength()); } + *mask = NoMask; *needsBoundsCheck = NO_BOUNDS_CHECK; *def = f.constant(Int32Value(byteOffset), Type::Int); return true; @@ -4494,7 +4498,7 @@ CheckArrayAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, // Mask off the low bits to account for the clearing effect of a right shift // followed by the left shift implicit in the array access. E.g., H32[i>>2] // loses the low two bits. - int32_t mask = ~(TypedArrayElemSize(*viewType) - 1); + *mask = ~(TypedArrayElemSize(*viewType) - 1); MDefinition *pointerDef; if (indexExpr->isKind(PNK_RSH)) { @@ -4511,7 +4515,7 @@ CheckArrayAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, ParseNode *pointerNode = BitwiseLeft(indexExpr); if (pointerNode->isKind(PNK_BITAND)) - FoldMaskedArrayIndex(f, &pointerNode, &mask, needsBoundsCheck); + FoldMaskedArrayIndex(f, &pointerNode, mask, needsBoundsCheck); f.enterHeapExpression(); @@ -4522,53 +4526,63 @@ CheckArrayAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, f.leaveHeapExpression(); if (!pointerType.isIntish()) - return f.failf(indexExpr, "%s is not a subtype of int", pointerType.toChars()); + return f.failf(pointerNode, "%s is not a subtype of int", pointerType.toChars()); } else { + // For legacy compatibility, accept Int8/Uint8 accesses with no shift. if (TypedArrayShift(*viewType) != 0) return f.fail(indexExpr, "index expression isn't shifted; must be an Int8/Uint8 access"); - MOZ_ASSERT(mask == -1); + MOZ_ASSERT(*mask == NoMask); bool folded = false; - if (indexExpr->isKind(PNK_BITAND)) - folded = FoldMaskedArrayIndex(f, &indexExpr, &mask, needsBoundsCheck); + ParseNode *pointerNode = indexExpr; + + if (pointerNode->isKind(PNK_BITAND)) + folded = FoldMaskedArrayIndex(f, &pointerNode, mask, needsBoundsCheck); f.enterHeapExpression(); Type pointerType; - if (!CheckExpr(f, indexExpr, &pointerDef, &pointerType)) + if (!CheckExpr(f, pointerNode, &pointerDef, &pointerType)) return false; f.leaveHeapExpression(); if (folded) { if (!pointerType.isIntish()) - return f.failf(indexExpr, "%s is not a subtype of intish", pointerType.toChars()); + return f.failf(pointerNode, "%s is not a subtype of intish", pointerType.toChars()); } else { if (!pointerType.isInt()) - return f.failf(indexExpr, "%s is not a subtype of int", pointerType.toChars()); + return f.failf(pointerNode, "%s is not a subtype of int", pointerType.toChars()); } } - // Don't generate the mask op if there is no need for it which could happen for - // a shift of zero. - if (mask == -1) - *def = pointerDef; - else - *def = f.bitwise(pointerDef, f.constant(Int32Value(mask), Type::Int)); - + *def = pointerDef; return true; } +static void +PrepareArrayIndex(FunctionCompiler &f, MDefinition **def, NeedsBoundsCheck needsBoundsCheck, + int32_t mask) +{ + // Don't generate the mask op if there is no need for it which could happen for + // a shift of zero or a SIMD access. + if (mask != NoMask) + *def = f.bitwise(*def, f.constant(Int32Value(mask), Type::Int)); +} + static bool CheckLoadArray(FunctionCompiler &f, ParseNode *elem, MDefinition **def, Type *type) { Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckArrayAccess(f, ElemBase(elem), ElemIndex(elem), &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckArrayAccess(f, ElemBase(elem), ElemIndex(elem), &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + *def = f.loadHeap(viewType, pointerDef, needsBoundsCheck); *type = TypedArrayLoadType(viewType); return true; @@ -4625,7 +4639,8 @@ CheckStoreArray(FunctionCompiler &f, ParseNode *lhs, ParseNode *rhs, MDefinition Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckArrayAccess(f, ElemBase(lhs), ElemIndex(lhs), &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckArrayAccess(f, ElemBase(lhs), ElemIndex(lhs), &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; f.enterHeapExpression(); @@ -4663,6 +4678,8 @@ CheckStoreArray(FunctionCompiler &f, ParseNode *lhs, ParseNode *rhs, MDefinition MOZ_CRASH("Unexpected view type"); } + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + f.storeHeap(viewType, pointerDef, rhsDef, needsBoundsCheck); *def = rhsDef; @@ -4879,9 +4896,9 @@ CheckMathMinMax(FunctionCompiler &f, ParseNode *callNode, MDefinition **def, boo static bool CheckSharedArrayAtomicAccess(FunctionCompiler &f, ParseNode *viewName, ParseNode *indexExpr, Scalar::Type *viewType, MDefinition** pointerDef, - NeedsBoundsCheck *needsBoundsCheck) + NeedsBoundsCheck *needsBoundsCheck, int32_t *mask) { - if (!CheckArrayAccess(f, viewName, indexExpr, viewType, pointerDef, needsBoundsCheck)) + if (!CheckArrayAccess(f, viewName, indexExpr, viewType, pointerDef, needsBoundsCheck, mask)) return false; // Atomic accesses may be made on shared integer arrays only. @@ -4929,9 +4946,12 @@ CheckAtomicsLoad(FunctionCompiler &f, ParseNode *call, MDefinition **def, Type * Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + *def = f.atomicLoadHeap(viewType, pointerDef, needsBoundsCheck); *type = Type::Signed; return true; @@ -4950,7 +4970,8 @@ CheckAtomicsStore(FunctionCompiler &f, ParseNode *call, MDefinition **def, Type Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; MDefinition *rhsDef; @@ -4961,6 +4982,8 @@ CheckAtomicsStore(FunctionCompiler &f, ParseNode *call, MDefinition **def, Type if (!rhsType.isIntish()) return f.failf(arrayArg, "%s is not a subtype of intish", rhsType.toChars()); + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + f.atomicStoreHeap(viewType, pointerDef, rhsDef, needsBoundsCheck); *def = rhsDef; @@ -4981,7 +5004,8 @@ CheckAtomicsBinop(FunctionCompiler &f, ParseNode *call, MDefinition **def, Type Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; MDefinition *valueArgDef; @@ -4992,6 +5016,8 @@ CheckAtomicsBinop(FunctionCompiler &f, ParseNode *call, MDefinition **def, Type if (!valueArgType.isIntish()) return f.failf(valueArg, "%s is not a subtype of intish", valueArgType.toChars()); + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + *def = f.atomicBinopHeap(op, viewType, pointerDef, valueArgDef, needsBoundsCheck); *type = Type::Signed; return true; @@ -5011,7 +5037,8 @@ CheckAtomicsCompareExchange(FunctionCompiler &f, ParseNode *call, MDefinition ** Scalar::Type viewType; MDefinition *pointerDef; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck)) + int32_t mask; + if (!CheckSharedArrayAtomicAccess(f, arrayArg, indexArg, &viewType, &pointerDef, &needsBoundsCheck, &mask)) return false; MDefinition *oldValueArgDef; @@ -5030,6 +5057,8 @@ CheckAtomicsCompareExchange(FunctionCompiler &f, ParseNode *call, MDefinition ** if (!newValueArgType.isIntish()) return f.failf(newValueArg, "%s is not a subtype of intish", newValueArgType.toChars()); + PrepareArrayIndex(f, &pointerDef, needsBoundsCheck, mask); + *def = f.atomicCompareExchangeHeap(viewType, pointerDef, oldValueArgDef, newValueArgDef, needsBoundsCheck); *type = Type::Signed; @@ -5741,7 +5770,7 @@ CheckSimdShuffle(FunctionCompiler &f, ParseNode *call, AsmJSSimdType opType, MDe static bool CheckSimdLoadStoreArgs(FunctionCompiler &f, ParseNode *call, AsmJSSimdType opType, - unsigned numElems, Scalar::Type *viewType, MDefinition **index, + Scalar::Type *viewType, MDefinition **index, NeedsBoundsCheck *needsBoundsCheck) { ParseNode *view = CallArgList(call); @@ -5804,9 +5833,11 @@ CheckSimdLoad(FunctionCompiler &f, ParseNode *call, AsmJSSimdType opType, Scalar::Type viewType; MDefinition *index; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSimdLoadStoreArgs(f, call, opType, numElems, &viewType, &index, &needsBoundsCheck)) + if (!CheckSimdLoadStoreArgs(f, call, opType, &viewType, &index, &needsBoundsCheck)) return false; + PrepareArrayIndex(f, &index, needsBoundsCheck, NoMask); + *def = f.loadSimdHeap(viewType, index, needsBoundsCheck, numElems); *type = opType; return true; @@ -5823,7 +5854,7 @@ CheckSimdStore(FunctionCompiler &f, ParseNode *call, AsmJSSimdType opType, Scalar::Type viewType; MDefinition *index; NeedsBoundsCheck needsBoundsCheck; - if (!CheckSimdLoadStoreArgs(f, call, opType, numElems, &viewType, &index, &needsBoundsCheck)) + if (!CheckSimdLoadStoreArgs(f, call, opType, &viewType, &index, &needsBoundsCheck)) return false; Type retType = opType; @@ -5835,6 +5866,8 @@ CheckSimdStore(FunctionCompiler &f, ParseNode *call, AsmJSSimdType opType, if (!(vecType <= retType)) return f.failf(vecExpr, "%s is not a subtype of %s", vecType.toChars(), retType.toChars()); + PrepareArrayIndex(f, &index, needsBoundsCheck, NoMask); + f.storeSimdHeap(viewType, index, vec, needsBoundsCheck, numElems); *def = vec; *type = vecType; diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 4a1b3b5093e..c34792fddf1 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -29,12 +29,6 @@ using mozilla::IsFinite; using mozilla::IsNaN; using mozilla::FloorLog2; -namespace js { -extern const JSFunctionSpec Float32x4Methods[]; -extern const JSFunctionSpec Float64x2Methods[]; -extern const JSFunctionSpec Int32x4Methods[]; -} - /////////////////////////////////////////////////////////////////////////// // SIMD @@ -191,39 +185,44 @@ const Class SimdTypeDescr::class_ = { call }; +namespace { + // These classes just exist to group together various properties and so on. -namespace js { class Int32x4Defn { public: - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_INT32; + static const SimdTypeDescr::Type type = SimdTypeDescr::Int32x4; static const JSFunctionSpec TypeDescriptorMethods[]; static const JSPropertySpec TypedObjectProperties[]; static const JSFunctionSpec TypedObjectMethods[]; + static const JSFunctionSpec Methods[]; }; class Float32x4Defn { public: - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT32; + static const SimdTypeDescr::Type type = SimdTypeDescr::Float32x4; static const JSFunctionSpec TypeDescriptorMethods[]; static const JSPropertySpec TypedObjectProperties[]; static const JSFunctionSpec TypedObjectMethods[]; + static const JSFunctionSpec Methods[]; }; class Float64x2Defn { public: - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64; + static const SimdTypeDescr::Type type = SimdTypeDescr::Float64x2; static const JSFunctionSpec TypeDescriptorMethods[]; static const JSPropertySpec TypedObjectProperties[]; static const JSFunctionSpec TypedObjectMethods[]; + static const JSFunctionSpec Methods[]; }; -} // namespace js -const JSFunctionSpec js::Float32x4Defn::TypeDescriptorMethods[] = { +} + +const JSFunctionSpec Float32x4Defn::TypeDescriptorMethods[] = { JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0), JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0), JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0), JS_FS_END }; -const JSPropertySpec js::Float32x4Defn::TypedObjectProperties[] = { +const JSPropertySpec Float32x4Defn::TypedObjectProperties[] = { JS_PSG("x", Float32x4Lane0, JSPROP_PERMANENT), JS_PSG("y", Float32x4Lane1, JSPROP_PERMANENT), JS_PSG("z", Float32x4Lane2, JSPROP_PERMANENT), @@ -232,38 +231,54 @@ const JSPropertySpec js::Float32x4Defn::TypedObjectProperties[] = { JS_PS_END }; -const JSFunctionSpec js::Float32x4Defn::TypedObjectMethods[] = { +const JSFunctionSpec Float32x4Defn::TypedObjectMethods[] = { JS_SELF_HOSTED_FN("toSource", "SimdToSource", 0, 0), JS_FS_END }; -const JSFunctionSpec js::Float64x2Defn::TypeDescriptorMethods[] = { +const JSFunctionSpec Float32x4Defn::Methods[] = { +#define SIMD_FLOAT32X4_FUNCTION_ITEM(Name, Func, Operands) \ + JS_FN(#Name, js::simd_float32x4_##Name, Operands, 0), + FLOAT32X4_FUNCTION_LIST(SIMD_FLOAT32X4_FUNCTION_ITEM) +#undef SIMD_FLOAT32x4_FUNCTION_ITEM + JS_FS_END +}; + +const JSFunctionSpec Float64x2Defn::TypeDescriptorMethods[] = { JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0), JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0), JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0), JS_FS_END }; -const JSPropertySpec js::Float64x2Defn::TypedObjectProperties[] = { +const JSPropertySpec Float64x2Defn::TypedObjectProperties[] = { JS_PSG("x", Float64x2Lane0, JSPROP_PERMANENT), JS_PSG("y", Float64x2Lane1, JSPROP_PERMANENT), JS_PSG("signMask", Float64x2SignMask, JSPROP_PERMANENT), JS_PS_END }; -const JSFunctionSpec js::Float64x2Defn::TypedObjectMethods[] = { +const JSFunctionSpec Float64x2Defn::TypedObjectMethods[] = { JS_SELF_HOSTED_FN("toSource", "SimdToSource", 0, 0), JS_FS_END }; -const JSFunctionSpec js::Int32x4Defn::TypeDescriptorMethods[] = { +const JSFunctionSpec Float64x2Defn::Methods[] = { +#define SIMD_FLOAT64X2_FUNCTION_ITEM(Name, Func, Operands) \ + JS_FN(#Name, js::simd_float64x2_##Name, Operands, 0), + FLOAT64X2_FUNCTION_LIST(SIMD_FLOAT64X2_FUNCTION_ITEM) +#undef SIMD_FLOAT64X2_FUNCTION_ITEM + JS_FS_END +}; + +const JSFunctionSpec Int32x4Defn::TypeDescriptorMethods[] = { JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0), JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0), JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0), JS_FS_END, }; -const JSPropertySpec js::Int32x4Defn::TypedObjectProperties[] = { +const JSPropertySpec Int32x4Defn::TypedObjectProperties[] = { JS_PSG("x", Int32x4Lane0, JSPROP_PERMANENT), JS_PSG("y", Int32x4Lane1, JSPROP_PERMANENT), JS_PSG("z", Int32x4Lane2, JSPROP_PERMANENT), @@ -272,14 +287,23 @@ const JSPropertySpec js::Int32x4Defn::TypedObjectProperties[] = { JS_PS_END }; -const JSFunctionSpec js::Int32x4Defn::TypedObjectMethods[] = { +const JSFunctionSpec Int32x4Defn::TypedObjectMethods[] = { JS_SELF_HOSTED_FN("toSource", "SimdToSource", 0, 0), JS_FS_END }; +const JSFunctionSpec Int32x4Defn::Methods[] = { +#define SIMD_INT32X4_FUNCTION_ITEM(Name, Func, Operands) \ + JS_FN(#Name, js::simd_int32x4_##Name, Operands, 0), + INT32X4_FUNCTION_LIST(SIMD_INT32X4_FUNCTION_ITEM) +#undef SIMD_INT32X4_FUNCTION_ITEM + JS_FS_END +}; + template static JSObject * -CreateSimdClass(JSContext *cx, Handle global, HandlePropertyName stringRepr) +CreateAndBindSimdClass(JSContext *cx, Handle global, HandleObject SIMD, + HandlePropertyName stringRepr) { const SimdTypeDescr::Type type = T::type; @@ -288,7 +312,6 @@ CreateSimdClass(JSContext *cx, Handle global, HandlePropertyName return nullptr; // Create type constructor itself and initialize its reserved slots. - Rooted typeDescr(cx); typeDescr = NewObjectWithProto(cx, funcProto, SingletonObject); if (!typeDescr) @@ -306,7 +329,6 @@ CreateSimdClass(JSContext *cx, Handle global, HandlePropertyName return nullptr; // Create prototype property, which inherits from Object.prototype. - RootedObject objProto(cx, global->getOrCreateObjectPrototype(cx)); if (!objProto) return nullptr; @@ -317,7 +339,6 @@ CreateSimdClass(JSContext *cx, Handle global, HandlePropertyName typeDescr->initReservedSlot(JS_DESCR_SLOT_TYPROTO, ObjectValue(*proto)); // Link constructor to prototype and install properties. - if (!JS_DefineFunctions(cx, typeDescr, T::TypeDescriptorMethods)) return nullptr; @@ -328,19 +349,32 @@ CreateSimdClass(JSContext *cx, Handle global, HandlePropertyName return nullptr; } + // Bind type descriptor to the global SIMD object + RootedValue typeValue(cx, ObjectValue(*typeDescr)); + if (!JS_DefineFunctions(cx, typeDescr, T::Methods) || + !DefineProperty(cx, SIMD, stringRepr, typeValue, nullptr, nullptr, + JSPROP_READONLY | JSPROP_PERMANENT)) + { + return nullptr; + } + return typeDescr; } -const char* -SimdTypeToMinimumLanesNumber(SimdTypeDescr &descr) { - switch (descr.type()) { - case SimdTypeDescr::TYPE_INT32: - case SimdTypeDescr::TYPE_FLOAT32: - return "3"; - case SimdTypeDescr::TYPE_FLOAT64: - return "1"; +template +static bool +FillLanes(JSContext *cx, Handle result, const CallArgs &args) +{ + typedef typename T::Elem Elem; + InternalHandle mem(result, reinterpret_cast(result->typedMem())); + Elem tmp; + for (unsigned i = 0; i < T::lanes; i++) { + if (!T::toType(cx, args.get(i), &tmp)) + return false; + mem.get()[i] = tmp; } - MOZ_CRASH("Unexpected SIMD type description."); + args.rval().setObject(*result); + return true; } bool @@ -357,39 +391,13 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp) return false; switch (descr->type()) { - case SimdTypeDescr::TYPE_INT32: { - InternalHandle mem(result, reinterpret_cast(result->typedMem())); - int32_t tmp; - for (unsigned i = 0; i < 4; i++) { - if (!ToInt32(cx, args.get(i), &tmp)) - return false; - mem.get()[i] = tmp; - } - break; - } - case SimdTypeDescr::TYPE_FLOAT32: { - InternalHandle mem(result, reinterpret_cast(result->typedMem())); - float tmp; - for (unsigned i = 0; i < 4; i++) { - if (!RoundFloat32(cx, args.get(i), &tmp)) - return false; - mem.get()[i] = tmp; - } - break; - } - case SimdTypeDescr::TYPE_FLOAT64: { - InternalHandle mem(result, reinterpret_cast(result->typedMem())); - double tmp; - for (unsigned i = 0; i < 2; i++) { - if (!ToNumber(cx, args.get(i), &tmp)) - return false; - mem.get()[i] = tmp; - } - break; - } + case SimdTypeDescr::Int32x4: return FillLanes< ::Int32x4>(cx, result, args); + case SimdTypeDescr::Float32x4: return FillLanes< ::Float32x4>(cx, result, args); + case SimdTypeDescr::Float64x2: return FillLanes< ::Float64x2>(cx, result, args); } - args.rval().setObject(*result); - return true; + + MOZ_CRASH("unexpected SIMD descriptor"); + return false; } /////////////////////////////////////////////////////////////////////////// @@ -420,67 +428,30 @@ SIMDObject::initClass(JSContext *cx, Handle global) if (!SIMD) return nullptr; - // float32x4 - RootedObject float32x4Object(cx); - float32x4Object = CreateSimdClass(cx, global, - cx->names().float32x4); - if (!float32x4Object) + RootedObject f32x4(cx); + f32x4 = CreateAndBindSimdClass(cx, global, SIMD, cx->names().float32x4); + if (!f32x4) return nullptr; + global->setFloat32x4TypeDescr(*f32x4); - // Define float32x4 functions and install as a property of the SIMD object. - RootedValue float32x4Value(cx, ObjectValue(*float32x4Object)); - if (!JS_DefineFunctions(cx, float32x4Object, Float32x4Methods) || - !DefineProperty(cx, SIMD, cx->names().float32x4, - float32x4Value, nullptr, nullptr, - JSPROP_READONLY | JSPROP_PERMANENT)) - { + RootedObject i32x4(cx); + i32x4 = CreateAndBindSimdClass(cx, global, SIMD, cx->names().int32x4); + if (!i32x4) return nullptr; - } + global->setInt32x4TypeDescr(*i32x4); - // float64x2 - RootedObject float64x2Object(cx); - float64x2Object = CreateSimdClass(cx, global, - cx->names().float64x2); - if (!float64x2Object) + RootedObject f64x2(cx); + f64x2 = CreateAndBindSimdClass(cx, global, SIMD, cx->names().float64x2); + if (!f64x2) return nullptr; - - // Define float64x2 functions and install as a property of the SIMD object. - RootedValue float64x2Value(cx, ObjectValue(*float64x2Object)); - if (!JS_DefineFunctions(cx, float64x2Object, Float64x2Methods) || - !DefineProperty(cx, SIMD, cx->names().float64x2, - float64x2Value, nullptr, nullptr, - JSPROP_READONLY | JSPROP_PERMANENT)) - { - return nullptr; - } - - // int32x4 - RootedObject int32x4Object(cx); - int32x4Object = CreateSimdClass(cx, global, - cx->names().int32x4); - if (!int32x4Object) - return nullptr; - - // Define int32x4 functions and install as a property of the SIMD object. - RootedValue int32x4Value(cx, ObjectValue(*int32x4Object)); - if (!JS_DefineFunctions(cx, int32x4Object, Int32x4Methods) || - !DefineProperty(cx, SIMD, cx->names().int32x4, - int32x4Value, nullptr, nullptr, - JSPROP_READONLY | JSPROP_PERMANENT)) - { - return nullptr; - } - - RootedValue SIMDValue(cx, ObjectValue(*SIMD)); + global->setFloat64x2TypeDescr(*f64x2); // Everything is set up, install SIMD on the global object. + RootedValue SIMDValue(cx, ObjectValue(*SIMD)); if (!DefineProperty(cx, global, cx->names().SIMD, SIMDValue, nullptr, nullptr, 0)) return nullptr; global->setConstructor(JSProto_SIMD, SIMDValue); - global->setFloat32x4TypeDescr(*float32x4Object); - global->setFloat64x2TypeDescr(*float64x2Object); - global->setInt32x4TypeDescr(*int32x4Object); return SIMD; } @@ -721,14 +692,15 @@ FuncWith(JSContext *cx, unsigned argc, Value *vp) typedef typename V::Elem Elem; CallArgs args = CallArgsFromVp(argc, vp); - if (args.length() != 2 || !IsVectorObject(args[0])) + // Only the first argument is mandatory + if (args.length() < 1 || !IsVectorObject(args[0])) return ErrorBadArgs(cx); Elem *vec = TypedObjectMemory(args[0]); Elem result[V::lanes]; Elem value; - if (!V::toType(cx, args[1], &value)) + if (!V::toType(cx, args.get(1), &value)) return false; for (unsigned i = 0; i < V::lanes; i++) @@ -878,22 +850,6 @@ FuncConvertBits(JSContext *cx, unsigned argc, Value *vp) return StoreResult(cx, args, copy); } -template -static bool -FuncZero(JSContext *cx, unsigned argc, Value *vp) -{ - typedef typename Vret::Elem RetElem; - - CallArgs args = CallArgsFromVp(argc, vp); - if (args.length() != 0) - return ErrorBadArgs(cx); - - RetElem result[Vret::lanes]; - for (unsigned i = 0; i < Vret::lanes; i++) - result[i] = RetElem(0); - return StoreResult(cx, args, result); -} - template static bool FuncSplat(JSContext *cx, unsigned argc, Value *vp) @@ -901,11 +857,8 @@ FuncSplat(JSContext *cx, unsigned argc, Value *vp) typedef typename Vret::Elem RetElem; CallArgs args = CallArgsFromVp(argc, vp); - if (args.length() != 1) - return ErrorBadArgs(cx); - RetElem arg; - if (!Vret::toType(cx, args[0], &arg)) + if (!Vret::toType(cx, args.get(0), &arg)) return false; RetElem result[Vret::lanes]; @@ -1092,53 +1045,30 @@ Store(JSContext *cx, unsigned argc, Value *vp) return true; } -#define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags) \ -bool \ -js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ -{ \ - return Func(cx, argc, vp); \ +#define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands) \ +bool \ +js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ +{ \ + return Func(cx, argc, vp); \ } FLOAT32X4_FUNCTION_LIST(DEFINE_SIMD_FLOAT32X4_FUNCTION) #undef DEFINE_SIMD_FLOAT32X4_FUNCTION -#define DEFINE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands, Flags) \ -bool \ -js::simd_float64x2_##Name(JSContext *cx, unsigned argc, Value *vp) \ -{ \ - return Func(cx, argc, vp); \ +#define DEFINE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands) \ +bool \ +js::simd_float64x2_##Name(JSContext *cx, unsigned argc, Value *vp) \ +{ \ + return Func(cx, argc, vp); \ } FLOAT64X2_FUNCTION_LIST(DEFINE_SIMD_FLOAT64X2_FUNCTION) #undef DEFINE_SIMD_FLOAT64X2_FUNCTION -#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags) \ -bool \ -js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ -{ \ - return Func(cx, argc, vp); \ +#define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands) \ +bool \ +js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ +{ \ + return Func(cx, argc, vp); \ } INT32X4_FUNCTION_LIST(DEFINE_SIMD_INT32X4_FUNCTION) #undef DEFINE_SIMD_INT32X4_FUNCTION -const JSFunctionSpec js::Float32x4Methods[] = { -#define SIMD_FLOAT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags) \ - JS_FN(#Name, js::simd_float32x4_##Name, Operands, Flags), - FLOAT32X4_FUNCTION_LIST(SIMD_FLOAT32X4_FUNCTION_ITEM) -#undef SIMD_FLOAT32x4_FUNCTION_ITEM - JS_FS_END -}; - -const JSFunctionSpec js::Float64x2Methods[] = { -#define SIMD_FLOAT64X2_FUNCTION_ITEM(Name, Func, Operands, Flags) \ - JS_FN(#Name, js::simd_float64x2_##Name, Operands, Flags), - FLOAT64X2_FUNCTION_LIST(SIMD_FLOAT64X2_FUNCTION_ITEM) -#undef SIMD_FLOAT64X2_FUNCTION_ITEM - JS_FS_END -}; - -const JSFunctionSpec js::Int32x4Methods[] = { -#define SIMD_INT32X4_FUNCTION_ITEM(Name, Func, Operands, Flags) \ - JS_FN(#Name, js::simd_int32x4_##Name, Operands, Flags), - INT32X4_FUNCTION_LIST(SIMD_INT32X4_FUNCTION_ITEM) -#undef SIMD_INT32X4_FUNCTION_ITEM - JS_FS_END -}; diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index 6051d2dd8f8..9c94f0e00c2 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -20,171 +20,171 @@ * https://github.com/johnmccutchan/ecmascript_simd/blob/master/src/ecmascript_simd.js */ -#define FLOAT32X4_UNARY_FUNCTION_LIST(V) \ - V(abs, (UnaryFunc), 1, 0) \ - V(check, (UnaryFunc), 1, 0) \ - V(fromFloat64x2, (FuncConvert ), 1, 0) \ - V(fromFloat64x2Bits, (FuncConvertBits), 1, 0) \ - V(fromInt32x4, (FuncConvert ), 1, 0) \ - V(fromInt32x4Bits, (FuncConvertBits), 1, 0) \ - V(neg, (UnaryFunc), 1, 0) \ - V(not, (CoercedUnaryFunc), 1, 0) \ - V(reciprocalApproximation, (UnaryFunc), 1, 0) \ - V(reciprocalSqrtApproximation, (UnaryFunc), 1, 0) \ - V(splat, (FuncSplat), 1, 0) \ - V(sqrt, (UnaryFunc), 1, 0) +#define FLOAT32X4_UNARY_FUNCTION_LIST(V) \ + V(abs, (UnaryFunc), 1) \ + V(check, (UnaryFunc), 1) \ + V(fromFloat64x2, (FuncConvert ), 1) \ + V(fromFloat64x2Bits, (FuncConvertBits), 1) \ + V(fromInt32x4, (FuncConvert ), 1) \ + V(fromInt32x4Bits, (FuncConvertBits), 1) \ + V(neg, (UnaryFunc), 1) \ + V(not, (CoercedUnaryFunc), 1) \ + V(reciprocalApproximation, (UnaryFunc), 1) \ + V(reciprocalSqrtApproximation, (UnaryFunc), 1) \ + V(splat, (FuncSplat), 1) \ + V(sqrt, (UnaryFunc), 1) -#define FLOAT32X4_BINARY_FUNCTION_LIST(V) \ - V(add, (BinaryFunc), 2, 0) \ - V(and, (CoercedBinaryFunc), 2, 0) \ - V(div, (BinaryFunc), 2, 0) \ - V(equal, (CompareFunc), 2, 0) \ - V(greaterThan, (CompareFunc), 2, 0) \ - V(greaterThanOrEqual, (CompareFunc), 2, 0) \ - V(lessThan, (CompareFunc), 2, 0) \ - V(lessThanOrEqual, (CompareFunc), 2, 0) \ - V(load, (Load), 2, 0) \ - V(loadXYZ, (Load), 2, 0) \ - V(loadXY, (Load), 2, 0) \ - V(loadX, (Load), 2, 0) \ - V(max, (BinaryFunc), 2, 0) \ - V(maxNum, (BinaryFunc), 2, 0) \ - V(min, (BinaryFunc), 2, 0) \ - V(minNum, (BinaryFunc), 2, 0) \ - V(mul, (BinaryFunc), 2, 0) \ - V(notEqual, (CompareFunc), 2, 0) \ - V(or, (CoercedBinaryFunc), 2, 0) \ - V(store, (Store), 3, 0) \ - V(storeXYZ, (Store), 3, 0) \ - V(storeXY, (Store), 3, 0) \ - V(storeX, (Store), 3, 0) \ - V(sub, (BinaryFunc), 2, 0) \ - V(withX, (FuncWith), 2, 0) \ - V(withY, (FuncWith), 2, 0) \ - V(withZ, (FuncWith), 2, 0) \ - V(withW, (FuncWith), 2, 0) \ - V(xor, (CoercedBinaryFunc), 2, 0) +#define FLOAT32X4_BINARY_FUNCTION_LIST(V) \ + V(add, (BinaryFunc), 2) \ + V(and, (CoercedBinaryFunc), 2) \ + V(div, (BinaryFunc), 2) \ + V(equal, (CompareFunc), 2) \ + V(greaterThan, (CompareFunc), 2) \ + V(greaterThanOrEqual, (CompareFunc), 2) \ + V(lessThan, (CompareFunc), 2) \ + V(lessThanOrEqual, (CompareFunc), 2) \ + V(load, (Load), 2) \ + V(loadXYZ, (Load), 2) \ + V(loadXY, (Load), 2) \ + V(loadX, (Load), 2) \ + V(max, (BinaryFunc), 2) \ + V(maxNum, (BinaryFunc), 2) \ + V(min, (BinaryFunc), 2) \ + V(minNum, (BinaryFunc), 2) \ + V(mul, (BinaryFunc), 2) \ + V(notEqual, (CompareFunc), 2) \ + V(or, (CoercedBinaryFunc), 2) \ + V(store, (Store), 3) \ + V(storeXYZ, (Store), 3) \ + V(storeXY, (Store), 3) \ + V(storeX, (Store), 3) \ + V(sub, (BinaryFunc), 2) \ + V(withX, (FuncWith), 2) \ + V(withY, (FuncWith), 2) \ + V(withZ, (FuncWith), 2) \ + V(withW, (FuncWith), 2) \ + V(xor, (CoercedBinaryFunc), 2) -#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, BitSelect, 3, 0) \ - V(clamp, Clamp, 3, 0) \ - V(select, Select, 3, 0) +#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \ + V(bitselect, BitSelect, 3) \ + V(clamp, Clamp, 3) \ + V(select, Select, 3) -#define FLOAT32X4_SHUFFLE_FUNCTION_LIST(V) \ - V(swizzle, Swizzle, 2, 0) \ - V(shuffle, Shuffle, 3, 0) +#define FLOAT32X4_SHUFFLE_FUNCTION_LIST(V) \ + V(swizzle, Swizzle, 2) \ + V(shuffle, Shuffle, 3) -#define FLOAT32X4_FUNCTION_LIST(V) \ - FLOAT32X4_UNARY_FUNCTION_LIST(V) \ - FLOAT32X4_BINARY_FUNCTION_LIST(V) \ - FLOAT32X4_TERNARY_FUNCTION_LIST(V) \ +#define FLOAT32X4_FUNCTION_LIST(V) \ + FLOAT32X4_UNARY_FUNCTION_LIST(V) \ + FLOAT32X4_BINARY_FUNCTION_LIST(V) \ + FLOAT32X4_TERNARY_FUNCTION_LIST(V) \ FLOAT32X4_SHUFFLE_FUNCTION_LIST(V) -#define FLOAT64X2_UNARY_FUNCTION_LIST(V) \ - V(abs, (UnaryFunc), 1, 0) \ - V(check, (UnaryFunc), 1, 0) \ - V(fromFloat32x4, (FuncConvert ), 1, 0) \ - V(fromFloat32x4Bits, (FuncConvertBits), 1, 0) \ - V(fromInt32x4, (FuncConvert ), 1, 0) \ - V(fromInt32x4Bits, (FuncConvertBits), 1, 0) \ - V(neg, (UnaryFunc), 1, 0) \ - V(reciprocalApproximation, (UnaryFunc), 1, 0) \ - V(reciprocalSqrtApproximation, (UnaryFunc), 1, 0) \ - V(splat, (FuncSplat), 1, 0) \ - V(sqrt, (UnaryFunc), 1, 0) +#define FLOAT64X2_UNARY_FUNCTION_LIST(V) \ + V(abs, (UnaryFunc), 1) \ + V(check, (UnaryFunc), 1) \ + V(fromFloat32x4, (FuncConvert ), 1) \ + V(fromFloat32x4Bits, (FuncConvertBits), 1) \ + V(fromInt32x4, (FuncConvert ), 1) \ + V(fromInt32x4Bits, (FuncConvertBits), 1) \ + V(neg, (UnaryFunc), 1) \ + V(reciprocalApproximation, (UnaryFunc), 1) \ + V(reciprocalSqrtApproximation, (UnaryFunc), 1) \ + V(splat, (FuncSplat), 1) \ + V(sqrt, (UnaryFunc), 1) -#define FLOAT64X2_BINARY_FUNCTION_LIST(V) \ - V(add, (BinaryFunc), 2, 0) \ - V(div, (BinaryFunc), 2, 0) \ - V(equal, (CompareFunc), 2, 0) \ - V(greaterThan, (CompareFunc), 2, 0) \ - V(greaterThanOrEqual, (CompareFunc), 2, 0) \ - V(lessThan, (CompareFunc), 2, 0) \ - V(lessThanOrEqual, (CompareFunc), 2, 0) \ - V(load, (Load), 2, 0) \ - V(loadX, (Load), 2, 0) \ - V(max, (BinaryFunc), 2, 0) \ - V(maxNum, (BinaryFunc), 2, 0) \ - V(min, (BinaryFunc), 2, 0) \ - V(minNum, (BinaryFunc), 2, 0) \ - V(mul, (BinaryFunc), 2, 0) \ - V(notEqual, (CompareFunc), 2, 0) \ - V(store, (Store), 3, 0) \ - V(storeX, (Store), 3, 0) \ - V(sub, (BinaryFunc), 2, 0) \ - V(withX, (FuncWith), 2, 0) \ - V(withY, (FuncWith), 2, 0) +#define FLOAT64X2_BINARY_FUNCTION_LIST(V) \ + V(add, (BinaryFunc), 2) \ + V(div, (BinaryFunc), 2) \ + V(equal, (CompareFunc), 2) \ + V(greaterThan, (CompareFunc), 2) \ + V(greaterThanOrEqual, (CompareFunc), 2) \ + V(lessThan, (CompareFunc), 2) \ + V(lessThanOrEqual, (CompareFunc), 2) \ + V(load, (Load), 2) \ + V(loadX, (Load), 2) \ + V(max, (BinaryFunc), 2) \ + V(maxNum, (BinaryFunc), 2) \ + V(min, (BinaryFunc), 2) \ + V(minNum, (BinaryFunc), 2) \ + V(mul, (BinaryFunc), 2) \ + V(notEqual, (CompareFunc), 2) \ + V(store, (Store), 3) \ + V(storeX, (Store), 3) \ + V(sub, (BinaryFunc), 2) \ + V(withX, (FuncWith), 2) \ + V(withY, (FuncWith), 2) -#define FLOAT64X2_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, BitSelect, 3, 0) \ - V(clamp, Clamp, 3, 0) \ - V(select, Select, 3, 0) +#define FLOAT64X2_TERNARY_FUNCTION_LIST(V) \ + V(bitselect, BitSelect, 3) \ + V(clamp, Clamp, 3) \ + V(select, Select, 3) -#define FLOAT64X2_SHUFFLE_FUNCTION_LIST(V) \ - V(swizzle, Swizzle, 2, 0) \ - V(shuffle, Shuffle, 3, 0) +#define FLOAT64X2_SHUFFLE_FUNCTION_LIST(V) \ + V(swizzle, Swizzle, 2) \ + V(shuffle, Shuffle, 3) -#define FLOAT64X2_FUNCTION_LIST(V) \ - FLOAT64X2_UNARY_FUNCTION_LIST(V) \ - FLOAT64X2_BINARY_FUNCTION_LIST(V) \ - FLOAT64X2_TERNARY_FUNCTION_LIST(V) \ +#define FLOAT64X2_FUNCTION_LIST(V) \ + FLOAT64X2_UNARY_FUNCTION_LIST(V) \ + FLOAT64X2_BINARY_FUNCTION_LIST(V) \ + FLOAT64X2_TERNARY_FUNCTION_LIST(V) \ FLOAT64X2_SHUFFLE_FUNCTION_LIST(V) -#define INT32X4_UNARY_FUNCTION_LIST(V) \ - V(check, (UnaryFunc), 1, 0) \ - V(fromFloat32x4, (FuncConvert), 1, 0) \ - V(fromFloat32x4Bits, (FuncConvertBits), 1, 0) \ - V(fromFloat64x2, (FuncConvert), 1, 0) \ - V(fromFloat64x2Bits, (FuncConvertBits), 1, 0) \ - V(neg, (UnaryFunc), 1, 0) \ - V(not, (UnaryFunc), 1, 0) \ - V(splat, (FuncSplat), 0, 0) +#define INT32X4_UNARY_FUNCTION_LIST(V) \ + V(check, (UnaryFunc), 1) \ + V(fromFloat32x4, (FuncConvert), 1) \ + V(fromFloat32x4Bits, (FuncConvertBits), 1) \ + V(fromFloat64x2, (FuncConvert), 1) \ + V(fromFloat64x2Bits, (FuncConvertBits), 1) \ + V(neg, (UnaryFunc), 1) \ + V(not, (UnaryFunc), 1) \ + V(splat, (FuncSplat), 0) -#define INT32X4_BINARY_FUNCTION_LIST(V) \ - V(add, (BinaryFunc), 2, 0) \ - V(and, (BinaryFunc), 2, 0) \ - V(equal, (CompareFunc), 2, 0) \ - V(greaterThan, (CompareFunc), 2, 0) \ - V(greaterThanOrEqual, (CompareFunc), 2, 0) \ - V(lessThan, (CompareFunc), 2, 0) \ - V(lessThanOrEqual, (CompareFunc), 2, 0) \ - V(load, (Load), 2, 0) \ - V(loadXYZ, (Load), 2, 0) \ - V(loadXY, (Load), 2, 0) \ - V(loadX, (Load), 2, 0) \ - V(mul, (BinaryFunc), 2, 0) \ - V(notEqual, (CompareFunc), 2, 0) \ - V(or, (BinaryFunc), 2, 0) \ - V(sub, (BinaryFunc), 2, 0) \ - V(shiftLeftByScalar, (Int32x4BinaryScalar), 2, 0) \ - V(shiftRightArithmeticByScalar, (Int32x4BinaryScalar), 2, 0) \ - V(shiftRightLogicalByScalar, (Int32x4BinaryScalar), 2, 0) \ - V(store, (Store), 3, 0) \ - V(storeXYZ, (Store), 3, 0) \ - V(storeXY, (Store), 3, 0) \ - V(storeX, (Store), 3, 0) \ - V(withX, (FuncWith), 2, 0) \ - V(withY, (FuncWith), 2, 0) \ - V(withZ, (FuncWith), 2, 0) \ - V(withW, (FuncWith), 2, 0) \ - V(xor, (BinaryFunc), 2, 0) +#define INT32X4_BINARY_FUNCTION_LIST(V) \ + V(add, (BinaryFunc), 2) \ + V(and, (BinaryFunc), 2) \ + V(equal, (CompareFunc), 2) \ + V(greaterThan, (CompareFunc), 2) \ + V(greaterThanOrEqual, (CompareFunc), 2) \ + V(lessThan, (CompareFunc), 2) \ + V(lessThanOrEqual, (CompareFunc), 2) \ + V(load, (Load), 2) \ + V(loadXYZ, (Load), 2) \ + V(loadXY, (Load), 2) \ + V(loadX, (Load), 2) \ + V(mul, (BinaryFunc), 2) \ + V(notEqual, (CompareFunc), 2) \ + V(or, (BinaryFunc), 2) \ + V(sub, (BinaryFunc), 2) \ + V(shiftLeftByScalar, (Int32x4BinaryScalar), 2) \ + V(shiftRightArithmeticByScalar, (Int32x4BinaryScalar), 2) \ + V(shiftRightLogicalByScalar, (Int32x4BinaryScalar), 2) \ + V(store, (Store), 3) \ + V(storeXYZ, (Store), 3) \ + V(storeXY, (Store), 3) \ + V(storeX, (Store), 3) \ + V(withX, (FuncWith), 2) \ + V(withY, (FuncWith), 2) \ + V(withZ, (FuncWith), 2) \ + V(withW, (FuncWith), 2) \ + V(xor, (BinaryFunc), 2) -#define INT32X4_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, BitSelect, 3, 0) \ - V(select, Select, 3, 0) +#define INT32X4_TERNARY_FUNCTION_LIST(V) \ + V(bitselect, BitSelect, 3) \ + V(select, Select, 3) -#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \ - V(bool, Int32x4Bool, 4, 0) +#define INT32X4_QUARTERNARY_FUNCTION_LIST(V) \ + V(bool, Int32x4Bool, 4) -#define INT32X4_SHUFFLE_FUNCTION_LIST(V) \ - V(swizzle, Swizzle, 2, 0) \ - V(shuffle, Shuffle, 3, 0) +#define INT32X4_SHUFFLE_FUNCTION_LIST(V) \ + V(swizzle, Swizzle, 2) \ + V(shuffle, Shuffle, 3) -#define INT32X4_FUNCTION_LIST(V) \ - INT32X4_UNARY_FUNCTION_LIST(V) \ - INT32X4_BINARY_FUNCTION_LIST(V) \ - INT32X4_TERNARY_FUNCTION_LIST(V) \ - INT32X4_QUARTERNARY_FUNCTION_LIST(V) \ +#define INT32X4_FUNCTION_LIST(V) \ + INT32X4_UNARY_FUNCTION_LIST(V) \ + INT32X4_BINARY_FUNCTION_LIST(V) \ + INT32X4_TERNARY_FUNCTION_LIST(V) \ + INT32X4_QUARTERNARY_FUNCTION_LIST(V) \ INT32X4_SHUFFLE_FUNCTION_LIST(V) #define CONVERSION_INT32X4_SIMD_OP(_) \ @@ -275,7 +275,7 @@ class SIMDObject : public JSObject struct Float32x4 { typedef float Elem; static const unsigned lanes = 4; - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT32; + static const SimdTypeDescr::Type type = SimdTypeDescr::Float32x4; static TypeDescr &GetTypeDescr(GlobalObject &global) { return global.float32x4TypeDescr().as(); @@ -298,7 +298,7 @@ struct Float32x4 { struct Float64x2 { typedef double Elem; static const unsigned lanes = 2; - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_FLOAT64; + static const SimdTypeDescr::Type type = SimdTypeDescr::Float64x2; static TypeDescr &GetTypeDescr(GlobalObject &global) { return global.float64x2TypeDescr().as(); @@ -317,7 +317,7 @@ struct Float64x2 { struct Int32x4 { typedef int32_t Elem; static const unsigned lanes = 4; - static const SimdTypeDescr::Type type = SimdTypeDescr::TYPE_INT32; + static const SimdTypeDescr::Type type = SimdTypeDescr::Int32x4; static TypeDescr &GetTypeDescr(GlobalObject &global) { return global.int32x4TypeDescr().as(); @@ -342,20 +342,20 @@ bool IsVectorObject(HandleValue v); template bool ToSimdConstant(JSContext *cx, HandleValue v, jit::SimdConstant *out); -#define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags) \ -extern bool \ +#define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands) \ +extern bool \ simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp); FLOAT32X4_FUNCTION_LIST(DECLARE_SIMD_FLOAT32X4_FUNCTION) #undef DECLARE_SIMD_FLOAT32X4_FUNCTION -#define DECLARE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands, Flags) \ -extern bool \ +#define DECLARE_SIMD_FLOAT64X2_FUNCTION(Name, Func, Operands) \ +extern bool \ simd_float64x2_##Name(JSContext *cx, unsigned argc, Value *vp); FLOAT64X2_FUNCTION_LIST(DECLARE_SIMD_FLOAT64X2_FUNCTION) #undef DECLARE_SIMD_FLOAT64X2_FUNCTION -#define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags) \ -extern bool \ +#define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands) \ +extern bool \ simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp); INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION) #undef DECLARE_SIMD_INT32x4_FUNCTION diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index edde9932087..7b67475959b 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -331,10 +331,10 @@ class SimdTypeDescr : public ComplexTypeDescr { public: enum Type { - TYPE_INT32 = JS_SIMDTYPEREPR_INT32, - TYPE_FLOAT32 = JS_SIMDTYPEREPR_FLOAT32, - TYPE_FLOAT64 = JS_SIMDTYPEREPR_FLOAT64, - LAST_TYPE = TYPE_FLOAT64 + Int32x4 = JS_SIMDTYPEREPR_INT32, + Float32x4 = JS_SIMDTYPEREPR_FLOAT32, + Float64x2 = JS_SIMDTYPEREPR_FLOAT64, + LAST_TYPE = Float64x2 }; static const type::Kind Kind = type::Simd; @@ -352,10 +352,10 @@ class SimdTypeDescr : public ComplexTypeDescr static bool is(const Value &v); }; -#define JS_FOR_EACH_SIMD_TYPE_REPR(macro_) \ - macro_(SimdTypeDescr::TYPE_INT32, int32_t, int32, 4) \ - macro_(SimdTypeDescr::TYPE_FLOAT32, float, float32, 4) \ - macro_(SimdTypeDescr::TYPE_FLOAT64, double, float64, 2) +#define JS_FOR_EACH_SIMD_TYPE_REPR(macro_) \ + macro_(SimdTypeDescr::Int32x4, int32_t, int32, 4) \ + macro_(SimdTypeDescr::Float32x4, float, float32, 4) \ + macro_(SimdTypeDescr::Float64x2, double, float64, 2) bool IsTypedObjectClass(const Class *clasp); // Defined below bool IsTypedObjectArray(JSObject& obj); diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index ed0bce688cb..e51723b9e95 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -5047,19 +5047,30 @@ BytecodeEmitter::emitNormalFor(ParseNode *pn, ptrdiff_t top) ParseNode *forBody = pn->pn_right; /* C-style for (init; cond; update) ... loop. */ - JSOp op = JSOP_POP; - ParseNode *pn3 = forHead->pn_kid1; - if (!pn3) { - // No initializer, but emit a nop so that there's somewhere to put the + bool forLoopRequiresFreshening = false; + JSOp op; + ParseNode *init = forHead->pn_kid1; + if (!init) { + // If there's no init, emit a nop so that there's somewhere to put the // SRC_FOR annotation that IonBuilder will look for. op = JSOP_NOP; + } else if (init->isKind(PNK_FRESHENBLOCK)) { + // Also emit a nop, as above. + op = JSOP_NOP; + + // The loop's init declaration was hoisted into an enclosing lexical + // scope node. Note that the block scope must be freshened each + // iteration. + forLoopRequiresFreshening = true; } else { emittingForInit = true; - if (!updateSourceCoordNotes(pn3->pn_pos.begin)) + if (!updateSourceCoordNotes(init->pn_pos.begin)) return false; - if (!emitTree(pn3)) + if (!emitTree(init)) return false; emittingForInit = false; + + op = JSOP_POP; } /* @@ -5099,19 +5110,38 @@ BytecodeEmitter::emitNormalFor(ParseNode *pn, ptrdiff_t top) /* Set the second note offset so we can find the update part. */ ptrdiff_t tmp2 = offset(); - /* Set loop and enclosing "update" offsets, for continue. */ + // Set loop and enclosing "update" offsets, for continue. Note that we + // continue to immediately *before* the block-freshening: continuing must + // refresh the block. StmtInfoBCE *stmt = &stmtInfo; do { stmt->update = offset(); } while ((stmt = stmt->down) != nullptr && stmt->type == STMT_LABEL); + // Freshen the block on the scope chain to expose distinct bindings for each loop + // iteration. + if (forLoopRequiresFreshening) { + // The scope chain only includes an actual block *if* the scope object + // is captured and therefore requires cloning. Get the static block + // object from the parent let-block statement (which *must* be the + // let-statement for the guarding condition to have held) and freshen + // if the block object needs cloning. + StmtInfoBCE *parent = stmtInfo.down; + MOZ_ASSERT(parent->type == STMT_BLOCK); + MOZ_ASSERT(parent->isBlockScope); + + if (parent->staticScope->as().needsClone()) { + if (!emit1(JSOP_FRESHENBLOCKSCOPE)) + return false; + } + } + /* Check for update code to do before the condition (if any). */ - pn3 = forHead->pn_kid3; - if (pn3) { - if (!updateSourceCoordNotes(pn3->pn_pos.begin)) + if (ParseNode *update = forHead->pn_kid3) { + if (!updateSourceCoordNotes(update->pn_pos.begin)) return false; op = JSOP_POP; - if (!emitTree(pn3)) + if (!emitTree(update)) return false; /* Always emit the POP or NOP to help IonBuilder. */ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 383bc7acc89..8958a8a09f6 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -307,8 +307,11 @@ ContainsHoistedDeclaration(ExclusiveContext *cx, ParseNode *node, bool *result) case PNK_LETBLOCK: { MOZ_ASSERT(node->isArity(PN_BINARY)); - MOZ_ASSERT(node->pn_left->isKind(PNK_LET)); MOZ_ASSERT(node->pn_right->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(node->pn_left->isKind(PNK_LET) || + (node->pn_left->isKind(PNK_CONST) && node->pn_right->pn_expr->isKind(PNK_FOR)), + "a let-block's left half is its declarations: ordinarily a PNK_LET node but " + "PNK_CONST in the weird case of |for (const x ...)|"); return ContainsHoistedDeclaration(cx, node->pn_right, result); } @@ -412,6 +415,7 @@ ContainsHoistedDeclaration(ExclusiveContext *cx, ParseNode *node, bool *result) case PNK_FORIN: case PNK_FOROF: case PNK_FORHEAD: + case PNK_FRESHENBLOCK: case PNK_CLASSMETHOD: case PNK_CLASSMETHODLIST: case PNK_CLASSNAMES: diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index ee31f6589e1..043d8d5d69c 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -499,6 +499,10 @@ class FullParseHandler return new_(kind, JSOP_NOP, pn1, pn2, pn3, pos); } + ParseNode *newFreshenBlock(const TokenPos &pos) { + return new_(PNK_FRESHENBLOCK, pos); + } + ParseNode *newSwitchStatement(uint32_t begin, ParseNode *discriminant, ParseNode *caseList) { TokenPos pos(begin, caseList->pn_pos.end); return new_(PNK_SWITCH, JSOP_NOP, pos, discriminant, caseList); diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 4eb140d7d3d..75dc62276ea 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -208,6 +208,7 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack) case PNK_DEBUGGER: case PNK_EXPORT_BATCH_SPEC: case PNK_OBJECT_PROPERTY_NAME: + case PNK_FRESHENBLOCK: MOZ_ASSERT(pn->isArity(PN_NULLARY)); MOZ_ASSERT(!pn->isUsed(), "handle non-trivial cases separately"); MOZ_ASSERT(!pn->isDefn(), "handle non-trivial cases separately"); diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index c62297daa04..deae0020e77 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -146,6 +146,7 @@ class UpvarCookie F(FORIN) \ F(FOROF) \ F(FORHEAD) \ + F(FRESHENBLOCK) \ F(ARGSBODY) \ F(SPREAD) \ F(MUTATEPROTO) \ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 971c1854d41..6e70e8a8aa5 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -4709,11 +4709,50 @@ Parser::forStatement() MOZ_ASSERT_IF(isForDecl, pn1->isArity(PN_LIST)); MOZ_ASSERT(!!blockObj == (isForDecl && pn1->isOp(JSOP_NOP))); - // The form 'for (let ; ; ) ' generates an - // implicit block even if stmt is not a BlockStatement. - // If the loop has that exact form, then: - // - forLetImpliedBlock is the node for the implicit block scope. - // - forLetDecl is the node for the decl 'let '. + // All forms of for-loop (for(;;), for-in, for-of) generate an implicit + // block to store any lexical variables declared by the loop-head. We + // implement this by desugaring such loops. These: + // + // for (let/const ; ; ) + // for (let in ) + // for (let of ) + // + // transform into almost these desugarings: + // + // let () { for (; ; ) } + // let () { for ( in ) } + // let () { for ( of ) } + // + // This desugaring is not *quite* correct. Assignments in the head of a + // let-block are evaluated *outside* the scope of the variables declared by + // the let-block-head. But ES6 mandates that they be evaluated in the same + // scope, triggering used-before-initialization temporal dead zone errors + // as necessary. Bug 1069480 will fix this. + // + // Additionally, ES6 mandates that *each iteration* of a for-loop create a + // fresh binding of loop variables. For example: + // + // var funcs = []; + // for (let i = 0; i < 2; i++) + // funcs.push(function() { return i; }); + // assertEq(funcs[0](), 0); + // assertEq(funcs[1](), 1); + // + // These semantics are implemented by "freshening" the implicit block -- + // changing the scope chain to a fresh clone of the instantaneous block + // object -- each iteration, just before evaluating the "update" in + // for(;;) loops. (We don't implement this freshening for for-in/of loops, + // but soon: bug 449811.) No freshening occurs in for (const ...;;) as + // there's no point (you can't reassign consts), and moreover the spec + // requires it (which fact isn't exposed in-language but can be observed + // through the Debugger API). + // + // If the for-loop head includes a lexical declaration, then we create an + // implicit block scope, and: + // + // * forLetImpliedBlock is the node for the implicit block scope. + // * forLetDecl is the node for the decl 'let/const '. + // // Otherwise both are null. ParseNode *forLetImpliedBlock = nullptr; ParseNode *forLetDecl = nullptr; @@ -4885,23 +4924,45 @@ Parser::forStatement() headKind = PNK_FORHEAD; if (blockObj) { - /* - * Desugar 'for (let A; B; C) D' into 'let (A) { for (; B; C) D }' - * to induce the correct scoping for A. Ensure here that the previously - * unchecked assignment mandate for const declarations holds. - */ + // Ensure here that the previously-unchecked assignment mandate for + // const declarations holds. if (!checkForHeadConstInitializers(pn1)) { report(ParseError, false, nullptr, JSMSG_BAD_CONST_DECL); return null(); } + // Desugar + // + // for (let INIT; TEST; UPDATE) STMT + // + // into + // + // let (INIT) { for (; TEST; UPDATE) STMT } + // + // to provide a block scope for INIT. forLetImpliedBlock = pushLetScope(blockObj, &letStmt); if (!forLetImpliedBlock) return null(); letStmt.isForLetBlock = true; forLetDecl = pn1; - pn1 = nullptr; + + // The above transformation isn't enough to implement |INIT| + // scoping, because each loop iteration must see separate bindings + // of |INIT|. We handle this by replacing the block on the scope + // chain with a new block, copying the old one's contents, each + // iteration. We supply a special PNK_FRESHENBLOCK node as the + // |let INIT| node for |for(let INIT;;)| loop heads to distinguish + // such nodes from *actual*, non-desugared use of the above syntax. + // (We don't do this for PNK_CONST nodes because the spec says no + // freshening happens -- observable with the Debugger API.) + if (pn1->isKind(PNK_CONST)) { + pn1 = nullptr; + } else { + pn1 = handler.newFreshenBlock(pn1->pn_pos); + if (!pn1) + return null(); + } } /* Parse the loop condition or null into pn2. */ diff --git a/js/src/jit-test/tests/asm.js/testFastHeapAccess.js b/js/src/jit-test/tests/asm.js/testFastHeapAccess.js index 8986e4ca820..c926174e958 100644 --- a/js/src/jit-test/tests/asm.js/testFastHeapAccess.js +++ b/js/src/jit-test/tests/asm.js/testFastHeapAccess.js @@ -25,6 +25,7 @@ var f = asmLink(code, this, null, BUF_64KB); for (var i = 0; i < 100; i++) assertEq(f(i), i); +// For legacy compatibility, test Int8/Uint8 accesses with no shift. var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i,j) {i=i|0;j=j|0; u8[i+20 & 0xffff] = j } return f'); var f = asmLink(code, this, null, BUF_64KB); for (var i = 0; i < 100; i++) @@ -37,6 +38,18 @@ var f = asmLink(code, this, null, BUF_64KB); for (var i = 0; i < 100; i++) assertEq(f(i), i); +var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i,j) {i=i|0;j=j|0; u8[(i+20 & 0xffff)>>0] = j } return f'); +var f = asmLink(code, this, null, BUF_64KB); +for (var i = 0; i < 100; i++) + f(i, i); +var u8 = new Uint8Array(BUF_64KB); +for (var i = 0; i < 100; i++) + assertEq(u8[i+20], i); +var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; return u8[(i+20 & 0xffff)>>0]|0 } return f'); +var f = asmLink(code, this, null, BUF_64KB); +for (var i = 0; i < 100; i++) + assertEq(f(i), i); + var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i,j,k) {i=i|0;j=j|0;k=k|0; i32[(i + (j<<2) & 0xffff) >> 2] = k } return f'); var f = asmLink(code, this, null, BUF_64KB); for (var i = 0; i < 100; i++) diff --git a/js/src/jit-test/tests/asm.js/testHeapAccess.js b/js/src/jit-test/tests/asm.js/testHeapAccess.js index a4a07f6da3d..4c362b1c753 100644 --- a/js/src/jit-test/tests/asm.js/testHeapAccess.js +++ b/js/src/jit-test/tests/asm.js/testHeapAccess.js @@ -173,10 +173,15 @@ assertEq(f(1), 0xfffeeee); var f = asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; return i32[((i<<2)+4)>>2]|0 }; return f'), this, null, i32.buffer); assertEq(f(0), 0xfffeeee); +// For legacy compatibility, test Int8/Uint8 accesses with no shift. asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { u8[7&0xffff] = 41 } return f'), this, null, BUF_64KB)(); assertEq(new Uint8Array(BUF_64KB)[7], 41); asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { i8[7&0xffff] = -41 } return f'), this, null, BUF_64KB)(); assertEq(new Int8Array(BUF_64KB)[7], -41); +asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { u8[(7&0xffff)>>0] = 41 } return f'), this, null, BUF_64KB)(); +assertEq(new Uint8Array(BUF_64KB)[7], 41); +asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { i8[(7&0xffff)>>0] = -41 } return f'), this, null, BUF_64KB)(); +assertEq(new Int8Array(BUF_64KB)[7], -41); asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { u16[(6&0xffff)>>1] = 0xabc } return f'), this, null, BUF_64KB)(); assertEq(new Uint16Array(BUF_64KB)[3], 0xabc); asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { i16[(6&0xffff)>>1] = -0xabc } return f'), this, null, BUF_64KB)(); @@ -197,7 +202,9 @@ new Float64Array(BUF_64KB)[1] = 1.3; assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { return +f64[(8&0xffff)>>3] } return f'), this, null, BUF_64KB)(), 1.3); asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) { i=i|0; u8[255]; u8[i] } return f'); +// For legacy compatibility, test Int8/Uint8 accesses with no shift. asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) { i=i|0; u8[i&0xff]; u8[255] } return f'); +asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) { i=i|0; u8[(i&0xff)>>0]; u8[255] } return f'); asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) { i=i|0; u32[63]; u32[i>>2] } return f'); asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) { i=i|0; u32[i>>2]; u32[63] } return f'); diff --git a/js/src/jit-test/tests/basic/error-stack-accessors.js b/js/src/jit-test/tests/basic/error-stack-accessors.js new file mode 100644 index 00000000000..9bbcae14ba8 --- /dev/null +++ b/js/src/jit-test/tests/basic/error-stack-accessors.js @@ -0,0 +1,31 @@ +// Test the Error.prototype.stack getter/setter with various "fun" edge cases. + +load(libdir + "asserts.js"); + +// Stack should be accessible in subclasses. The accessor should walk up the +// prototype chain. +assertEq(typeof Object.create(Error()).stack, "string"); +assertEq(Object.create(Error.prototype).stack, ""); + +// Stack should be overridable in subclasses. +{ + let myError = Object.create(Error()); + myError.stack = 5; + assertEq(myError.stack, 5); + + let myOtherError = Object.create(Error.prototype); + myOtherError.stack = 2; + assertEq(myOtherError.stack, 2); +} + +// Should throw when there is no Error in the `this` object's prototype chain. +var obj = Object.create(null); +var desc = Object.getOwnPropertyDescriptor(Error.prototype, "stack"); +Object.defineProperty(obj, "stack", desc); +assertThrowsInstanceOf(() => obj.stack, TypeError); + +// Should throw with non-object `this` values. +assertThrowsInstanceOf(desc.set, TypeError); +assertThrowsInstanceOf(desc.set.bind("string"), TypeError); +assertThrowsInstanceOf(desc.get, TypeError); +assertThrowsInstanceOf(desc.get.bind("string"), TypeError); diff --git a/js/src/jit-test/tests/basic/shell-principals.js b/js/src/jit-test/tests/basic/shell-principals.js index 2a97914846d..a96ce69c7cf 100644 --- a/js/src/jit-test/tests/basic/shell-principals.js +++ b/js/src/jit-test/tests/basic/shell-principals.js @@ -30,7 +30,10 @@ var high = newGlobal({ principal: 0xfffff }); low .eval('function b() { check("b", Error().stack); c(); }'); mid .eval('function c() { check("cba", Error().stack); d(); }'); high.eval('function d() { check("dcba", Error().stack); e(); }'); - eval('function e() { check("edcba", Error().stack); f(); }'); // no principal, so checks skipped + +// Globals created with no explicit principals get 0xffff. + eval('function e() { check("ecba", Error().stack); f(); }'); + low .eval('function f() { check("fb", Error().stack); g(); }'); mid .eval('function g() { check("gfecba", Error().stack); h(); }'); high.eval('function h() { check("hgfedcba", Error().stack); }'); diff --git a/js/src/jit-test/tests/basic/test-error-accessors-with-wrappers.js b/js/src/jit-test/tests/basic/test-error-accessors-with-wrappers.js new file mode 100644 index 00000000000..2afa881f3a3 --- /dev/null +++ b/js/src/jit-test/tests/basic/test-error-accessors-with-wrappers.js @@ -0,0 +1,11 @@ +let g = newGlobal(); + +let error = g.eval("Error()"); + +// This should not throw. +assertEq(typeof error.stack, "string"); + +g.error = Error(); + +// Nor should this. +assertEq(g.eval("typeof error.stack"), "string"); diff --git a/js/src/jit-test/tests/basic/testBug763950.js b/js/src/jit-test/tests/basic/testBug763950.js index 246a7a155ea..6f685217fdc 100644 --- a/js/src/jit-test/tests/basic/testBug763950.js +++ b/js/src/jit-test/tests/basic/testBug763950.js @@ -2,5 +2,5 @@ var x; for (let j = 0; j < 1; j = j + 1) x = function() { return j; }; - assertEq(x(), 1); + assertEq(x(), 0); })(); diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js index 67d0d07a991..e9f2fb41c6f 100644 --- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js +++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js @@ -21,10 +21,10 @@ let allocs1 = dbg.memory.drainAllocationsLog(); root.doSecondAlloc(); let allocs2 = dbg.memory.drainAllocationsLog(); -let allocs1Lines = allocs1.map(x => x.frame.line); +let allocs1Lines = allocs1.filter(x => !!x.frame).map(x => x.frame.line); assertEq(allocs1Lines.indexOf(root.firstAllocLine) != -1, true); assertEq(allocs1Lines.indexOf(root.secondAllocLine) == -1, true); -let allocs2Lines = allocs2.map(x => x.frame.line); +let allocs2Lines = allocs2.filter(x => !!x.frame).map(x => x.frame.line); assertEq(allocs2Lines.indexOf(root.secondAllocLine) != -1, true); assertEq(allocs2Lines.indexOf(root.firstAllocLine) == -1, true); diff --git a/js/src/jit-test/tests/ion/bug1143216.js b/js/src/jit-test/tests/ion/bug1143216.js new file mode 100644 index 00000000000..0bc0e9166a8 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug1143216.js @@ -0,0 +1,17 @@ +// Note: This test produces a link error which is required to reproduce the +// original issue. +m = (function(stdlib, n, heap) { + "use asm" + var Float64ArrayView = new stdlib.Float64Array(heap) + var Int16ArrayView = new stdlib.Int16Array(heap) + function f(i0) { + i0 = i0 | 0 + i0 = i0 | 0 + Int16ArrayView[0] = (i0 << 0) + i0 + Float64ArrayView[0] + } + return f +})(this, {}, Array) +for (var j = 0; j < 9; j++) { + m() +} diff --git a/js/src/jit-test/tests/parser/columnNumber.js b/js/src/jit-test/tests/parser/columnNumber.js index dec88309382..ce29db33cd7 100644 --- a/js/src/jit-test/tests/parser/columnNumber.js +++ b/js/src/jit-test/tests/parser/columnNumber.js @@ -2,10 +2,10 @@ load(libdir + 'asserts.js'); -assertEq(evaluate("saveStack().column"), 0); -assertEq(evaluate("saveStack().column", { columnNumber: 1729 }), 1729); -assertEq(evaluate("\nsaveStack().column", { columnNumber: 1729 }), 0); -assertEq(evaluate("saveStack().column", { columnNumber: "42" }), 42); +assertEq(evaluate("saveStack().column"), 1); +assertEq(evaluate("saveStack().column", { columnNumber: 1729 }), 1730); +assertEq(evaluate("\nsaveStack().column", { columnNumber: 1729 }), 1); +assertEq(evaluate("saveStack().column", { columnNumber: "42" }), 43); assertThrowsInstanceOf(() => evaluate("saveStack().column", { columnNumber: -10 }), RangeError); assertThrowsInstanceOf(() => evaluate("saveStack().column", { columnNumber: Math.pow(2,30) }), @@ -22,7 +22,7 @@ if (helperThreadCount() > 0) { print("offThreadCompileScript 3"); offThreadCompileScript("saveStack().column", { columnNumber: 10000 }); - assertEq(runOffThreadScript(), 10000); + assertEq(runOffThreadScript(), 10001); } // Check handling of columns near the limit of our ability to represent them. @@ -30,12 +30,12 @@ if (helperThreadCount() > 0) { // it's probably not worth it to be thorough.) const maxColumn = Math.pow(2, 30) - 1; assertEq(evaluate("saveStack().column", { columnNumber: maxColumn }), - maxColumn); + maxColumn + 1); // Check the 'silently zero' behavior when we reach the limit of the srcnotes // column encoding. assertEq(evaluate(" saveStack().column", { columnNumber: maxColumn }), - 0); + 1); // Gathering source text for inclusion in error messages should not try to reach // outside the buffer to find the start of the source line. The below should diff --git a/js/src/jit-test/tests/saved-stacks/asm-frames.js b/js/src/jit-test/tests/saved-stacks/asm-frames.js index ca69f4564e4..cbbb49a94f3 100644 --- a/js/src/jit-test/tests/saved-stacks/asm-frames.js +++ b/js/src/jit-test/tests/saved-stacks/asm-frames.js @@ -28,13 +28,13 @@ assertEq(stack.functionDisplayName, "tester"); assertEq(stack.parent.functionDisplayName, "doTest"); assertEq(stack.parent.line, 6); -assertEq(stack.parent.column, 4); +assertEq(stack.parent.column, 5); assertEq(stack.parent.parent.functionDisplayName, "test"); assertEq(stack.parent.parent.line, 10); -assertEq(stack.parent.parent.column, 4); +assertEq(stack.parent.parent.column, 5); assertEq(stack.parent.parent.parent.line, 24); -assertEq(stack.parent.parent.parent.column, 0); +assertEq(stack.parent.parent.parent.column, 1); assertEq(stack.parent.parent.parent.parent, null); diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 2cc417ae9bb..5fd488fd35c 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -3011,7 +3011,6 @@ static const VMFunction PopBlockScopeInfo = FunctionInfo(jit::P bool BaselineCompiler::emit_JSOP_POPBLOCKSCOPE() { - // Call a stub to pop the block from the block chain. prepareVMCall(); masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg()); @@ -3020,6 +3019,21 @@ BaselineCompiler::emit_JSOP_POPBLOCKSCOPE() return callVM(PopBlockScopeInfo); } +typedef bool (*FreshenBlockScopeFn)(JSContext *, BaselineFrame *); +static const VMFunction FreshenBlockScopeInfo = + FunctionInfo(jit::FreshenBlockScope); + +bool +BaselineCompiler::emit_JSOP_FRESHENBLOCKSCOPE() +{ + prepareVMCall(); + + masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg()); + pushArg(R0.scratchReg()); + + return callVM(FreshenBlockScopeInfo); +} + typedef bool (*DebugLeaveBlockFn)(JSContext *, BaselineFrame *, jsbytecode *); static const VMFunction DebugLeaveBlockInfo = FunctionInfo(jit::DebugLeaveBlock); diff --git a/js/src/jit/BaselineCompiler.h b/js/src/jit/BaselineCompiler.h index 6abf948359e..da4ff491138 100644 --- a/js/src/jit/BaselineCompiler.h +++ b/js/src/jit/BaselineCompiler.h @@ -172,6 +172,7 @@ namespace jit { _(JSOP_RETSUB) \ _(JSOP_PUSHBLOCKSCOPE) \ _(JSOP_POPBLOCKSCOPE) \ + _(JSOP_FRESHENBLOCKSCOPE) \ _(JSOP_DEBUGLEAVEBLOCK) \ _(JSOP_EXCEPTION) \ _(JSOP_DEBUGGER) \ diff --git a/js/src/jit/BaselineFrame-inl.h b/js/src/jit/BaselineFrame-inl.h index cb46a24ec12..4cb42f4f41d 100644 --- a/js/src/jit/BaselineFrame-inl.h +++ b/js/src/jit/BaselineFrame-inl.h @@ -45,6 +45,13 @@ BaselineFrame::popWith(JSContext *cx) popOffScopeChain(); } +inline void +BaselineFrame::replaceInnermostScope(ScopeObject &scope) +{ + MOZ_ASSERT(scope.enclosingScope() == scopeChain_->as().enclosingScope()); + scopeChain_ = &scope; +} + inline bool BaselineFrame::pushBlock(JSContext *cx, Handle block) { @@ -66,6 +73,18 @@ BaselineFrame::popBlock(JSContext *cx) popOffScopeChain(); } +inline bool +BaselineFrame::freshenBlock(JSContext *cx) +{ + Rooted current(cx, &scopeChain_->as()); + ClonedBlockObject *clone = ClonedBlockObject::clone(cx, current); + if (!clone) + return false; + + replaceInnermostScope(*clone); + return true; +} + inline CallObject & BaselineFrame::callObj() const { diff --git a/js/src/jit/BaselineFrame.h b/js/src/jit/BaselineFrame.h index 76f71247224..9fd31238246 100644 --- a/js/src/jit/BaselineFrame.h +++ b/js/src/jit/BaselineFrame.h @@ -133,6 +133,7 @@ class BaselineFrame inline void pushOnScopeChain(ScopeObject &scope); inline void popOffScopeChain(); + inline void replaceInnermostScope(ScopeObject &scope); inline void popWith(JSContext *cx); @@ -249,6 +250,7 @@ class BaselineFrame inline bool pushBlock(JSContext *cx, Handle block); inline void popBlock(JSContext *cx); + inline bool freshenBlock(JSContext *cx); bool strictEvalPrologue(JSContext *cx); bool heavyweightFunPrologue(JSContext *cx); diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 10685a0d380..32ff4c4354f 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -4535,10 +4535,10 @@ CodeGenerator::visitSimdUnbox(LSimdUnbox *lir) js::SimdTypeDescr::Type type; switch (lir->mir()->type()) { case MIRType_Int32x4: - type = js::SimdTypeDescr::TYPE_INT32; + type = js::SimdTypeDescr::Int32x4; break; case MIRType_Float32x4: - type = js::SimdTypeDescr::TYPE_FLOAT32; + type = js::SimdTypeDescr::Float32x4; break; default: MOZ_CRASH("Unexpected SIMD Type."); diff --git a/js/src/jit/EagerSimdUnbox.cpp b/js/src/jit/EagerSimdUnbox.cpp index beaf54b761a..5a911ffa095 100644 --- a/js/src/jit/EagerSimdUnbox.cpp +++ b/js/src/jit/EagerSimdUnbox.cpp @@ -18,8 +18,8 @@ MIRTypeToSimdTypeDescr(MIRType type) { MOZ_ASSERT(IsSimdType(type)); switch (type) { - case MIRType_Float32x4: return SimdTypeDescr::TYPE_FLOAT32; - case MIRType_Int32x4: return SimdTypeDescr::TYPE_INT32; + case MIRType_Float32x4: return SimdTypeDescr::Float32x4; + case MIRType_Int32x4: return SimdTypeDescr::Int32x4; default: break; } MOZ_CRASH("unexpected MIRType"); diff --git a/js/src/jit/EffectiveAddressAnalysis.cpp b/js/src/jit/EffectiveAddressAnalysis.cpp index b8364949472..8263bcedee7 100644 --- a/js/src/jit/EffectiveAddressAnalysis.cpp +++ b/js/src/jit/EffectiveAddressAnalysis.cpp @@ -17,6 +17,9 @@ AnalyzeLsh(TempAllocator &alloc, MLsh *lsh) if (lsh->specialization() != MIRType_Int32) return; + if (lsh->isRecoveredOnBailout()) + return; + MDefinition *index = lsh->lhs(); MOZ_ASSERT(index->type() == MIRType_Int32); @@ -56,6 +59,8 @@ AnalyzeLsh(TempAllocator &alloc, MLsh *lsh) } last = add; + if (last->isRecoveredOnBailout()) + return; } if (!base) { @@ -71,6 +76,9 @@ AnalyzeLsh(TempAllocator &alloc, MLsh *lsh) return; MBitAnd *bitAnd = use->consumer()->toDefinition()->toBitAnd(); + if (bitAnd->isRecoveredOnBailout()) + return; + MDefinition *other = bitAnd->getOperand(1 - bitAnd->indexOf(*use)); if (!other->isConstantValue() || !other->constantValue().isInt32()) return; @@ -84,6 +92,9 @@ AnalyzeLsh(TempAllocator &alloc, MLsh *lsh) return; } + if (base->isRecoveredOnBailout()) + return; + MEffectiveAddress *eaddr = MEffectiveAddress::New(alloc, base, index, scale, displacement); last->replaceAllUsesWith(eaddr); last->block()->insertAfter(last, eaddr); diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 960f9374fdf..4fb0942c13f 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -2005,6 +2005,17 @@ IonBuilder::inspectOpcode(JSOp op) // Just fall through to the unsupported bytecode case. break; +#ifdef DEBUG + case JSOP_PUSHBLOCKSCOPE: + case JSOP_FRESHENBLOCKSCOPE: + case JSOP_POPBLOCKSCOPE: + // These opcodes are currently unhandled by Ion, but in principle + // there's no reason they couldn't be. Whenever this happens, OSR will + // have to consider that JSOP_FRESHENBLOCK mutates the scope chain -- + // right now it caches the scope chain in MBasicBlock::scopeChain(). + // That stale value will have to be updated when JSOP_FRESHENBLOCK is + // encountered. +#endif default: break; } @@ -3150,6 +3161,7 @@ IonBuilder::forLoop(JSOp op, jssrcnote *sn) // body: // ; [body] // [increment:] + // [FRESHENBLOCKSCOPE, if needed by a cloned block] // ; [increment] // [cond:] // LOOPENTRY @@ -3157,6 +3169,10 @@ IonBuilder::forLoop(JSOp op, jssrcnote *sn) // // If there is a condition (condpc != ifne), this acts similar to a while // loop otherwise, it acts like a do-while loop. + // + // Note that currently Ion does not compile pushblockscope/popblockscope as + // necessary prerequisites to freshenblockscope. So the code below doesn't + // and needn't consider the implications of freshenblockscope. jsbytecode *bodyStart = pc; jsbytecode *bodyEnd = updatepc; jsbytecode *loopEntry = condpc; @@ -10238,9 +10254,9 @@ MIRType IonBuilder::SimdTypeDescrToMIRType(SimdTypeDescr::Type type) { switch (type) { - case SimdTypeDescr::TYPE_INT32: return MIRType_Int32x4; - case SimdTypeDescr::TYPE_FLOAT32: return MIRType_Float32x4; - case SimdTypeDescr::TYPE_FLOAT64: return MIRType_Undefined; + case SimdTypeDescr::Int32x4: return MIRType_Int32x4; + case SimdTypeDescr::Float32x4: return MIRType_Float32x4; + case SimdTypeDescr::Float64x2: return MIRType_Undefined; } MOZ_CRASH("unimplemented MIR type for a SimdTypeDescr::Type"); } diff --git a/js/src/jit/MCallOptimize.cpp b/js/src/jit/MCallOptimize.cpp index 2f9d00aa390..650e6eb3f01 100644 --- a/js/src/jit/MCallOptimize.cpp +++ b/js/src/jit/MCallOptimize.cpp @@ -263,12 +263,12 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target) #define INLINE_FLOAT32X4_SIMD_ARITH_(OP) \ if (native == js::simd_float32x4_##OP) \ return inlineBinarySimd(callInfo, native, MSimdBinaryArith::Op_##OP, \ - SimdTypeDescr::TYPE_FLOAT32); + SimdTypeDescr::Float32x4); #define INLINE_INT32X4_SIMD_ARITH_(OP) \ if (native == js::simd_int32x4_##OP) \ return inlineBinarySimd(callInfo, native, MSimdBinaryArith::Op_##OP, \ - SimdTypeDescr::TYPE_INT32); + SimdTypeDescr::Int32x4); ARITH_COMMONX4_SIMD_OP(INLINE_INT32X4_SIMD_ARITH_) ARITH_COMMONX4_SIMD_OP(INLINE_FLOAT32X4_SIMD_ARITH_) @@ -279,28 +279,28 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target) #define INLINE_SIMD_BITWISE_(OP) \ if (native == js::simd_int32x4_##OP) \ return inlineBinarySimd(callInfo, native, MSimdBinaryBitwise::OP##_, \ - SimdTypeDescr::TYPE_INT32); \ + SimdTypeDescr::Int32x4); \ if (native == js::simd_float32x4_##OP) \ return inlineBinarySimd(callInfo, native, MSimdBinaryBitwise::OP##_, \ - SimdTypeDescr::TYPE_FLOAT32); + SimdTypeDescr::Float32x4); BITWISE_COMMONX4_SIMD_OP(INLINE_SIMD_BITWISE_) #undef INLINE_SIMD_BITWISE_ #define INLINE_SIMD_COMPARISON_(OP) \ if (native == js::simd_int32x4_##OP) \ - return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::TYPE_INT32); \ + return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Int32x4); \ if (native == js::simd_float32x4_##OP) \ - return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::TYPE_FLOAT32); + return inlineCompSimd(callInfo, native, MSimdBinaryComp::OP, SimdTypeDescr::Float32x4); COMP_COMMONX4_TO_INT32X4_SIMD_OP(INLINE_SIMD_COMPARISON_) #undef INLINE_SIMD_COMPARISON_ #define INLINE_SIMD_SETTER_(LANE) \ if (native == js::simd_int32x4_with##LANE) \ - return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::TYPE_INT32); \ + return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::Int32x4); \ if (native == js::simd_float32x4_with##LANE) \ - return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdWith(callInfo, native, SimdLane::Lane##LANE, SimdTypeDescr::Float32x4); INLINE_SIMD_SETTER_(X) INLINE_SIMD_SETTER_(Y) @@ -309,94 +309,94 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target) #undef INLINE_SIMD_SETTER_ if (native == js::simd_int32x4_not) - return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::TYPE_INT32); + return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Int32x4); if (native == js::simd_int32x4_neg) - return inlineUnarySimd(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::TYPE_INT32); + return inlineUnarySimd(callInfo, native, MSimdUnaryArith::neg, SimdTypeDescr::Int32x4); #define INLINE_SIMD_FLOAT32X4_UNARY_(OP) \ if (native == js::simd_float32x4_##OP) \ - return inlineUnarySimd(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::TYPE_FLOAT32); + return inlineUnarySimd(callInfo, native, MSimdUnaryArith::OP, SimdTypeDescr::Float32x4); UNARY_ARITH_FLOAT32X4_SIMD_OP(INLINE_SIMD_FLOAT32X4_UNARY_) INLINE_SIMD_FLOAT32X4_UNARY_(neg) #undef INLINE_SIMD_FLOAT32X4_UNARY_ if (native == js::simd_float32x4_not) - return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::TYPE_FLOAT32); + return inlineUnarySimd(callInfo, native, MSimdUnaryArith::not_, SimdTypeDescr::Float32x4); typedef bool IsCast; if (native == js::simd_float32x4_fromInt32x4) - return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::TYPE_INT32, SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Int32x4, SimdTypeDescr::Float32x4); if (native == js::simd_int32x4_fromFloat32x4) - return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::TYPE_FLOAT32, SimdTypeDescr::TYPE_INT32); + return inlineSimdConvert(callInfo, native, IsCast(false), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4); if (native == js::simd_float32x4_fromInt32x4Bits) - return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::TYPE_INT32, SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::Int32x4, SimdTypeDescr::Float32x4); if (native == js::simd_int32x4_fromFloat32x4Bits) - return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::TYPE_FLOAT32, SimdTypeDescr::TYPE_INT32); + return inlineSimdConvert(callInfo, native, IsCast(true), SimdTypeDescr::Float32x4, SimdTypeDescr::Int32x4); if (native == js::simd_int32x4_splat) - return inlineSimdSplat(callInfo, native, SimdTypeDescr::TYPE_INT32); + return inlineSimdSplat(callInfo, native, SimdTypeDescr::Int32x4); if (native == js::simd_float32x4_splat) - return inlineSimdSplat(callInfo, native, SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdSplat(callInfo, native, SimdTypeDescr::Float32x4); if (native == js::simd_int32x4_check) - return inlineSimdCheck(callInfo, native, SimdTypeDescr::TYPE_INT32); + return inlineSimdCheck(callInfo, native, SimdTypeDescr::Int32x4); if (native == js::simd_float32x4_check) - return inlineSimdCheck(callInfo, native, SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdCheck(callInfo, native, SimdTypeDescr::Float32x4); typedef bool IsElementWise; if (native == js::simd_int32x4_select) - return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::TYPE_INT32); + return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Int32x4); if (native == js::simd_int32x4_bitselect) - return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::TYPE_INT32); + return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Int32x4); if (native == js::simd_float32x4_select) - return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Float32x4); if (native == js::simd_float32x4_bitselect) - return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::TYPE_FLOAT32); + return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Float32x4); if (native == js::simd_int32x4_swizzle) - return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_INT32, 1, 4); + return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Int32x4, 1, 4); if (native == js::simd_float32x4_swizzle) - return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1, 4); + return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Float32x4, 1, 4); if (native == js::simd_int32x4_shuffle) - return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_INT32, 2, 4); + return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Int32x4, 2, 4); if (native == js::simd_float32x4_shuffle) - return inlineSimdShuffle(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2, 4); + return inlineSimdShuffle(callInfo, native, SimdTypeDescr::Float32x4, 2, 4); if (native == js::simd_int32x4_load) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 4); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 4); if (native == js::simd_int32x4_loadX) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 1); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 1); if (native == js::simd_int32x4_loadXY) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 2); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 2); if (native == js::simd_int32x4_loadXYZ) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_INT32, 3); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 3); if (native == js::simd_float32x4_load) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 4); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 4); if (native == js::simd_float32x4_loadX) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 1); if (native == js::simd_float32x4_loadXY) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 2); if (native == js::simd_float32x4_loadXYZ) - return inlineSimdLoad(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 3); + return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 3); if (native == js::simd_int32x4_store) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 4); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 4); if (native == js::simd_int32x4_storeX) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 1); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 1); if (native == js::simd_int32x4_storeXY) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 2); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 2); if (native == js::simd_int32x4_storeXYZ) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_INT32, 3); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 3); if (native == js::simd_float32x4_store) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 4); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 4); if (native == js::simd_float32x4_storeX) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 1); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 1); if (native == js::simd_float32x4_storeXY) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 2); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 2); if (native == js::simd_float32x4_storeXYZ) - return inlineSimdStore(callInfo, native, SimdTypeDescr::TYPE_FLOAT32, 3); + return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 3); return InliningStatus_NotInlined; } @@ -3116,7 +3116,7 @@ IonBuilder::inlineCompSimd(CallInfo &callInfo, JSNative native, MSimdBinaryComp: SimdTypeDescr::Type compType) { InlineTypedObject *templateObj = nullptr; - if (!checkInlineSimd(callInfo, native, SimdTypeDescr::TYPE_INT32, 2, &templateObj)) + if (!checkInlineSimd(callInfo, native, SimdTypeDescr::Int32x4, 2, &templateObj)) return InliningStatus_NotInlined; // If the type of any of the arguments is neither a SIMD type, an Object @@ -3251,9 +3251,9 @@ static Scalar::Type SimdTypeToScalarType(SimdTypeDescr::Type type) { switch (type) { - case SimdTypeDescr::TYPE_FLOAT32: return Scalar::Float32x4; - case SimdTypeDescr::TYPE_INT32: return Scalar::Int32x4; - case SimdTypeDescr::TYPE_FLOAT64: break; + case SimdTypeDescr::Float32x4: return Scalar::Float32x4; + case SimdTypeDescr::Int32x4: return Scalar::Int32x4; + case SimdTypeDescr::Float64x2: break; } MOZ_CRASH("unexpected simd type"); } diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 078b23abc0d..bfaafd76fd1 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -948,27 +948,27 @@ class MInstruction #define INSTRUCTION_HEADER_WITHOUT_TYPEPOLICY(opcode) \ static const Opcode classOpcode = MDefinition::Op_##opcode; \ - Opcode op() const override { \ + Opcode op() const override { \ return classOpcode; \ } \ - const char *opName() const override { \ + const char *opName() const override { \ return #opcode; \ } \ - void accept(MDefinitionVisitor *visitor) override { \ + void accept(MDefinitionVisitor *visitor) override { \ visitor->visit##opcode(this); \ } #define INSTRUCTION_HEADER(opcode) \ INSTRUCTION_HEADER_WITHOUT_TYPEPOLICY(opcode) \ - virtual TypePolicy *typePolicy() override; \ + virtual TypePolicy *typePolicy() override; \ virtual MIRType typePolicySpecialization() override; #define ALLOW_CLONE(typename) \ - bool canClone() const override { \ + bool canClone() const override { \ return true; \ } \ MInstruction *clone(TempAllocator &alloc, \ - const MDefinitionVector &inputs) const override { \ + const MDefinitionVector &inputs) const override { \ MInstruction *res = new(alloc) typename(*this); \ for (size_t i = 0; i < numOperands(); i++) \ res->replaceOperand(i, inputs[i]); \ diff --git a/js/src/jit/Recover.cpp b/js/src/jit/Recover.cpp index 32516c2c700..d1213da6e85 100644 --- a/js/src/jit/Recover.cpp +++ b/js/src/jit/Recover.cpp @@ -1338,17 +1338,17 @@ RSimdBox::recover(JSContext *cx, SnapshotIterator &iter) const MOZ_ASSERT(iter.allocationReadable(a)); const FloatRegisters::RegisterContent *raw = iter.floatAllocationPointer(a); switch (SimdTypeDescr::Type(type_)) { - case SimdTypeDescr::TYPE_INT32: + case SimdTypeDescr::Int32x4: MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG, a.fpuReg().isInt32x4()); resultObject = js::CreateSimd(cx, (const Int32x4::Elem *) raw); break; - case SimdTypeDescr::TYPE_FLOAT32: + case SimdTypeDescr::Float32x4: MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG, a.fpuReg().isFloat32x4()); resultObject = js::CreateSimd(cx, (const Float32x4::Elem *) raw); break; - case SimdTypeDescr::TYPE_FLOAT64: + case SimdTypeDescr::Float64x2: MOZ_CRASH("NYI, RSimdBox of Float64x2"); break; } diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index c40553ed078..038049e85db 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -994,6 +994,12 @@ PopBlockScope(JSContext *cx, BaselineFrame *frame) return true; } +bool +FreshenBlockScope(JSContext *cx, BaselineFrame *frame) +{ + return frame->freshenBlock(cx); +} + bool DebugLeaveBlock(JSContext *cx, BaselineFrame *frame, jsbytecode *pc) { diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index e954dc0c365..20003530494 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -728,6 +728,7 @@ bool LeaveWith(JSContext *cx, BaselineFrame *frame); bool PushBlockScope(JSContext *cx, BaselineFrame *frame, Handle block); bool PopBlockScope(JSContext *cx, BaselineFrame *frame); +bool FreshenBlockScope(JSContext *cx, BaselineFrame *frame); bool DebugLeaveBlock(JSContext *cx, BaselineFrame *frame, jsbytecode *pc); bool InitBaselineFrameForOsr(BaselineFrame *frame, InterpreterFrame *interpFrame, diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index 013e38e084a..16ffbcd79f4 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -40,8 +40,7 @@ CodeGeneratorShared::ensureMasm(MacroAssembler *masmArg) } CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masmArg) - : oolIns(nullptr), - maybeMasm_(), + : maybeMasm_(), masm(ensureMasm(masmArg)), gen(gen), graph(*graph), @@ -129,10 +128,8 @@ CodeGeneratorShared::generateOutOfLineCode() lastPC_ = outOfLineCode_[i]->pc(); outOfLineCode_[i]->bind(&masm); - oolIns = outOfLineCode_[i]; outOfLineCode_[i]->generate(this); } - oolIns = nullptr; return true; } diff --git a/js/src/jit/shared/CodeGenerator-shared.h b/js/src/jit/shared/CodeGenerator-shared.h index 45d46e4c4f6..cd5b8a7ba16 100644 --- a/js/src/jit/shared/CodeGenerator-shared.h +++ b/js/src/jit/shared/CodeGenerator-shared.h @@ -62,7 +62,6 @@ struct NativeToTrackedOptimizations class CodeGeneratorShared : public LElementVisitor { js::Vector outOfLineCode_; - OutOfLineCode *oolIns; MacroAssembler &ensureMasm(MacroAssembler *masm); mozilla::Maybe maybeMasm_; @@ -486,7 +485,6 @@ class CodeGeneratorShared : public LElementVisitor protected: void addOutOfLineCode(OutOfLineCode *code, const MInstruction *mir); void addOutOfLineCode(OutOfLineCode *code, const BytecodeSite *site); - bool hasOutOfLineCode() { return !outOfLineCode_.empty(); } bool generateOutOfLineCode(); Label *labelForBackedgeWithImplicitCheck(MBasicBlock *mir); diff --git a/js/src/jit/shared/Disassembler-x86-shared.cpp b/js/src/jit/shared/Disassembler-x86-shared.cpp index b6cb7fd5e45..a0c4f384447 100644 --- a/js/src/jit/shared/Disassembler-x86-shared.cpp +++ b/js/src/jit/shared/Disassembler-x86-shared.cpp @@ -13,51 +13,51 @@ using namespace js::jit; using namespace js::jit::X86Encoding; using namespace js::jit::Disassembler; -static bool REX_W(uint8_t rex) { return (rex >> 3) & 0x1; } -static bool REX_R(uint8_t rex) { return (rex >> 2) & 0x1; } -static bool REX_X(uint8_t rex) { return (rex >> 1) & 0x1; } -static bool REX_B(uint8_t rex) { return (rex >> 0) & 0x1; } +MOZ_COLD static bool REX_W(uint8_t rex) { return (rex >> 3) & 0x1; } +MOZ_COLD static bool REX_R(uint8_t rex) { return (rex >> 2) & 0x1; } +MOZ_COLD static bool REX_X(uint8_t rex) { return (rex >> 1) & 0x1; } +MOZ_COLD static bool REX_B(uint8_t rex) { return (rex >> 0) & 0x1; } -static uint8_t +MOZ_COLD static uint8_t MakeREXFlags(bool w, bool r, bool x, bool b) { uint8_t rex = (w << 3) | (r << 2) | (x << 1) | (b << 0); - MOZ_ASSERT(REX_W(rex) == w); - MOZ_ASSERT(REX_R(rex) == r); - MOZ_ASSERT(REX_X(rex) == x); - MOZ_ASSERT(REX_B(rex) == b); + MOZ_RELEASE_ASSERT(REX_W(rex) == w); + MOZ_RELEASE_ASSERT(REX_R(rex) == r); + MOZ_RELEASE_ASSERT(REX_X(rex) == x); + MOZ_RELEASE_ASSERT(REX_B(rex) == b); return rex; } -static ModRmMode +MOZ_COLD static ModRmMode ModRM_Mode(uint8_t modrm) { return ModRmMode((modrm >> 6) & 0x3); } -static uint8_t +MOZ_COLD static uint8_t ModRM_Reg(uint8_t modrm) { return (modrm >> 3) & 0x7; } -static uint8_t +MOZ_COLD static uint8_t ModRM_RM(uint8_t modrm) { return (modrm >> 0) & 0x7; } -static bool +MOZ_COLD static bool ModRM_hasSIB(uint8_t modrm) { return ModRM_Mode(modrm) != ModRmRegister && ModRM_RM(modrm) == hasSib; } -static bool +MOZ_COLD static bool ModRM_hasDisp8(uint8_t modrm) { return ModRM_Mode(modrm) == ModRmMemoryDisp8; } -static bool +MOZ_COLD static bool ModRM_hasRIP(uint8_t modrm) { #ifdef JS_CODEGEN_X64 @@ -66,50 +66,50 @@ ModRM_hasRIP(uint8_t modrm) return false; #endif } -static bool +MOZ_COLD static bool ModRM_hasDisp32(uint8_t modrm) { return ModRM_Mode(modrm) == ModRmMemoryDisp32 || ModRM_hasRIP(modrm); } -static uint8_t +MOZ_COLD static uint8_t SIB_SS(uint8_t sib) { return (sib >> 6) & 0x3; } -static uint8_t +MOZ_COLD static uint8_t SIB_Index(uint8_t sib) { return (sib >> 3) & 0x7; } -static uint8_t +MOZ_COLD static uint8_t SIB_Base(uint8_t sib) { return (sib >> 0) & 0x7; } -static bool +MOZ_COLD static bool SIB_hasRIP(uint8_t sib) { return SIB_Base(sib) == noBase && SIB_Index(sib) == noIndex; } -static bool +MOZ_COLD static bool HasRIP(uint8_t modrm, uint8_t sib, uint8_t rex) { return ModRM_hasRIP(modrm) && SIB_hasRIP(sib); } -static bool +MOZ_COLD static bool HasDisp8(uint8_t modrm) { return ModRM_hasDisp8(modrm); } -static bool +MOZ_COLD static bool HasDisp32(uint8_t modrm, uint8_t sib) { return ModRM_hasDisp32(modrm) || @@ -118,13 +118,13 @@ HasDisp32(uint8_t modrm, uint8_t sib) ModRM_Mode(modrm) == ModRmMemoryNoDisp); } -static uint32_t +MOZ_COLD static uint32_t Reg(uint8_t modrm, uint8_t sib, uint8_t rex) { return ModRM_Reg(modrm) | (REX_R(rex) << 3); } -static bool +MOZ_COLD static bool HasBase(uint8_t modrm, uint8_t sib) { return !ModRM_hasSIB(modrm) || @@ -133,7 +133,7 @@ HasBase(uint8_t modrm, uint8_t sib) ModRM_Mode(modrm) != ModRmMemoryNoDisp; } -static RegisterID +MOZ_COLD static RegisterID DecodeBase(uint8_t modrm, uint8_t sib, uint8_t rex) { return HasBase(modrm, sib) @@ -141,14 +141,14 @@ DecodeBase(uint8_t modrm, uint8_t sib, uint8_t rex) : invalid_reg; } -static RegisterID +MOZ_COLD static RegisterID DecodeIndex(uint8_t modrm, uint8_t sib, uint8_t rex) { RegisterID index = RegisterID(SIB_Index(sib) | (REX_X(rex) << 3)); return ModRM_hasSIB(modrm) && index != noIndex ? index : invalid_reg; } -static uint32_t +MOZ_COLD static uint32_t DecodeScale(uint8_t modrm, uint8_t sib, uint8_t rex) { return ModRM_hasSIB(modrm) ? SIB_SS(sib) : 0; @@ -377,25 +377,25 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) case OP_GROUP11_EvIb: if (gpr != RegisterID(GROUP11_MOV)) MOZ_CRASH("Unable to disassemble instruction"); - MOZ_ASSERT(haveImm); + MOZ_RELEASE_ASSERT(haveImm); memSize = 1; kind = HeapAccess::Store; break; case OP_GROUP11_EvIz: if (gpr != RegisterID(GROUP11_MOV)) MOZ_CRASH("Unable to disassemble instruction"); - MOZ_ASSERT(haveImm); + MOZ_RELEASE_ASSERT(haveImm); memSize = opsize; kind = HeapAccess::Store; break; case OP_MOV_GvEv: - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = opsize; kind = HeapAccess::Load; break; case OP_MOV_GvEb: - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = 1; kind = HeapAccess::Load; @@ -413,38 +413,38 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) kind = HeapAccess::Store; break; case Pack2ByteOpcode(OP2_MOVZX_GvEb): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = 1; kind = HeapAccess::Load; break; case Pack2ByteOpcode(OP2_MOVZX_GvEw): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = 2; kind = HeapAccess::Load; break; case Pack2ByteOpcode(OP2_MOVSX_GvEb): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = 1; kind = HeapAccess::LoadSext32; break; case Pack2ByteOpcode(OP2_MOVSX_GvEw): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(gpr); memSize = 2; kind = HeapAccess::LoadSext32; break; case Pack2ByteOpcode(OP2_MOVDQ_VdqWdq): // aka OP2_MOVDQ_VsdWsd case Pack2ByteOpcode(OP2_MOVAPS_VsdWsd): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); memSize = 16; kind = HeapAccess::Load; break; case Pack2ByteOpcode(OP2_MOVSD_VsdWsd): // aka OP2_MOVPS_VpsWps - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); switch (type) { case VEX_SS: memSize = 4; break; @@ -456,13 +456,13 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) kind = HeapAccess::Load; break; case Pack2ByteOpcode(OP2_MOVDQ_WdqVdq): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); memSize = 16; kind = HeapAccess::Store; break; case Pack2ByteOpcode(OP2_MOVSD_WsdVsd): // aka OP2_MOVPS_WpsVps - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); switch (type) { case VEX_SS: memSize = 4; break; @@ -474,7 +474,7 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) kind = HeapAccess::Store; break; case Pack2ByteOpcode(OP2_MOVD_VdEd): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); switch (type) { case VEX_PD: memSize = 4; break; @@ -483,7 +483,7 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) kind = HeapAccess::Load; break; case Pack2ByteOpcode(OP2_MOVQ_WdVd): - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); switch (type) { case VEX_PD: memSize = 8; break; @@ -492,7 +492,7 @@ js::jit::Disassembler::DisassembleHeapAccess(uint8_t *ptr, HeapAccess *access) kind = HeapAccess::Store; break; case Pack2ByteOpcode(OP2_MOVD_EdVd): // aka OP2_MOVQ_VdWd - MOZ_ASSERT(!haveImm); + MOZ_RELEASE_ASSERT(!haveImm); otherOperand = OtherOperand(xmm); switch (type) { case VEX_SS: memSize = 8; kind = HeapAccess::Load; break; diff --git a/js/src/jsapi-tests/testSavedStacks.cpp b/js/src/jsapi-tests/testSavedStacks.cpp index 0dbd4c5051a..186e9c1825e 100644 --- a/js/src/jsapi-tests/testSavedStacks.cpp +++ b/js/src/jsapi-tests/testSavedStacks.cpp @@ -57,8 +57,7 @@ BEGIN_TEST(testSavedStacks_ApiDefaultValues) CHECK(parent.get() == nullptr); // Stack string - result = JS::GetSavedFrameSource(cx, savedFrame, &str); - CHECK(result == JS::SavedFrameResult::AccessDenied); + CHECK(JS::BuildStackString(cx, savedFrame, &str)); CHECK(str.get() == cx->runtime()->emptyString); return true; diff --git a/js/src/jsapi-tests/testUncaughtError.cpp b/js/src/jsapi-tests/testUncaughtError.cpp index 7e0881a8e92..6683dbd4096 100644 --- a/js/src/jsapi-tests/testUncaughtError.cpp +++ b/js/src/jsapi-tests/testUncaughtError.cpp @@ -22,7 +22,7 @@ BEGIN_TEST(testUncaughtError) return false; Rooted err(cx); - if (!CreateError(cx, JSEXN_TYPEERR, empty, empty, 0, 0, nullptr, empty, &err)) + if (!CreateError(cx, JSEXN_TYPEERR, JS::NullPtr(), empty, 0, 0, nullptr, empty, &err)) return false; Rooted errObj(cx, &err.toObject()); diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 483d0f26103..d488689ca27 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -316,7 +316,7 @@ class JSAPITest #define BEGIN_TEST(testname) \ class cls_##testname : public JSAPITest { \ public: \ - virtual const char * name() override { return #testname; } \ + virtual const char * name() override { return #testname; } \ virtual bool run(JS::HandleObject global) override #define END_TEST(testname) \ @@ -334,7 +334,7 @@ class JSAPITest #define BEGIN_FIXTURE_TEST(fixture, testname) \ class cls_##testname : public fixture { \ public: \ - virtual const char * name() override { return #testname; } \ + virtual const char * name() override { return #testname; } \ virtual bool run(JS::HandleObject global) override #define END_FIXTURE_TEST(fixture, testname) \ diff --git a/js/src/jsapi.h b/js/src/jsapi.h index e1491ca8260..4be76c0976f 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4553,7 +4553,7 @@ JS_SetErrorReporter(JSRuntime *rt, JSErrorReporter er); namespace JS { extern JS_PUBLIC_API(bool) -CreateError(JSContext *cx, JSExnType type, HandleString stack, +CreateError(JSContext *cx, JSExnType type, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, HandleString message, MutableHandleValue rval); @@ -5262,9 +5262,13 @@ GetSavedFrameParent(JSContext *cx, HandleObject savedFrame, MutableHandleObject * Given a SavedFrame JSObject stack, stringify it in the same format as * Error.prototype.stack. The stringified stack out parameter is placed in the * cx's compartment. Defaults to the empty string. + * + * The same notes above about SavedFrame accessors applies here as well: cx + * doesn't need to be in stack's compartment, and stack can be null, a + * SavedFrame object, or a wrapper (CCW or Xray) around a SavedFrame object. */ extern JS_PUBLIC_API(bool) -StringifySavedFrameStack(JSContext *cx, HandleObject stack, MutableHandleString stringp); +BuildStackString(JSContext *cx, HandleObject stack, MutableHandleString stringp); } /* namespace JS */ diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index e9abba006ce..fc51278573d 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -29,11 +29,13 @@ #include "gc/Marking.h" #include "vm/ErrorObject.h" #include "vm/GlobalObject.h" +#include "vm/SavedStacks.h" #include "vm/StringBuffer.h" #include "jsobjinlines.h" #include "vm/ErrorObject-inl.h" +#include "vm/SavedStacks-inl.h" using namespace js; using namespace js::gc; @@ -50,6 +52,11 @@ Error(JSContext *cx, unsigned argc, Value *vp); static bool exn_toSource(JSContext *cx, unsigned argc, Value *vp); +static const JSPropertySpec exception_properties[] = { + JS_PSGS("stack", ErrorObject::getStack, ErrorObject::setStack, 0), + JS_PS_END +}; + static const JSFunctionSpec exception_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, exn_toSource, 0, 0), @@ -82,7 +89,7 @@ static const JSFunctionSpec exception_methods[] = { nullptr, \ nullptr, \ exception_methods, \ - nullptr, \ + exception_properties, \ nullptr, \ JSProto_Error \ } \ @@ -113,7 +120,8 @@ ErrorObject::classes[JSEXN_LIMIT] = { nullptr, nullptr, exception_methods, - 0 + exception_properties, + nullptr } }, IMPLEMENT_ERROR_SUBCLASS(InternalError), @@ -264,69 +272,30 @@ struct SuppressErrorsGuard } }; +// Cut off the stack if it gets too deep (most commonly for infinite recursion +// errors). +static const size_t MAX_REPORTED_STACK_DEPTH = 1u << 7; + +static bool +CaptureStack(JSContext *cx, MutableHandleObject stack) +{ + return CaptureCurrentStack(cx, stack, MAX_REPORTED_STACK_DEPTH); +} + JSString * js::ComputeStackString(JSContext *cx) { - StringBuffer sb(cx); + SuppressErrorsGuard seg(cx); - { - RootedAtom atom(cx); - SuppressErrorsGuard seg(cx); - for (NonBuiltinFrameIter i(cx, FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED, - cx->compartment()->principals); - !i.done(); - ++i) - { - /* First append the function name, if any. */ - if (i.isNonEvalFunctionFrame()) - atom = i.functionDisplayAtom(); - else - atom = nullptr; - if (atom && !sb.append(atom)) - return nullptr; + RootedObject stack(cx); + if (!CaptureStack(cx, &stack)) + return nullptr; - /* Next a @ separating function name from source location. */ - if (!sb.append('@')) - return nullptr; + RootedString str(cx); + if (!BuildStackString(cx, stack, &str)) + return nullptr; - /* Now the filename. */ - - /* First, try the `//# sourceURL=some-display-url.js` directive. */ - if (const char16_t *display = i.scriptDisplayURL()) { - if (!sb.append(display, js_strlen(display))) - return nullptr; - } - /* Second, try the actual filename. */ - else if (const char *filename = i.scriptFilename()) { - if (!sb.append(filename, strlen(filename))) - return nullptr; - } - - uint32_t column = 0; - uint32_t line = i.computeLine(&column); - // Now the line number - if (!sb.append(':') || !NumberValueToStringBuffer(cx, NumberValue(line), sb)) - return nullptr; - - // Finally, : followed by the column number (1-based, as in other browsers) - // and a newline. - if (!sb.append(':') || !NumberValueToStringBuffer(cx, NumberValue(column + 1), sb) || - !sb.append('\n')) - { - return nullptr; - } - - /* - * Cut off the stack if it gets too deep (most commonly for - * infinite recursion errors). - */ - const size_t MaxReportedStackDepth = 1u << 20; - if (sb.length() > MaxReportedStackDepth) - break; - } - } - - return sb.finishString(); + return str.get(); } static void @@ -391,8 +360,8 @@ Error(JSContext *cx, unsigned argc, Value *vp) lineNumber = iter.done() ? 0 : iter.computeLine(&columnNumber); } - Rooted stack(cx, ComputeStackString(cx)); - if (!stack) + RootedObject stack(cx); + if (!CaptureStack(cx, &stack)) return false; /* @@ -502,7 +471,7 @@ ErrorObject::createProto(JSContext *cx, JSProtoKey key) Rooted err(cx, &errorProto->as()); RootedString emptyStr(cx, cx->names().empty); JSExnType type = ExnTypeFromProtoKey(key); - if (!ErrorObject::init(cx, err, type, nullptr, emptyStr, emptyStr, 0, 0, emptyStr)) + if (!ErrorObject::init(cx, err, type, nullptr, emptyStr, NullPtr(), 0, 0, emptyStr)) return nullptr; // The various prototypes also have .name in addition to the normal error @@ -583,8 +552,8 @@ js::ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp, uint32_t lineNumber = reportp->lineno; uint32_t columnNumber = reportp->column; - RootedString stack(cx, ComputeStackString(cx)); - if (!stack) + RootedObject stack(cx); + if (!CaptureStack(cx, &stack)) return cx->isExceptionPending(); js::ScopedJSFreePtr report(CopyErrorReport(cx, reportp)); @@ -928,7 +897,7 @@ js::CopyErrorObject(JSContext *cx, Handle err) RootedString fileName(cx, err->fileName(cx)); if (!cx->compartment()->wrap(cx, &fileName)) return nullptr; - RootedString stack(cx, err->stack(cx)); + RootedObject stack(cx, err->stack()); if (!cx->compartment()->wrap(cx, &stack)) return nullptr; uint32_t lineNumber = err->lineNumber(); @@ -941,11 +910,13 @@ js::CopyErrorObject(JSContext *cx, Handle err) } JS_PUBLIC_API(bool) -JS::CreateError(JSContext *cx, JSExnType type, HandleString stack, HandleString fileName, +JS::CreateError(JSContext *cx, JSExnType type, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, HandleString message, MutableHandleValue rval) { assertSameCompartment(cx, stack, fileName, message); + AssertObjectIsSavedFrameOrWrapper(cx, stack); + js::ScopedJSFreePtr rep; if (report) rep = CopyErrorReport(cx, report); diff --git a/js/src/jsobj.h b/js/src/jsobj.h index cecee582dee..1a7cea12353 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -147,7 +147,7 @@ class JSObject : public js::gc::Cell } /* - * Whether this is the only object which has its specified gbroup. This + * Whether this is the only object which has its specified group. This * object will have its group constructed lazily as needed by analysis. */ bool isSingleton() const { @@ -180,7 +180,7 @@ class JSObject : public js::gc::Cell js::HandleObjectGroup group); // Set the shape of an object. This pointer is valid for native objects and - // some non-native objects. After creating an object, tobjects for which + // some non-native objects. After creating an object, the objects for which // the shape pointer is invalid need to overwrite this pointer before a GC // can occur. inline void setInitialShapeMaybeNonNative(js::Shape *shape); diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index d232f5b3885..b6038185641 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -2560,7 +2560,10 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) RootedValue init(cx), test(cx), update(cx); - return forInit(head->pn_kid1, &init) && + return forInit(head->pn_kid1 && !head->pn_kid1->isKind(PNK_FRESHENBLOCK) + ? head->pn_kid1 + : nullptr, + &init) && optExpression(head->pn_kid2, &test) && optExpression(head->pn_kid3, &update) && builder.forStatement(init, test, update, stmt, &pn->pn_pos, dst); diff --git a/js/src/tests/ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js b/js/src/tests/ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js new file mode 100644 index 00000000000..ba918d520fa --- /dev/null +++ b/js/src/tests/ecma_6/LexicalEnvironment/const-declaration-in-for-loop.js @@ -0,0 +1,104 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +var gTestfile = "const-declaration-in-for-loop.js"; +//----------------------------------------------------------------------------- +var BUGNUMBER = 1146644; +var summary = + "Don't crash compiling a non-body-level for-loop whose loop declaration is " + + "a const"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +// Don't attempt execution as a script if we can't properly emulate it. We +// could perhaps use eval, but eval, while also doing global execution, is its +// own can of messiness. Ongoing work on for-loop scoping for lexical +// declarations will likely make these tests redundant with other tests to be +// added, anyway, in the very short term. +var executeGlobalScript = typeof evaluate === "function" + ? evaluate + : function(s) {}; + +for (const a1 = 3; false; ) + continue; + +Function(`for (const a2 = 3; false; ) + continue; + `)(); + +if (true) +{ + for (const a3 = 3; false; ) + continue; +} + +Function(`if (true) + { + for (const a4 = 3; false; ) + continue; + }`)(); + +// We don't support for (const ... in ...) or for (const ... of ...) yet. When +// we do, these all should start passing without throwing a syntax error, and +// we can remove the try/catch here, and the ultimate throw-canary forcing this +// test to be updated. +try +{ + +executeGlobalScript(`for (const a5 of []) + continue;`); + +Function(`for (const a6 of []) + continue;`)(); + +executeGlobalScript(`if (true) + { + for (const a7 of []) + continue; + }`); + +Function(`if (true) + { + for (const a8 of []) + continue; + }`)(); + +executeGlobalScript(`for (const a9 in {}) + continue;`); + +Function(`for (const a10 in {}) + continue;`)(); + +executeGlobalScript(`if (true) + { + for (const a11 in {}) + continue; + }`); + +Function(`if (true) + { + for (const a12 in {}) + continue; + }`)(); + +throw new Error("Congratulations on making for (const … in/of …) work! " + + "Please remove the try/catch and this throw."); +} +catch (e) +{ + assertEq(e instanceof SyntaxError, true, + "unexpected error: expected SyntaxError, got " + e); +} + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); diff --git a/js/src/tests/ecma_6/LexicalEnvironment/for-loop.js b/js/src/tests/ecma_6/LexicalEnvironment/for-loop.js new file mode 100644 index 00000000000..db36323488a --- /dev/null +++ b/js/src/tests/ecma_6/LexicalEnvironment/for-loop.js @@ -0,0 +1,128 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +var gTestfile = "for-loop.js"; +//----------------------------------------------------------------------------- +var BUGNUMBER = 985733; +var summary = + "ES6 for-loop semantics for for(;;) loops whose heads contain lexical " + "declarations"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +function isError(code, type) +{ + try + { + Function(code); + throw new Error("didn't throw"); + } + catch (e) + { + assertEq(e instanceof type, true, + "unexpected error for `" + code + "`: got " + e); + } +} + +function isOK(code) +{ + Function(code); +} + +isError("for (const x; ; ) ;", SyntaxError); +isError("for (const x = 5, y; ; ) ;", SyntaxError); +isError("for (const [z]; ; ) ;", SyntaxError); +//isError("for (const [z, z]; ; ) ;", SyntaxError); +//isError("for (const [z, z] = [0, 1]; ; ) ;", SyntaxError); + +isOK("for (let x; ; ) ;"); +isOK("for (let x = 5, y; ; ) ;"); + +// I'm fairly sure this is supposed to work: the negative-lookahead rules in +// IterationStatement ensure that |for (let| *always* is a loop header starting +// with a lexical declaration. But I'm not 100% certain, so these tests might +// need to be fixed when we implement the negative-lookahead restrictions. +isOK("for (let [z] = [3]; ; ) ;"); +isError("for (let [z, z]; ; ) ;", SyntaxError); // because missing initializer + +// This is wrong! Per 13.2.1.1, "It is a Syntax Error if the BoundNames of +// BindingList contains any duplicate entries." But we don't implement this +// yet, so it becomes a TypeError at runtime. +isError("for (let [z, z] = [0, 1]; ; ) ;", TypeError); + +// A for-loop with lexical declarations, with a mixture of bindings that are and +// aren't aliased. (The mixture stress-tests any code that incorrectly assumes +// all bindings are aliased.) +var funcs = []; +for (let [i, j, k] = [0, 1, 2]; i < 10; i++) + funcs.push(() => i); + +assertEq(funcs[0](), 0); +assertEq(funcs[1](), 1); +assertEq(funcs[2](), 2); +assertEq(funcs[3](), 3); +assertEq(funcs[4](), 4); +assertEq(funcs[5](), 5); +assertEq(funcs[6](), 6); +assertEq(funcs[7](), 7); +assertEq(funcs[8](), 8); +assertEq(funcs[9](), 9); + +var outer = "OUTER V IGNORE"; +var save; +for (let outer = (save = function() { return outer; }); ; ) + break; +assertEq(save(), "OUTER V IGNORE", + "this is actually a bug: fix for(;;) loops to evaluate init RHSes " + + "in the block scope containing all the LHS bindings!"); + + + +var funcs = []; +function t(i, name, expect) +{ + assertEq(funcs[i].name, name); + assertEq(funcs[i](), expect); +} + +if (save() !== "OUTER V IGNORE") +{ + var v = "OUTER V IGNORE"; + var i = 0; + for (let v = (funcs.push(function init() { return v; }), + 0); + v = (funcs.push(function test() { return v; }), + v + 1); + v = (funcs.push(function incr() { return v; }), + v + 1)) + { + v = (funcs.push(function body() { return v; }), + v + 1); + i++; + if (i >= 3) + break; + } + t(0, "init", 2); + t(1, "test", 2); + t(2, "body", 2); + t(3, "incr", 5); + t(4, "test", 5); + t(5, "body", 5); + t(6, "incr", 8); + t(7, "test", 8); + t(8, "body", 8); + assertEq(funcs.length, 9); +} + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); diff --git a/js/src/tests/ecma_7/SIMD/splat.js b/js/src/tests/ecma_7/SIMD/splat.js index 730e0420623..dd3c3fbd084 100644 --- a/js/src/tests/ecma_7/SIMD/splat.js +++ b/js/src/tests/ecma_7/SIMD/splat.js @@ -23,12 +23,15 @@ function test() { var bad = {valueOf: () => { throw new TestError(); }}; TestSplatX4('int32x4', [0, undefined, 3.5, 42, -1337, INT32_MAX, INT32_MAX + 1, good], (x) => x | 0); + assertEqX4(SIMD.int32x4.splat(), [0, 0, 0, 0]); assertThrowsInstanceOf(() => SIMD.int32x4.splat(bad), TestError); TestSplatX4('float32x4', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => Math.fround(x)); + assertEqX4(SIMD.float32x4.splat(), [NaN, NaN, NaN, NaN]); assertThrowsInstanceOf(() => SIMD.float32x4.splat(bad), TestError); TestSplatX2('float64x2', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => +x); + assertEqX4(SIMD.float64x2.splat(), [NaN, NaN]); assertThrowsInstanceOf(() => SIMD.float64x2.splat(bad), TestError); if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_7/SIMD/with.js b/js/src/tests/ecma_7/SIMD/with.js index 4316e9f96a2..b9f53adc30e 100644 --- a/js/src/tests/ecma_7/SIMD/with.js +++ b/js/src/tests/ecma_7/SIMD/with.js @@ -58,6 +58,7 @@ function test() { testType('float32x4', float32x4inputs); var v = float32x4inputs[1][0]; + assertEqX4(float32x4.withX(v), withX(simdToArray(v), NaN)); assertEqX4(float32x4.withX(v, good), withX(simdToArray(v), good | 0)); assertThrowsInstanceOf(() => float32x4.withX(v, bad), TestError); @@ -69,6 +70,7 @@ function test() { testType('float64x2', float64x2inputs); var v = float64x2inputs[1][0]; + assertEqX4(float64x2.withX(v), withX(simdToArray(v), NaN)); assertEqX4(float64x2.withX(v, good), withX(simdToArray(v), good | 0)); assertThrowsInstanceOf(() => float64x2.withX(v, bad), TestError); @@ -79,6 +81,7 @@ function test() { testType('int32x4', int32x4inputs); var v = int32x4inputs[1][0]; + assertEqX4(int32x4.withX(v), withX(simdToArray(v), 0)); assertEqX4(int32x4.withX(v, good), withX(simdToArray(v), good | 0)); assertThrowsInstanceOf(() => int32x4.withX(v, bad), TestError); diff --git a/js/src/vm/ErrorObject-inl.h b/js/src/vm/ErrorObject-inl.h index f23882d7a3c..d919d96f895 100644 --- a/js/src/vm/ErrorObject-inl.h +++ b/js/src/vm/ErrorObject-inl.h @@ -32,13 +32,10 @@ js::ErrorObject::columnNumber() const return slot.isInt32() ? slot.toInt32() : 0; } -inline JSString * -js::ErrorObject::stack(JSContext *cx) const +inline JSObject * +js::ErrorObject::stack() const { - const HeapSlot &slot = getReservedSlotRef(STACK_SLOT); - if (slot.isString()) - return slot.toString(); - return cx->names().empty; + return getReservedSlotRef(STACK_SLOT).toObjectOrNull(); } #endif /* vm_ErrorObject_inl_h */ diff --git a/js/src/vm/ErrorObject.cpp b/js/src/vm/ErrorObject.cpp index be5ab9895bb..bee7b2bb9de 100644 --- a/js/src/vm/ErrorObject.cpp +++ b/js/src/vm/ErrorObject.cpp @@ -9,11 +9,13 @@ #include "jsexn.h" +#include "js/CallArgs.h" #include "vm/GlobalObject.h" #include "jsobjinlines.h" #include "vm/NativeObject-inl.h" +#include "vm/SavedStacks-inl.h" #include "vm/Shape-inl.h" using namespace js; @@ -27,17 +29,18 @@ js::ErrorObject::assignInitialShape(ExclusiveContext *cx, Handle o return nullptr; if (!obj->addDataProperty(cx, cx->names().lineNumber, LINENUMBER_SLOT, 0)) return nullptr; - if (!obj->addDataProperty(cx, cx->names().columnNumber, COLUMNNUMBER_SLOT, 0)) - return nullptr; - return obj->addDataProperty(cx, cx->names().stack, STACK_SLOT, 0); + return obj->addDataProperty(cx, cx->names().columnNumber, COLUMNNUMBER_SLOT, 0); } /* static */ bool js::ErrorObject::init(JSContext *cx, Handle obj, JSExnType type, ScopedJSFreePtr *errorReport, HandleString fileName, - HandleString stack, uint32_t lineNumber, uint32_t columnNumber, + HandleObject stack, uint32_t lineNumber, uint32_t columnNumber, HandleString message) { + AssertObjectIsSavedFrameOrWrapper(cx, stack); + assertSameCompartment(cx, obj, stack); + // Null out early in case of error, for exn_finalize's sake. obj->initReservedSlot(ERROR_REPORT_SLOT, PrivateValue(nullptr)); @@ -60,7 +63,6 @@ js::ErrorObject::init(JSContext *cx, Handle obj, JSExnType type, MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().lineNumber))->slot() == LINENUMBER_SLOT); MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().columnNumber))->slot() == COLUMNNUMBER_SLOT); - MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().stack))->slot() == STACK_SLOT); MOZ_ASSERT_IF(message, obj->lookupPure(NameToId(cx->names().message))->slot() == MESSAGE_SLOT); @@ -68,11 +70,11 @@ js::ErrorObject::init(JSContext *cx, Handle obj, JSExnType type, JSErrorReport *report = errorReport ? errorReport->forget() : nullptr; obj->initReservedSlot(EXNTYPE_SLOT, Int32Value(type)); + obj->initReservedSlot(STACK_SLOT, ObjectOrNullValue(stack)); obj->setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(report)); obj->initReservedSlot(FILENAME_SLOT, StringValue(fileName)); obj->initReservedSlot(LINENUMBER_SLOT, Int32Value(lineNumber)); obj->initReservedSlot(COLUMNNUMBER_SLOT, Int32Value(columnNumber)); - obj->initReservedSlot(STACK_SLOT, StringValue(stack)); if (message) obj->setSlotWithType(cx, messageShape, StringValue(message)); @@ -80,10 +82,12 @@ js::ErrorObject::init(JSContext *cx, Handle obj, JSExnType type, } /* static */ ErrorObject * -js::ErrorObject::create(JSContext *cx, JSExnType errorType, HandleString stack, +js::ErrorObject::create(JSContext *cx, JSExnType errorType, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, ScopedJSFreePtr *report, HandleString message) { + AssertObjectIsSavedFrameOrWrapper(cx, stack); + Rooted proto(cx, GlobalObject::getOrCreateCustomErrorPrototype(cx, cx->global(), errorType)); if (!proto) return nullptr; @@ -149,3 +153,93 @@ js::ErrorObject::getOrCreateErrorReport(JSContext *cx) setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(copy)); return copy; } + +/* static */ bool +js::ErrorObject::checkAndUnwrapThis(JSContext *cx, CallArgs &args, const char *fnName, + MutableHandle error) +{ + const Value &thisValue = args.thisv(); + + if (!thisValue.isObject()) { + JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, + InformalValueTypeName(thisValue)); + return false; + } + + // Walk up the prototype chain until we find the first ErrorObject that has + // the slots we need. This allows us to support the poor-man's subclassing + // of error: Object.create(Error.prototype). + + RootedObject target(cx, CheckedUnwrap(&thisValue.toObject())); + if (!target) { + JS_ReportError(cx, "Permission denied to access object"); + return false; + } + + RootedObject proto(cx); + while (!target->is()) { + if (!GetPrototype(cx, target, &proto)) + return false; + + if (!proto) { + // We walked the whole prototype chain and did not find an Error + // object. + JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, + js_Error_str, fnName, thisValue.toObject().getClass()->name); + return false; + } + + target = CheckedUnwrap(proto); + if (!target) { + JS_ReportError(cx, "Permission denied to access object"); + return false; + } + } + + error.set(&target->as()); + return true; +} + +/* static */ bool +js::ErrorObject::getStack(JSContext *cx, unsigned argc, Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + Rooted error(cx); + if (!checkAndUnwrapThis(cx, args, "(get stack)", &error)) + return false; + + RootedObject savedFrameObj(cx, error->stack()); + RootedString stackString(cx); + if (!BuildStackString(cx, savedFrameObj, &stackString)) + return false; + args.rval().setString(stackString); + return true; +} + +static MOZ_ALWAYS_INLINE bool +IsObject(HandleValue v) +{ + return v.isObject(); +} + +/* static */ bool +js::ErrorObject::setStack(JSContext *cx, unsigned argc, Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + // We accept any object here, because of poor-man's subclassing of Error. + return CallNonGenericMethod(cx, args); +} + +/* static */ bool +js::ErrorObject::setStack_impl(JSContext *cx, CallArgs args) +{ + const Value &thisValue = args.thisv(); + MOZ_ASSERT(thisValue.isObject()); + RootedObject thisObj(cx, &thisValue.toObject()); + + if (!args.requireAtLeast(cx, "(set stack)", 1)) + return false; + RootedValue val(cx, args[0]); + + return DefineProperty(cx, thisObj, cx->names().stack, val); +} diff --git a/js/src/vm/ErrorObject.h b/js/src/vm/ErrorObject.h index b0a340ce7b5..7786d4c5dc2 100644 --- a/js/src/vm/ErrorObject.h +++ b/js/src/vm/ErrorObject.h @@ -10,6 +10,7 @@ #include "mozilla/ArrayUtils.h" #include "vm/NativeObject.h" +#include "vm/SavedStacks.h" #include "vm/Shape.h" struct JSExnPrivate; @@ -36,17 +37,20 @@ class ErrorObject : public NativeObject static bool init(JSContext *cx, Handle obj, JSExnType type, - ScopedJSFreePtr *errorReport, HandleString fileName, HandleString stack, + ScopedJSFreePtr *errorReport, HandleString fileName, HandleObject stack, uint32_t lineNumber, uint32_t columnNumber, HandleString message); + static bool checkAndUnwrapThis(JSContext *cx, CallArgs &args, const char *fnName, + MutableHandle error); + protected: - static const uint32_t EXNTYPE_SLOT = 0; - static const uint32_t ERROR_REPORT_SLOT = EXNTYPE_SLOT + 1; - static const uint32_t FILENAME_SLOT = ERROR_REPORT_SLOT + 1; - static const uint32_t LINENUMBER_SLOT = FILENAME_SLOT + 1; - static const uint32_t COLUMNNUMBER_SLOT = LINENUMBER_SLOT + 1; - static const uint32_t STACK_SLOT = COLUMNNUMBER_SLOT + 1; - static const uint32_t MESSAGE_SLOT = STACK_SLOT + 1; + static const uint32_t EXNTYPE_SLOT = 0; + static const uint32_t STACK_SLOT = EXNTYPE_SLOT + 1; + static const uint32_t ERROR_REPORT_SLOT = STACK_SLOT + 1; + static const uint32_t FILENAME_SLOT = ERROR_REPORT_SLOT + 1; + static const uint32_t LINENUMBER_SLOT = FILENAME_SLOT + 1; + static const uint32_t COLUMNNUMBER_SLOT = LINENUMBER_SLOT + 1; + static const uint32_t MESSAGE_SLOT = COLUMNNUMBER_SLOT + 1; static const uint32_t RESERVED_SLOTS = MESSAGE_SLOT + 1; @@ -68,7 +72,7 @@ class ErrorObject : public NativeObject // property with that value; otherwise the error will have no .message // property. static ErrorObject * - create(JSContext *cx, JSExnType type, HandleString stack, HandleString fileName, + create(JSContext *cx, JSExnType type, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, ScopedJSFreePtr *report, HandleString message); @@ -96,12 +100,17 @@ class ErrorObject : public NativeObject inline JSString * fileName(JSContext *cx) const; inline uint32_t lineNumber() const; inline uint32_t columnNumber() const; - inline JSString * stack(JSContext *cx) const; + inline JSObject * stack() const; JSString * getMessage() const { const HeapSlot &slot = getReservedSlotRef(MESSAGE_SLOT); return slot.isString() ? slot.toString() : nullptr; } + + // Getter and setter for the Error.prototype.stack accessor. + static bool getStack(JSContext *cx, unsigned argc, Value *vp); + static bool setStack(JSContext *cx, unsigned argc, Value *vp); + static bool setStack_impl(JSContext *cx, CallArgs args); }; } // namespace js diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index c0c7b928b78..0ad1ef419fb 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -1681,7 +1681,6 @@ CASE(JSOP_UNUSED189) CASE(JSOP_UNUSED190) CASE(JSOP_UNUSED191) CASE(JSOP_UNUSED192) -CASE(JSOP_UNUSED196) CASE(JSOP_UNUSED209) CASE(JSOP_UNUSED210) CASE(JSOP_UNUSED211) @@ -3440,6 +3439,13 @@ CASE(JSOP_DEBUGLEAVEBLOCK) } END_CASE(JSOP_DEBUGLEAVEBLOCK) +CASE(JSOP_FRESHENBLOCKSCOPE) +{ + if (!REGS.fp()->freshenBlock(cx)) + goto error; +} +END_CASE(JSOP_FRESHENBLOCKSCOPE) + CASE(JSOP_GENERATOR) { MOZ_ASSERT(!cx->isExceptionPending()); diff --git a/js/src/vm/Opcodes.h b/js/src/vm/Opcodes.h index 94e707a1292..c88d85caf54 100644 --- a/js/src/vm/Opcodes.h +++ b/js/src/vm/Opcodes.h @@ -1649,8 +1649,6 @@ */ \ macro(JSOP_GETXPROP, 195,"getxprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET) \ \ - macro(JSOP_UNUSED196, 196,"unused196", NULL, 1, 0, 0, JOF_BYTE) \ - \ /* * Pops the top stack value as 'val' and pushes 'typeof val'. Note that * this opcode isn't used when, in the original source code, 'val' is a @@ -1661,9 +1659,21 @@ * Operands: * Stack: val => (typeof val) */ \ - macro(JSOP_TYPEOFEXPR, 197,"typeofexpr", NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ + macro(JSOP_TYPEOFEXPR, 196,"typeofexpr", NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ \ /* Block-local scope support. */ \ + /* + * Replaces the current block on the scope chain with a fresh block + * that copies all the bindings in the bock. This operation implements the + * behavior of inducing a fresh block scope for every iteration of a + * for(let ...; ...; ...) loop, if any declarations induced by such a loop + * are captured within the loop. + * Category: Variables and Scopes + * Type: Block-local Scope + * Operands: + * Stack: => + */ \ + macro(JSOP_FRESHENBLOCKSCOPE,197,"freshenblockscope", NULL, 1, 0, 0, JOF_BYTE) \ /* * Pushes block onto the scope chain. * Category: Variables and Scopes diff --git a/js/src/vm/SavedStacks-inl.h b/js/src/vm/SavedStacks-inl.h new file mode 100644 index 00000000000..c3dadeca5f6 --- /dev/null +++ b/js/src/vm/SavedStacks-inl.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * 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 vm_SavedStacksInl_h +#define vm_SavedStacksInl_h + +#include "vm/SavedStacks.h" + +// Assert that if the given object is not null, it's Class is the +// SavedFrame::class_ or the given object is a cross-compartment or Xray wrapper +// around such an object. +// +// We allow wrappers here because the JSAPI functions for working with +// SavedFrame objects and the SavedFrame accessors themselves handle wrappers +// and use the original caller's compartment's principals to determine what +// level of data to present. Unwrapping and entering the referent's compartment +// would mess that up. See the module level documentation in +// `js/src/vm/SavedStacks.h` as well as the comments in `js/src/jsapi.h`. +inline void +js::AssertObjectIsSavedFrameOrWrapper(JSContext *cx, HandleObject stack) +{ +#ifdef DEBUG + if (stack) { + RootedObject savedFrameObj(cx, CheckedUnwrap(stack)); + MOZ_ASSERT(savedFrameObj); + MOZ_ASSERT(js::SavedFrame::isSavedFrameAndNotProto(*savedFrameObj)); + } +#endif +} + +#endif // vm_SavedStacksInl_h diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index 2f08e8fad9f..c1283818d33 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -631,7 +631,7 @@ GetSavedFrameParent(JSContext *cx, HandleObject savedFrame, MutableHandleObject } JS_PUBLIC_API(bool) -StringifySavedFrameStack(JSContext *cx, HandleObject stack, MutableHandleString stringp) +BuildStackString(JSContext *cx, HandleObject stack, MutableHandleString stringp) { js::StringBuffer sb(cx); @@ -779,7 +779,7 @@ SavedFrame::toStringMethod(JSContext *cx, unsigned argc, Value *vp) { THIS_SAVEDFRAME(cx, argc, vp, "toString", args, frame); RootedString string(cx); - if (!JS::StringifySavedFrameStack(cx, frame, &string)) + if (!JS::BuildStackString(cx, frame, &string)) return false; args.rval().setString(string); return true; @@ -800,6 +800,11 @@ SavedStacks::saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame, unsi MOZ_ASSERT(initialized()); assertSameCompartment(cx, this); + if (creatingSavedFrame) { + frame.set(nullptr); + return true; + } + FrameIter iter(cx, FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED); return insertFrames(cx, iter, frame, maxFrameCount); } @@ -920,8 +925,10 @@ SavedStacks::insertFrames(JSContext *cx, FrameIter &iter, MutableHandleSavedFram // Use growByUninitialized and placement-new instead of just append. // We'd ideally like to use an emplace method once Vector supports it. - if (!stackChain->growByUninitialized(1)) + if (!stackChain->growByUninitialized(1)) { + ReportOutOfMemory(cx); return false; + } new (&stackChain->back()) SavedFrame::Lookup( location->source, location->line, @@ -992,8 +999,10 @@ SavedStacks::adoptAsyncStack(JSContext *cx, HandleSavedFrame asyncStack, for (unsigned i = 0; i < maxFrameCount && currentSavedFrame; i++) { // Use growByUninitialized and placement-new instead of just append. // We'd ideally like to use an emplace method once Vector supports it. - if (!stackChain->growByUninitialized(1)) + if (!stackChain->growByUninitialized(1)) { + ReportOutOfMemory(cx); return false; + } new (&stackChain->back()) SavedFrame::Lookup(*currentSavedFrame); // Attach the asyncCause to the youngest frame. @@ -1030,8 +1039,10 @@ SavedStacks::getOrCreateSavedFrame(JSContext *cx, SavedFrame::HandleLookup looku if (!frame) return nullptr; - if (!p.add(cx, frames, lookupInstance, frame)) + if (!p.add(cx, frames, lookupInstance, frame)) { + ReportOutOfMemory(cx); return nullptr; + } return frame; } @@ -1042,6 +1053,11 @@ SavedStacks::createFrameFromLookup(JSContext *cx, SavedFrame::HandleLookup looku RootedGlobalObject global(cx, cx->global()); assertSameCompartment(cx, global); + // Ensure that we don't try to capture the stack again in the + // `SavedStacksMetadataCallback` for this new SavedFrame object, and + // accidentally cause O(n^2) behavior. + SavedStacks::AutoReentrancyGuard guard(*this); + RootedNativeObject proto(cx, GlobalObject::getOrCreateSavedFramePrototype(cx, global)); if (!proto) return nullptr; @@ -1103,6 +1119,10 @@ SavedStacks::getLocation(JSContext *cx, const FrameIter &iter, MutableHandleLoca return false; locationp->line = iter.computeLine(&locationp->column); + // XXX: Make the column 1-based as in other browsers, instead of 0-based + // which is how SpiderMonkey stores it internally. This will be + // unnecessary once bug 1144340 is fixed. + locationp->column++; return true; } @@ -1126,9 +1146,12 @@ SavedStacks::getLocation(JSContext *cx, const FrameIter &iter, MutableHandleLoca uint32_t column; uint32_t line = PCToLineNumber(script, pc, &column); - LocationValue value(source, line, column); - if (!pcLocationMap.add(p, key, value)) + // Make the column 1-based. See comment above. + LocationValue value(source, line, column + 1); + if (!pcLocationMap.add(p, key, value)) { + ReportOutOfMemory(cx); return false; + } } locationp.set(p->value()); diff --git a/js/src/vm/SavedStacks.h b/js/src/vm/SavedStacks.h index 2964d28cda5..91ed7bd30b2 100644 --- a/js/src/vm/SavedStacks.h +++ b/js/src/vm/SavedStacks.h @@ -9,9 +9,140 @@ #include "jscntxt.h" #include "jsmath.h" +#include "jswrapper.h" #include "js/HashTable.h" #include "vm/Stack.h" +// # Saved Stacks +// +// The `SavedStacks` class provides a compact way to capture and save JS stacks +// as `SavedFrame` `JSObject` subclasses. A single `SavedFrame` object +// represents one frame that was on the stack, and has a strong reference to its +// parent `SavedFrame` (the next youngest frame). This reference is null when +// the `SavedFrame` object is the oldest frame that was on the stack. +// +// This comment documents implementation. For usage documentation, see the +// `js/src/doc/SavedFrame/SavedFrame.md` file and relevant `SavedFrame` +// functions in `js/src/jsapi.h`. +// +// ## Compact +// +// Older saved stack frame tails are shared via hash consing, to deduplicate +// structurally identical data. `SavedStacks` contains a hash table of weakly +// held `SavedFrame` objects, and when the owning compartment is swept, it +// removes entries from this table that aren't held alive in any other way. When +// saving new stacks, we use this table to find pre-existing `SavedFrame` +// objects. If such an object is already extant, it is reused; otherwise a new +// `SavedFrame` is allocated and inserted into the table. +// +// Naive | Hash Consing +// --------------+------------------ +// c -> b -> a | c -> b -> a +// | ^ +// d -> b -> a | d ---| +// | | +// e -> b -> a | e ---' +// +// This technique is effective because of the nature of the events that trigger +// capturing the stack. Currently, these events consist primarily of `JSObject` +// allocation (when an observing `Debugger` has such tracking), `Promise` +// settlement, and `Error` object creation. While these events may occur many +// times, they tend to occur only at a few locations in the JS source. For +// example, if we enable Object allocation tracking and run the esprima +// JavaScript parser on its own JavaScript source, there are approximately 54700 +// total `Object` allocations, but just ~1400 unique JS stacks at allocation +// time. There's only ~200 allocation sites if we capture only the youngest +// stack frame. +// +// ## Security and Wrappers +// +// We save every frame on the stack, regardless of whether the `SavedStack`'s +// compartment's principals subsume the frame's compartment's principals or +// not. This gives us maximum flexibility down the line when accessing and +// presenting captured stacks, but at the price of some complication involved in +// preventing the leakage of privileged stack frames to unprivileged callers. +// +// When a `SavedFrame` method or accessor is called, we compare the caller's +// compartment's principals to each `SavedFrame`'s captured principals. We avoid +// using the usual `CallNonGenericMethod` and `nativeCall` machinery which +// enters the `SavedFrame` object's compartment before we can check these +// principals, because we need access to the original caller's compartment's +// principals (unlike other `CallNonGenericMethod` users) to determine what view +// of the stack to present. Instead, we take a similar approach to that used by +// DOM methods, and manually unwrap wrappers until we get the underlying +// `SavedFrame` object, find the first `SavedFrame` in its stack whose captured +// principals are subsumed by the caller's principals, access the reserved slots +// we care about, and then rewrap return values as necessary. +// +// Consider the following diagram: +// +//                                     Content Compartment +//                                    +---------------------------------------+ +//                                    |              | +//                                    |           +------------------------+  | +//      Chrome Compartment            |           |                        |  | +//    +--------------------+          |           | SavedFrame C (content) |  | +//    |                    |          |           |                        |  | +//    |                  +--------------+         +------------------------+ | +//    |                  |              |                    ^                | +//    |     var x -----> | Xray Wrapper |-----.              |                | +//    |                  |              |     |              |                | +//    |                  +--------------+     |   +------------------------+  | +//    |                    |          |       |   |                        |  | +//    |                  +--------------+     |   | SavedFrame B (content) |  | +//    |                  |              |     |   |                        |  | +//    |     var y -----> | CCW (waived) |--.  |   +------------------------+  | +//    |                  |              |  |  |              ^               | +//    |                  +--------------+  |  |              |               | +//    |                    |          |    |  |              |                | +//    +--------------------+          |    |  |   +------------------------+  | +//                                    |    |  '-> |                        |  | +//                                    |    |      | SavedFrame A (chrome)  |  | +//                                    |    '----> |                        |  | +//                                    |           +------------------------+  | +//                                    |                      ^                | +//                                    |                      |                | +//                                    |           var z -----'                | +//                                    |                                       | +//                                    +---------------------------------------+ +// +// CCW is a plain cross-compartment wrapper, yielded by waiving Xray vision. A +// is the youngest `SavedFrame` and represents a frame that was from the chrome +// compartment, while B and C are from frames from the content compartment. C is +// the oldest frame. +// +// Note that it is always safe to waive an Xray around a SavedFrame object, +// because SavedFrame objects and the SavedFrame prototype are always frozen you +// will never run untrusted code. +// +// Depending on who the caller is, the view of the stack will be different, and +// is summarized in the table below. +// +// Var | View +// -----+------------ +// x | A -> B -> C +// y, z | B -> C +// +// In the case of x, the `SavedFrame` accessors are called with an Xray wrapper +// around the `SavedFrame` object as the `this` value, and the chrome +// compartment as the cx's current principals. Because the chrome compartment's +// principals subsume both itself and the content compartment's principals, x +// has the complete view of the stack. +// +// In the case of y, the cross-compartment machinery automatically enters the +// content compartment, and calls the `SavedFrame` accessors with the wrapped +// `SavedFrame` object as the `this` value. Because the cx's current compartment +// is the content compartment, and the content compartment's principals do not +// subsume the chrome compartment's principals, it can only see the B and C +// frames. +// +// In the case of z, the `SavedFrame` accessors are called with the `SavedFrame` +// object in the `this` value, and the content compartment as the cx's current +// compartment. Similar to the case of y, only the B and C frames are exposed +// because the cx's current compartment's principals do not subsume A's captured +// principals. + + namespace js { class SavedFrame; @@ -124,6 +255,10 @@ struct SavedFrame::HashPolicy static void rekey(Key &key, const Key &newKey); }; +// Assert that if the given object is not null, that it must be either a +// SavedFrame object or wrapper (Xray or CCW) around a SavedFrame object. +inline void AssertObjectIsSavedFrameOrWrapper(JSContext *cx, HandleObject stack); + class SavedStacks { friend JSObject *SavedStacksMetadataCallback(JSContext *cx); @@ -132,7 +267,8 @@ class SavedStacks { : frames(), allocationSamplingProbability(1.0), allocationSkipCount(0), - rngState(0) + rngState(0), + creatingSavedFrame(false) { } bool init(); @@ -147,10 +283,31 @@ class SavedStacks { size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf); private: - SavedFrame::Set frames; - double allocationSamplingProbability; - uint32_t allocationSkipCount; - uint64_t rngState; + SavedFrame::Set frames; + double allocationSamplingProbability; + uint32_t allocationSkipCount; + uint64_t rngState; + bool creatingSavedFrame; + + // Similar to mozilla::ReentrancyGuard, but instead of asserting against + // reentrancy, just change the behavior of SavedStacks::saveCurrentStack to + // return a nullptr SavedFrame. + struct MOZ_STACK_CLASS AutoReentrancyGuard { + MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; + SavedStacks &stacks; + + explicit AutoReentrancyGuard(SavedStacks &stacks MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : stacks(stacks) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + stacks.creatingSavedFrame = true; + } + + ~AutoReentrancyGuard() + { + stacks.creatingSavedFrame = false; + } + }; bool insertFrames(JSContext *cx, FrameIter &iter, MutableHandleSavedFrame frame, unsigned maxFrameCount = 0); diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 089d20caeb4..6ef12041809 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -660,6 +660,35 @@ ClonedBlockObject::copyUnaliasedValues(AbstractFramePtr frame) } } +/* static */ ClonedBlockObject * +ClonedBlockObject::clone(ExclusiveContext *cx, Handle block) +{ + RootedObject enclosing(cx, &block->enclosingScope()); + + MOZ_ASSERT(block->getClass() == &BlockObject::class_); + + RootedObjectGroup cloneGroup(cx, block->group()); + RootedShape cloneShape(cx, block->lastProperty()); + + JSObject *obj = JSObject::create(cx, FINALIZE_KIND, gc::TenuredHeap, cloneShape, cloneGroup); + if (!obj) + return nullptr; + + ClonedBlockObject © = obj->as(); + + MOZ_ASSERT(!copy.inDictionaryMode()); + MOZ_ASSERT(copy.isDelegate()); + MOZ_ASSERT(block->slotSpan() == copy.slotSpan()); + MOZ_ASSERT(copy.slotSpan() >= copy.numVariables() + RESERVED_SLOTS); + + copy.setReservedSlot(SCOPE_CHAIN_SLOT, block->getReservedSlot(SCOPE_CHAIN_SLOT)); + + for (uint32_t i = 0, count = copy.numVariables(); i < count; i++) + copy.setVar(i, block->var(i, DONT_CHECK_ALIASING), DONT_CHECK_ALIASING); + + return © +} + StaticBlockObject * StaticBlockObject::create(ExclusiveContext *cx) { diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index f4866b4f60c..dae35a207b5 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -669,6 +669,12 @@ class ClonedBlockObject : public BlockObject /* Copy in all the unaliased formals and locals. */ void copyUnaliasedValues(AbstractFramePtr frame); + + /* + * Create a new ClonedBlockObject with the same enclosing scope and + * variable values as this. + */ + static ClonedBlockObject *clone(ExclusiveContext *cx, Handle block); }; // Internal scope object used by JSOP_BINDNAME upon encountering an diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 97e86820b97..8d496882bc2 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -207,6 +207,14 @@ InterpreterFrame::popOffScopeChain() scopeChain_ = &scopeChain_->as().enclosingScope(); } +inline void +InterpreterFrame::replaceInnermostScope(ScopeObject &scope) +{ + MOZ_ASSERT(flags_ & HAS_SCOPECHAIN); + MOZ_ASSERT(scope.enclosingScope() == scopeChain_->as().enclosingScope()); + scopeChain_ = &scope; +} + bool InterpreterFrame::hasCallObj() const { @@ -799,6 +807,14 @@ AbstractFramePtr::thisValue() const return asRematerializedFrame()->thisValue(); } +inline bool +AbstractFramePtr::freshenBlock(JSContext *cx) const +{ + if (isInterpreterFrame()) + return asInterpreterFrame()->freshenBlock(cx); + return asBaselineFrame()->freshenBlock(cx); +} + inline void AbstractFramePtr::popBlock(JSContext *cx) const { diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index 8f7fb194d96..8e93daeeac4 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -293,6 +293,19 @@ InterpreterFrame::pushBlock(JSContext *cx, StaticBlockObject &block) return true; } +bool +InterpreterFrame::freshenBlock(JSContext *cx) +{ + MOZ_ASSERT(flags_ & HAS_SCOPECHAIN); + Rooted block(cx, &scopeChain_->as()); + ClonedBlockObject *fresh = ClonedBlockObject::clone(cx, block); + if (!fresh) + return false; + + replaceInnermostScope(*fresh); + return true; +} + void InterpreterFrame::popBlock(JSContext *cx) { diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 88ba5f12f1c..072adefd255 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -28,6 +28,7 @@ class AsmJSModule; class InterpreterRegs; class CallObject; class ScopeObject; +class ClonedBlockObject; class ScriptFrameIter; class SPSProfiler; class InterpreterFrame; @@ -234,6 +235,8 @@ class AbstractFramePtr bool hasPushedSPSFrame() const; + inline bool freshenBlock(JSContext *cx) const; + inline void popBlock(JSContext *cx) const; inline void popWith(JSContext *cx) const; @@ -587,14 +590,18 @@ class InterpreterFrame inline void pushOnScopeChain(ScopeObject &scope); inline void popOffScopeChain(); + inline void replaceInnermostScope(ScopeObject &scope); /* * For blocks with aliased locals, these interfaces push and pop entries on - * the scope chain. + * the scope chain. The "freshen" operation replaces the current block + * with a fresh copy of it, to implement semantics providing distinct + * bindings per iteration of a for-loop. */ bool pushBlock(JSContext *cx, StaticBlockObject &block); void popBlock(JSContext *cx); + bool freshenBlock(JSContext *cx); /* * With diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 72ee5aecf4e..29e836e1b1b 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -2409,10 +2409,10 @@ private: // interface on the single underlying (possibly aggregate) JSObject. class nsXPCWrappedJS final : protected nsAutoXPTCStub, - public nsIXPConnectWrappedJS, - public nsSupportsWeakReference, - public nsIPropertyBag, - public XPCRootSetElem + public nsIXPConnectWrappedJS, + public nsSupportsWeakReference, + public nsIPropertyBag, + public XPCRootSetElem { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/js/xpconnect/tests/chrome/test_xrayToJS.xul b/js/xpconnect/tests/chrome/test_xrayToJS.xul index d521f5fc170..7d0d1450c36 100644 --- a/js/xpconnect/tests/chrome/test_xrayToJS.xul +++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul @@ -559,7 +559,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 // to deal with dependent classes and fixing it up is more trouble than // it's worth. testXray('Error', new iwin.Error('some error message'), new iwin.Error(), - ['fileName', 'lineNumber', 'columnNumber', 'message', 'stack']); + ['fileName', 'lineNumber', 'columnNumber', 'message']); // Make sure that the dependent classes have their prototypes set up correctly. for (let c of errorObjectClasses.filter(x => x != "Error")) { @@ -577,12 +577,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 } testProperty('message', x => x == 'some message', 'some other message', 42); testProperty('fileName', x => /xul/.test(x), 'otherFilename.html', new iwin.Object()); + testProperty('columnNumber', x => x > 5 && x < 100, 99, 99.5); + testProperty('lineNumber', x => x > 100 && x < 10000, 50, 'foo'); + // Note - an Exception newed via Xrays is going to have an empty stack given the // current semantics and implementation. This tests the current behavior, but that // may change in bug 1036527 or similar. - testProperty('stack', x => /^\s*$/.test(x), 'some other stack', new iwin.WeakMap()); - testProperty('columnNumber', x => x > 5 && x < 100, 99, 99.5); - testProperty('lineNumber', x => x > 100 && x < 10000, 50, 'foo'); + // + // Furthermore, xrays should always return an error's original stack, and + // not overwrite it. + var stack = e.stack; + ok(/^\s*$/.test(stack), "stack property should be correct"); + e.wrappedJSObject.stack = "not a stack"; + is(e.stack, stack, "Xrays should never get an overwritten stack property."); } } diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 19db3ba00ad..4cfc23de015 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -399,19 +399,19 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, } } } else if (IsErrorObjectKey(key)) { - // The useful state of error objects is (unfortunately) represented - // as own data properties per-spec. This means that we can't have a - // a clean representation of the data (free from tampering) without - // doubling the slots of Error objects, which isn't great. So we - // forward these properties to the underlying object and then just - // censor any values with the wrong type. This limits the ability - // of content to do anything all that confusing. + // The useful state of error objects (except for .stack) is + // (unfortunately) represented as own data properties per-spec. This + // means that we can't have a a clean representation of the data + // (free from tampering) without doubling the slots of Error + // objects, which isn't great. So we forward these properties to the + // underlying object and then just censor any values with the wrong + // type. This limits the ability of content to do anything all that + // confusing. bool isErrorIntProperty = id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_LINENUMBER) || id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_COLUMNNUMBER); bool isErrorStringProperty = id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_FILENAME) || - id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_STACK) || id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_MESSAGE); if (isErrorIntProperty || isErrorStringProperty) { RootedObject waiver(cx, wrapper); diff --git a/layout/base/SelectionCarets.h b/layout/base/SelectionCarets.h index ec5d851eafd..342b39c36de 100644 --- a/layout/base/SelectionCarets.h +++ b/layout/base/SelectionCarets.h @@ -57,9 +57,9 @@ class Selection; * caret becomes tilt. */ class SelectionCarets final : public nsIReflowObserver, - public nsISelectionListener, - public nsIScrollObserver, - public nsSupportsWeakReference + public nsISelectionListener, + public nsIScrollObserver, + public nsSupportsWeakReference { public: /** diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 69e5c6deb98..fcc16359f75 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -214,12 +214,12 @@ private: //------------------------------------------------------------- class nsDocumentViewer final : public nsIContentViewer, - public nsIContentViewerEdit, - public nsIContentViewerFile, - public nsIDocumentViewerPrint + public nsIContentViewerEdit, + public nsIContentViewerFile, + public nsIDocumentViewerPrint #ifdef NS_PRINTING - , public nsIWebBrowserPrint + , public nsIWebBrowserPrint #endif { diff --git a/layout/base/nsLayoutHistoryState.cpp b/layout/base/nsLayoutHistoryState.cpp index 9fa0c3a3faa..686b2434b6d 100644 --- a/layout/base/nsLayoutHistoryState.cpp +++ b/layout/base/nsLayoutHistoryState.cpp @@ -15,7 +15,7 @@ #include "mozilla/Attributes.h" class nsLayoutHistoryState final : public nsILayoutHistoryState, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: nsLayoutHistoryState() diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 471557c39f3..8cddd190641 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -59,9 +59,10 @@ class EventDispatchingCallback; #define PAINTLOCK_EVENT_DELAY 250 class PresShell final : public nsIPresShell, - public nsStubDocumentObserver, - public nsISelectionController, public nsIObserver, - public nsSupportsWeakReference + public nsStubDocumentObserver, + public nsISelectionController, + public nsIObserver, + public nsSupportsWeakReference { public: PresShell(); diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index e7e08d52bba..e001e7fa381 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -67,7 +67,8 @@ public: }; class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, - public nsARefreshObserver { + public nsARefreshObserver +{ public: explicit nsRefreshDriver(nsPresContext *aPresContext); ~nsRefreshDriver(); diff --git a/layout/forms/nsColorControlFrame.h b/layout/forms/nsColorControlFrame.h index 6d9e6c75512..584491e56c6 100644 --- a/layout/forms/nsColorControlFrame.h +++ b/layout/forms/nsColorControlFrame.h @@ -15,7 +15,7 @@ typedef nsHTMLButtonControlFrame nsColorControlFrameSuper; // Class which implements the input type=color class nsColorControlFrame final : public nsColorControlFrameSuper, - public nsIAnonymousContentCreator + public nsIAnonymousContentCreator { typedef mozilla::dom::Element Element; diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index 2fd92a70b47..e459c178351 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -44,12 +44,12 @@ class DrawTarget; } class nsComboboxControlFrame final : public nsBlockFrame, - public nsIFormControlFrame, - public nsIComboboxControlFrame, - public nsIAnonymousContentCreator, - public nsISelectControlFrame, - public nsIRollupListener, - public nsIStatefulFrame + public nsIFormControlFrame, + public nsIComboboxControlFrame, + public nsIAnonymousContentCreator, + public nsISelectControlFrame, + public nsIRollupListener, + public nsIStatefulFrame { typedef mozilla::gfx::DrawTarget DrawTarget; diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index 93fd0126a18..e83e92a82c0 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -47,9 +47,9 @@ class HTMLOptionsCollection; */ class nsListControlFrame final : public nsHTMLScrollFrame, - public nsIFormControlFrame, - public nsIListControlFrame, - public nsISelectControlFrame + public nsIFormControlFrame, + public nsIListControlFrame, + public nsISelectControlFrame { public: friend nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell, diff --git a/layout/forms/nsNumberControlFrame.h b/layout/forms/nsNumberControlFrame.h index 698890a34e3..c07b2ee9ddf 100644 --- a/layout/forms/nsNumberControlFrame.h +++ b/layout/forms/nsNumberControlFrame.h @@ -27,8 +27,8 @@ class HTMLInputElement; * This frame type is used for . */ class nsNumberControlFrame final : public nsContainerFrame - , public nsIAnonymousContentCreator - , public nsITextControlFrame + , public nsIAnonymousContentCreator + , public nsITextControlFrame { friend nsIFrame* NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 169d17b746b..5f85b149c1a 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -25,9 +25,9 @@ class Element; } class nsTextControlFrame final : public nsContainerFrame, - public nsIAnonymousContentCreator, - public nsITextControlFrame, - public nsIStatefulFrame + public nsIAnonymousContentCreator, + public nsITextControlFrame, + public nsIStatefulFrame { public: NS_DECL_FRAMEARENA_HELPERS diff --git a/layout/generic/ScrollbarActivity.h b/layout/generic/ScrollbarActivity.h index cc8c55bdbf2..b390fefbfcd 100644 --- a/layout/generic/ScrollbarActivity.h +++ b/layout/generic/ScrollbarActivity.h @@ -56,7 +56,8 @@ namespace layout { */ class ScrollbarActivity final : public nsIDOMEventListener, - public nsARefreshObserver { + public nsARefreshObserver +{ public: explicit ScrollbarActivity(nsIScrollbarMediator* aScrollableFrame) : mScrollableFrame(aScrollableFrame) diff --git a/layout/generic/Selection.h b/layout/generic/Selection.h index 5ccbe89e834..e5b1af2eada 100644 --- a/layout/generic/Selection.h +++ b/layout/generic/Selection.h @@ -49,8 +49,8 @@ namespace mozilla { namespace dom { class Selection final : public nsISelectionPrivate, - public nsWrapperCache, - public nsSupportsWeakReference + public nsWrapperCache, + public nsSupportsWeakReference { protected: virtual ~Selection(); diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index 135d39a3d95..b050859b838 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -21,7 +21,7 @@ class imgRequestProxy; class nsBulletFrame; class nsBulletListener final : public imgINotificationObserver, - public imgIOnloadBlocker + public imgIOnloadBlocker { public: nsBulletListener(); diff --git a/layout/generic/nsCanvasFrame.h b/layout/generic/nsCanvasFrame.h index f5edc71022a..96b26e4777a 100644 --- a/layout/generic/nsCanvasFrame.h +++ b/layout/generic/nsCanvasFrame.h @@ -27,8 +27,8 @@ class nsRenderingContext; * frame */ class nsCanvasFrame final : public nsContainerFrame, - public nsIScrollPositionListener, - public nsIAnonymousContentCreator + public nsIScrollPositionListener, + public nsIAnonymousContentCreator { public: explicit nsCanvasFrame(nsStyleContext* aContext) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index b99868df0fb..64d3b37b89e 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -21,6 +21,7 @@ #include #include "mozilla/LinkedList.h" #include "mozilla/FloatingPoint.h" +#include "WritingModes.h" using namespace mozilla; using namespace mozilla::layout; @@ -95,13 +96,6 @@ AxisGrowsInPositiveDirection(AxisOrientationType aAxis) return eAxis_LR == aAxis || eAxis_TB == aAxis; } -// Indicates whether the given axis is horizontal. -static inline bool -IsAxisHorizontal(AxisOrientationType aAxis) -{ - return eAxis_LR == aAxis || eAxis_RL == aAxis; -} - // Given an AxisOrientationType, returns the "reverse" AxisOrientationType // (in the same dimension, but the opposite direction) static inline AxisOrientationType @@ -124,18 +118,6 @@ GetReverseAxis(AxisOrientationType aAxis) return reversedAxis; } -// Returns aFrame's computed value for 'height' or 'width' -- whichever is in -// the same dimension as aAxis. -static inline const nsStyleCoord& -GetSizePropertyForAxis(const nsIFrame* aFrame, AxisOrientationType aAxis) -{ - const nsStylePosition* stylePos = aFrame->StylePosition(); - - return IsAxisHorizontal(aAxis) ? - stylePos->mWidth : - stylePos->mHeight; -} - /** * Converts a "flex-relative" coordinate in a single axis (a main- or cross-axis * coordinate) into a coordinate in the corresponding physical (x or y) axis. If @@ -166,20 +148,24 @@ PhysicalCoordFromFlexRelativeCoord(nscoord aFlexRelativeCoord, // evaluate), these macros will ensure that only the expression for the correct // axis gets evaluated. #define GET_MAIN_COMPONENT(axisTracker_, width_, height_) \ - IsAxisHorizontal((axisTracker_).GetMainAxis()) ? (width_) : (height_) + (axisTracker_).IsMainAxisHorizontal() ? (width_) : (height_) #define GET_CROSS_COMPONENT(axisTracker_, width_, height_) \ - IsAxisHorizontal((axisTracker_).GetCrossAxis()) ? (width_) : (height_) + (axisTracker_).IsCrossAxisHorizontal() ? (width_) : (height_) // Encapsulates our flex container's main & cross axes. class MOZ_STACK_CLASS nsFlexContainerFrame::FlexboxAxisTracker { public: - explicit FlexboxAxisTracker(nsFlexContainerFrame* aFlexContainerFrame); + FlexboxAxisTracker(const nsStylePosition* aStylePosition, + const WritingMode& aWM); // Accessors: AxisOrientationType GetMainAxis() const { return mMainAxis; } AxisOrientationType GetCrossAxis() const { return mCrossAxis; } + bool IsMainAxisHorizontal() const { return IsAxisHorizontal(mMainAxis); } + bool IsCrossAxisHorizontal() const { return IsAxisHorizontal(mCrossAxis); } + nscoord GetMainComponent(const nsSize& aSize) const { return GET_MAIN_COMPONENT(*this, aSize.width, aSize.height); } @@ -195,16 +181,27 @@ public: } nscoord GetMarginSizeInMainAxis(const nsMargin& aMargin) const { - return IsAxisHorizontal(mMainAxis) ? + return IsMainAxisHorizontal() ? aMargin.LeftRight() : aMargin.TopBottom(); } nscoord GetMarginSizeInCrossAxis(const nsMargin& aMargin) const { - return IsAxisHorizontal(mCrossAxis) ? + return IsCrossAxisHorizontal() ? aMargin.LeftRight() : aMargin.TopBottom(); } + // Returns aFrame's computed value for 'height' or 'width' -- whichever is in + // the cross-axis. (NOTE: This is cross-axis-specific for now. If we need a + // main-axis version as well, we could generalize or clone this function.) + const nsStyleCoord& ComputedCrossSize(const nsIFrame* aFrame) const { + const nsStylePosition* stylePos = aFrame->StylePosition(); + + return IsCrossAxisHorizontal() ? + stylePos->mWidth : + stylePos->mHeight; + } + /** * Converts a "flex-relative" point (a main-axis & cross-axis coordinate) * into a "physical" x,y point. @@ -231,7 +228,7 @@ public: PhysicalCoordFromFlexRelativeCoord(aCrossCoord, aContainerCrossSize, mCrossAxis); - return IsAxisHorizontal(mMainAxis) ? + return IsMainAxisHorizontal() ? nsPoint(physicalCoordInMainAxis, physicalCoordInCrossAxis) : nsPoint(physicalCoordInCrossAxis, physicalCoordInMainAxis); } @@ -239,7 +236,7 @@ public: nsSize PhysicalSizeFromFlexRelativeSizes(nscoord aMainSize, nscoord aCrossSize) const { - return IsAxisHorizontal(mMainAxis) ? + return IsMainAxisHorizontal() ? nsSize(aMainSize, aCrossSize) : nsSize(aCrossSize, aMainSize); } @@ -253,6 +250,14 @@ public: } private: + // Indicates whether the given AxisOrientationType is horizontal. + // XXXdholbert This is private so that callers outside of FlexboxAxisTracker + // don't depend on it. This lets us move away from AxisOrientationType to a + // logical-axis-relative representation more seamlessly. + static inline bool IsAxisHorizontal(AxisOrientationType aAxis) { + return eAxis_LR == aAxis || eAxis_RL == aAxis; + } + AxisOrientationType mMainAxis; AxisOrientationType mCrossAxis; bool mAreAxesInternallyReversed; @@ -332,11 +337,11 @@ public: // Returns the distance between this FlexItem's baseline and the cross-start // edge of its margin-box. Used in baseline alignment. - // (This function needs to be told what cross axis is & which edge we're - // measuring the baseline from, so that it can look up the appropriate - // components from mMargin.) - nscoord GetBaselineOffsetFromOuterCrossEdge(AxisOrientationType aCrossAxis, - AxisEdgeType aEdge) const; + // (This function needs to be told which edge we're measuring the baseline + // from, so that it can look up the appropriate components from mMargin.) + nscoord GetBaselineOffsetFromOuterCrossEdge( + AxisEdgeType aEdge, + const FlexboxAxisTracker& aAxisTracker) const; float GetShareOfWeightSoFar() const { return mShareOfWeightSoFar; } @@ -980,8 +985,8 @@ IsOrderLEQ(nsIFrame* aFrame1, bool nsFlexContainerFrame::IsHorizontal() { - const FlexboxAxisTracker axisTracker(this); - return IsAxisHorizontal(axisTracker.GetMainAxis()); + const FlexboxAxisTracker axisTracker(StylePosition(), GetWritingMode()); + return axisTracker.IsMainAxisHorizontal(); } FlexItem* @@ -1115,7 +1120,7 @@ IsCrossSizeDefinite(const nsHTMLReflowState& aItemReflowState, const FlexboxAxisTracker& aAxisTracker) { const nsStylePosition* pos = aItemReflowState.mStylePosition; - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + if (aAxisTracker.IsCrossAxisHorizontal()) { return pos->mWidth.GetUnit() != eStyleUnit_Auto; } // else, vertical. (We need to use IsAutoHeight() to catch e.g. %-height @@ -1178,7 +1183,7 @@ MainSizeFromAspectRatio(nscoord aCrossSize, MOZ_ASSERT(aAxisTracker.GetCrossComponent(aIntrinsicRatio) != 0, "Invalid ratio; will divide by 0! Caller should've checked..."); - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + if (aAxisTracker.IsCrossAxisHorizontal()) { // cross axis horiz --> aCrossSize is a width. Converting to height. return NSCoordMulDiv(aCrossSize, aIntrinsicRatio.height, aIntrinsicRatio.width); } @@ -1297,7 +1302,7 @@ nsFlexContainerFrame:: { // (Note: We should never have a used flex-basis of "auto" if our main axis // is horizontal; width values should always be resolvable without reflow.) - const bool isMainSizeAuto = (!IsAxisHorizontal(aAxisTracker.GetMainAxis()) && + const bool isMainSizeAuto = (!aAxisTracker.IsMainAxisHorizontal() && NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize()); const bool isMainMinSizeAuto = aFlexItem.NeedsMinSizeAutoResolution(); @@ -1330,7 +1335,7 @@ nsFlexContainerFrame:: // Is container's cross size "definite"? // (Container's cross size is definite if cross-axis is horizontal, or if // cross-axis is vertical and the cross-size is not NS_AUTOHEIGHT.) - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis()) || + if (aAxisTracker.IsCrossAxisHorizontal() || containerCrossSize != NS_AUTOHEIGHT) { aFlexItem.ResolveStretchedCrossSize(containerCrossSize, aAxisTracker); } @@ -1368,7 +1373,7 @@ nsFlexContainerFrame:: // Measure content, if needed (w/ intrinsic-width method or a reflow) if (minSizeNeedsToMeasureContent || flexBasisNeedsToMeasureContent) { - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + if (aAxisTracker.IsMainAxisHorizontal()) { nsRenderingContext rctx( aPresContext->PresShell()->CreateReferenceRenderingContext()); if (minSizeNeedsToMeasureContent) { @@ -1538,11 +1543,11 @@ FlexItem::FlexItem(nsHTMLReflowState& aFlexItemReflowState, // Moreover: for the time being (until we support writing-modes), // all inline axes are horizontal -- so we can just check if the cross axis // is horizontal. - // FIXME: Once we support writing-mode (vertical text), this IsAxisHorizontal - // check won't be sufficient anymore -- we'll actually need to compare our - // inline axis vs. the cross axis. + // FIXME: Once we support writing-mode (vertical text), this + // IsCrossAxisHorizontal check won't be sufficient anymore -- we'll actually + // need to compare our inline axis vs. the cross axis. if (mAlignSelf == NS_STYLE_ALIGN_ITEMS_BASELINE && - IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + aAxisTracker.IsCrossAxisHorizontal()) { mAlignSelf = NS_STYLE_ALIGN_ITEMS_FLEX_START; } } @@ -1611,19 +1616,21 @@ FlexItem::CheckForMinSizeAuto(const nsHTMLReflowState& aFlexItemReflowState, } nscoord -FlexItem::GetBaselineOffsetFromOuterCrossEdge(AxisOrientationType aCrossAxis, - AxisEdgeType aEdge) const +FlexItem::GetBaselineOffsetFromOuterCrossEdge( + AxisEdgeType aEdge, + const FlexboxAxisTracker& aAxisTracker) const { // NOTE: Currently, 'mAscent' (taken from reflow) is an inherently vertical // measurement -- it's the distance from the border-top edge of this FlexItem // to its baseline. So, we can really only do baseline alignment when the // cross axis is vertical. (The FlexItem constructor enforces this when // resolving the item's "mAlignSelf" value). - MOZ_ASSERT(!IsAxisHorizontal(aCrossAxis), + MOZ_ASSERT(!aAxisTracker.IsCrossAxisHorizontal(), "Only expecting to be doing baseline computations when the " "cross axis is vertical"); - mozilla::Side sideToMeasureFrom = kAxisOrientationToSidesMap[aCrossAxis][aEdge]; + AxisOrientationType crossAxis = aAxisTracker.GetCrossAxis(); + mozilla::Side sideToMeasureFrom = kAxisOrientationToSidesMap[crossAxis][aEdge]; nscoord marginTopToBaseline = ResolvedAscent() + mMargin.top; @@ -1640,7 +1647,7 @@ FlexItem::GetBaselineOffsetFromOuterCrossEdge(AxisOrientationType aCrossAxis, // Measuring from bottom: The distance from the margin-box bottom edge to the // baseline is just the margin-box cross size (i.e. outer cross size), minus // the already-computed distance from margin-top to baseline. - return GetOuterCrossSize(aCrossAxis) - marginTopToBaseline; + return GetOuterCrossSize(crossAxis) - marginTopToBaseline; } uint32_t @@ -2696,8 +2703,8 @@ FlexLine::ComputeCrossSizeAndBaseline(const FlexboxAxisTracker& aAxisTracker) // crossEndToBaseline. nscoord crossStartToBaseline = - item->GetBaselineOffsetFromOuterCrossEdge(aAxisTracker.GetCrossAxis(), - eAxisEdge_Start); + item->GetBaselineOffsetFromOuterCrossEdge(eAxisEdge_Start, + aAxisTracker); nscoord crossEndToBaseline = curOuterCrossSize - crossStartToBaseline; // Now, update our "largest" values for these (across all the flex items @@ -2739,7 +2746,7 @@ FlexItem::ResolveStretchedCrossSize(nscoord aLineCrossSize, // conditions don't hold up, we won't stretch. if (mAlignSelf != NS_STYLE_ALIGN_ITEMS_STRETCH || GetNumAutoMarginsInAxis(crossAxis) != 0 || - eStyleUnit_Auto != GetSizePropertyForAxis(mFrame, crossAxis).GetUnit()) { + eStyleUnit_Auto != aAxisTracker.ComputedCrossSize(mFrame).GetUnit()) { return; } @@ -2846,10 +2853,13 @@ SingleLineCrossAxisPositionTracker:: // Normally, baseline-aligned items are collectively aligned with the // line's cross-start edge; however, if our cross axis is (internally) // reversed, we instead align them with the cross-end edge. + AxisEdgeType baselineAlignEdge = + aAxisTracker.AreAxesInternallyReversed() ? + eAxisEdge_End : eAxisEdge_Start; + nscoord itemBaselineOffset = - aItem.GetBaselineOffsetFromOuterCrossEdge(mAxis, - aAxisTracker.AreAxesInternallyReversed() ? - eAxisEdge_End : eAxisEdge_Start); + aItem.GetBaselineOffsetFromOuterCrossEdge(baselineAlignEdge, + aAxisTracker); nscoord lineBaselineOffset = aLine.GetBaselineOffset(); @@ -2878,36 +2888,57 @@ SingleLineCrossAxisPositionTracker:: } } -FlexboxAxisTracker::FlexboxAxisTracker( - nsFlexContainerFrame* aFlexContainerFrame) +// Utility function to convert an InlineDir to an AxisOrientationType +static inline AxisOrientationType +InlineDirToAxisOrientation(WritingMode::InlineDir aInlineDir) +{ + switch (aInlineDir) { + case WritingMode::eInlineLTR: + return eAxis_LR; + case WritingMode::eInlineRTL: + return eAxis_RL; + case WritingMode::eInlineTTB: + return eAxis_TB; + case WritingMode::eInlineBTT: + return eAxis_BT; + } + + MOZ_ASSERT_UNREACHABLE("Unhandled InlineDir"); + return eAxis_LR; // in case of unforseen error, assume English LTR text flow. +} + +// Utility function to convert a BlockDir to an AxisOrientationType +static inline AxisOrientationType +BlockDirToAxisOrientation(WritingMode::BlockDir aBlockDir) +{ + switch (aBlockDir) { + case WritingMode::eBlockLR: + return eAxis_LR; + case WritingMode::eBlockRL: + return eAxis_RL; + case WritingMode::eBlockTB: + return eAxis_TB; + // NOTE: WritingMode::eBlockBT (bottom-to-top) does not exist. + } + + MOZ_ASSERT_UNREACHABLE("Unhandled BlockDir"); + return eAxis_TB; // in case of unforseen error, assume English TTB block-flow +} + +FlexboxAxisTracker::FlexboxAxisTracker(const nsStylePosition* aStylePosition, + const WritingMode& aWM) : mAreAxesInternallyReversed(false) { - const nsStylePosition* pos = aFlexContainerFrame->StylePosition(); - uint32_t flexDirection = pos->mFlexDirection; - uint32_t cssDirection = - aFlexContainerFrame->StyleVisibility()->mDirection; - - MOZ_ASSERT(cssDirection == NS_STYLE_DIRECTION_LTR || - cssDirection == NS_STYLE_DIRECTION_RTL, - "Unexpected computed value for 'direction' property"); - // (Not asserting for flexDirection here; it's checked by the switch below.) - - // These are defined according to writing-modes' definitions of - // start/end (for the inline dimension) and before/after (for the block - // dimension), here: - // http://www.w3.org/TR/css3-writing-modes/#logical-directions - // (NOTE: I'm intentionally not calling this "inlineAxis"/"blockAxis", since - // those terms have explicit definition in the writing-modes spec, which are - // the opposite of how I'd be using them here.) - // XXXdholbert Once we support the 'writing-mode' property, use its value - // here to further customize inlineDimension & blockDimension. + uint32_t flexDirection = aStylePosition->mFlexDirection; // Inline dimension ("start-to-end"): + // (NOTE: I'm intentionally not calling these "inlineAxis"/"blockAxis", since + // those terms have explicit definition in the writing-modes spec, which are + // the opposite of how I'd be using them here.) AxisOrientationType inlineDimension = - cssDirection == NS_STYLE_DIRECTION_RTL ? eAxis_RL : eAxis_LR; - - // Block dimension ("before-to-after"): - AxisOrientationType blockDimension = eAxis_TB; + InlineDirToAxisOrientation(aWM.GetInlineDir()); + AxisOrientationType blockDimension = + BlockDirToAxisOrientation(aWM.GetBlockDir()); // Determine main axis: switch (flexDirection) { @@ -2938,7 +2969,7 @@ FlexboxAxisTracker::FlexboxAxisTracker( } // "flex-wrap: wrap-reverse" reverses our cross axis. - if (pos->mFlexWrap == NS_STYLE_FLEX_WRAP_WRAP_REVERSE) { + if (aStylePosition->mFlexWrap == NS_STYLE_FLEX_WRAP_WRAP_REVERSE) { mCrossAxis = GetReverseAxis(mCrossAxis); } @@ -2958,7 +2989,7 @@ FlexboxAxisTracker::FlexboxAxisTracker( } } - MOZ_ASSERT(IsAxisHorizontal(mMainAxis) != IsAxisHorizontal(mCrossAxis), + MOZ_ASSERT(IsMainAxisHorizontal() != IsCrossAxisHorizontal(), "main & cross axes should be in different dimensions"); } @@ -3026,7 +3057,7 @@ nsFlexContainerFrame::GenerateFlexLines( // Also: if we're vertical and paginating, we may need to wrap sooner // (before we run off the end of the page) - if (!IsAxisHorizontal(aAxisTracker.GetMainAxis()) && + if (!aAxisTracker.IsMainAxisHorizontal() && aAvailableHeightForContent != NS_UNCONSTRAINEDSIZE) { wrapThreshold = std::min(wrapThreshold, aAvailableHeightForContent); } @@ -3098,7 +3129,7 @@ nsFlexContainerFrame::GetMainSizeFromReflowState( const nsHTMLReflowState& aReflowState, const FlexboxAxisTracker& aAxisTracker) { - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + if (aAxisTracker.IsMainAxisHorizontal()) { // Horizontal case is easy -- our main size is our computed width // (which is already resolved). return aReflowState.ComputedISize(); @@ -3132,7 +3163,7 @@ ClampFlexContainerMainSize(const nsHTMLReflowState& aReflowState, { MOZ_ASSERT(aFirstLine, "null first line pointer"); - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + if (aAxisTracker.IsMainAxisHorizontal()) { // Horizontal case is easy -- our main size should already be resolved // before we get a call to Reflow. We don't have to worry about doing // page-breaking or shrinkwrapping in the horizontal axis. @@ -3186,7 +3217,7 @@ nsFlexContainerFrame::ComputeCrossSize(const nsHTMLReflowState& aReflowState, { MOZ_ASSERT(aIsDefinite, "outparam pointer must be non-null"); - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + if (aAxisTracker.IsCrossAxisHorizontal()) { // Cross axis is horizontal: our cross size is our computed width // (which is already resolved). *aIsDefinite = true; @@ -3284,9 +3315,9 @@ nsFlexContainerFrame::SizeItemInCrossAxis( nsHTMLReflowState& aChildReflowState, FlexItem& aItem) { - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + if (aAxisTracker.IsCrossAxisHorizontal()) { // XXXdholbert NOTE: For now, we should never hit this case, due to a - // !IsAxisHorizontal(aAxisTracker.GetCrossAxis()) check that guards this + // !aAxisTracker.IsCrossAxisHorizontal() check that guards this // call in the caller. BUT, when we add support for vertical writing-modes, // (in bug 1079155 or a dependency), we'll relax that check, and we'll need // to be able to measure the baseline & width (given our resolved height) @@ -3443,7 +3474,8 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext, SortChildrenIfNeeded(); } - const FlexboxAxisTracker axisTracker(this); + const FlexboxAxisTracker axisTracker(aReflowState.mStylePosition, + aReflowState.GetWritingMode()); // If we're being fragmented into a constrained height, subtract off // borderpadding-top from it, to get the available height for our @@ -3554,18 +3586,18 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext, // height.) if (!item->IsStretched() && // !A !item->IsStrut() && // !B - !IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { // !C + !aAxisTracker.IsCrossAxisHorizontal()) { // !C WritingMode wm = item->Frame()->GetWritingMode(); LogicalSize availSize = aReflowState.ComputedSize(wm); availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE; nsHTMLReflowState childReflowState(aPresContext, aReflowState, item->Frame(), availSize); // Override computed main-size - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + if (aAxisTracker.IsMainAxisHorizontal()) { childReflowState.SetComputedWidth(item->GetMainSize()); } else { // XXXdholbert NOTE: For now, we'll never hit this case, due to the - // !IsAxisHorizontal(aAxisTracker.GetCrossAxis()) check above. But + // !aAxisTracker.IsCrossAxisHorizontal() check above. But // when we add support for vertical writing modes, we'll relax that // check and be able to hit this code. childReflowState.SetComputedHeight(item->GetMainSize()); @@ -3666,7 +3698,7 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext, const nsPoint containerContentBoxOrigin(containerBorderPadding.left, containerBorderPadding.top); WritingMode outerWM = aReflowState.GetWritingMode(); - nscoord containerWidth = IsAxisHorizontal(aAxisTracker.GetMainAxis()) ? + nscoord containerWidth = aAxisTracker.IsMainAxisHorizontal() ? aContentBoxMainSize : contentBoxCrossSize; // FINAL REFLOW: Give each child frame another chance to reflow, now that @@ -3843,7 +3875,7 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext, bool didOverrideComputedHeight = false; // Override computed main-size - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + if (aAxisTracker.IsMainAxisHorizontal()) { childReflowState.SetComputedWidth(aItem.GetMainSize()); didOverrideComputedWidth = true; } else { @@ -3855,7 +3887,7 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext, if (aItem.IsStretched()) { MOZ_ASSERT(aItem.GetAlignSelf() == NS_STYLE_ALIGN_ITEMS_STRETCH, "stretched item w/o 'align-self: stretch'?"); - if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + if (aAxisTracker.IsCrossAxisHorizontal()) { childReflowState.SetComputedWidth(aItem.GetCrossSize()); didOverrideComputedWidth = true; } else { @@ -3926,7 +3958,8 @@ nsFlexContainerFrame::GetMinISize(nsRenderingContext* aRenderingContext) nscoord minWidth = 0; DISPLAY_MIN_WIDTH(this, minWidth); - FlexboxAxisTracker axisTracker(this); + const nsStylePosition* stylePos = StylePosition(); + const FlexboxAxisTracker axisTracker(stylePos, GetWritingMode()); for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { nscoord childMinWidth = @@ -3936,8 +3969,8 @@ nsFlexContainerFrame::GetMinISize(nsRenderingContext* aRenderingContext) // the sum of its items' min widths. // For a vertical flex container, or for a multi-line horizontal flex // container, the intrinsic min width is the max of its items' min widths. - if (IsAxisHorizontal(axisTracker.GetMainAxis()) && - NS_STYLE_FLEX_WRAP_NOWRAP == StylePosition()->mFlexWrap) { + if (axisTracker.IsMainAxisHorizontal() && + NS_STYLE_FLEX_WRAP_NOWRAP == stylePos->mFlexWrap) { minWidth += childMinWidth; } else { minWidth = std::max(minWidth, childMinWidth); @@ -3957,13 +3990,13 @@ nsFlexContainerFrame::GetPrefISize(nsRenderingContext* aRenderingContext) // Whenever anything happens that might change it, set it to // NS_INTRINSIC_WIDTH_UNKNOWN (like nsBlockFrame::MarkIntrinsicISizesDirty // does) - FlexboxAxisTracker axisTracker(this); + const FlexboxAxisTracker axisTracker(StylePosition(), GetWritingMode()); for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { nscoord childPrefWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, e.get(), nsLayoutUtils::PREF_ISIZE); - if (IsAxisHorizontal(axisTracker.GetMainAxis())) { + if (axisTracker.IsMainAxisHorizontal()) { prefWidth += childPrefWidth; } else { prefWidth = std::max(prefWidth, childPrefWidth); diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 0506cb3c2df..26ce5b8b2b7 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -946,9 +946,10 @@ private: * or remove the scrolled frame */ class nsXULScrollFrame final : public nsBoxFrame, - public nsIScrollableFrame, - public nsIAnonymousContentCreator, - public nsIStatefulFrame { + public nsIScrollableFrame, + public nsIAnonymousContentCreator, + public nsIStatefulFrame +{ public: typedef mozilla::ScrollFrameHelper ScrollFrameHelper; typedef mozilla::CSSIntPoint CSSIntPoint; diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 96002abaf0c..d383aa09bb2 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -324,7 +324,8 @@ private: imgRequestProxy **aRequest); class IconLoad final : public nsIObserver, - public imgINotificationObserver { + public imgINotificationObserver + { // private class that wraps the data and logic needed for // broken image and loading image icons public: diff --git a/layout/generic/nsImageMap.h b/layout/generic/nsImageMap.h index 0808a0dee0a..627657b1045 100644 --- a/layout/generic/nsImageMap.h +++ b/layout/generic/nsImageMap.h @@ -22,7 +22,7 @@ class nsIContent; struct nsRect; class nsImageMap final : public nsStubMutationObserver, - public nsIDOMEventListener + public nsIDOMEventListener { typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::ColorPattern ColorPattern; diff --git a/layout/ipc/VsyncParent.h b/layout/ipc/VsyncParent.h index 4b8e3e02e1b..b0a3691cdca 100644 --- a/layout/ipc/VsyncParent.h +++ b/layout/ipc/VsyncParent.h @@ -25,7 +25,7 @@ namespace layout { // content process. This actor will be released when its parent protocol calls // DeallocPVsyncParent(). class VsyncParent final : public PVsyncParent, - public VsyncObserver + public VsyncObserver { friend class mozilla::ipc::BackgroundParentImpl; diff --git a/layout/printing/nsPagePrintTimer.h b/layout/printing/nsPagePrintTimer.h index 7f47004e966..396effbf751 100644 --- a/layout/printing/nsPagePrintTimer.h +++ b/layout/printing/nsPagePrintTimer.h @@ -19,7 +19,7 @@ class nsPrintEngine; //-- Page Timer Class //--------------------------------------------------- class nsPagePrintTimer final : public nsRunnable, - public nsITimerCallback + public nsITimerCallback { public: diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index efbb6d91ff6..1d99c08b341 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -38,8 +38,8 @@ class nsIWeakReference; // //------------------------------------------------------------------------ class nsPrintEngine final : public nsIObserver, - public nsIWebProgressListener, - public nsSupportsWeakReference + public nsIWebProgressListener, + public nsSupportsWeakReference { public: // nsISupports interface... diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001-ref.html new file mode 100644 index 00000000000..931a5809d66 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001.html new file mode 100644 index 00000000000..b34952bd4f8 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-001.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: ltr' and 'writing-mode: horizontal-tb' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002-ref.html new file mode 100644 index 00000000000..a3c456b7655 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002.html new file mode 100644 index 00000000000..3452ec914db --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-002.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: ltr' and 'writing-mode: vertical-rl' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003-ref.html new file mode 100644 index 00000000000..54d1ba22fbf --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003.html new file mode 100644 index 00000000000..3fa2c600e72 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-003.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: ltr' and 'writing-mode: vertical-lr' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004-ref.html new file mode 100644 index 00000000000..a663580d84d --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004.html new file mode 100644 index 00000000000..e342be61f3e --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-004.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: rtl' and 'writing-mode: horizontal-tb' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005-ref.html new file mode 100644 index 00000000000..1bb55e11826 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005.html new file mode 100644 index 00000000000..bf9fcd02a9b --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-005.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: rtl' and 'writing-mode: vertical-rl' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006-ref.html new file mode 100644 index 00000000000..bf947c0e99b --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006-ref.html @@ -0,0 +1,76 @@ + + + + + CSS Reftest Reference + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006.html new file mode 100644 index 00000000000..db0cf52f1c6 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-writing-mode-006.html @@ -0,0 +1,78 @@ + + + + + CSS Test: Try various flex-flow values, with 'direction: rtl' and 'writing-mode: vertical-lr' + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/layout/reftests/w3c-css/submitted/flexbox/reftest.list b/layout/reftests/w3c-css/submitted/flexbox/reftest.list index 609799fab75..43aa2dc3b38 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list +++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list @@ -182,3 +182,11 @@ skip-if(Mulet) == flexbox-overflow-vert-001.html flexbox-overflow-vert-001-ref.h == flexbox-with-pseudo-elements-001.html flexbox-with-pseudo-elements-001-ref.html == flexbox-with-pseudo-elements-002.html flexbox-with-pseudo-elements-002-ref.html == flexbox-with-pseudo-elements-003.html flexbox-with-pseudo-elements-003-ref.html + +# Tests for combined influence of 'writing-mode' & 'direction' on flex axes +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-001.html flexbox-writing-mode-001-ref.html +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-002.html flexbox-writing-mode-002-ref.html +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-003.html flexbox-writing-mode-003-ref.html +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-004.html flexbox-writing-mode-004-ref.html +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-005.html flexbox-writing-mode-005-ref.html +test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-006.html flexbox-writing-mode-006-ref.html diff --git a/layout/reftests/w3c-css/submitted/images3/reftest.list b/layout/reftests/w3c-css/submitted/images3/reftest.list index 3834b0713fd..71d4e57ec11 100644 --- a/layout/reftests/w3c-css/submitted/images3/reftest.list +++ b/layout/reftests/w3c-css/submitted/images3/reftest.list @@ -80,9 +80,9 @@ fails == object-fit-fill-svg-006p.html object-fit-fill-svg-006-ref.html # bug 10 == object-fit-contain-svg-001i.html object-fit-contain-svg-001-ref.html == object-fit-contain-svg-001o.html object-fit-contain-svg-001-ref.html == object-fit-contain-svg-001p.html object-fit-contain-svg-001-ref.html -== object-fit-contain-svg-002e.html object-fit-contain-svg-002-ref.html +skip-if(B2G) == object-fit-contain-svg-002e.html object-fit-contain-svg-002-ref.html == object-fit-contain-svg-002i.html object-fit-contain-svg-002-ref.html -== object-fit-contain-svg-002o.html object-fit-contain-svg-002-ref.html +skip-if(B2G) == object-fit-contain-svg-002o.html object-fit-contain-svg-002-ref.html == object-fit-contain-svg-002p.html object-fit-contain-svg-002-ref.html == object-fit-contain-svg-003e.html object-fit-contain-svg-003-ref.html == object-fit-contain-svg-003i.html object-fit-contain-svg-003-ref.html @@ -108,17 +108,17 @@ fails == object-fit-fill-svg-006p.html object-fit-fill-svg-006-ref.html # bug 10 == object-fit-cover-svg-002i.html object-fit-cover-svg-002-ref.html == object-fit-cover-svg-002o.html object-fit-cover-svg-002-ref.html == object-fit-cover-svg-002p.html object-fit-cover-svg-002-ref.html -== object-fit-cover-svg-003e.html object-fit-cover-svg-003-ref.html +skip-if(B2G) == object-fit-cover-svg-003e.html object-fit-cover-svg-003-ref.html == object-fit-cover-svg-003i.html object-fit-cover-svg-003-ref.html -== object-fit-cover-svg-003o.html object-fit-cover-svg-003-ref.html +skip-if(B2G) == object-fit-cover-svg-003o.html object-fit-cover-svg-003-ref.html == object-fit-cover-svg-003p.html object-fit-cover-svg-003-ref.html -== object-fit-cover-svg-004e.html object-fit-cover-svg-004-ref.html +skip-if(B2G) == object-fit-cover-svg-004e.html object-fit-cover-svg-004-ref.html == object-fit-cover-svg-004i.html object-fit-cover-svg-004-ref.html -== object-fit-cover-svg-004o.html object-fit-cover-svg-004-ref.html +skip-if(B2G) == object-fit-cover-svg-004o.html object-fit-cover-svg-004-ref.html == object-fit-cover-svg-004p.html object-fit-cover-svg-004-ref.html -== object-fit-cover-svg-005e.html object-fit-cover-svg-005-ref.html +skip-if(B2G) == object-fit-cover-svg-005e.html object-fit-cover-svg-005-ref.html == object-fit-cover-svg-005i.html object-fit-cover-svg-005-ref.html -== object-fit-cover-svg-005o.html object-fit-cover-svg-005-ref.html +skip-if(B2G) == object-fit-cover-svg-005o.html object-fit-cover-svg-005-ref.html == object-fit-cover-svg-005p.html object-fit-cover-svg-005-ref.html == object-fit-cover-svg-006e.html object-fit-cover-svg-006-ref.html == object-fit-cover-svg-006i.html object-fit-cover-svg-006-ref.html @@ -140,21 +140,21 @@ fails == object-fit-fill-svg-006p.html object-fit-fill-svg-006-ref.html # bug 10 == object-fit-none-svg-004i.html object-fit-none-svg-004-ref.html == object-fit-none-svg-004o.html object-fit-none-svg-004-ref.html == object-fit-none-svg-004p.html object-fit-none-svg-004-ref.html -== object-fit-none-svg-005e.html object-fit-none-svg-005-ref.html +skip-if(B2G) == object-fit-none-svg-005e.html object-fit-none-svg-005-ref.html == object-fit-none-svg-005i.html object-fit-none-svg-005-ref.html -== object-fit-none-svg-005o.html object-fit-none-svg-005-ref.html +skip-if(B2G) == object-fit-none-svg-005o.html object-fit-none-svg-005-ref.html == object-fit-none-svg-005p.html object-fit-none-svg-005-ref.html -== object-fit-none-svg-006e.html object-fit-none-svg-006-ref.html +skip-if(B2G) == object-fit-none-svg-006e.html object-fit-none-svg-006-ref.html == object-fit-none-svg-006i.html object-fit-none-svg-006-ref.html -== object-fit-none-svg-006o.html object-fit-none-svg-006-ref.html +skip-if(B2G) == object-fit-none-svg-006o.html object-fit-none-svg-006-ref.html == object-fit-none-svg-006p.html object-fit-none-svg-006-ref.html -== object-fit-scale-down-svg-001e.html object-fit-scale-down-svg-001-ref.html +skip-if(B2G) == object-fit-scale-down-svg-001e.html object-fit-scale-down-svg-001-ref.html == object-fit-scale-down-svg-001i.html object-fit-scale-down-svg-001-ref.html -== object-fit-scale-down-svg-001o.html object-fit-scale-down-svg-001-ref.html +skip-if(B2G) == object-fit-scale-down-svg-001o.html object-fit-scale-down-svg-001-ref.html == object-fit-scale-down-svg-001p.html object-fit-scale-down-svg-001-ref.html -== object-fit-scale-down-svg-002e.html object-fit-scale-down-svg-002-ref.html +skip-if(B2G) == object-fit-scale-down-svg-002e.html object-fit-scale-down-svg-002-ref.html == object-fit-scale-down-svg-002i.html object-fit-scale-down-svg-002-ref.html -== object-fit-scale-down-svg-002o.html object-fit-scale-down-svg-002-ref.html +skip-if(B2G) == object-fit-scale-down-svg-002o.html object-fit-scale-down-svg-002-ref.html == object-fit-scale-down-svg-002p.html object-fit-scale-down-svg-002-ref.html == object-fit-scale-down-svg-003e.html object-fit-scale-down-svg-003-ref.html == object-fit-scale-down-svg-003i.html object-fit-scale-down-svg-003-ref.html diff --git a/layout/style/CSSStyleSheet.h b/layout/style/CSSStyleSheet.h index 3e58c8745a8..108510f17d2 100644 --- a/layout/style/CSSStyleSheet.h +++ b/layout/style/CSSStyleSheet.h @@ -117,9 +117,9 @@ private: class CSSStyleSheet final : public nsIStyleSheet, - public nsIDOMCSSStyleSheet, - public nsICSSLoaderObserver, - public nsWrapperCache + public nsIDOMCSSStyleSheet, + public nsICSSLoaderObserver, + public nsWrapperCache { public: typedef net::ReferrerPolicy ReferrerPolicy; diff --git a/layout/style/FontFace.h b/layout/style/FontFace.h index d9a2cd6a006..8c623f048be 100644 --- a/layout/style/FontFace.h +++ b/layout/style/FontFace.h @@ -31,7 +31,7 @@ namespace mozilla { namespace dom { class FontFace final : public nsISupports, - public nsWrapperCache + public nsWrapperCache { friend class mozilla::dom::FontFaceBufferSource; friend class Entry; diff --git a/layout/style/FontFaceSet.h b/layout/style/FontFaceSet.h index 38c65e630c0..0dc50395060 100644 --- a/layout/style/FontFaceSet.h +++ b/layout/style/FontFaceSet.h @@ -31,8 +31,8 @@ namespace mozilla { namespace dom { class FontFaceSet final : public DOMEventTargetHelper - , public nsIDOMEventListener - , public nsICSSLoaderObserver + , public nsIDOMEventListener + , public nsICSSLoaderObserver { friend class UserFontSet; diff --git a/layout/style/ImageLoader.h b/layout/style/ImageLoader.h index 8096832198a..25ac387d3bc 100644 --- a/layout/style/ImageLoader.h +++ b/layout/style/ImageLoader.h @@ -29,7 +29,8 @@ namespace css { struct ImageValue; class ImageLoader final : public imgINotificationObserver, - public imgIOnloadBlocker { + public imgIOnloadBlocker +{ public: typedef mozilla::css::ImageValue Image; diff --git a/layout/style/ImportRule.h b/layout/style/ImportRule.h index 8288e4b213e..87cd6ebbb4e 100644 --- a/layout/style/ImportRule.h +++ b/layout/style/ImportRule.h @@ -24,7 +24,7 @@ class CSSStyleSheet; namespace css { class ImportRule final : public Rule, - public nsIDOMCSSImportRule + public nsIDOMCSSImportRule { public: ImportRule(nsMediaList* aMedia, const nsString& aURLSpec, diff --git a/layout/style/MediaQueryList.h b/layout/style/MediaQueryList.h index 4f28d0a56ae..144696be338 100644 --- a/layout/style/MediaQueryList.h +++ b/layout/style/MediaQueryList.h @@ -26,8 +26,8 @@ namespace mozilla { namespace dom { class MediaQueryList final : public nsISupports, - public nsWrapperCache, - public PRCList + public nsWrapperCache, + public PRCList { public: // The caller who constructs is responsible for calling Evaluate diff --git a/layout/style/NameSpaceRule.h b/layout/style/NameSpaceRule.h index 24e8d97b4aa..9ef50d7089d 100644 --- a/layout/style/NameSpaceRule.h +++ b/layout/style/NameSpaceRule.h @@ -25,7 +25,7 @@ namespace mozilla { namespace css { class NameSpaceRule final : public Rule, - public nsIDOMCSSRule + public nsIDOMCSSRule { public: NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec, diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index 0750e50e055..90e1fc11123 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -45,7 +45,7 @@ class ErrorResult; namespace css { class MediaRule final : public GroupRule, - public nsIDOMCSSMediaRule + public nsIDOMCSSMediaRule { public: MediaRule(uint32_t aLineNumber, uint32_t aColumnNumber); @@ -103,7 +103,7 @@ protected: }; class DocumentRule final : public GroupRule, - public nsIDOMCSSMozDocumentRule + public nsIDOMCSSMozDocumentRule { public: DocumentRule(uint32_t aLineNumber, uint32_t aColumnNumber); @@ -236,7 +236,7 @@ private: }; class nsCSSFontFaceRule final : public mozilla::css::Rule, - public nsIDOMCSSFontFaceRule + public nsIDOMCSSFontFaceRule { public: nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber) @@ -303,9 +303,8 @@ nsCSSFontFaceStyleDecl::ContainingRule() const (reinterpret_cast(this) - offsetof(nsCSSFontFaceRule, mDecl)); } -class nsCSSFontFeatureValuesRule final : - public mozilla::css::Rule, - public nsIDOMCSSFontFeatureValuesRule +class nsCSSFontFeatureValuesRule final : public mozilla::css::Rule, + public nsIDOMCSSFontFeatureValuesRule { public: nsCSSFontFeatureValuesRule(uint32_t aLineNumber, uint32_t aColumnNumber) @@ -360,7 +359,7 @@ namespace mozilla { namespace css { class CharsetRule final : public Rule, - public nsIDOMCSSCharsetRule + public nsIDOMCSSCharsetRule { public: CharsetRule(const nsAString& aEncoding, @@ -429,7 +428,7 @@ protected: }; class nsCSSKeyframeRule final : public mozilla::css::Rule, - public nsIDOMMozCSSKeyframeRule + public nsIDOMMozCSSKeyframeRule { public: // WARNING: Steals the contents of aKeys *and* aDeclaration @@ -481,7 +480,7 @@ private: }; class nsCSSKeyframesRule final : public mozilla::css::GroupRule, - public nsIDOMMozCSSKeyframesRule + public nsIDOMMozCSSKeyframesRule { public: nsCSSKeyframesRule(const nsSubstring& aName, @@ -562,7 +561,7 @@ protected: }; class nsCSSPageRule final : public mozilla::css::Rule, - public nsIDOMCSSPageRule + public nsIDOMCSSPageRule { public: // WARNING: Steals the contents of aDeclaration @@ -665,7 +664,7 @@ protected: } // namespace mozilla class nsCSSCounterStyleRule final : public mozilla::css::Rule, - public nsIDOMCSSCounterStyleRule + public nsIDOMCSSCounterStyleRule { public: explicit nsCSSCounterStyleRule(const nsAString& aName, diff --git a/layout/style/nsDOMCSSValueList.h b/layout/style/nsDOMCSSValueList.h index 835ed2f08f6..1fc48579ccf 100644 --- a/layout/style/nsDOMCSSValueList.h +++ b/layout/style/nsDOMCSSValueList.h @@ -12,7 +12,7 @@ #include "nsTArray.h" class nsDOMCSSValueList final : public mozilla::dom::CSSValue, - public nsIDOMCSSValueList + public nsIDOMCSSValueList { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index 2f4a7a65839..6b36d9db0a2 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -155,9 +155,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID) #define NS_DECL_NSICSSDECLARATION \ NS_IMETHOD GetPropertyValue(const nsCSSProperty aPropID, \ - nsAString& aValue) override; \ + nsAString& aValue) override; \ NS_IMETHOD GetAuthoredPropertyValue(const nsAString& aPropName, \ - nsAString& aValue) override; \ + nsAString& aValue) override; \ NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, \ const nsAString& aValue) override; diff --git a/layout/style/nsIMediaList.h b/layout/style/nsIMediaList.h index baeaf79c6c9..ac9c686f487 100644 --- a/layout/style/nsIMediaList.h +++ b/layout/style/nsIMediaList.h @@ -189,7 +189,7 @@ private: }; class nsMediaList final : public nsIDOMMediaList - , public nsWrapperCache + , public nsWrapperCache { public: typedef mozilla::ErrorResult ErrorResult; diff --git a/layout/style/nsROCSSPrimitiveValue.h b/layout/style/nsROCSSPrimitiveValue.h index 1e7c28e27b4..c1a06298161 100644 --- a/layout/style/nsROCSSPrimitiveValue.h +++ b/layout/style/nsROCSSPrimitiveValue.h @@ -35,7 +35,7 @@ class nsDOMCSSRGBColor; * computed style. */ class nsROCSSPrimitiveValue final : public mozilla::dom::CSSValue, - public nsIDOMCSSPrimitiveValue + public nsIDOMCSSPrimitiveValue { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index 2fd90bd2ab8..a132885e95c 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -20,7 +20,7 @@ class nsSVGForeignObjectFrame; typedef nsSVGDisplayContainerFrame nsSVGOuterSVGFrameBase; class nsSVGOuterSVGFrame final : public nsSVGOuterSVGFrameBase, - public nsISVGSVGFrame + public nsISVGSVGFrame { friend nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); diff --git a/layout/xul/ListBoxObject.h b/layout/xul/ListBoxObject.h index 12f7ba991b2..39cdf5c8c11 100644 --- a/layout/xul/ListBoxObject.h +++ b/layout/xul/ListBoxObject.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { class ListBoxObject final : public BoxObject, - public nsPIListBoxObject + public nsPIListBoxObject { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/layout/xul/grid/nsGridLayout2.h b/layout/xul/grid/nsGridLayout2.h index 1b4feabe91e..04e231e279f 100644 --- a/layout/xul/grid/nsGridLayout2.h +++ b/layout/xul/grid/nsGridLayout2.h @@ -24,7 +24,7 @@ class nsGridCell; * The nsBoxLayout implementation for a grid. */ class nsGridLayout2 final : public nsStackLayout, - public nsIGridPart + public nsIGridPart { public: diff --git a/layout/xul/nsImageBoxFrame.h b/layout/xul/nsImageBoxFrame.h index a19486b4a8d..0b4239339c9 100644 --- a/layout/xul/nsImageBoxFrame.h +++ b/layout/xul/nsImageBoxFrame.h @@ -20,7 +20,7 @@ class nsImageBoxFrame; class nsDisplayXULImage; class nsImageBoxListener final : public imgINotificationObserver, - public imgIOnloadBlocker + public imgIOnloadBlocker { public: nsImageBoxListener(); diff --git a/layout/xul/nsListBoxBodyFrame.h b/layout/xul/nsListBoxBodyFrame.h index 49e27692ffe..ea65c7e7464 100644 --- a/layout/xul/nsListBoxBodyFrame.h +++ b/layout/xul/nsListBoxBodyFrame.h @@ -21,8 +21,8 @@ nsIFrame* NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); class nsListBoxBodyFrame final : public nsBoxFrame, - public nsIScrollbarMediator, - public nsIReflowCallback + public nsIScrollbarMediator, + public nsIReflowCallback { nsListBoxBodyFrame(nsStyleContext* aContext, nsBoxLayout* aLayoutManager); diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index d6fcff91f26..2d32c193b84 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -153,7 +153,7 @@ private: }; class nsMenuPopupFrame final : public nsBoxFrame, public nsMenuParent, - public nsIReflowCallback + public nsIReflowCallback { public: NS_DECL_QUERYFRAME_TARGET(nsMenuPopupFrame) diff --git a/layout/xul/nsXULPopupManager.h b/layout/xul/nsXULPopupManager.h index 900350ef49f..c01d0e020d5 100644 --- a/layout/xul/nsXULPopupManager.h +++ b/layout/xul/nsXULPopupManager.h @@ -271,9 +271,9 @@ private: }; class nsXULPopupManager final : public nsIDOMEventListener, - public nsIRollupListener, - public nsITimerCallback, - public nsIObserver + public nsIRollupListener, + public nsITimerCallback, + public nsIObserver { public: diff --git a/layout/xul/tree/TreeBoxObject.h b/layout/xul/tree/TreeBoxObject.h index fd80ab1bc66..d997b5a63d3 100644 --- a/layout/xul/tree/TreeBoxObject.h +++ b/layout/xul/tree/TreeBoxObject.h @@ -21,7 +21,7 @@ struct TreeCellInfo; class DOMRect; class TreeBoxObject final : public BoxObject, - public nsITreeBoxObject + public nsITreeBoxObject { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/layout/xul/tree/nsTreeColumns.h b/layout/xul/tree/nsTreeColumns.h index f7e393d46aa..ae4afee2d74 100644 --- a/layout/xul/tree/nsTreeColumns.h +++ b/layout/xul/tree/nsTreeColumns.h @@ -40,7 +40,7 @@ class TreeBoxObject; // This class is our column info. We use it to iterate our columns and to obtain // information about each column. class nsTreeColumn final : public nsITreeColumn - , public nsWrapperCache + , public nsWrapperCache { public: nsTreeColumn(nsTreeColumns* aColumns, nsIContent* aContent); @@ -151,7 +151,7 @@ private: NS_DEFINE_STATIC_IID_ACCESSOR(nsTreeColumn, NS_TREECOLUMN_IMPL_CID) class nsTreeColumns final : public nsITreeColumns - , public nsWrapperCache + , public nsWrapperCache { private: ~nsTreeColumns(); diff --git a/layout/xul/tree/nsTreeContentView.h b/layout/xul/tree/nsTreeContentView.h index c6bbbdf4688..d0898c9f2e8 100644 --- a/layout/xul/tree/nsTreeContentView.h +++ b/layout/xul/tree/nsTreeContentView.h @@ -23,8 +23,8 @@ class Row; nsresult NS_NewTreeContentView(nsITreeView** aResult); class nsTreeContentView final : public nsINativeTreeView, - public nsITreeContentView, - public nsStubDocumentObserver + public nsITreeContentView, + public nsStubDocumentObserver { public: nsTreeContentView(void); diff --git a/media/gmp-clearkey/0.1/ClearKeySessionManager.h b/media/gmp-clearkey/0.1/ClearKeySessionManager.h index 3e734a6c1b5..7c11db694b0 100644 --- a/media/gmp-clearkey/0.1/ClearKeySessionManager.h +++ b/media/gmp-clearkey/0.1/ClearKeySessionManager.h @@ -19,7 +19,7 @@ #include "RefCounted.h" class ClearKeySessionManager final : public GMPDecryptor - , public RefCounted + , public RefCounted { public: ClearKeySessionManager(); diff --git a/media/mtransport/transportflow.h b/media/mtransport/transportflow.h index 0d51d3e0285..d0fe4844565 100644 --- a/media/mtransport/transportflow.h +++ b/media/mtransport/transportflow.h @@ -50,7 +50,7 @@ namespace mozilla { class TransportFlow final : public nsISupports, - public sigslot::has_slots<> { + public sigslot::has_slots<> { public: TransportFlow() : id_("(anonymous)"), diff --git a/media/webrtc/signaling/src/jsep/JsepCodecDescription.h b/media/webrtc/signaling/src/jsep/JsepCodecDescription.h index a2b946fece8..36b19a988e3 100644 --- a/media/webrtc/signaling/src/jsep/JsepCodecDescription.h +++ b/media/webrtc/signaling/src/jsep/JsepCodecDescription.h @@ -12,7 +12,7 @@ namespace mozilla { #define JSEP_CODEC_CLONE(T) \ - virtual JsepCodecDescription* Clone() const override \ + virtual JsepCodecDescription* Clone() const override \ { \ return new T(*this); \ } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index d0aecde4862..465b8dc930d 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -289,14 +289,20 @@ PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, void *closure p != ctx->mPeerConnections.end(); ++p) { if (p->second->HasMedia()) { queries->append(nsAutoPtr(new RTCStatsQuery(true))); - p->second->BuildStatsQuery_m(nullptr, // all tracks - queries->back()); + if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks + queries->back())))) { + queries->popBack(); + } else { + MOZ_ASSERT(queries->back()->report); + } } } - rv = RUN_ON_THREAD(stsThread, - WrapRunnableNM(&EverySecondTelemetryCallback_s, queries), - NS_DISPATCH_NORMAL); - NS_ENSURE_SUCCESS_VOID(rv); + if (!queries->empty()) { + rv = RUN_ON_THREAD(stsThread, + WrapRunnableNM(&EverySecondTelemetryCallback_s, queries), + NS_DISPATCH_NORMAL); + NS_ENSURE_SUCCESS_VOID(rv); + } } #endif diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 95139f1b3a7..bf52a08b51a 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -2807,17 +2807,22 @@ PeerConnectionImpl::BuildStatsQuery_m( RTCStatsQuery *query) { if (!HasMedia()) { - return NS_OK; + return NS_ERROR_UNEXPECTED; } - if (!mMedia->ice_ctx() || !mThread) { - CSFLogError(logTag, "Could not build stats query, critical components of " - "PeerConnectionImpl not set."); + // Note: mMedia->ice_ctx() is deleted on STS thread; so make sure we grab and hold + // a ref instead of making multiple calls. NrIceCtx uses threadsafe refcounting. + query->iceCtx = mMedia->ice_ctx(); + if (!query->iceCtx) { + CSFLogError(logTag, "Could not build stats query, no ice_ctx"); + return NS_ERROR_UNEXPECTED; + } + if (!mThread) { + CSFLogError(logTag, "Could not build stats query, no MainThread"); return NS_ERROR_UNEXPECTED; } nsresult rv = GetTimeSinceEpoch(&(query->now)); - if (NS_FAILED(rv)) { CSFLogError(logTag, "Could not build stats query, could not get timestamp"); return rv; @@ -2884,8 +2889,6 @@ PeerConnectionImpl::BuildStatsQuery_m( } } - query->iceCtx = mMedia->ice_ctx(); - // From the list of MediaPipelines, determine the set of NrIceMediaStreams // we are interested in. std::set levelsToGrab; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index da33437731c..8bf8f6ae82c 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -229,11 +229,11 @@ class RTCStatsQuery { class PeerConnectionImpl final : public nsISupports, #ifdef MOZILLA_INTERNAL_API - public mozilla::DataChannelConnection::DataConnectionListener, - public nsNSSShutDownObject, - public DOMMediaStream::PrincipalChangeObserver, + public mozilla::DataChannelConnection::DataConnectionListener, + public nsNSSShutDownObject, + public DOMMediaStream::PrincipalChangeObserver, #endif - public sigslot::has_slots<> + public sigslot::has_slots<> { struct Internal; // Avoid exposing c includes to bindings diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h index 3fac0212d49..704707e4ada 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h @@ -20,8 +20,8 @@ namespace webrtc { // A wrapper for DesktopCapturer that also captures mouse using specified // MouseCursorMonitor and renders it on the generated streams. class DesktopAndCursorComposer : public DesktopCapturer, - public DesktopCapturer::Callback, - public MouseCursorMonitor::Callback { + public DesktopCapturer::Callback, + public MouseCursorMonitor::Callback { public: // Creates a new blender that captures mouse cursor using |mouse_monitor| and // renders it into the frames generated by |desktop_capturer|. If diff --git a/mobile/android/components/build/nsAndroidHistory.h b/mobile/android/components/build/nsAndroidHistory.h index 0d30afa73ad..95cf21f51e4 100644 --- a/mobile/android/components/build/nsAndroidHistory.h +++ b/mobile/android/components/build/nsAndroidHistory.h @@ -24,8 +24,8 @@ #define EMBED_URI_SIZE 128 class nsAndroidHistory final : public mozilla::IHistory, - public nsIRunnable, - public nsITimerCallback + public nsIRunnable, + public nsITimerCallback { public: NS_DECL_ISUPPORTS diff --git a/modules/libjar/nsJARChannel.h b/modules/libjar/nsJARChannel.h index 6f488912619..59e0777afdc 100644 --- a/modules/libjar/nsJARChannel.h +++ b/modules/libjar/nsJARChannel.h @@ -31,12 +31,12 @@ class nsJARInputThunk; //----------------------------------------------------------------------------- class nsJARChannel final : public nsIJARChannel - , public mozilla::net::MemoryDownloader::IObserver - , public nsIStreamListener - , public nsIRemoteOpenFileListener - , public nsIThreadRetargetableRequest - , public nsIThreadRetargetableStreamListener - , public nsHashPropertyBag + , public mozilla::net::MemoryDownloader::IObserver + , public nsIStreamListener + , public nsIRemoteOpenFileListener + , public nsIThreadRetargetableRequest + , public nsIThreadRetargetableStreamListener + , public nsHashPropertyBag { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/modules/libjar/nsJARProtocolHandler.h b/modules/libjar/nsJARProtocolHandler.h index 64310f4eab6..09e3385932e 100644 --- a/modules/libjar/nsJARProtocolHandler.h +++ b/modules/libjar/nsJARProtocolHandler.h @@ -21,7 +21,7 @@ class nsIHashable; class nsIRemoteOpenFileListener; class nsJARProtocolHandler final : public nsIJARProtocolHandler - , public nsSupportsWeakReference + , public nsSupportsWeakReference { typedef nsAutoTArray, 5> RemoteFileListenerArray; diff --git a/modules/libjar/nsJARURI.h b/modules/libjar/nsJARURI.h index 680f215fbef..b2647467889 100644 --- a/modules/libjar/nsJARURI.h +++ b/modules/libjar/nsJARURI.h @@ -33,10 +33,10 @@ class nsJARURI final : public nsIJARURI, - public nsISerializable, - public nsIClassInfo, - public nsINestedURI, - public nsIIPCSerializableURI + public nsISerializable, + public nsIClassInfo, + public nsINestedURI, + public nsIIPCSerializableURI { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/modules/libjar/zipwriter/nsZipWriter.h b/modules/libjar/zipwriter/nsZipWriter.h index 80d940d9b7a..f7fa1b1633c 100644 --- a/modules/libjar/zipwriter/nsZipWriter.h +++ b/modules/libjar/zipwriter/nsZipWriter.h @@ -37,7 +37,7 @@ public: }; class nsZipWriter final : public nsIZipWriter, - public nsIRequestObserver + public nsIRequestObserver { public: NS_DECL_ISUPPORTS diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index 95940faef29..17f773d41a8 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -126,7 +126,7 @@ public: }; class ValueObserver final : public nsIObserver, - public ValueObserverHashKey + public ValueObserverHashKey { ~ValueObserver() { Preferences::RemoveObserver(this, mPrefName.get()); diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index 7e766a78d13..4a8f03e3696 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -37,9 +37,9 @@ class PrefSetting; } class Preferences final : public nsIPrefService, - public nsIObserver, - public nsIPrefBranchInternal, - public nsSupportsWeakReference + public nsIObserver, + public nsIPrefBranchInternal, + public nsSupportsWeakReference { public: typedef mozilla::dom::PrefSetting PrefSetting; diff --git a/netwerk/base/ProxyAutoConfig.cpp b/netwerk/base/ProxyAutoConfig.cpp index 1324304e032..994608c99b8 100644 --- a/netwerk/base/ProxyAutoConfig.cpp +++ b/netwerk/base/ProxyAutoConfig.cpp @@ -259,7 +259,7 @@ static void SetRunning(ProxyAutoConfig *arg) // The PACResolver is used for dnsResolve() class PACResolver final : public nsIDNSListener - , public nsITimerCallback + , public nsITimerCallback { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsAsyncRedirectVerifyHelper.h b/netwerk/base/nsAsyncRedirectVerifyHelper.h index fd4680b04d0..635acdbfaca 100644 --- a/netwerk/base/nsAsyncRedirectVerifyHelper.h +++ b/netwerk/base/nsAsyncRedirectVerifyHelper.h @@ -24,7 +24,7 @@ class nsIChannel; * redirect decision is returned through the callback. */ class nsAsyncRedirectVerifyHelper final : public nsIRunnable, - public nsIAsyncVerifyRedirectCallback + public nsIAsyncVerifyRedirectCallback { NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE diff --git a/netwerk/base/nsAsyncStreamCopier.h b/netwerk/base/nsAsyncStreamCopier.h index 8709c83dfc8..7529a327aa6 100644 --- a/netwerk/base/nsAsyncStreamCopier.h +++ b/netwerk/base/nsAsyncStreamCopier.h @@ -16,7 +16,7 @@ class nsIRequestObserver; //----------------------------------------------------------------------------- class nsAsyncStreamCopier final : public nsIAsyncStreamCopier, - nsIAsyncStreamCopier2 + nsIAsyncStreamCopier2 { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index 0ce99c7f390..0486d65c3a3 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -45,10 +45,10 @@ namespace net { } // namespace mozilla class nsIOService final : public nsIIOService2 - , public nsIObserver - , public nsINetUtil - , public nsISpeculativeConnect - , public nsSupportsWeakReference + , public nsIObserver + , public nsINetUtil + , public nsISpeculativeConnect + , public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsInputStreamPump.h b/netwerk/base/nsInputStreamPump.h index 483cb192a4f..c9b7bd64cca 100644 --- a/netwerk/base/nsInputStreamPump.h +++ b/netwerk/base/nsInputStreamPump.h @@ -18,8 +18,8 @@ class nsILoadGroup; class nsIStreamListener; class nsInputStreamPump final : public nsIInputStreamPump - , public nsIInputStreamCallback - , public nsIThreadRetargetableRequest + , public nsIInputStreamCallback + , public nsIThreadRetargetableRequest { ~nsInputStreamPump(); diff --git a/netwerk/base/nsPACMan.h b/netwerk/base/nsPACMan.h index 7668d775183..4b816ded420 100644 --- a/netwerk/base/nsPACMan.h +++ b/netwerk/base/nsPACMan.h @@ -51,7 +51,7 @@ public: }; class PendingPACQuery final : public nsRunnable, - public mozilla::LinkedListElement + public mozilla::LinkedListElement { public: PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, uint32_t appId, @@ -88,8 +88,8 @@ private: */ class nsPACMan final : public nsIStreamLoaderObserver - , public nsIInterfaceRequestor - , public nsIChannelEventSink + , public nsIInterfaceRequestor + , public nsIChannelEventSink { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsProtocolProxyService.cpp b/netwerk/base/nsProtocolProxyService.cpp index 047e81fdbeb..f222d47ddd7 100644 --- a/netwerk/base/nsProtocolProxyService.cpp +++ b/netwerk/base/nsProtocolProxyService.cpp @@ -98,8 +98,8 @@ GetProxyURI(nsIChannel *channel, nsIURI **aOut) // on the main thread - so call nsPACMan::AsyncGetProxyForURI() with // a true mainThreadResponse parameter. class nsAsyncResolveRequest final : public nsIRunnable - , public nsPACManCallback - , public nsICancelable + , public nsPACManCallback + , public nsICancelable { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsProtocolProxyService.h b/netwerk/base/nsProtocolProxyService.h index 1114febedcf..751ec160a59 100644 --- a/netwerk/base/nsProtocolProxyService.h +++ b/netwerk/base/nsProtocolProxyService.h @@ -34,7 +34,7 @@ class nsPACMan; { 0xad, 0x62, 0x0c, 0x87, 0x35, 0x1e, 0x64, 0x0d } } class nsProtocolProxyService final : public nsIProtocolProxyService2 - , public nsIObserver + , public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/netwerk/base/nsSocketTransport2.h b/netwerk/base/nsSocketTransport2.h index 9afb856eabd..df12d5ccf04 100644 --- a/netwerk/base/nsSocketTransport2.h +++ b/netwerk/base/nsSocketTransport2.h @@ -106,10 +106,10 @@ private: //----------------------------------------------------------------------------- class nsSocketTransport final : public nsASocketHandler - , public nsISocketTransport - , public nsIDNSListener - , public nsIClassInfo - , public nsIInterfaceRequestor + , public nsISocketTransport + , public nsIDNSListener + , public nsIClassInfo + , public nsIInterfaceRequestor { typedef mozilla::Mutex Mutex; diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index eb38e3a3246..f51bd456a92 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -60,10 +60,10 @@ static const int32_t kDefaultTCPKeepCount = //----------------------------------------------------------------------------- class nsSocketTransportService final : public nsPISocketTransportService - , public nsIEventTarget - , public nsIThreadObserver - , public nsIRunnable - , public nsIObserver + , public nsIEventTarget + , public nsIThreadObserver + , public nsIRunnable + , public nsIObserver { typedef mozilla::Mutex Mutex; diff --git a/netwerk/base/nsStreamListenerWrapper.h b/netwerk/base/nsStreamListenerWrapper.h index 617a917ae5b..69f65370d29 100644 --- a/netwerk/base/nsStreamListenerWrapper.h +++ b/netwerk/base/nsStreamListenerWrapper.h @@ -14,7 +14,7 @@ // Wrapper class to make replacement of nsHttpChannel's listener // from JavaScript possible. It is workaround for bug 433711 and 682305. class nsStreamListenerWrapper final : public nsIStreamListener - , public nsIThreadRetargetableStreamListener + , public nsIThreadRetargetableStreamListener { public: explicit nsStreamListenerWrapper(nsIStreamListener *listener) diff --git a/netwerk/base/nsStreamLoader.h b/netwerk/base/nsStreamLoader.h index 2a0c9f184a6..391d9f59152 100644 --- a/netwerk/base/nsStreamLoader.h +++ b/netwerk/base/nsStreamLoader.h @@ -15,7 +15,7 @@ class nsIRequest; class nsStreamLoader final : public nsIStreamLoader - , public nsIThreadRetargetableStreamListener + , public nsIThreadRetargetableStreamListener { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsStreamTransportService.h b/netwerk/base/nsStreamTransportService.h index 280182eba10..f52877295e2 100644 --- a/netwerk/base/nsStreamTransportService.h +++ b/netwerk/base/nsStreamTransportService.h @@ -13,8 +13,8 @@ class nsIThreadPool; class nsStreamTransportService final : public nsIStreamTransportService - , public nsIEventTarget - , public nsIObserver + , public nsIEventTarget + , public nsIObserver { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/base/nsSyncStreamListener.h b/netwerk/base/nsSyncStreamListener.h index 20e756a0622..9fa9c58c3e1 100644 --- a/netwerk/base/nsSyncStreamListener.h +++ b/netwerk/base/nsSyncStreamListener.h @@ -14,7 +14,7 @@ //----------------------------------------------------------------------------- class nsSyncStreamListener final : public nsISyncStreamListener - , public nsIInputStream + , public nsIInputStream { public: NS_DECL_ISUPPORTS diff --git a/netwerk/base/nsUDPSocket.h b/netwerk/base/nsUDPSocket.h index 118c6d49e79..51db15d60d6 100644 --- a/netwerk/base/nsUDPSocket.h +++ b/netwerk/base/nsUDPSocket.h @@ -15,7 +15,7 @@ //----------------------------------------------------------------------------- class nsUDPSocket final : public nsASocketHandler - , public nsIUDPSocket + , public nsIUDPSocket { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h index 309d29d8f69..e6234e35b85 100644 --- a/netwerk/cache/nsCacheService.h +++ b/netwerk/cache/nsCacheService.h @@ -63,7 +63,7 @@ private: ******************************************************************************/ class nsCacheService final : public nsICacheServiceInternal, - public nsIMemoryReporter + public nsIMemoryReporter { virtual ~nsCacheService(); diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.h b/netwerk/cache/nsDiskCacheDeviceSQL.h index 27f9f39499a..3cdc0dd8c36 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.h +++ b/netwerk/cache/nsDiskCacheDeviceSQL.h @@ -63,7 +63,7 @@ private: }; class nsOfflineCacheDevice final : public nsCacheDevice - , public nsISupports + , public nsISupports { public: nsOfflineCacheDevice(); diff --git a/netwerk/cache2/CacheEntry.h b/netwerk/cache2/CacheEntry.h index 584e72ece7c..e38f9e54e8b 100644 --- a/netwerk/cache2/CacheEntry.h +++ b/netwerk/cache2/CacheEntry.h @@ -48,8 +48,8 @@ class CacheOutputCloseListener; class CacheEntryHandle; class CacheEntry final : public nsICacheEntry - , public nsIRunnable - , public CacheFileListener + , public nsIRunnable + , public CacheFileListener { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/cache2/CacheStorageService.h b/netwerk/cache2/CacheStorageService.h index 72ece79f63a..fb07a4dffd7 100644 --- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -65,8 +65,8 @@ protected: }; class CacheStorageService final : public nsICacheStorageService - , public nsIMemoryReporter - , public nsITimerCallback + , public nsIMemoryReporter + , public nsITimerCallback { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/cookie/nsCookieService.h b/netwerk/cookie/nsCookieService.h index ee65ae4f768..1e486e912e3 100644 --- a/netwerk/cookie/nsCookieService.h +++ b/netwerk/cookie/nsCookieService.h @@ -239,10 +239,10 @@ enum OpenDBResult ******************************************************************************/ class nsCookieService final : public nsICookieService - , public nsICookieManager2 - , public nsIObserver - , public nsSupportsWeakReference - , public nsIMemoryReporter + , public nsICookieManager2 + , public nsIObserver + , public nsSupportsWeakReference + , public nsIMemoryReporter { private: size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 19abe6471cc..1990567b3d4 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -294,7 +294,7 @@ nsDNSRecord::ReportUnusable(uint16_t aPort) //----------------------------------------------------------------------------- class nsDNSAsyncRequest final : public nsResolveHostCallback - , public nsICancelable + , public nsICancelable { ~nsDNSAsyncRequest() {} diff --git a/netwerk/dns/nsDNSService2.h b/netwerk/dns/nsDNSService2.h index 70a4ac771a0..39add3d4e50 100644 --- a/netwerk/dns/nsDNSService2.h +++ b/netwerk/dns/nsDNSService2.h @@ -22,8 +22,8 @@ #include "mozilla/Attributes.h" class nsDNSService final : public nsPIDNSService - , public nsIObserver - , public nsIMemoryReporter + , public nsIObserver + , public nsIMemoryReporter { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp index 09c0a1965c1..85ef04f5482 100644 --- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -167,6 +167,20 @@ NeckoChild::DeallocPWebSocketChild(PWebSocketChild* child) return true; } +PDataChannelChild* +NeckoChild::AllocPDataChannelChild(const uint32_t& channelId) +{ + MOZ_ASSERT_UNREACHABLE("Should never get here"); + return nullptr; +} + +bool +NeckoChild::DeallocPDataChannelChild(PDataChannelChild* child) +{ + // NB: See DataChannelChild::ActorDestroy. + return true; +} + PRtspControllerChild* NeckoChild::AllocPRtspControllerChild() { diff --git a/netwerk/ipc/NeckoChild.h b/netwerk/ipc/NeckoChild.h index 169879797a6..63e8b6cc441 100644 --- a/netwerk/ipc/NeckoChild.h +++ b/netwerk/ipc/NeckoChild.h @@ -62,6 +62,8 @@ protected: const URIParams&, const OptionalURIParams&) override; virtual bool DeallocPRemoteOpenFileChild(PRemoteOpenFileChild*) override; + virtual PDataChannelChild* AllocPDataChannelChild(const uint32_t& channelId) override; + virtual bool DeallocPDataChannelChild(PDataChannelChild* child) override; virtual PRtspControllerChild* AllocPRtspControllerChild() override; virtual bool DeallocPRtspControllerChild(PRtspControllerChild*) override; virtual PRtspChannelChild* diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 80c416d2e4a..429415a9625 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -13,6 +13,7 @@ #include "mozilla/net/WyciwygChannelParent.h" #include "mozilla/net/FTPChannelParent.h" #include "mozilla/net/WebSocketChannelParent.h" +#include "mozilla/net/DataChannelParent.h" #ifdef NECKO_PROTOCOL_rtsp #include "mozilla/net/RtspControllerParent.h" #include "mozilla/net/RtspChannelParent.h" @@ -349,6 +350,29 @@ NeckoParent::DeallocPWebSocketParent(PWebSocketParent* actor) return true; } +PDataChannelParent* +NeckoParent::AllocPDataChannelParent(const uint32_t &channelId) +{ + nsRefPtr p = new DataChannelParent(); + return p.forget().take(); +} + +bool +NeckoParent::DeallocPDataChannelParent(PDataChannelParent* actor) +{ + nsRefPtr p = dont_AddRef(static_cast(actor)); + return true; +} + +bool +NeckoParent::RecvPDataChannelConstructor(PDataChannelParent* actor, + const uint32_t& channelId) +{ + DataChannelParent* p = static_cast(actor); + p->Init(channelId); + return true; +} + PRtspControllerParent* NeckoParent::AllocPRtspControllerParent() { diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h index d9e6cf75020..bcd66cf4556 100644 --- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -170,6 +170,14 @@ protected: virtual mozilla::ipc::IProtocol* CloneProtocol(Channel* aChannel, mozilla::ipc::ProtocolCloneContext* aCtx) override; + + virtual PDataChannelParent* + AllocPDataChannelParent(const uint32_t& channelId) override; + virtual bool DeallocPDataChannelParent(PDataChannelParent* parent) override; + + virtual bool RecvPDataChannelConstructor(PDataChannelParent* aActor, + const uint32_t& channelId) override; + virtual PRtspControllerParent* AllocPRtspControllerParent() override; virtual bool DeallocPRtspControllerParent(PRtspControllerParent*) override; diff --git a/netwerk/ipc/PDataChannel.ipdl b/netwerk/ipc/PDataChannel.ipdl new file mode 100644 index 00000000000..17a340cc0d4 --- /dev/null +++ b/netwerk/ipc/PDataChannel.ipdl @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */ + +/* 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/. */ + +include protocol PNecko; +include URIParams; + +namespace mozilla { +namespace net { + +async protocol PDataChannel +{ + manager PNecko; + +parent: + // Note: channels are opened during construction, so no open method here: + // see PNecko.ipdl + __delete__(); +}; + +} // namespace net +} // namespace mozilla diff --git a/netwerk/ipc/PNecko.ipdl b/netwerk/ipc/PNecko.ipdl index b35c7b816f5..4e60f0a13d0 100644 --- a/netwerk/ipc/PNecko.ipdl +++ b/netwerk/ipc/PNecko.ipdl @@ -20,6 +20,7 @@ include protocol PDNSRequest; include protocol PChannelDiverter; include protocol PBlob; //FIXME: bug #792908 include protocol PFileDescriptorSet; +include protocol PDataChannel; include protocol PRtspController; include protocol PRtspChannel; @@ -48,6 +49,7 @@ prio(normal upto urgent) sync protocol PNecko manages PUDPSocket; manages PDNSRequest; manages PRemoteOpenFile; + manages PDataChannel; manages PRtspController; manages PRtspChannel; manages PChannelDiverter; @@ -76,6 +78,13 @@ parent: SpeculativeConnect(URIParams uri); HTMLDNSPrefetch(nsString hostname, uint16_t flags); CancelHTMLDNSPrefetch(nsString hostname, uint16_t flags, nsresult reason); + + /** + * channelId is used to establish a connection between redirect channels in + * the parent and the child when we're redirecting to a data: URI. + */ + PDataChannel(uint32_t channelId); + PRtspController(); PRtspChannel(RtspChannelConnectArgs args); PChannelDiverter(ChannelDiverterArgs channel); diff --git a/netwerk/ipc/moz.build b/netwerk/ipc/moz.build index 7f5d05df7b6..d3c8f8ddd4c 100644 --- a/netwerk/ipc/moz.build +++ b/netwerk/ipc/moz.build @@ -32,6 +32,7 @@ UNIFIED_SOURCES += [ IPDL_SOURCES = [ 'NeckoChannelParams.ipdlh', 'PChannelDiverter.ipdl', + 'PDataChannel.ipdl', 'PNecko.ipdl', 'PRemoteOpenFile.ipdl', 'PRtspChannel.ipdl', diff --git a/netwerk/protocol/data/DataChannelChild.cpp b/netwerk/protocol/data/DataChannelChild.cpp new file mode 100644 index 00000000000..8f6f846f958 --- /dev/null +++ b/netwerk/protocol/data/DataChannelChild.cpp @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set ts=4 sw=4 sts=4 et tw=80: */ +/* 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/. */ + +#include "DataChannelChild.h" + +#include "mozilla/unused.h" +#include "mozilla/net/NeckoChild.h" + +namespace mozilla { +namespace net { + +NS_IMPL_ISUPPORTS_INHERITED(DataChannelChild, nsDataChannel, nsIChildChannel) + +DataChannelChild::DataChannelChild(nsIURI* aURI) + : nsDataChannel(aURI) + , mIPCOpen(false) +{ +} + +DataChannelChild::~DataChannelChild() +{ +} + +NS_IMETHODIMP +DataChannelChild::ConnectParent(uint32_t aId) +{ + if (!gNeckoChild->SendPDataChannelConstructor(this, aId)) { + return NS_ERROR_FAILURE; + } + + // IPC now has a ref to us. + AddIPDLReference(); + return NS_OK; +} + +NS_IMETHODIMP +DataChannelChild::CompleteRedirectSetup(nsIStreamListener *aListener, + nsISupports *aContext) +{ + nsresult rv = AsyncOpen(aListener, aContext); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + if (mIPCOpen) { + unused << Send__delete__(this); + } + return NS_OK; +} + +void +DataChannelChild::AddIPDLReference() +{ + AddRef(); + mIPCOpen = true; +} + +void +DataChannelChild::ActorDestroy(ActorDestroyReason why) +{ + MOZ_ASSERT(mIPCOpen); + mIPCOpen = false; + Release(); +} + +} // namespace mozilla +} // namespace net diff --git a/netwerk/protocol/data/DataChannelChild.h b/netwerk/protocol/data/DataChannelChild.h new file mode 100644 index 00000000000..112199d7970 --- /dev/null +++ b/netwerk/protocol/data/DataChannelChild.h @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set ts=4 sw=4 sts=4 et tw=80: */ +/* 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 NS_DATACHANNELCHILD_H +#define NS_DATACHANNELCHILD_H + +#include "nsDataChannel.h" +#include "nsIChildChannel.h" +#include "nsISupportsImpl.h" + +#include "mozilla/net/PDataChannelChild.h" + +namespace mozilla { +namespace net { + +class DataChannelChild : public nsDataChannel + , public nsIChildChannel + , public PDataChannelChild +{ +public: + explicit DataChannelChild(nsIURI *uri); + + NS_DECL_ISUPPORTS + NS_DECL_NSICHILDCHANNEL + +protected: + virtual void ActorDestroy(ActorDestroyReason why) override; + +private: + ~DataChannelChild(); + + void AddIPDLReference(); + + bool mIPCOpen; +}; + +} // namespace mozilla +} // namespace net + +#endif /* NS_DATACHANNELCHILD_H */ diff --git a/netwerk/protocol/data/DataChannelParent.cpp b/netwerk/protocol/data/DataChannelParent.cpp new file mode 100644 index 00000000000..ece9a0aae82 --- /dev/null +++ b/netwerk/protocol/data/DataChannelParent.cpp @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set ts=4 sw=4 sts=4 et tw=80: */ +/* 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/. */ + +#include "DataChannelParent.h" +#include "mozilla/Assertions.h" + +namespace mozilla { +namespace net { + +NS_IMPL_ISUPPORTS(DataChannelParent, nsIParentChannel, nsIStreamListener) + +DataChannelParent::~DataChannelParent() +{ +} + +bool +DataChannelParent::Init(const uint32_t &channelId) +{ + nsCOMPtr channel; + MOZ_ALWAYS_TRUE(NS_SUCCEEDED( + NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel)))); + + return true; +} + +NS_IMETHODIMP +DataChannelParent::SetParentListener(HttpChannelParentListener* aListener) +{ + // Nothing to do. + return NS_OK; +} + +NS_IMETHODIMP +DataChannelParent::NotifyTrackingProtectionDisabled() +{ + // Nothing to do. + return NS_OK; +} + +NS_IMETHODIMP +DataChannelParent::Delete() +{ + // Nothing to do. + return NS_OK; +} + +void +DataChannelParent::ActorDestroy(ActorDestroyReason why) +{ +} + +NS_IMETHODIMP +DataChannelParent::OnStartRequest(nsIRequest *aRequest, + nsISupports *aContext) +{ + // We don't have a way to prevent nsBaseChannel from calling AsyncOpen on + // the created nsDataChannel. We don't have anywhere to send the data in the + // parent, so abort the binding. + return NS_BINDING_ABORTED; +} + +NS_IMETHODIMP +DataChannelParent::OnStopRequest(nsIRequest *aRequest, + nsISupports *aContext, + nsresult aStatusCode) +{ + // See above. + MOZ_ASSERT(NS_FAILED(aStatusCode)); + return NS_OK; +} + +NS_IMETHODIMP +DataChannelParent::OnDataAvailable(nsIRequest *aRequest, + nsISupports *aContext, + nsIInputStream *aInputStream, + uint64_t aOffset, + uint32_t aCount) +{ + // See above. + MOZ_CRASH("Should never be called"); +} + +} // namespace mozilla +} // namespace net diff --git a/netwerk/protocol/data/DataChannelParent.h b/netwerk/protocol/data/DataChannelParent.h new file mode 100644 index 00000000000..69272718491 --- /dev/null +++ b/netwerk/protocol/data/DataChannelParent.h @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set ts=4 sw=4 sts=4 et tw=80: */ +/* 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 NS_DATACHANNELPARENT_H +#define NS_DATACHANNELPARENT_H + +#include "nsIParentChannel.h" +#include "nsISupportsImpl.h" + +#include "mozilla/net/PDataChannelParent.h" + +namespace mozilla { +namespace net { + +// In order to support HTTP redirects to data:, we need to implement the HTTP +// redirection API, which requires a class that implements nsIParentChannel +// and which calls NS_LinkRedirectChannels. +class DataChannelParent : public nsIParentChannel + , public PDataChannelParent +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIPARENTCHANNEL + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + + bool Init(const uint32_t& aArgs); + +private: + ~DataChannelParent(); + + virtual void ActorDestroy(ActorDestroyReason why) override; +}; + +} // namespace mozilla +} // namespace net + +#endif /* NS_DATACHANNELPARENT_H */ diff --git a/netwerk/protocol/data/moz.build b/netwerk/protocol/data/moz.build index 9486e8f246e..75a137ffb27 100644 --- a/netwerk/protocol/data/moz.build +++ b/netwerk/protocol/data/moz.build @@ -4,11 +4,19 @@ # 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/. +EXPORTS.mozilla.net += [ + 'DataChannelParent.h', +] + UNIFIED_SOURCES += [ + 'DataChannelChild.cpp', + 'DataChannelParent.cpp', 'nsDataChannel.cpp', 'nsDataHandler.cpp', ] +include('/ipc/chromium/chromium-config.mozbuild') + FAIL_ON_WARNINGS = True FINAL_LIBRARY = 'xul' diff --git a/netwerk/protocol/data/nsDataChannel.h b/netwerk/protocol/data/nsDataChannel.h index 7fdab0e2e8e..20bf861fed5 100644 --- a/netwerk/protocol/data/nsDataChannel.h +++ b/netwerk/protocol/data/nsDataChannel.h @@ -12,7 +12,8 @@ class nsIInputStream; -class nsDataChannel : public nsBaseChannel { +class nsDataChannel : public nsBaseChannel +{ public: explicit nsDataChannel(nsIURI *uri) { SetURI(uri); diff --git a/netwerk/protocol/data/nsDataHandler.cpp b/netwerk/protocol/data/nsDataHandler.cpp index b242593d29b..f82e09f1d05 100644 --- a/netwerk/protocol/data/nsDataHandler.cpp +++ b/netwerk/protocol/data/nsDataHandler.cpp @@ -7,6 +7,7 @@ #include "nsDataHandler.h" #include "nsNetCID.h" #include "nsError.h" +#include "DataChannelChild.h" static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID); @@ -108,9 +109,12 @@ nsDataHandler::NewChannel2(nsIURI* uri, nsIChannel** result) { NS_ENSURE_ARG_POINTER(uri); - nsDataChannel* channel = new nsDataChannel(uri); - if (!channel) - return NS_ERROR_OUT_OF_MEMORY; + nsDataChannel* channel; + if (XRE_GetProcessType() == GeckoProcessType_Default) { + channel = new nsDataChannel(uri); + } else { + channel = new mozilla::net::DataChannelChild(uri); + } NS_ADDREF(channel); nsresult rv = channel->Init(); diff --git a/netwerk/protocol/ftp/FTPChannelParent.h b/netwerk/protocol/ftp/FTPChannelParent.h index 00eb5919b2e..8188a26d699 100644 --- a/netwerk/protocol/ftp/FTPChannelParent.h +++ b/netwerk/protocol/ftp/FTPChannelParent.h @@ -22,11 +22,11 @@ namespace mozilla { namespace net { class FTPChannelParent final : public PFTPChannelParent - , public nsIParentChannel - , public nsIInterfaceRequestor - , public ADivertableParentChannel - , public nsIChannelEventSink - , public DisconnectableParent + , public nsIParentChannel + , public nsIInterfaceRequestor + , public ADivertableParentChannel + , public nsIChannelEventSink + , public DisconnectableParent { public: NS_DECL_ISUPPORTS diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.h b/netwerk/protocol/ftp/nsFtpConnectionThread.h index 82a67af4211..6378d11d386 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.h +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.h @@ -73,11 +73,11 @@ class nsIStreamListener; // control connection and the data connection. class nsFtpState final : public nsBaseContentStream, - public nsIInputStreamCallback, - public nsITransportEventSink, - public nsIRequestObserver, - public nsFtpControlConnectionListener, - public nsIProtocolProxyCallback + public nsIInputStreamCallback, + public nsITransportEventSink, + public nsIRequestObserver, + public nsFtpControlConnectionListener, + public nsIProtocolProxyCallback { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.h b/netwerk/protocol/ftp/nsFtpProtocolHandler.h index 9d25e6b6243..428c3106ebd 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.h +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.h @@ -16,8 +16,8 @@ //----------------------------------------------------------------------------- class nsFtpProtocolHandler final : public nsIProxiedProtocolHandler - , public nsIObserver - , public nsSupportsWeakReference + , public nsIObserver + , public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/protocol/http/Http2Session.h b/netwerk/protocol/http/Http2Session.h index a06802a1601..4a2a90141eb 100644 --- a/netwerk/protocol/http/Http2Session.h +++ b/netwerk/protocol/http/Http2Session.h @@ -28,9 +28,9 @@ class Http2Stream; class nsHttpTransaction; class Http2Session final : public ASpdySession - , public nsAHttpConnection - , public nsAHttpSegmentReader - , public nsAHttpSegmentWriter + , public nsAHttpConnection + , public nsAHttpSegmentReader + , public nsAHttpSegmentWriter { ~Http2Session(); diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index 7306cede3df..7844f383bd4 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -39,16 +39,16 @@ class InterceptedChannelContent; class InterceptStreamListener; class HttpChannelChild final : public PHttpChannelChild - , public HttpBaseChannel - , public HttpAsyncAborter - , public nsICacheInfoChannel - , public nsIProxiedChannel - , public nsIApplicationCacheChannel - , public nsIAsyncVerifyRedirectCallback - , public nsIAssociatedContentSecurity - , public nsIChildChannel - , public nsIHttpChannelChild - , public nsIDivertableChannel + , public HttpBaseChannel + , public HttpAsyncAborter + , public nsICacheInfoChannel + , public nsIProxiedChannel + , public nsIApplicationCacheChannel + , public nsIAsyncVerifyRedirectCallback + , public nsIAssociatedContentSecurity + , public nsIChildChannel + , public nsIHttpChannelChild + , public nsIDivertableChannel { virtual ~HttpChannelChild(); public: diff --git a/netwerk/protocol/http/SpdySession31.h b/netwerk/protocol/http/SpdySession31.h index 83b24cb25c4..7d6b68494f2 100644 --- a/netwerk/protocol/http/SpdySession31.h +++ b/netwerk/protocol/http/SpdySession31.h @@ -26,9 +26,9 @@ class SpdyStream31; class nsHttpTransaction; class SpdySession31 final : public ASpdySession - , public nsAHttpConnection - , public nsAHttpSegmentReader - , public nsAHttpSegmentWriter + , public nsAHttpConnection + , public nsAHttpSegmentReader + , public nsAHttpSegmentWriter { ~SpdySession31(); diff --git a/netwerk/protocol/http/SpdyStream31.h b/netwerk/protocol/http/SpdyStream31.h index b1fe1407bbb..7541b85f303 100644 --- a/netwerk/protocol/http/SpdyStream31.h +++ b/netwerk/protocol/http/SpdyStream31.h @@ -12,7 +12,7 @@ namespace mozilla { namespace net { class SpdyStream31 : public nsAHttpSegmentReader - , public nsAHttpSegmentWriter + , public nsAHttpSegmentWriter { public: NS_DECL_NSAHTTPSEGMENTREADER diff --git a/netwerk/protocol/http/nsAHttpConnection.h b/netwerk/protocol/http/nsAHttpConnection.h index 849e8eefab8..d858342c25c 100644 --- a/netwerk/protocol/http/nsAHttpConnection.h +++ b/netwerk/protocol/http/nsAHttpConnection.h @@ -153,31 +153,30 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsAHttpConnection, NS_AHTTPCONNECTION_IID) nsresult TakeTransport(nsISocketTransport **, \ nsIAsyncInputStream **, \ nsIAsyncOutputStream **) override; \ - bool IsPersistent() override; \ - bool IsReused() override; \ - void DontReuse() override; \ - nsresult PushBack(const char *, uint32_t) override; \ - nsHttpConnection *TakeHttpConnection() override; \ - uint32_t CancelPipeline(nsresult originalReason) override; \ - nsAHttpTransaction::Classifier Classification() override; \ + bool IsPersistent() override; \ + bool IsReused() override; \ + void DontReuse() override; \ + nsresult PushBack(const char *, uint32_t) override; \ + nsHttpConnection *TakeHttpConnection() override; \ + uint32_t CancelPipeline(nsresult originalReason) override; \ + nsAHttpTransaction::Classifier Classification() override; \ /* \ Thes methods below have automatic definitions that just forward the \ function to a lower level connection object \ */ \ void GetConnectionInfo(nsHttpConnectionInfo **result) \ - override \ + override \ { \ if (!(fwdObject)) { \ - *result = nullptr; \ + *result = nullptr; \ return; \ } \ return (fwdObject)->GetConnectionInfo(result); \ } \ - void GetSecurityInfo(nsISupports **result) \ - override \ + void GetSecurityInfo(nsISupports **result) override \ { \ if (!(fwdObject)) { \ - *result = nullptr; \ + *result = nullptr; \ return; \ } \ return (fwdObject)->GetSecurityInfo(result); \ @@ -219,29 +218,29 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsAHttpConnection, NS_AHTTPCONNECTION_IID) (fwdObject)->Version() : \ NS_HTTP_VERSION_UNKNOWN; \ } \ - bool IsProxyConnectInProgress() override \ + bool IsProxyConnectInProgress() override \ { \ return (fwdObject)->IsProxyConnectInProgress(); \ } \ - bool LastTransactionExpectedNoContent() override \ + bool LastTransactionExpectedNoContent() override \ { \ return (fwdObject)->LastTransactionExpectedNoContent(); \ } \ void SetLastTransactionExpectedNoContent(bool val) \ - override \ + override \ { \ return (fwdObject)->SetLastTransactionExpectedNoContent(val); \ } \ void Classify(nsAHttpTransaction::Classifier newclass) \ - override \ + override \ { \ if (fwdObject) \ return (fwdObject)->Classify(newclass); \ } \ - int64_t BytesWritten() override \ + int64_t BytesWritten() override \ { return fwdObject ? (fwdObject)->BytesWritten() : 0; } \ void SetSecurityCallbacks(nsIInterfaceRequestor* aCallbacks) \ - override \ + override \ { \ if (fwdObject) \ (fwdObject)->SetSecurityCallbacks(aCallbacks); \ diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 955fbc9350d..27d09c2fb17 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -5981,7 +5981,7 @@ nsHttpChannel::SetOfflineCacheToken(nsISupports *token) } class nsHttpChannelCacheKey final : public nsISupportsPRUint32, - public nsISupportsCString + public nsISupportsCString { NS_DECL_ISUPPORTS diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index 82c41fb0d0d..9010e4a5c55 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -47,19 +47,19 @@ class Http2PushedStream; } class nsHttpChannel final : public HttpBaseChannel - , public HttpAsyncAborter - , public nsIStreamListener - , public nsICachingChannel - , public nsICacheEntryOpenCallback - , public nsITransportEventSink - , public nsIProtocolProxyCallback - , public nsIHttpAuthenticableChannel - , public nsIApplicationCacheChannel - , public nsIAsyncVerifyRedirectCallback - , public nsIThreadRetargetableRequest - , public nsIThreadRetargetableStreamListener - , public nsIDNSListener - , public nsSupportsWeakReference + , public HttpAsyncAborter + , public nsIStreamListener + , public nsICachingChannel + , public nsICacheEntryOpenCallback + , public nsITransportEventSink + , public nsIProtocolProxyCallback + , public nsIHttpAuthenticableChannel + , public nsIApplicationCacheChannel + , public nsIAsyncVerifyRedirectCallback + , public nsIThreadRetargetableRequest + , public nsIThreadRetargetableStreamListener + , public nsIDNSListener + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/netwerk/protocol/http/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h index a10d4168fa9..6963061d5e7 100644 --- a/netwerk/protocol/http/nsHttpConnection.h +++ b/netwerk/protocol/http/nsHttpConnection.h @@ -37,12 +37,12 @@ class ASpdySession; //----------------------------------------------------------------------------- class nsHttpConnection final : public nsAHttpSegmentReader - , public nsAHttpSegmentWriter - , public nsIInputStreamCallback - , public nsIOutputStreamCallback - , public nsITransportEventSink - , public nsIInterfaceRequestor - , public NudgeTunnelCallback + , public nsAHttpSegmentWriter + , public nsIInputStreamCallback + , public nsIOutputStreamCallback + , public nsITransportEventSink + , public nsIInterfaceRequestor + , public NudgeTunnelCallback { virtual ~nsHttpConnection(); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index ed53bebb17f..af566ecb655 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -431,9 +431,9 @@ private: // while we wait for it to establish and bind it to a connection class nsHalfOpenSocket final : public nsIOutputStreamCallback, - public nsITransportEventSink, - public nsIInterfaceRequestor, - public nsITimerCallback + public nsITransportEventSink, + public nsIInterfaceRequestor, + public nsITimerCallback { ~nsHalfOpenSocket(); diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index cfbf005447c..27e7d6d6628 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -50,9 +50,9 @@ enum FrameCheckLevel { //----------------------------------------------------------------------------- class nsHttpHandler final : public nsIHttpProtocolHandler - , public nsIObserver - , public nsSupportsWeakReference - , public nsISpeculativeConnect + , public nsIObserver + , public nsSupportsWeakReference + , public nsISpeculativeConnect { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/protocol/http/nsHttpPipeline.h b/netwerk/protocol/http/nsHttpPipeline.h index 086b0d830cb..9ab37178a23 100644 --- a/netwerk/protocol/http/nsHttpPipeline.h +++ b/netwerk/protocol/http/nsHttpPipeline.h @@ -17,8 +17,8 @@ class nsIOutputStream; namespace mozilla { namespace net { class nsHttpPipeline final : public nsAHttpConnection - , public nsAHttpTransaction - , public nsAHttpSegmentReader + , public nsAHttpTransaction + , public nsAHttpSegmentReader { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 216897f0d22..6902c8bc614 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -41,9 +41,9 @@ class nsHttpResponseHead; //----------------------------------------------------------------------------- class nsHttpTransaction final : public nsAHttpTransaction - , public ATokenBucketEvent - , public nsIInputStreamCallback - , public nsIOutputStreamCallback + , public ATokenBucketEvent + , public nsIInputStreamCallback + , public nsIOutputStreamCallback { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/protocol/rtsp/controller/RtspController.h b/netwerk/protocol/rtsp/controller/RtspController.h index a6c4ba7260c..666fb822648 100644 --- a/netwerk/protocol/rtsp/controller/RtspController.h +++ b/netwerk/protocol/rtsp/controller/RtspController.h @@ -17,7 +17,7 @@ namespace mozilla { namespace net { class RtspController final : public nsIStreamingProtocolController - , public nsIStreamingProtocolListener + , public nsIStreamingProtocolListener { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.h b/netwerk/protocol/viewsource/nsViewSourceChannel.h index 9c7249d7757..8f63a5f4aa2 100644 --- a/netwerk/protocol/viewsource/nsViewSourceChannel.h +++ b/netwerk/protocol/viewsource/nsViewSourceChannel.h @@ -19,12 +19,12 @@ #include "mozilla/Attributes.h" class nsViewSourceChannel final : public nsIViewSourceChannel, - public nsIStreamListener, - public nsIHttpChannel, - public nsIHttpChannelInternal, - public nsICachingChannel, - public nsIApplicationCacheChannel, - public nsIUploadChannel + public nsIStreamListener, + public nsIHttpChannel, + public nsIHttpChannelInternal, + public nsICachingChannel, + public nsIApplicationCacheChannel, + public nsIUploadChannel { public: diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index eb8beec4801..281cd038f00 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -1125,7 +1125,7 @@ DataChannelConnection::SendDeferredMessages() nullptr, 0, (void *)spa, (socklen_t)sizeof(struct sctp_sendv_spa), SCTP_SENDV_SPA, - 0) < 0)) { + 0)) < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { // leave queued for resend failed_send = true; diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.h b/netwerk/streamconv/converters/nsMultiMixedConv.h index 0e3e287808d..8b3c874da4c 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.h +++ b/netwerk/streamconv/converters/nsMultiMixedConv.h @@ -35,9 +35,9 @@ using mozilla::net::nsHttpResponseHead; // nsIStreamListener interface. // class nsPartChannel final : public nsIChannel, - public nsIByteRangeRequest, - public nsIResponseHeadProvider, - public nsIMultiPartChannel + public nsIByteRangeRequest, + public nsIResponseHeadProvider, + public nsIMultiPartChannel { public: nsPartChannel(nsIChannel *aMultipartChannel, uint32_t aPartID, diff --git a/netwerk/test/TestIncrementalDownload.cpp b/netwerk/test/TestIncrementalDownload.cpp index 9caecb31669..082828ad85e 100644 --- a/netwerk/test/TestIncrementalDownload.cpp +++ b/netwerk/test/TestIncrementalDownload.cpp @@ -20,7 +20,7 @@ //----------------------------------------------------------------------------- class FetchObserver final : public nsIRequestObserver - , public nsIProgressEventSink + , public nsIProgressEventSink { ~FetchObserver() {} public: diff --git a/netwerk/test/unit/test_redirect_different-protocol.js b/netwerk/test/unit/test_redirect_different-protocol.js index 401fc47b6c0..89114d686c0 100644 --- a/netwerk/test/unit/test_redirect_different-protocol.js +++ b/netwerk/test/unit/test_redirect_different-protocol.js @@ -44,13 +44,7 @@ function redirectHandler(metadata, response) function finish_test(request, buffer) { - if (inChildProcess()) { - // redirects to protocols other than http/ftp will fail until bug 590682 is fixed. - do_check_eq(buffer, response301Body); - } else { - do_check_eq(buffer, redirectTargetBody); - } - + do_check_eq(buffer, redirectTargetBody); httpServer.stop(do_test_finished); } diff --git a/parser/html/nsHtml5Parser.h b/parser/html/nsHtml5Parser.h index 3ac25d27c31..277143368a9 100644 --- a/parser/html/nsHtml5Parser.h +++ b/parser/html/nsHtml5Parser.h @@ -28,7 +28,7 @@ #include "nsHtml5StreamListener.h" class nsHtml5Parser final : public nsIParser, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW diff --git a/parser/html/nsHtml5TreeOpExecutor.h b/parser/html/nsHtml5TreeOpExecutor.h index b3b54eee10c..ec922c1bea2 100644 --- a/parser/html/nsHtml5TreeOpExecutor.h +++ b/parser/html/nsHtml5TreeOpExecutor.h @@ -32,9 +32,9 @@ class nsIContent; class nsIDocument; class nsHtml5TreeOpExecutor final : public nsHtml5DocumentBuilder, - public nsIContentSink, - public nsAHtml5TreeOpSink, - public mozilla::LinkedListElement + public nsIContentSink, + public nsAHtml5TreeOpSink, + public mozilla::LinkedListElement { friend class nsHtml5FlushLoopGuard; typedef mozilla::net::ReferrerPolicy ReferrerPolicy; diff --git a/parser/html/nsParserUtils.h b/parser/html/nsParserUtils.h index 5356cf6fc29..4645f11b948 100644 --- a/parser/html/nsParserUtils.h +++ b/parser/html/nsParserUtils.h @@ -11,7 +11,7 @@ #include "mozilla/Attributes.h" class nsParserUtils final : public nsIScriptableUnescapeHTML, - public nsIParserUtils + public nsIParserUtils { ~nsParserUtils() {} public: diff --git a/parser/htmlparser/nsParser.h b/parser/htmlparser/nsParser.h index 54bccf4f5c1..858ee23d706 100644 --- a/parser/htmlparser/nsParser.h +++ b/parser/htmlparser/nsParser.h @@ -63,8 +63,8 @@ class nsIRunnable; class nsParser final : public nsIParser, - public nsIStreamListener, - public nsSupportsWeakReference + public nsIStreamListener, + public nsSupportsWeakReference { /** * Destructor diff --git a/parser/xml/nsSAXXMLReader.h b/parser/xml/nsSAXXMLReader.h index e1885a8bb23..763f787e56e 100644 --- a/parser/xml/nsSAXXMLReader.h +++ b/parser/xml/nsSAXXMLReader.h @@ -26,8 +26,8 @@ { 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} } class nsSAXXMLReader final : public nsISAXXMLReader, - public nsIExtendedExpatSink, - public nsIContentSink + public nsIExtendedExpatSink, + public nsIContentSink { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/rdf/base/nsRDFService.h b/rdf/base/nsRDFService.h index 27905f9b9aa..8dad600975a 100644 --- a/rdf/base/nsRDFService.h +++ b/rdf/base/nsRDFService.h @@ -34,7 +34,7 @@ class nsIRDFDate; class BlobImpl; class RDFServiceImpl final : public nsIRDFService, - public nsSupportsWeakReference + public nsSupportsWeakReference { protected: PLHashTable* mNamedDataSources; diff --git a/security/manager/ssl/src/PSMContentListener.h b/security/manager/ssl/src/PSMContentListener.h index 17ee0959804..49239029bfc 100644 --- a/security/manager/ssl/src/PSMContentListener.h +++ b/security/manager/ssl/src/PSMContentListener.h @@ -17,7 +17,8 @@ namespace mozilla { namespace psm { class PSMContentListener : public nsIURIContentListener, - public nsSupportsWeakReference { + public nsSupportsWeakReference +{ public: PSMContentListener(); nsresult init(); diff --git a/security/manager/ssl/src/nsCertOverrideService.h b/security/manager/ssl/src/nsCertOverrideService.h index 97245aa28ea..794ef1eb9dd 100644 --- a/security/manager/ssl/src/nsCertOverrideService.h +++ b/security/manager/ssl/src/nsCertOverrideService.h @@ -127,8 +127,8 @@ class nsCertOverrideEntry final : public PLDHashEntryHdr }; class nsCertOverrideService final : public nsICertOverrideService - , public nsIObserver - , public nsSupportsWeakReference + , public nsIObserver + , public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/security/manager/ssl/src/nsClientAuthRemember.h b/security/manager/ssl/src/nsClientAuthRemember.h index 7b2fbebc463..bfbf2bcad59 100644 --- a/security/manager/ssl/src/nsClientAuthRemember.h +++ b/security/manager/ssl/src/nsClientAuthRemember.h @@ -107,7 +107,7 @@ class nsClientAuthRememberEntry final : public PLDHashEntryHdr }; class nsClientAuthRememberService final : public nsIObserver, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/security/manager/ssl/src/nsNSSCertificate.h b/security/manager/ssl/src/nsNSSCertificate.h index 6ecd17e9e37..77e3ab45bdc 100644 --- a/security/manager/ssl/src/nsNSSCertificate.h +++ b/security/manager/ssl/src/nsNSSCertificate.h @@ -25,9 +25,9 @@ class nsINSSComponent; class nsIASN1Sequence; class nsNSSCertificate final : public nsIX509Cert, - public nsISerializable, - public nsIClassInfo, - public nsNSSShutDownObject + public nsISerializable, + public nsIClassInfo, + public nsNSSShutDownObject { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/security/manager/ssl/src/nsNSSCertificateDB.h b/security/manager/ssl/src/nsNSSCertificateDB.h index 9440537dc0a..3f272a9a217 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.h +++ b/security/manager/ssl/src/nsNSSCertificateDB.h @@ -15,7 +15,7 @@ class nsCString; class nsIArray; class nsNSSCertificateDB final : public nsIX509CertDB - , public nsNSSShutDownObject + , public nsNSSShutDownObject { public: diff --git a/security/manager/ssl/src/nsNSSComponent.h b/security/manager/ssl/src/nsNSSComponent.h index ed450c3775d..fd58714248d 100644 --- a/security/manager/ssl/src/nsNSSComponent.h +++ b/security/manager/ssl/src/nsNSSComponent.h @@ -106,9 +106,9 @@ class nsCertVerificationThread; // Implementation of the PSM component interface. class nsNSSComponent final : public nsIEntropyCollector, - public nsINSSComponent, - public nsIObserver, - public nsSupportsWeakReference + public nsINSSComponent, + public nsIObserver, + public nsSupportsWeakReference { typedef mozilla::Mutex Mutex; diff --git a/security/manager/ssl/src/nsNSSIOLayer.h b/security/manager/ssl/src/nsNSSIOLayer.h index 5ea576bd21d..4eed0afdb1f 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.h +++ b/security/manager/ssl/src/nsNSSIOLayer.h @@ -25,8 +25,8 @@ class SharedSSLState; class nsIObserver; class nsNSSSocketInfo final : public mozilla::psm::TransportSecurityInfo, - public nsISSLSocketControl, - public nsIClientAuthUserDecision + public nsISSLSocketControl, + public nsIClientAuthUserDecision { public: nsNSSSocketInfo(mozilla::psm::SharedSSLState& aState, uint32_t providerFlags); diff --git a/security/manager/ssl/src/nsRandomGenerator.h b/security/manager/ssl/src/nsRandomGenerator.h index 970d75d8448..197f2d7477a 100644 --- a/security/manager/ssl/src/nsRandomGenerator.h +++ b/security/manager/ssl/src/nsRandomGenerator.h @@ -16,7 +16,7 @@ "@mozilla.org/security/random-generator;1" class nsRandomGenerator final : public nsIRandomGenerator - , public nsNSSShutDownObject + , public nsNSSShutDownObject { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/storage/src/mozStorageAsyncStatement.h b/storage/src/mozStorageAsyncStatement.h index 5c95285c47a..72534d07704 100644 --- a/storage/src/mozStorageAsyncStatement.h +++ b/storage/src/mozStorageAsyncStatement.h @@ -28,7 +28,7 @@ class AsyncStatementJSHelper; class Connection; class AsyncStatement final : public mozIStorageAsyncStatement - , public StorageBaseStatementInternal + , public StorageBaseStatementInternal { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/storage/src/mozStorageAsyncStatementExecution.h b/storage/src/mozStorageAsyncStatementExecution.h index 841800641bc..4364231e70c 100644 --- a/storage/src/mozStorageAsyncStatementExecution.h +++ b/storage/src/mozStorageAsyncStatementExecution.h @@ -30,7 +30,7 @@ class ResultSet; class StatementData; class AsyncExecuteStatements final : public nsIRunnable - , public mozIStoragePendingStatement + , public mozIStoragePendingStatement { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/storage/src/mozStorageAsyncStatementParams.h b/storage/src/mozStorageAsyncStatementParams.h index ec10fa3d992..71f53dab65b 100644 --- a/storage/src/mozStorageAsyncStatementParams.h +++ b/storage/src/mozStorageAsyncStatementParams.h @@ -23,7 +23,7 @@ class AsyncStatement; * an async variant. */ class AsyncStatementParams final : public mozIStorageStatementParams - , public nsIXPCScriptable + , public nsIXPCScriptable { public: explicit AsyncStatementParams(AsyncStatement *aStatement); diff --git a/storage/src/mozStorageConnection.h b/storage/src/mozStorageConnection.h index 9a3848871a3..a86ec796f08 100644 --- a/storage/src/mozStorageConnection.h +++ b/storage/src/mozStorageConnection.h @@ -37,7 +37,7 @@ namespace mozilla { namespace storage { class Connection final : public mozIStorageConnection - , public nsIInterfaceRequestor + , public nsIInterfaceRequestor { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/storage/src/mozStorageStatement.h b/storage/src/mozStorageStatement.h index ee786cfa2b0..84fd5da2de7 100644 --- a/storage/src/mozStorageStatement.h +++ b/storage/src/mozStorageStatement.h @@ -28,8 +28,8 @@ class StatementJSHelper; class Connection; class Statement final : public mozIStorageStatement - , public mozIStorageValueArray - , public StorageBaseStatementInternal + , public mozIStorageValueArray + , public StorageBaseStatementInternal { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/storage/src/mozStorageStatementParams.h b/storage/src/mozStorageStatementParams.h index a51b189970d..2627f8aa191 100644 --- a/storage/src/mozStorageStatementParams.h +++ b/storage/src/mozStorageStatementParams.h @@ -17,7 +17,7 @@ namespace mozilla { namespace storage { class StatementParams final : public mozIStorageStatementParams - , public nsIXPCScriptable + , public nsIXPCScriptable { public: explicit StatementParams(mozIStorageStatement *aStatement); diff --git a/storage/src/mozStorageStatementRow.h b/storage/src/mozStorageStatementRow.h index 5cb065b7281..ea9e4034845 100644 --- a/storage/src/mozStorageStatementRow.h +++ b/storage/src/mozStorageStatementRow.h @@ -17,7 +17,7 @@ namespace storage { class Statement; class StatementRow final : public mozIStorageStatementRow - , public nsIXPCScriptable + , public nsIXPCScriptable { public: NS_DECL_ISUPPORTS diff --git a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini index d22d74be395..22b151967e3 100644 --- a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini +++ b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html.ini @@ -30,30 +30,9 @@ ["data:,a \\" , data:,b 1x, \\", data:,c"] expected: FAIL - ["data:,a \\\\,data:;\\,b, data:,c"] - expected: FAIL - - ["data:,a, data:,b ("] - expected: FAIL - - ["data:,a, data:,b ( "] - expected: FAIL - - ["data:,a, data:,b (,"] - expected: FAIL - - ["data:,a, data:,b (x"] - expected: FAIL - - ["data:,a, data:,b ()"] - expected: FAIL - ["data:,a (, data:,b"] expected: FAIL - ["data:,a /*, data:,b, data:,c */"] - expected: FAIL - ["data:,a foo"] expected: FAIL diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.h b/toolkit/components/autocomplete/nsAutoCompleteController.h index 796e04dbade..9a6dae78257 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.h +++ b/toolkit/components/autocomplete/nsAutoCompleteController.h @@ -21,9 +21,9 @@ #include "nsCycleCollectionParticipant.h" class nsAutoCompleteController final : public nsIAutoCompleteController, - public nsIAutoCompleteObserver, - public nsITimerCallback, - public nsITreeView + public nsIAutoCompleteObserver, + public nsITimerCallback, + public nsITreeView { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h index 82d8ea28e9f..6559af3cdec 100644 --- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h +++ b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h @@ -9,7 +9,7 @@ #include "nsCOMPtr.h" class DiskSpaceWatcher final : public nsIDiskSpaceWatcher, - public nsIObserver + public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/downloads/nsDownloadManager.h b/toolkit/components/downloads/nsDownloadManager.h index aa957adf6e0..aaf09bc4992 100644 --- a/toolkit/components/downloads/nsDownloadManager.h +++ b/toolkit/components/downloads/nsDownloadManager.h @@ -39,9 +39,9 @@ class nsDownload; #endif class nsDownloadManager final : public nsIDownloadManager, - public nsINavHistoryObserver, - public nsIObserver, - public nsSupportsWeakReference + public nsINavHistoryObserver, + public nsIObserver, + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/filewatcher/NativeFileWatcherWin.h b/toolkit/components/filewatcher/NativeFileWatcherWin.h index 43f9419e04c..37dd97f84d3 100644 --- a/toolkit/components/filewatcher/NativeFileWatcherWin.h +++ b/toolkit/components/filewatcher/NativeFileWatcherWin.h @@ -17,7 +17,7 @@ namespace mozilla { class NativeFileWatcherService final : public nsINativeFileWatcherService, - public nsIObserver + public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/places/Database.h b/toolkit/components/places/Database.h index 577db769a61..7844833c58f 100644 --- a/toolkit/components/places/Database.h +++ b/toolkit/components/places/Database.h @@ -62,7 +62,7 @@ enum JournalMode { }; class Database final : public nsIObserver - , public nsSupportsWeakReference + , public nsSupportsWeakReference { typedef mozilla::storage::StatementCache StatementCache; typedef mozilla::storage::StatementCache AsyncStatementCache; diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index eecb400ed78..f042f259118 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -466,8 +466,8 @@ GetJSObjectFromArray(JSContext* aCtx, return NS_OK; } -class VisitedQuery final: public AsyncStatementCallback, - public mozIStorageCompletionCallback +class VisitedQuery final : public AsyncStatementCallback, + public mozIStorageCompletionCallback { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/toolkit/components/places/History.h b/toolkit/components/places/History.h index fbaa07b0e3e..4051792a64b 100644 --- a/toolkit/components/places/History.h +++ b/toolkit/components/places/History.h @@ -37,10 +37,10 @@ class ConcurrentStatementsHolder; #define RECENTLY_VISITED_URI_SIZE 8 class History final : public IHistory - , public nsIDownloadHistory - , public mozIAsyncHistory - , public nsIObserver - , public nsIMemoryReporter + , public nsIDownloadHistory + , public mozIAsyncHistory + , public nsIObserver + , public nsIMemoryReporter { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/toolkit/components/places/nsAnnotationService.h b/toolkit/components/places/nsAnnotationService.h index 397d7c688ee..d60113b89b4 100644 --- a/toolkit/components/places/nsAnnotationService.h +++ b/toolkit/components/places/nsAnnotationService.h @@ -44,8 +44,8 @@ private: } // namespace mozilla class nsAnnotationService final : public nsIAnnotationService - , public nsIObserver - , public nsSupportsWeakReference + , public nsIObserver + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/places/nsFaviconService.h b/toolkit/components/places/nsFaviconService.h index 36bf179266f..629a4a2aa5a 100644 --- a/toolkit/components/places/nsFaviconService.h +++ b/toolkit/components/places/nsFaviconService.h @@ -52,8 +52,8 @@ public: }; class nsFaviconService final : public nsIFaviconService - , public mozIAsyncFavicons - , public nsITimerCallback + , public mozIAsyncFavicons + , public nsITimerCallback { public: nsFaviconService(); diff --git a/toolkit/components/places/nsNavBookmarks.h b/toolkit/components/places/nsNavBookmarks.h index 2c2ad2c85be..3db327519c5 100644 --- a/toolkit/components/places/nsNavBookmarks.h +++ b/toolkit/components/places/nsNavBookmarks.h @@ -70,10 +70,10 @@ namespace places { } // namespace mozilla class nsNavBookmarks final : public nsINavBookmarksService - , public nsINavHistoryObserver - , public nsIAnnotationObserver - , public nsIObserver - , public nsSupportsWeakReference + , public nsINavHistoryObserver + , public nsIAnnotationObserver + , public nsIObserver + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index be39bb5e832..d21a5b3b0a3 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -62,11 +62,11 @@ class nsIAutoCompleteController; // nsNavHistory class nsNavHistory final : public nsSupportsWeakReference - , public nsINavHistoryService - , public nsIObserver - , public nsIBrowserHistory - , public nsPIPlacesDatabase - , public mozIStorageVacuumParticipant + , public nsINavHistoryService + , public nsIObserver + , public nsIBrowserHistory + , public nsPIPlacesDatabase + , public mozIStorageVacuumParticipant { friend class PlacesSQLQueryBuilder; diff --git a/toolkit/components/places/nsNavHistoryResult.h b/toolkit/components/places/nsNavHistoryResult.h index 8a351799d9a..5c1d33206f2 100644 --- a/toolkit/components/places/nsNavHistoryResult.h +++ b/toolkit/components/places/nsNavHistoryResult.h @@ -106,9 +106,9 @@ private: { 0x455d1d40, 0x1b9b, 0x40e6, { 0xa6, 0x41, 0x8b, 0xb7, 0xe8, 0x82, 0x23, 0x87 } } class nsNavHistoryResult final : public nsSupportsWeakReference, - public nsINavHistoryResult, - public nsINavBookmarkObserver, - public nsINavHistoryObserver + public nsINavHistoryResult, + public nsINavBookmarkObserver, + public nsINavHistoryObserver { public: static nsresult NewHistoryResult(nsINavHistoryQuery** aQueries, @@ -612,8 +612,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryContainerResultNode, // bookmark notifications. class nsNavHistoryQueryResultNode final : public nsNavHistoryContainerResultNode, - public nsINavHistoryQueryResultNode, - public nsINavBookmarkObserver + public nsINavHistoryQueryResultNode, + public nsINavBookmarkObserver { public: nsNavHistoryQueryResultNode(const nsACString& aTitle, @@ -693,9 +693,9 @@ protected: // of the folder in sync with the bookmark service. class nsNavHistoryFolderResultNode final : public nsNavHistoryContainerResultNode, - public nsINavHistoryQueryResultNode, - public nsINavBookmarkObserver, - public mozilla::places::AsyncStatementCallback + public nsINavHistoryQueryResultNode, + public nsINavBookmarkObserver, + public mozilla::places::AsyncStatementCallback { public: nsNavHistoryFolderResultNode(const nsACString& aTitle, diff --git a/toolkit/components/satchel/nsFormFillController.h b/toolkit/components/satchel/nsFormFillController.h index c9f68a72239..8a732369d44 100644 --- a/toolkit/components/satchel/nsFormFillController.h +++ b/toolkit/components/satchel/nsFormFillController.h @@ -32,11 +32,11 @@ class nsFormHistory; class nsINode; class nsFormFillController final : public nsIFormFillController, - public nsIAutoCompleteInput, - public nsIAutoCompleteSearch, - public nsIDOMEventListener, - public nsIFormAutoCompleteObserver, - public nsIMutationObserver + public nsIAutoCompleteInput, + public nsIAutoCompleteSearch, + public nsIDOMEventListener, + public nsIFormAutoCompleteObserver, + public nsIMutationObserver { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/toolkit/components/startup/nsAppStartup.h b/toolkit/components/startup/nsAppStartup.h index 7b586040cd9..d251b01dbff 100644 --- a/toolkit/components/startup/nsAppStartup.h +++ b/toolkit/components/startup/nsAppStartup.h @@ -30,9 +30,9 @@ struct PLEvent; class nsAppStartup final : public nsIAppStartup, - public nsIWindowCreator2, - public nsIObserver, - public nsSupportsWeakReference + public nsIWindowCreator2, + public nsIObserver, + public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 759cffc1a93..7bfe066ded6 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -738,7 +738,7 @@ nsUrlClassifierDBServiceWorker::OpenDb() // the client callback. class nsUrlClassifierLookupCallback final : public nsIUrlClassifierLookupCallback - , public nsIUrlClassifierHashCompleterCallback + , public nsIUrlClassifierHashCompleterCallback { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.h b/toolkit/components/url-classifier/nsUrlClassifierDBService.h index 4939f36b024..ed91826fcbf 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h @@ -51,8 +51,8 @@ class TableUpdate; // This is a proxy class that just creates a background thread and delagates // calls to the background thread. class nsUrlClassifierDBService final : public nsIUrlClassifierDBService, - public nsIURIClassifier, - public nsIObserver + public nsIURIClassifier, + public nsIObserver { public: // This is thread safe. It throws an exception if the thread is busy. diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h index c568674c2fb..6846b83aa96 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h @@ -21,11 +21,11 @@ class nsIURI; class nsUrlClassifierStreamUpdater final : public nsIUrlClassifierStreamUpdater, - public nsIUrlClassifierUpdateObserver, - public nsIStreamListener, - public nsIObserver, - public nsIInterfaceRequestor, - public nsITimerCallback + public nsIUrlClassifierUpdateObserver, + public nsIStreamListener, + public nsIObserver, + public nsIInterfaceRequestor, + public nsITimerCallback { public: nsUrlClassifierStreamUpdater(); diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/elf_symbols_to_module_unittest.cc b/toolkit/crashreporter/google-breakpad/src/common/linux/elf_symbols_to_module_unittest.cc index 8984449ab65..2f36b739966 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/linux/elf_symbols_to_module_unittest.cc +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/elf_symbols_to_module_unittest.cc @@ -90,7 +90,7 @@ public: }; class ELFSymbolsToModuleTest32 : public ELFSymbolsToModuleTestFixture, - public TestWithParam { + public TestWithParam { public: ELFSymbolsToModuleTest32() : ELFSymbolsToModuleTestFixture(GetParam(), 4) {} diff --git a/toolkit/devtools/server/tests/unit/test_objectgrips-11.js b/toolkit/devtools/server/tests/unit/test_objectgrips-11.js index 95da35414f8..94d594577a9 100644 --- a/toolkit/devtools/server/tests/unit/test_objectgrips-11.js +++ b/toolkit/devtools/server/tests/unit/test_objectgrips-11.js @@ -33,13 +33,12 @@ function test_object_grip() let objClient = gThreadClient.pauseGrip(args[0]); objClient.getOwnPropertyNames(function(aResponse) { var opn = aResponse.ownPropertyNames; - do_check_eq(opn.length, 5); + do_check_eq(opn.length, 4); opn.sort(); do_check_eq(opn[0], "columnNumber"); do_check_eq(opn[1], "fileName"); do_check_eq(opn[2], "lineNumber"); do_check_eq(opn[3], "message"); - do_check_eq(opn[4], "stack"); gThreadClient.resume(function() { finishClient(gClient); diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h index 3944c90a401..1243bebc43d 100644 --- a/toolkit/xre/nsXREDirProvider.h +++ b/toolkit/xre/nsXREDirProvider.h @@ -15,7 +15,7 @@ #include "mozilla/Attributes.h" class nsXREDirProvider final : public nsIDirectoryServiceProvider2, - public nsIProfileStartup + public nsIProfileStartup { public: // we use a custom isupports implementation (no refcount) diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index a8e377d8b3e..85fbbe225fc 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -69,7 +69,7 @@ PRLogModuleInfo* nsURILoader::mLog = nullptr; * (or aborted). */ class nsDocumentOpenInfo final : public nsIStreamListener - , public nsIThreadRetargetableStreamListener + , public nsIThreadRetargetableStreamListener { public: // Needed for nsCOMPtr to work right... Don't call this! diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index a425d47ffcb..511daac8c15 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -202,9 +202,9 @@ private: * data using a helper app. */ class nsExternalAppHandler final : public nsIStreamListener, - public nsIHelperAppLauncher, - public nsITimerCallback, - public nsIBackgroundFileSaverObserver + public nsIHelperAppLauncher, + public nsITimerCallback, + public nsIBackgroundFileSaverObserver { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.h b/uriloader/prefetch/OfflineCacheUpdateGlue.h index f2e41f31d0d..b4a9b96ca93 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.h +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.h @@ -38,8 +38,8 @@ namespace docshell { NS_IMETHOD Cancel() override { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } class OfflineCacheUpdateGlue final : public nsSupportsWeakReference - , public nsIOfflineCacheUpdate - , public nsIOfflineCacheUpdateObserver + , public nsIOfflineCacheUpdate + , public nsIOfflineCacheUpdateObserver { public: NS_DECL_ISUPPORTS diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index cfa609e4d38..b41b6174c0a 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -116,8 +116,8 @@ LogToConsole(const char * message, nsOfflineCacheUpdateItem * item = nullptr) //----------------------------------------------------------------------------- class nsManifestCheck final : public nsIStreamListener - , public nsIChannelEventSink - , public nsIInterfaceRequestor + , public nsIChannelEventSink + , public nsIInterfaceRequestor { public: nsManifestCheck(nsOfflineCacheUpdate *aUpdate, diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.h b/uriloader/prefetch/nsOfflineCacheUpdate.h index ebbe1259d1a..77b169c222e 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.h +++ b/uriloader/prefetch/nsOfflineCacheUpdate.h @@ -194,9 +194,9 @@ public: }; class nsOfflineCacheUpdate final : public nsIOfflineCacheUpdate - , public nsIOfflineCacheUpdateObserver - , public nsIRunnable - , public nsOfflineCacheUpdateOwner + , public nsIOfflineCacheUpdateObserver + , public nsIRunnable + , public nsOfflineCacheUpdateOwner { public: MOZ_DECLARE_REFCOUNTED_TYPENAME(nsOfflineCacheUpdate) @@ -320,9 +320,9 @@ private: }; class nsOfflineCacheUpdateService final : public nsIOfflineCacheUpdateService - , public nsIObserver - , public nsOfflineCacheUpdateOwner - , public nsSupportsWeakReference + , public nsIObserver + , public nsOfflineCacheUpdateOwner + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 717d5b7a9fe..9f4b6f9d2b3 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -126,7 +126,7 @@ GetAppIDAndInBrowserFromWindow(nsIDOMWindow *aWindow, //----------------------------------------------------------------------------- class nsOfflineCachePendingUpdate final : public nsIWebProgressListener - , public nsSupportsWeakReference + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/uriloader/prefetch/nsPrefetchService.h b/uriloader/prefetch/nsPrefetchService.h index 28912ed269b..0ac2636d94e 100644 --- a/uriloader/prefetch/nsPrefetchService.h +++ b/uriloader/prefetch/nsPrefetchService.h @@ -28,9 +28,9 @@ class nsPrefetchNode; //----------------------------------------------------------------------------- class nsPrefetchService final : public nsIPrefetchService - , public nsIWebProgressListener - , public nsIObserver - , public nsSupportsWeakReference + , public nsIWebProgressListener + , public nsIObserver + , public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS @@ -82,9 +82,9 @@ private: //----------------------------------------------------------------------------- class nsPrefetchNode final : public nsIStreamListener - , public nsIInterfaceRequestor - , public nsIChannelEventSink - , public nsIRedirectResultListener + , public nsIInterfaceRequestor + , public nsIChannelEventSink + , public nsIRedirectResultListener { public: NS_DECL_ISUPPORTS diff --git a/widget/android/APZCCallbackHandler.cpp b/widget/android/APZCCallbackHandler.cpp index 0ef8d1f5e02..0cf5b21b7a3 100644 --- a/widget/android/APZCCallbackHandler.cpp +++ b/widget/android/APZCCallbackHandler.cpp @@ -25,13 +25,15 @@ namespace mozilla { namespace widget { namespace android { -StaticRefPtr APZCCallbackHandler::sInstance; +StaticRefPtr APZCCallbackHandler::sInstance; + +NativePanZoomController::GlobalRef APZCCallbackHandler::sNativePanZoomController = nullptr; NativePanZoomController::LocalRef APZCCallbackHandler::SetNativePanZoomController(NativePanZoomController::Param obj) { - NativePanZoomController::LocalRef old = mNativePanZoomController; - mNativePanZoomController = obj; + NativePanZoomController::LocalRef old = sNativePanZoomController; + sNativePanZoomController = obj; return old; } @@ -56,111 +58,6 @@ APZCCallbackHandler::NotifyDefaultPrevented(uint64_t aInputBlockId, } } -nsIDOMWindowUtils* -APZCCallbackHandler::GetDOMWindowUtils() -{ - nsIAndroidBrowserApp* browserApp = nullptr; - if (!nsAppShell::gAppShell) { - return nullptr; - } - nsAppShell::gAppShell->GetBrowserApp(&browserApp); - if (!browserApp) { - return nullptr; - } - nsIBrowserTab* tab = nullptr; - if (browserApp->GetSelectedTab(&tab) != NS_OK) { - return nullptr; - } - nsIDOMWindow* window = nullptr; - if (tab->GetWindow(&window) != NS_OK) { - return nullptr; - } - nsCOMPtr utils = do_GetInterface(window); - return utils.get(); -} - -void -APZCCallbackHandler::RequestContentRepaint(const FrameMetrics& aFrameMetrics) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aFrameMetrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID); - - if (aFrameMetrics.GetIsRoot()) { - nsIDOMWindowUtils* utils = GetDOMWindowUtils(); - if (utils && APZCCallbackHelper::HasValidPresShellId(utils, aFrameMetrics)) { - FrameMetrics metrics = aFrameMetrics; - APZCCallbackHelper::UpdateRootFrame(utils, metrics); - } - } else { - // aFrameMetrics.mIsRoot is false, so we are trying to update a subframe. - // This requires special handling. - nsCOMPtr content = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId()); - if (content) { - FrameMetrics newSubFrameMetrics(aFrameMetrics); - APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics); - } - } -} - -void -APZCCallbackHandler::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId, - const mozilla::CSSPoint& aDestination) -{ - APZCCallbackHelper::RequestFlingSnap(aScrollId, aDestination); -} - -void -APZCCallbackHandler::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, - const uint32_t& aScrollGeneration) -{ - APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration); -} - -void -APZCCallbackHandler::HandleDoubleTap(const CSSPoint& aPoint, - Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) -{ - CSSIntPoint point = RoundedToInt(aPoint); - nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y); - nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent( - NS_LITERAL_CSTRING("Gesture:DoubleTap"), data)); -} - -void -APZCCallbackHandler::HandleSingleTap(const CSSPoint& aPoint, - Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) -{ - // FIXME Send the modifier data to Gecko for use in mouse events. - CSSIntPoint point = RoundedToInt(aPoint); - nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y); - nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent( - NS_LITERAL_CSTRING("Gesture:SingleTap"), data)); -} - -void -APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint, - Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid, - uint64_t aInputBlockId) -{ - // TODO send content response back to APZC - CSSIntPoint point = RoundedToInt(aPoint); - nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y); - nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent( - NS_LITERAL_CSTRING("Gesture:LongPress"), data)); -} - -void -APZCCallbackHandler::SendAsyncScrollDOMEvent(bool aIsRoot, - const CSSRect& aContentRect, - const CSSSize& aScrollableSize) -{ - // no-op, we don't want to support this event on fennec, and we - // want to get rid of this entirely. See bug 898075. -} - void APZCCallbackHandler::PostDelayedTask(Task* aTask, int aDelayMs) { diff --git a/widget/android/APZCCallbackHandler.h b/widget/android/APZCCallbackHandler.h index d47ca83bba8..ca628c33708 100644 --- a/widget/android/APZCCallbackHandler.h +++ b/widget/android/APZCCallbackHandler.h @@ -6,7 +6,8 @@ #ifndef APZCCallbackHandler_h__ #define APZCCallbackHandler_h__ -#include "mozilla/layers/GeckoContentController.h" +#include "mozilla/layers/ChromeProcessController.h" +#include "mozilla/layers/APZEventState.h" #include "mozilla/EventForwards.h" // for Modifiers #include "mozilla/StaticPtr.h" #include "mozilla/TimeStamp.h" @@ -18,45 +19,35 @@ namespace mozilla { namespace widget { namespace android { -class APZCCallbackHandler final : public mozilla::layers::GeckoContentController +class APZCCallbackHandler final : public mozilla::layers::ChromeProcessController { private: static StaticRefPtr sInstance; - NativePanZoomController::GlobalRef mNativePanZoomController; + + static NativePanZoomController::GlobalRef sNativePanZoomController; private: - APZCCallbackHandler() - : mNativePanZoomController(nullptr) + APZCCallbackHandler(nsIWidget* aWidget, mozilla::layers::APZEventState* aAPZEventState) + : mozilla::layers::ChromeProcessController(aWidget, aAPZEventState) {} - nsIDOMWindowUtils* GetDOMWindowUtils(); - public: + static void Initialize(nsIWidget* aWidget, mozilla::layers::APZEventState* aAPZEventState) { + + MOZ_ASSERT(!sInstance.get(), "APZCCallbackHandler.Initialize() got called twice"); + sInstance = new APZCCallbackHandler(aWidget, aAPZEventState); + } + static APZCCallbackHandler* GetInstance() { - if (sInstance.get() == nullptr) { - sInstance = new APZCCallbackHandler(); - } + MOZ_ASSERT(sInstance.get(), "Calling APZCCallbackHandler.GetInstance() before it's initialization"); return sInstance.get(); } - NativePanZoomController::LocalRef SetNativePanZoomController(NativePanZoomController::Param obj); + static NativePanZoomController::LocalRef SetNativePanZoomController(NativePanZoomController::Param obj); void NotifyDefaultPrevented(uint64_t aInputBlockId, bool aDefaultPrevented); -public: // GeckoContentController methods - void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) override; - void RequestFlingSnap(const mozilla::layers::FrameMetrics::ViewID& aScrollId, - const mozilla::CSSPoint& aDestination) override; - void AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::ViewID& aScrollId, - const uint32_t& aScrollGeneration) override; - void HandleDoubleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) override; - void HandleSingleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) override; - void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid, - uint64_t aInputBlockId) override; - void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect& aContentRect, - const mozilla::CSSSize& aScrollableSize) override; +public: // ChromeProcessController methods + void PostDelayedTask(Task* aTask, int aDelayMs) override; }; diff --git a/widget/android/AndroidJNI.cpp b/widget/android/AndroidJNI.cpp index e66874c0135..dbd177df453 100644 --- a/widget/android/AndroidJNI.cpp +++ b/widget/android/AndroidJNI.cpp @@ -903,7 +903,7 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_init(JNIEnv* env, jobject ins const auto& newRef = NativePanZoomController::Ref::From(instance); NativePanZoomController::LocalRef oldRef = - APZCCallbackHandler::GetInstance()->SetNativePanZoomController(newRef); + APZCCallbackHandler::SetNativePanZoomController(newRef); MOZ_ASSERT(!oldRef, "Registering a new NPZC when we already have one"); } @@ -947,7 +947,7 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_destroy(JNIEnv* env, jobject } NativePanZoomController::LocalRef oldRef = - APZCCallbackHandler::GetInstance()->SetNativePanZoomController(nullptr); + APZCCallbackHandler::SetNativePanZoomController(nullptr); MOZ_ASSERT(oldRef, "Clearing a non-existent NPZC"); } diff --git a/widget/android/nsAndroidProtocolHandler.h b/widget/android/nsAndroidProtocolHandler.h index c395fc95683..11705dd0a58 100644 --- a/widget/android/nsAndroidProtocolHandler.h +++ b/widget/android/nsAndroidProtocolHandler.h @@ -19,7 +19,7 @@ } class nsAndroidProtocolHandler final : public nsIProtocolHandler, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: NS_DECL_THREADSAFE_ISUPPORTS diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 796b1394257..33ff6c8d3cf 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -2486,6 +2486,8 @@ nsWindow::ConfigureAPZCTreeManager() already_AddRefed nsWindow::CreateRootContentController() { + widget::android::APZCCallbackHandler::Initialize(this, mAPZEventState); + nsRefPtr controller = widget::android::APZCCallbackHandler::GetInstance(); return controller.forget(); diff --git a/widget/gonk/nativewindow/GonkBufferQueueKK.h b/widget/gonk/nativewindow/GonkBufferQueueKK.h index 0209de02c51..d40e439f3ab 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueKK.h +++ b/widget/gonk/nativewindow/GonkBufferQueueKK.h @@ -37,8 +37,9 @@ namespace android { // ---------------------------------------------------------------------------- class GonkBufferQueue : public BnGraphicBufferProducer, - public BnGonkGraphicBufferConsumer, - private IBinder::DeathRecipient { + public BnGonkGraphicBufferConsumer, + private IBinder::DeathRecipient +{ typedef mozilla::layers::TextureClient TextureClient; public: diff --git a/widget/gtk/nsDragService.h b/widget/gtk/nsDragService.h index b3ab9422ade..35fa40638fb 100644 --- a/widget/gtk/nsDragService.h +++ b/widget/gtk/nsDragService.h @@ -49,7 +49,7 @@ class nsAutoRefTraits : */ class nsDragService final : public nsBaseDragService, - public nsIObserver + public nsIObserver { public: nsDragService(); diff --git a/widget/nsColorPickerProxy.h b/widget/nsColorPickerProxy.h index c166801c2b5..0f3af3793f4 100644 --- a/widget/nsColorPickerProxy.h +++ b/widget/nsColorPickerProxy.h @@ -11,7 +11,7 @@ #include "mozilla/dom/PColorPickerChild.h" class nsColorPickerProxy final : public nsIColorPicker, - public mozilla::dom::PColorPickerChild + public mozilla::dom::PColorPickerChild { public: NS_DECL_ISUPPORTS diff --git a/widget/nsScreenManagerProxy.h b/widget/nsScreenManagerProxy.h index eb9915d6e71..2db660ca741 100644 --- a/widget/nsScreenManagerProxy.h +++ b/widget/nsScreenManagerProxy.h @@ -24,7 +24,7 @@ * loop. */ class nsScreenManagerProxy final : public nsIScreenManager, - public mozilla::dom::PScreenManagerChild + public mozilla::dom::PScreenManagerChild { public: nsScreenManagerProxy(); diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index 83d5394d201..00f85269dac 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -704,7 +704,7 @@ private: /******************************************************************/ class TSFStaticSink final : public ITfActiveLanguageProfileNotifySink - , public ITfInputProcessorProfileActivationSink + , public ITfInputProcessorProfileActivationSink { public: static TSFStaticSink* GetInstance() diff --git a/widget/windows/nsTextStore.h b/widget/windows/nsTextStore.h index 9aacfec823b..88c1c67ef9c 100644 --- a/widget/windows/nsTextStore.h +++ b/widget/windows/nsTextStore.h @@ -54,8 +54,8 @@ struct MSGResult; */ class nsTextStore final : public ITextStoreACP - , public ITfContextOwnerCompositionSink - , public ITfMouseTrackerACP + , public ITfContextOwnerCompositionSink + , public ITfMouseTrackerACP { public: /*IUnknown*/ STDMETHODIMP QueryInterface(REFIID, void**); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 92b38ecb5bf..533e69ebc31 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -4144,8 +4144,8 @@ nsWindow::IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult) void nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam) { - NS_ASSERTION(!mozilla::ipc::MessageChannel::IsPumpingMessages(), - "Failed to prevent a nonqueued message from running!"); + MOZ_ASSERT_IF(msg != WM_GETOBJECT, + !mozilla::ipc::MessageChannel::IsPumpingMessages()); // Modal UI being displayed in windowless plugins. if (mozilla::ipc::MessageChannel::IsSpinLoopActive() && diff --git a/xpcom/base/nsIStatusReporter.idl b/xpcom/base/nsIStatusReporter.idl index e85632d90f5..9f9245f4983 100644 --- a/xpcom/base/nsIStatusReporter.idl +++ b/xpcom/base/nsIStatusReporter.idl @@ -65,15 +65,15 @@ interface nsIStatusReporterManager : nsISupports * Note that this defaults 'process' to "", which is usually what's desired. */ #define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function) \ - class StatusReporter_##_classname final : public nsIStatusReporter { \ + class StatusReporter_##_classname final : public nsIStatusReporter { \ ~StatusReporter_##_classname() {} \ public: \ NS_DECL_ISUPPORTS \ - NS_IMETHOD GetName(nsACString &name) override \ + NS_IMETHOD GetName(nsACString &name) override \ { name.AssignLiteral(_name); return NS_OK; } \ - NS_IMETHOD GetProcess(nsACString &process) override \ + NS_IMETHOD GetProcess(nsACString &process) override \ { process.Truncate(); return NS_OK; } \ - NS_IMETHOD GetDescription(nsACString &desc) override \ + NS_IMETHOD GetDescription(nsACString &desc) override \ { _desc_Function(desc); return NS_OK; } \ }; \ NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter) diff --git a/xpcom/glue/nsCycleCollectionParticipant.h b/xpcom/glue/nsCycleCollectionParticipant.h index 4c6f66842f9..128cf0138c7 100644 --- a/xpcom/glue/nsCycleCollectionParticipant.h +++ b/xpcom/glue/nsCycleCollectionParticipant.h @@ -267,7 +267,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCOMCycleCollectionParticipant, } \ nsresult rv; -#define NS_CYCLE_COLLECTION_UPCAST(obj, clazz) \ +#define NS_CYCLE_COLLECTION_UPCAST(obj, clazz) \ NS_CYCLE_COLLECTION_CLASSNAME(clazz)::Upcast(obj) #ifdef DEBUG @@ -508,8 +508,8 @@ DowncastCCParticipant(void* aPtr) #define NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(_class, _base) \ public: \ NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) \ - override; \ - NS_IMETHOD_(void) DeleteCycleCollectable(void *p) override \ + override; \ + NS_IMETHOD_(void) DeleteCycleCollectable(void *p) override \ { \ DowncastCCParticipant<_class>(p)->DeleteCycleCollectable(); \ } \ @@ -574,9 +574,9 @@ public: : nsXPCOMCycleCollectionParticipant(true) {} \ private: \ NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \ - NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ - NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ - NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ + NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \ }; \ NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class) \ @@ -591,8 +591,7 @@ class NS_CYCLE_COLLECTION_INNERCLASS : public nsXPCOMCycleCollectionParticipant \ { \ NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \ - NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) \ - override; \ + NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) override; \ NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \ }; \ NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class) \ @@ -608,10 +607,10 @@ public: : nsXPCOMCycleCollectionParticipant(true) {} \ private: \ NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \ - NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) override; \ - NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ - NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ - NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ + NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) override; \ + NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ + NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \ }; \ NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class) \ @@ -627,10 +626,10 @@ class NS_CYCLE_COLLECTION_INNERCLASS : public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \ { \ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \ - NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) override; \ - NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ - NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ - NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ + NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) override; \ + NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ + NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \ }; \ NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class) \ @@ -643,7 +642,7 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME; _base_class) \ public: \ NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) \ - override; \ + override; \ static _class* Downcast(nsISupports* s) \ { \ return static_cast<_class*>(static_cast<_base_class*>( \ @@ -684,7 +683,7 @@ class NS_CYCLE_COLLECTION_INNERCLASS { \ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \ NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) \ - override; \ + override; \ NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \ }; \ NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class) \ @@ -694,12 +693,12 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME; #define NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \ public: \ - NS_IMETHOD_(void) Root(void *n) override; \ - NS_IMETHOD_(void) Unlink(void *n) override; \ - NS_IMETHOD_(void) Unroot(void *n) override; \ + NS_IMETHOD_(void) Root(void *n) override; \ + NS_IMETHOD_(void) Unlink(void *n) override; \ + NS_IMETHOD_(void) Unroot(void *n) override; \ NS_IMETHOD Traverse(void *n, nsCycleCollectionTraversalCallback &cb) \ - override; \ - NS_IMETHOD_(void) DeleteCycleCollectable(void *n) override \ + override; \ + NS_IMETHOD_(void) DeleteCycleCollectable(void *n) override \ { \ DowncastCCParticipant<_class>(n)->DeleteCycleCollectable(); \ } \ @@ -741,9 +740,9 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME; : nsCycleCollectionParticipant(true) {} \ private: \ NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \ - NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override;\ - NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ - NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ + NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ static nsCycleCollectionParticipant* GetParticipant() \ { \ return &_class::NS_CYCLE_COLLECTION_INNERNAME; \ @@ -760,9 +759,9 @@ public: \ : nsCycleCollectionParticipant(true) {} \ private: \ NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \ - NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ - NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ - NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed) override; \ + NS_IMETHOD_(bool) CanSkipInCCReal(void *p) override; \ + NS_IMETHOD_(bool) CanSkipThisReal(void *p) override; \ static nsCycleCollectionParticipant* GetParticipant() \ { \ return &_class::NS_CYCLE_COLLECTION_INNERNAME; \ @@ -780,7 +779,7 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME; { \ NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \ NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure) \ - override; \ + override; \ static MOZ_CONSTEXPR nsScriptObjectTracer* GetParticipant() \ { \ return &_class::NS_CYCLE_COLLECTION_INNERNAME; \ diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index 8bd3f2e7c01..c44d1db8e1b 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -385,9 +385,9 @@ private: #define NS_DECL_ISUPPORTS \ public: \ NS_IMETHOD QueryInterface(REFNSIID aIID, \ - void** aInstancePtr) override; \ - NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ - NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ + void** aInstancePtr) override; \ + NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ + NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ protected: \ nsAutoRefCnt mRefCnt; \ NS_DECL_OWNINGTHREAD \ @@ -396,9 +396,9 @@ public: #define NS_DECL_THREADSAFE_ISUPPORTS \ public: \ NS_IMETHOD QueryInterface(REFNSIID aIID, \ - void** aInstancePtr) override; \ - NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ - NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ + void** aInstancePtr) override; \ + NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ + NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ protected: \ ::mozilla::ThreadSafeAutoRefCnt mRefCnt; \ NS_DECL_OWNINGTHREAD \ @@ -407,9 +407,9 @@ public: #define NS_DECL_CYCLE_COLLECTING_ISUPPORTS \ public: \ NS_IMETHOD QueryInterface(REFNSIID aIID, \ - void** aInstancePtr) override; \ - NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ - NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ + void** aInstancePtr) override; \ + NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override; \ + NS_IMETHOD_(MozExternalRefCountType) Release(void) override; \ NS_IMETHOD_(void) DeleteCycleCollectable(void); \ protected: \ nsCycleCollectingAutoRefCnt mRefCnt; \ diff --git a/xpcom/io/SnappyCompressOutputStream.h b/xpcom/io/SnappyCompressOutputStream.h index 98f51c544ee..36c47e66e35 100644 --- a/xpcom/io/SnappyCompressOutputStream.h +++ b/xpcom/io/SnappyCompressOutputStream.h @@ -17,7 +17,7 @@ namespace mozilla { class SnappyCompressOutputStream final : public nsIOutputStream - , protected detail::SnappyFrameUtils + , protected detail::SnappyFrameUtils { public: // Maximum compression block size. diff --git a/xpcom/io/SnappyUncompressInputStream.h b/xpcom/io/SnappyUncompressInputStream.h index 60e4afdd341..0d24c0d1157 100644 --- a/xpcom/io/SnappyUncompressInputStream.h +++ b/xpcom/io/SnappyUncompressInputStream.h @@ -17,7 +17,7 @@ namespace mozilla { class SnappyUncompressInputStream final : public nsIInputStream - , protected detail::SnappyFrameUtils + , protected detail::SnappyFrameUtils { public: // Construct a new blocking stream to uncompress the given base stream. The diff --git a/xpcom/tests/TestCallTemplates.cpp b/xpcom/tests/TestCallTemplates.cpp index 65d46a0e100..9d55ecad1eb 100644 --- a/xpcom/tests/TestCallTemplates.cpp +++ b/xpcom/tests/TestCallTemplates.cpp @@ -34,7 +34,7 @@ class NS_NO_VTABLE nsITestService : public nsISupports { NS_DEFINE_STATIC_IID_ACCESSOR(nsITestService, NS_ITESTSERVICE_IID) class nsTestService final : public nsITestService, - public nsSupportsWeakReference + public nsSupportsWeakReference { ~nsTestService() {} public: diff --git a/xpcom/tests/TestObserverService.cpp b/xpcom/tests/TestObserverService.cpp index 374868526a9..213d116bf5f 100644 --- a/xpcom/tests/TestObserverService.cpp +++ b/xpcom/tests/TestObserverService.cpp @@ -31,7 +31,7 @@ void printString(nsString &str) { } class TestObserver final : public nsIObserver, - public nsSupportsWeakReference + public nsSupportsWeakReference { public: explicit TestObserver( const nsAString &name ) diff --git a/xpfe/appshell/nsAppShellService.cpp b/xpfe/appshell/nsAppShellService.cpp index fb95243d59e..0b52f29f426 100644 --- a/xpfe/appshell/nsAppShellService.cpp +++ b/xpfe/appshell/nsAppShellService.cpp @@ -322,7 +322,8 @@ WebBrowserChrome2Stub::GetInterface(const nsIID & aIID, void **aSink) // purely to keep a strong reference to the browser and the container to // prevent the container being collected while the stub remains alive. class WindowlessBrowserStub final : public nsIWebNavigation, - public nsIInterfaceRequestor { + public nsIInterfaceRequestor +{ public: WindowlessBrowserStub(nsIWebBrowser *aBrowser, nsISupports *aContainer) { mBrowser = aBrowser; diff --git a/xpfe/appshell/nsAppShellService.h b/xpfe/appshell/nsAppShellService.h index 9afca13f0fb..389b1a75abe 100644 --- a/xpfe/appshell/nsAppShellService.h +++ b/xpfe/appshell/nsAppShellService.h @@ -21,7 +21,7 @@ { 0x99907d, 0x123c, 0x4853, { 0xa4, 0x6a, 0x43, 0x9, 0x8b, 0x5f, 0xb6, 0x8c } } class nsAppShellService final : public nsIAppShellService, - public nsIObserver + public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/xpfe/appshell/nsContentTreeOwner.h b/xpfe/appshell/nsContentTreeOwner.h index dcad42617f8..d6a0d42b3dd 100644 --- a/xpfe/appshell/nsContentTreeOwner.h +++ b/xpfe/appshell/nsContentTreeOwner.h @@ -23,10 +23,10 @@ class nsXULWindow; class nsSiteWindow; class nsContentTreeOwner final : public nsIDocShellTreeOwner, - public nsIBaseWindow, - public nsIInterfaceRequestor, - public nsIWebBrowserChrome3, - public nsIWindowProvider + public nsIBaseWindow, + public nsIInterfaceRequestor, + public nsIWebBrowserChrome3, + public nsIWindowProvider { friend class nsXULWindow; friend class nsSiteWindow; diff --git a/xpfe/appshell/nsWebShellWindow.h b/xpfe/appshell/nsWebShellWindow.h index 8ae2f201965..65e1d3d3d10 100644 --- a/xpfe/appshell/nsWebShellWindow.h +++ b/xpfe/appshell/nsWebShellWindow.h @@ -24,8 +24,8 @@ class WebShellWindowTimerCallback; } // namespace mozilla class nsWebShellWindow final : public nsXULWindow, - public nsIWebProgressListener, - public nsIWidgetListener + public nsIWebProgressListener, + public nsIWidgetListener { public: explicit nsWebShellWindow(uint32_t aChromeFlags); diff --git a/xpfe/components/directory/nsDirectoryViewer.h b/xpfe/components/directory/nsDirectoryViewer.h index dea0b0318aa..4a3b5eb601e 100644 --- a/xpfe/components/directory/nsDirectoryViewer.h +++ b/xpfe/components/directory/nsDirectoryViewer.h @@ -35,11 +35,11 @@ protected: }; class nsHTTPIndex final : public nsIHTTPIndex, - public nsIRDFDataSource, - public nsIStreamListener, - public nsIDirIndexListener, - public nsIInterfaceRequestor, - public nsIFTPEventSink + public nsIRDFDataSource, + public nsIStreamListener, + public nsIDirIndexListener, + public nsIInterfaceRequestor, + public nsIFTPEventSink { private: diff --git a/xpfe/components/windowds/nsWindowDataSource.h b/xpfe/components/windowds/nsWindowDataSource.h index f499c9bef6c..351ff951b1e 100644 --- a/xpfe/components/windowds/nsWindowDataSource.h +++ b/xpfe/components/windowds/nsWindowDataSource.h @@ -21,9 +21,9 @@ class nsWindowDataSource final : public nsIRDFDataSource, - public nsIObserver, - public nsIWindowMediatorListener, - public nsIWindowDataSource + public nsIObserver, + public nsIWindowMediatorListener, + public nsIWindowDataSource { public: nsWindowDataSource() { }