From 5da8aef683cda79615dd1fb01c1a4bf4b5b79694 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Fri, 18 Oct 2013 17:22:05 -0400 Subject: [PATCH 01/48] Bug 928221 r=jesup, abr --- dom/media/PeerConnection.js | 15 +++++++++ dom/webidl/PeerConnectionObserver.webidl | 5 +++ .../src/peerconnection/PeerConnectionImpl.cpp | 33 +++++++++++++++---- .../src/peerconnection/PeerConnectionImpl.h | 27 ++++++--------- media/webrtc/signaling/test/FakePCObserver.h | 3 +- .../signaling/test/signaling_unittests.cpp | 2 +- 6 files changed, 59 insertions(+), 26 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index f8595d68e1a..bf269c34f05 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -891,6 +891,7 @@ RTCError.prototype = { // This is a separate object because we don't want to expose it to DOM. function PeerConnectionObserver() { this._dompc = null; + this._guard = new WeakReferent(this); } PeerConnectionObserver.prototype = { classDescription: "PeerConnectionObserver", @@ -1192,9 +1193,23 @@ PeerConnectionObserver.prototype = { getSupportedConstraints: function(dict) { return dict; + }, + + get weakReferent() { + return this._guard; } }; +// A PeerConnectionObserver member that c++ can do weak references on + +function WeakReferent(parent) { + this._parent = parent; // prevents parent from going away without us +} +WeakReferent.prototype = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, + Ci.nsISupportsWeakReference]), +}; + this.NSGetFactory = XPCOMUtils.generateNSGetFactory( [GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection, RTCStatsReport, PeerConnectionObserver] diff --git a/dom/webidl/PeerConnectionObserver.webidl b/dom/webidl/PeerConnectionObserver.webidl index 162ff8b4c08..a8bdbd73bfe 100644 --- a/dom/webidl/PeerConnectionObserver.webidl +++ b/dom/webidl/PeerConnectionObserver.webidl @@ -4,6 +4,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ +interface nsISupports; + [ChromeOnly, JSImplementation="@mozilla.org/dom/peerconnectionobserver;1", Constructor (object domPC)] @@ -40,6 +42,9 @@ interface PeerConnectionObserver void onAddTrack(); void onRemoveTrack(); + /* Used by c++ to know when Observer goes away */ + readonly attribute nsISupports weakReferent; + /* Helper function to access supported constraints defined in webidl. Needs to * be in a separate webidl object we hold, so putting it here was convenient. */ diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 5f17923913c..4b4a185c84c 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -655,7 +655,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver, MOZ_ASSERT(aThread); mThread = do_QueryInterface(aThread); - mPCObserver.Init(&aObserver); + mPCObserver.Set(&aObserver); // Find the STS thread @@ -1383,12 +1383,6 @@ PeerConnectionImpl::CloseInt() { PC_AUTO_ENTER_API_CALL_NO_CHECK(); - // Clear raw pointer to observer since PeerConnection.js does not guarantee - // the observer's existence past Close(). - // - // Any outstanding runnables hold RefPtr<> references to observer. - mPCObserver.Close(); - if (mInternal->mCall) { CSFLogInfo(logTag, "%s: Closing PeerConnectionImpl %s; " "ending call", __FUNCTION__, mHandle.c_str()); @@ -1762,5 +1756,30 @@ PeerConnectionImpl::GetRemoteStreams(nsTArray #endif } +// WeakConcretePtr gets around WeakPtr not working on concrete types by using +// the attribute getWeakReferent, a member that supports weak refs, as a guard. + +void +PeerConnectionImpl::WeakConcretePtr::Set(PeerConnectionObserver *aObserver) { + mObserver = aObserver; +#ifdef MOZILLA_INTERNAL_API + MOZ_ASSERT(NS_IsMainThread()); + JSErrorResult rv; + nsCOMPtr tmp = aObserver->GetWeakReferent(rv); + MOZ_ASSERT(!rv.Failed()); + mWeakPtr = do_GetWeakReference(tmp); +#else + mWeakPtr = do_GetWeakReference(aObserver); +#endif +} + +PeerConnectionObserver * +PeerConnectionImpl::WeakConcretePtr::MayGet() { +#ifdef MOZILLA_INTERNAL_API + MOZ_ASSERT(NS_IsMainThread()); +#endif + nsCOMPtr guard = do_QueryReferent(mWeakPtr); + return (!guard) ? nullptr : mObserver; +} } // end sipcc namespace diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 237ba93d51d..de8fef6eb12 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -12,6 +12,9 @@ #include "prlock.h" #include "mozilla/RefPtr.h" +#include "nsWeakPtr.h" +#include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr +#include "IPeerConnection.h" #include "sigslot.h" #include "nricectx.h" #include "nricemediastream.h" @@ -502,29 +505,19 @@ private: mozilla::dom::PCImplIceState mIceState; nsCOMPtr mThread; - // We hold a raw pointer to PeerConnectionObserver (no WeakRefs to concretes!) - // which is an invariant guaranteed to exist between Initialize() and Close(). - // We explicitly clear it in Close(). We wrap it in a helper, to encourage - // testing against nullptr before use. Use in Runnables requires wrapping - // access in RefPtr<> since they may execute after close. This is only safe - // to use on the main thread + // WeakConcretePtr to PeerConnectionObserver. TODO: Remove after bug 928535 // + // This is only safe to use on the main thread // TODO: Remove if we ever properly wire PeerConnection for cycle-collection. - class WeakReminder + class WeakConcretePtr { public: - WeakReminder() : mObserver(nullptr) {} - void Init(PeerConnectionObserver *aObserver) { - mObserver = aObserver; - } - void Close() { - mObserver = nullptr; - } - PeerConnectionObserver *MayGet() { - return mObserver; - } + WeakConcretePtr() : mObserver(nullptr) {} + void Set(PeerConnectionObserver *aObserver); + PeerConnectionObserver *MayGet(); private: PeerConnectionObserver *mObserver; + nsWeakPtr mWeakPtr; } mPCObserver; nsCOMPtr mWindow; diff --git a/media/webrtc/signaling/test/FakePCObserver.h b/media/webrtc/signaling/test/FakePCObserver.h index 54761a1c8cd..ddb42734168 100644 --- a/media/webrtc/signaling/test/FakePCObserver.h +++ b/media/webrtc/signaling/test/FakePCObserver.h @@ -21,6 +21,7 @@ #include "nsIDOMMediaStream.h" #include "mozilla/dom/PeerConnectionObserverEnumsBinding.h" #include "PeerConnectionImpl.h" +#include "nsWeakReference.h" namespace sipcc { class PeerConnectionImpl; @@ -32,7 +33,7 @@ class nsIDOMDataChannel; namespace test { using namespace mozilla::dom; -class AFakePCObserver : public nsISupports +class AFakePCObserver : public nsSupportsWeakReference { protected: typedef mozilla::ErrorResult ER; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 8122decd5dc..be6e9a6ea66 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -273,7 +273,7 @@ public: NS_IMETHODIMP OnIceCandidate(uint16_t level, const char *mid, const char *cand, ER&); }; -NS_IMPL_ISUPPORTS0(TestObserver) +NS_IMPL_ISUPPORTS1(TestObserver, nsISupportsWeakReference) NS_IMETHODIMP TestObserver::OnCreateOfferSuccess(const char* offer, ER&) From 84881097e7324eaac9bcb249ed2c73919bbb1365 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Sat, 19 Oct 2013 12:30:32 +0200 Subject: [PATCH 02/48] Bug 928367 - Preload ErrorPage.js in dom/ipc/preload.js. r=fabrice --- b2g/components/ErrorPage.jsm | 6 +++++- dom/browser-element/BrowserElementChild.js | 3 ++- dom/ipc/preload.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/b2g/components/ErrorPage.jsm b/b2g/components/ErrorPage.jsm index 60f2f97312f..8b6c2985e63 100644 --- a/b2g/components/ErrorPage.jsm +++ b/b2g/components/ErrorPage.jsm @@ -157,8 +157,12 @@ let ErrorPage = { observe: function errorPageObserve(aSubject, aTopic, aData) { let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader); let mm = frameLoader.messageManager; + + // This won't happen from dom/ipc/preload.js in non-OOP builds. try { - mm.loadFrameScript(kErrorPageFrameScript, true); + if (Services.prefs.getBoolPref("dom.ipc.tabs.disabled") === true) { + mm.loadFrameScript(kErrorPageFrameScript, true); + } } catch (e) { dump('Error loading ' + kErrorPageFrameScript + ' as frame script: ' + e + '\n'); } diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 0b87347aa13..3020e8aa99d 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -24,9 +24,10 @@ docShell.setFullscreenAllowed(infos.fullscreenAllowed); if (!('BrowserElementIsPreloaded' in this)) { - // This is a produc-specific file that's sometimes unavailable. + // Those are produc-specific files that's sometimes unavailable. try { Services.scriptloader.loadSubScript("chrome://browser/content/forms.js"); + Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js"); } catch (e) { } Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js"); diff --git a/dom/ipc/preload.js b/dom/ipc/preload.js index 15315ac94bb..337c7664f15 100644 --- a/dom/ipc/preload.js +++ b/dom/ipc/preload.js @@ -91,9 +91,10 @@ const BrowserElementIsPreloaded = true; } catch(e) { } - // This is a produc-specific file that's sometimes unavailable. + // Those are produc-specific files that's sometimes unavailable. try { Services.scriptloader.loadSubScript("chrome://browser/content/forms.js", global); + Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js", global); } catch (e) { } Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js", global); From eae8198829b82a5a45538561290dcea042d5c59b Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Sat, 19 Oct 2013 12:30:33 +0200 Subject: [PATCH 03/48] Bug 928405 - Reset :hover state when the application is sent to the background. r=fabrice --- .../BrowserElementChildPreload.js | 2 ++ dom/browser-element/BrowserElementPanning.js | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index 7682b74e841..b7b57c8f3a9 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -320,6 +320,8 @@ BrowserElementChild.prototype = { let returnValue = this._waitForResult(win); + Services.obs.notifyObservers(null, 'BEC:ShownModalPrompt', null); + if (args.promptType == 'prompt' || args.promptType == 'confirm' || args.promptType == 'custom-prompt') { diff --git a/dom/browser-element/BrowserElementPanning.js b/dom/browser-element/BrowserElementPanning.js index 90c5067be99..26accaf8326 100644 --- a/dom/browser-element/BrowserElementPanning.js +++ b/dom/browser-element/BrowserElementPanning.js @@ -63,6 +63,8 @@ const ContentPanning = { addMessageListener("Viewport:Change", this._recvViewportChange.bind(this)); addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this)); + addEventListener("visibilitychange", this._recvVisibilityChange.bind(this)); + Services.obs.addObserver(this, "BEC:ShownModalPrompt", false); }, handleEvent: function cp_handleEvent(evt) { @@ -110,6 +112,12 @@ const ContentPanning = { } }, + observe: function cp_observe(subject, topic, data) { + if (topic === 'BEC:ShownModalPrompt') { + this._resetHover(); + } + }, + position: new Point(0 , 0), findPrimaryPointer: function cp_findPrimaryPointer(touches) { @@ -496,6 +504,12 @@ const ContentPanning = { this._setActive(root.documentElement); }, + _resetHover: function cp_resetHover() { + const kStateHover = 0x00000004; + let element = content.document.createElement('foo'); + this._domUtils.setContentState(element, kStateHover); + }, + _setActive: function cp_setActive(elt) { const kStateActive = 0x00000001; this._domUtils.setContentState(elt, kStateActive); @@ -581,6 +595,13 @@ const ContentPanning = { } }, + _recvVisibilityChange: function(evt) { + if (!evt.target.hidden) + return; + + this._resetHover(); + }, + _shouldZoomToElement: function(aElement) { let win = aElement.ownerDocument.defaultView; if (win.getComputedStyle(aElement, null).display == "inline") From 9b273bc67e527631170f9a6aa6783ea80d862587 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Sat, 19 Oct 2013 14:04:43 +0200 Subject: [PATCH 04/48] Bug 928541: Drop unused variable 'cairoFormat' from MediaEngineTabVideoSource::Draw(). r=blassey --- content/media/webrtc/MediaEngineTabVideoSource.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index 530e5fe9e2f..f8274432973 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -256,7 +256,6 @@ MediaEngineTabVideoSource::Draw() { cairoData.mSurface = surf; cairoData.mSize = size; - ImageFormat cairoFormat = CAIRO_SURFACE; nsRefPtr image = new layers::CairoImage(); image->SetData(cairoData); From cbdde780a55d91c795c173b47fe44732e3df6fad Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:49 -0400 Subject: [PATCH 05/48] Bug 928091 follow-up: Rewrite the comment in English --HG-- extra : rebase_source : 9b8c45128f10aa00e0a8e1ab17156c2a42e812db --- mfbt/Char16.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mfbt/Char16.h b/mfbt/Char16.h index 2d342f933ef..fb182dfde20 100644 --- a/mfbt/Char16.h +++ b/mfbt/Char16.h @@ -22,7 +22,7 @@ * typedefs char16_t as an unsigned short. We would like to alias char16_t * to Windows's 16-bit wchar_t so we can declare UTF-16 literals as constant * expressions (and pass char16_t pointers to Windows APIs). We #define - * _CHAR16T here in order to prevent yvals.h to override our char16_t + * _CHAR16T here in order to prevent yvals.h from overriding our char16_t * typedefs, which we set to wchar_t for C++ code and to unsigned short for * C code. * From 482353a1227a406701fe668d5029ddb235d20ce1 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:56 -0400 Subject: [PATCH 06/48] Bug 928038 - Remove some prtypes.h inclusions from xulrunner/; r=bsmedberg --HG-- extra : rebase_source : 719d16cf540ddf0a28d74651fbd772881f41e16a --- xulrunner/stub/nsXULStub.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/xulrunner/stub/nsXULStub.cpp b/xulrunner/stub/nsXULStub.cpp index 80221d75d05..54ca21b0356 100644 --- a/xulrunner/stub/nsXULStub.cpp +++ b/xulrunner/stub/nsXULStub.cpp @@ -4,7 +4,6 @@ #include "nsXPCOMGlue.h" #include "nsINIParser.h" -#include "prtypes.h" #include "nsXPCOMPrivate.h" // for XP MAXPATHLEN #include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsXULAppAPI.h" From b02212d91b229bb5fb2a1187c681a81d970b82ab Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:57 -0400 Subject: [PATCH 07/48] Bug 928040 - Remove some prtypes.h inclusions from xpcom/; r=bsmedberg --HG-- extra : rebase_source : 2f238320ba8330a27aa986af1146446dcb5d7128 --- xpcom/glue/nsTextFormatter.h | 1 - xpcom/io/nsEscape.h | 1 - xpcom/io/nsWildCard.h | 1 - xpcom/tests/TestPRIntN.cpp | 1 - xpcom/threads/nsProcessCommon.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/xpcom/glue/nsTextFormatter.h b/xpcom/glue/nsTextFormatter.h index 756c4acab2e..89cc31192e3 100644 --- a/xpcom/glue/nsTextFormatter.h +++ b/xpcom/glue/nsTextFormatter.h @@ -29,7 +29,6 @@ ** %f - float ** %g - float */ -#include "prtypes.h" #include "prio.h" #include #include diff --git a/xpcom/io/nsEscape.h b/xpcom/io/nsEscape.h index e66ac28f6d2..a734bce6ccb 100644 --- a/xpcom/io/nsEscape.h +++ b/xpcom/io/nsEscape.h @@ -8,7 +8,6 @@ #ifndef _ESCAPE_H_ #define _ESCAPE_H_ -#include "prtypes.h" #include "nscore.h" #include "nsError.h" #include "nsString.h" diff --git a/xpcom/io/nsWildCard.h b/xpcom/io/nsWildCard.h index ef6fd349d34..85bff098f0c 100644 --- a/xpcom/io/nsWildCard.h +++ b/xpcom/io/nsWildCard.h @@ -20,7 +20,6 @@ #ifndef nsWildCard_h__ #define nsWildCard_h__ -#include "prtypes.h" #include "nscore.h" /* --------------------------- Public routines ---------------------------- */ diff --git a/xpcom/tests/TestPRIntN.cpp b/xpcom/tests/TestPRIntN.cpp index 7648decbadc..afc155d702b 100644 --- a/xpcom/tests/TestPRIntN.cpp +++ b/xpcom/tests/TestPRIntN.cpp @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include - #include "prtypes.h" // This test is NOT intended to be run. It's a test to make sure diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index ae5ce38e613..8a6345d11d3 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -17,7 +17,6 @@ #include "nsAutoPtr.h" #include "nsMemory.h" #include "nsProcess.h" -#include "prtypes.h" #include "prio.h" #include "prenv.h" #include "nsCRT.h" From 4a6090fdcb27ff93c3ffd9613d47452f72568586 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:57 -0400 Subject: [PATCH 08/48] Bug 928434 - Fix the invalid format string in nsMemoryImpl::IsLowMemoryPlatform; r=bsmedgerg --HG-- extra : rebase_source : 115fb93cb90a2004168032a4ad1d998a5dfb192d --- xpcom/base/nsMemoryImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index ac33c812055..f8b9bfc5a23 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -74,7 +74,7 @@ nsMemoryImpl::IsLowMemoryPlatform(bool *result) return NS_OK; } uint64_t mem = 0; - int rv = fscanf(fd, "MemTotal: %lu kB", &mem); + int rv = fscanf(fd, "MemTotal: %llu kB", &mem); if (fclose(fd)) { return NS_OK; } From 2e5ba6abd09423aeed9c2313ab3a87054401ac56 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:57 -0400 Subject: [PATCH 09/48] Bug 928046 - Remove the prtypes.h inclusion from rdfutil.h; r=bsmedberg --HG-- extra : rebase_source : 196e5fee3215a32e7a13e1507fdc81ead89e72da --- rdf/base/src/rdfutil.h | 1 - 1 file changed, 1 deletion(-) diff --git a/rdf/base/src/rdfutil.h b/rdf/base/src/rdfutil.h index 80657e8ebd9..284f8e57ae5 100644 --- a/rdf/base/src/rdfutil.h +++ b/rdf/base/src/rdfutil.h @@ -22,7 +22,6 @@ #ifndef rdfutil_h__ #define rdfutil_h__ -#include "prtypes.h" class nsACString; class nsCString; From 12d800543c70668b751eec80874403ff93060ff4 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:57 -0400 Subject: [PATCH 10/48] Bug 928043 - Remove some prtypes.h inclusions from startupcache/, testing/ and toolkit/; r=bsmedberg --HG-- extra : rebase_source : 5886932dda22ae179e8998ad92758e99495d09bd --- startupcache/StartupCache.cpp | 1 - testing/mochitest/ssltunnel/ssltunnel.cpp | 1 - toolkit/components/ctypes/tests/jsctypes-test-errno.h | 1 - toolkit/components/ctypes/tests/jsctypes-test.h | 1 - toolkit/components/places/nsPlacesMacros.h | 1 - 5 files changed, 5 deletions(-) diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 6cbf435dc97..524499836a7 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "prio.h" -#include "prtypes.h" #include "pldhash.h" #include "nsXPCOMStrings.h" #include "mozilla/MemoryReporting.h" diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp index 6c36fa269e3..3b58a205fa3 100644 --- a/testing/mochitest/ssltunnel/ssltunnel.cpp +++ b/testing/mochitest/ssltunnel/ssltunnel.cpp @@ -24,7 +24,6 @@ #include "prenv.h" #include "prnetdb.h" #include "prtpool.h" -#include "prtypes.h" #include "nsAlgorithm.h" #include "nss.h" #include "key.h" diff --git a/toolkit/components/ctypes/tests/jsctypes-test-errno.h b/toolkit/components/ctypes/tests/jsctypes-test-errno.h index 23762f7a628..adcd9bede01 100644 --- a/toolkit/components/ctypes/tests/jsctypes-test-errno.h +++ b/toolkit/components/ctypes/tests/jsctypes-test-errno.h @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nscore.h" -#include "prtypes.h" #define EXPORT_CDECL(type) NS_EXPORT type #define EXPORT_STDCALL(type) NS_EXPORT type NS_STDCALL diff --git a/toolkit/components/ctypes/tests/jsctypes-test.h b/toolkit/components/ctypes/tests/jsctypes-test.h index 6f1f5e8fd86..117c3b0650f 100644 --- a/toolkit/components/ctypes/tests/jsctypes-test.h +++ b/toolkit/components/ctypes/tests/jsctypes-test.h @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nscore.h" -#include "prtypes.h" #include "jspubtd.h" #define EXPORT_CDECL(type) NS_EXPORT type diff --git a/toolkit/components/places/nsPlacesMacros.h b/toolkit/components/places/nsPlacesMacros.h index af1306082c1..30bcbed1abb 100644 --- a/toolkit/components/places/nsPlacesMacros.h +++ b/toolkit/components/places/nsPlacesMacros.h @@ -3,7 +3,6 @@ * 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 "prtypes.h" #include "nsIConsoleService.h" #include "nsIScriptError.h" From 7c117780ed0aeded2a81705d2100fcd3f9f3e53d Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:57 -0400 Subject: [PATCH 11/48] Bug 928054 - Remove the prtypes.h #include from SVGPathSegUtils.h; rs=bsmedberg --HG-- extra : rebase_source : 874584d4f67570dcfd2fd120a89688cbd29b4330 --- content/svg/content/src/SVGPathSegUtils.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/content/svg/content/src/SVGPathSegUtils.h b/content/svg/content/src/SVGPathSegUtils.h index d75f8ae2e08..f386dd4b8ed 100644 --- a/content/svg/content/src/SVGPathSegUtils.h +++ b/content/svg/content/src/SVGPathSegUtils.h @@ -9,7 +9,6 @@ #include "gfxPoint.h" #include "nsDebug.h" #include "nsMemory.h" -#include "prtypes.h" namespace mozilla { @@ -113,13 +112,13 @@ public: * can simply do a bitwise uint32_t<->float copy. */ static float EncodeType(uint32_t aType) { - PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float)); + static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); return *(reinterpret_cast(&aType)); } static uint32_t DecodeType(float aType) { - PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float)); + static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); uint32_t type = *(reinterpret_cast(&aType)); NS_ABORT_IF_FALSE(IsValidType(type), "Seg type not recognized"); return type; @@ -150,7 +149,7 @@ public: PRUnichar('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS PRUnichar('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; - PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT); + static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); return table[aType]; } @@ -180,7 +179,7 @@ public: 2, // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS 2 // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; - PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT); + static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); return table[aType]; } @@ -222,8 +221,8 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType >= PATHSEG_MOVETO_ABS; } @@ -235,8 +234,8 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType & 1; } @@ -248,8 +247,8 @@ public: // When adding a new path segment type, ensure that the returned condition // below is still correct. - PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE == - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); + static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, + "Unexpected type"); return aType | 1; } From 0d9df20b904e429e8ef0811d6bc4f662750c2c4a Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:58 -0400 Subject: [PATCH 12/48] Bug 928053 - Remove some prtypes.h inclusions from gfx/; rs=bsmedberg --HG-- extra : rebase_source : 229c47dfa11d1b1d36663daf87285ccd40bcc856 --- gfx/layers/opengl/CompositorOGL.cpp | 1 - gfx/src/nsColor.h | 1 - gfx/src/nsFont.cpp | 1 - gfx/src/nsRect.cpp | 1 - gfx/thebes/gfxPangoFonts.cpp | 1 - gfx/thebes/gfxScriptItemizer.h | 1 - gfx/thebes/gfxUniscribeShaper.cpp | 1 - gfx/thebes/gfxUniscribeShaper.h | 1 - 8 files changed, 8 deletions(-) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index b2b12cc4afd..a2da6047ba3 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -39,7 +39,6 @@ #include "nsRect.h" // for nsIntRect #include "nsServiceManagerUtils.h" // for do_GetService #include "nsString.h" // for nsString, nsAutoCString, etc -#include "prtypes.h" // for PR_INT32_MAX #if MOZ_ANDROID_OMTC #include "TexturePoolOGL.h" diff --git a/gfx/src/nsColor.h b/gfx/src/nsColor.h index bcae9761f1a..a93fabcba0b 100644 --- a/gfx/src/nsColor.h +++ b/gfx/src/nsColor.h @@ -10,7 +10,6 @@ #include // for uint8_t, uint32_t #include "gfxCore.h" // for NS_GFX_ #include "nscore.h" // for nsAString -#include "prtypes.h" // for PR_BEGIN_MACRO, etc class nsAString; class nsString; diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index 351f1f39a41..bcb58374fb4 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -14,7 +14,6 @@ #include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsUnicharUtils.h" #include "nscore.h" // for PRUnichar -#include "prtypes.h" // for PR_STATIC_ASSERT #include "mozilla/gfx/2D.h" nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant, diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 84abd72d8f3..c38ae073404 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -7,7 +7,6 @@ #include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc #include "nsDeviceContext.h" // for nsDeviceContext #include "nsString.h" // for nsAutoString, etc -#include "prtypes.h" // for PR_STATIC_ASSERT #include "nsMargin.h" // for nsMargin // the mozilla::css::Side sequence must match the nsMargin nscoord sequence diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp index 214045b9a26..94820f132f4 100644 --- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -5,7 +5,6 @@ #include "mozilla/Util.h" -#include "prtypes.h" #include "prlink.h" #include "gfxTypes.h" diff --git a/gfx/thebes/gfxScriptItemizer.h b/gfx/thebes/gfxScriptItemizer.h index 3f48143ef35..618cfbb0766 100644 --- a/gfx/thebes/gfxScriptItemizer.h +++ b/gfx/thebes/gfxScriptItemizer.h @@ -51,7 +51,6 @@ #define GFX_SCRIPTITEMIZER_H #include -#include "prtypes.h" #include "nsUnicodeScriptCodes.h" #define PAREN_STACK_DEPTH 32 diff --git a/gfx/thebes/gfxUniscribeShaper.cpp b/gfx/thebes/gfxUniscribeShaper.cpp index 20d7d5723c5..006775aa2e7 100644 --- a/gfx/thebes/gfxUniscribeShaper.cpp +++ b/gfx/thebes/gfxUniscribeShaper.cpp @@ -3,7 +3,6 @@ * 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 "prtypes.h" #include "gfxTypes.h" #include "gfxContext.h" diff --git a/gfx/thebes/gfxUniscribeShaper.h b/gfx/thebes/gfxUniscribeShaper.h index ccf28c36752..d1f4d8d459e 100644 --- a/gfx/thebes/gfxUniscribeShaper.h +++ b/gfx/thebes/gfxUniscribeShaper.h @@ -6,7 +6,6 @@ #ifndef GFX_UNISCRIBESHAPER_H #define GFX_UNISCRIBESHAPER_H -#include "prtypes.h" #include "gfxTypes.h" #include "gfxGDIFont.h" From 633d4b87a21c7c4e74bc63ef42e410e732d17c8d Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 18 Oct 2013 20:34:58 -0400 Subject: [PATCH 13/48] Bug 928049 - Remove some prtypes.h inclusions from parser/; rs=bsmedberg --HG-- extra : rebase_source : e9f20ba45d4d1f4d76451b1ed066a6b4b9b6ae11 --- parser/html/nsHtml5ArrayCopy.h | 1 - parser/html/nsHtml5Highlighter.h | 1 - parser/html/nsHtml5NamedCharacters.cpp | 1 - parser/html/nsHtml5NamedCharacters.h | 1 - parser/html/nsHtml5NamedCharactersAccel.h | 1 - parser/html/nsHtml5Portability.cpp | 1 - parser/htmlparser/src/nsHTMLEntities.cpp | 1 - parser/htmlparser/src/nsScanner.h | 1 - 8 files changed, 8 deletions(-) diff --git a/parser/html/nsHtml5ArrayCopy.h b/parser/html/nsHtml5ArrayCopy.h index 046273f7b53..b277a9513e3 100644 --- a/parser/html/nsHtml5ArrayCopy.h +++ b/parser/html/nsHtml5ArrayCopy.h @@ -23,7 +23,6 @@ #ifndef nsHtml5ArrayCopy_h #define nsHtml5ArrayCopy_h -#include "prtypes.h" class nsString; class nsHtml5StackNode; diff --git a/parser/html/nsHtml5Highlighter.h b/parser/html/nsHtml5Highlighter.h index 025f37fe749..f869b6c667c 100644 --- a/parser/html/nsHtml5Highlighter.h +++ b/parser/html/nsHtml5Highlighter.h @@ -4,7 +4,6 @@ #ifndef nsHtml5Highlighter_h #define nsHtml5Highlighter_h -#include "prtypes.h" #include "nsCOMPtr.h" #include "nsHtml5TreeOperation.h" #include "nsHtml5UTF16Buffer.h" diff --git a/parser/html/nsHtml5NamedCharacters.cpp b/parser/html/nsHtml5NamedCharacters.cpp index 040893e9b71..2c486cca634 100644 --- a/parser/html/nsHtml5NamedCharacters.cpp +++ b/parser/html/nsHtml5NamedCharacters.cpp @@ -21,7 +21,6 @@ */ #define nsHtml5NamedCharacters_cpp_ -#include "prtypes.h" #include "jArray.h" #include "nscore.h" #include "nsDebug.h" diff --git a/parser/html/nsHtml5NamedCharacters.h b/parser/html/nsHtml5NamedCharacters.h index 51eac319947..a0e81214587 100644 --- a/parser/html/nsHtml5NamedCharacters.h +++ b/parser/html/nsHtml5NamedCharacters.h @@ -23,7 +23,6 @@ #ifndef nsHtml5NamedCharacters_h #define nsHtml5NamedCharacters_h -#include "prtypes.h" #include "jArray.h" #include "nscore.h" #include "nsDebug.h" diff --git a/parser/html/nsHtml5NamedCharactersAccel.h b/parser/html/nsHtml5NamedCharactersAccel.h index 104e0bde368..8098c00c4fd 100644 --- a/parser/html/nsHtml5NamedCharactersAccel.h +++ b/parser/html/nsHtml5NamedCharactersAccel.h @@ -9,7 +9,6 @@ #ifndef nsHtml5NamedCharactersAccel_h #define nsHtml5NamedCharactersAccel_h -#include "prtypes.h" #include "jArray.h" #include "nscore.h" #include "nsDebug.h" diff --git a/parser/html/nsHtml5Portability.cpp b/parser/html/nsHtml5Portability.cpp index 1f12cfd966f..618219f7339 100644 --- a/parser/html/nsHtml5Portability.cpp +++ b/parser/html/nsHtml5Portability.cpp @@ -2,7 +2,6 @@ * 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 "prtypes.h" #include "nsIAtom.h" #include "nsString.h" #include "jArray.h" diff --git a/parser/htmlparser/src/nsHTMLEntities.cpp b/parser/htmlparser/src/nsHTMLEntities.cpp index 005074b10de..e597cd8abcc 100644 --- a/parser/htmlparser/src/nsHTMLEntities.cpp +++ b/parser/htmlparser/src/nsHTMLEntities.cpp @@ -11,7 +11,6 @@ #include "nsString.h" #include "nsCRT.h" -#include "prtypes.h" #include "pldhash.h" using namespace mozilla; diff --git a/parser/htmlparser/src/nsScanner.h b/parser/htmlparser/src/nsScanner.h index 8443bfb4fdb..70eb287dfc9 100644 --- a/parser/htmlparser/src/nsScanner.h +++ b/parser/htmlparser/src/nsScanner.h @@ -22,7 +22,6 @@ #include "nsCOMPtr.h" #include "nsString.h" #include "nsIParser.h" -#include "prtypes.h" #include "nsIUnicodeDecoder.h" #include "nsScannerString.h" From 654a0915cc8512ba1d305b687b84d51726acbbc7 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 19 Oct 2013 10:48:41 -0400 Subject: [PATCH 14/48] Backed out changeset dc2b71e57211 (bug 928221) because it calls a non-existing GetWeakReferent function --- dom/media/PeerConnection.js | 15 --------- dom/webidl/PeerConnectionObserver.webidl | 5 --- .../src/peerconnection/PeerConnectionImpl.cpp | 33 ++++--------------- .../src/peerconnection/PeerConnectionImpl.h | 27 +++++++++------ media/webrtc/signaling/test/FakePCObserver.h | 3 +- .../signaling/test/signaling_unittests.cpp | 2 +- 6 files changed, 26 insertions(+), 59 deletions(-) diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index bf269c34f05..f8595d68e1a 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -891,7 +891,6 @@ RTCError.prototype = { // This is a separate object because we don't want to expose it to DOM. function PeerConnectionObserver() { this._dompc = null; - this._guard = new WeakReferent(this); } PeerConnectionObserver.prototype = { classDescription: "PeerConnectionObserver", @@ -1193,23 +1192,9 @@ PeerConnectionObserver.prototype = { getSupportedConstraints: function(dict) { return dict; - }, - - get weakReferent() { - return this._guard; } }; -// A PeerConnectionObserver member that c++ can do weak references on - -function WeakReferent(parent) { - this._parent = parent; // prevents parent from going away without us -} -WeakReferent.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsISupportsWeakReference]), -}; - this.NSGetFactory = XPCOMUtils.generateNSGetFactory( [GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection, RTCStatsReport, PeerConnectionObserver] diff --git a/dom/webidl/PeerConnectionObserver.webidl b/dom/webidl/PeerConnectionObserver.webidl index a8bdbd73bfe..162ff8b4c08 100644 --- a/dom/webidl/PeerConnectionObserver.webidl +++ b/dom/webidl/PeerConnectionObserver.webidl @@ -4,8 +4,6 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -interface nsISupports; - [ChromeOnly, JSImplementation="@mozilla.org/dom/peerconnectionobserver;1", Constructor (object domPC)] @@ -42,9 +40,6 @@ interface PeerConnectionObserver void onAddTrack(); void onRemoveTrack(); - /* Used by c++ to know when Observer goes away */ - readonly attribute nsISupports weakReferent; - /* Helper function to access supported constraints defined in webidl. Needs to * be in a separate webidl object we hold, so putting it here was convenient. */ diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 4b4a185c84c..5f17923913c 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -655,7 +655,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver, MOZ_ASSERT(aThread); mThread = do_QueryInterface(aThread); - mPCObserver.Set(&aObserver); + mPCObserver.Init(&aObserver); // Find the STS thread @@ -1383,6 +1383,12 @@ PeerConnectionImpl::CloseInt() { PC_AUTO_ENTER_API_CALL_NO_CHECK(); + // Clear raw pointer to observer since PeerConnection.js does not guarantee + // the observer's existence past Close(). + // + // Any outstanding runnables hold RefPtr<> references to observer. + mPCObserver.Close(); + if (mInternal->mCall) { CSFLogInfo(logTag, "%s: Closing PeerConnectionImpl %s; " "ending call", __FUNCTION__, mHandle.c_str()); @@ -1756,30 +1762,5 @@ PeerConnectionImpl::GetRemoteStreams(nsTArray #endif } -// WeakConcretePtr gets around WeakPtr not working on concrete types by using -// the attribute getWeakReferent, a member that supports weak refs, as a guard. - -void -PeerConnectionImpl::WeakConcretePtr::Set(PeerConnectionObserver *aObserver) { - mObserver = aObserver; -#ifdef MOZILLA_INTERNAL_API - MOZ_ASSERT(NS_IsMainThread()); - JSErrorResult rv; - nsCOMPtr tmp = aObserver->GetWeakReferent(rv); - MOZ_ASSERT(!rv.Failed()); - mWeakPtr = do_GetWeakReference(tmp); -#else - mWeakPtr = do_GetWeakReference(aObserver); -#endif -} - -PeerConnectionObserver * -PeerConnectionImpl::WeakConcretePtr::MayGet() { -#ifdef MOZILLA_INTERNAL_API - MOZ_ASSERT(NS_IsMainThread()); -#endif - nsCOMPtr guard = do_QueryReferent(mWeakPtr); - return (!guard) ? nullptr : mObserver; -} } // end sipcc namespace diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index de8fef6eb12..237ba93d51d 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -12,9 +12,6 @@ #include "prlock.h" #include "mozilla/RefPtr.h" -#include "nsWeakPtr.h" -#include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr -#include "IPeerConnection.h" #include "sigslot.h" #include "nricectx.h" #include "nricemediastream.h" @@ -505,19 +502,29 @@ private: mozilla::dom::PCImplIceState mIceState; nsCOMPtr mThread; - // WeakConcretePtr to PeerConnectionObserver. TODO: Remove after bug 928535 + // We hold a raw pointer to PeerConnectionObserver (no WeakRefs to concretes!) + // which is an invariant guaranteed to exist between Initialize() and Close(). + // We explicitly clear it in Close(). We wrap it in a helper, to encourage + // testing against nullptr before use. Use in Runnables requires wrapping + // access in RefPtr<> since they may execute after close. This is only safe + // to use on the main thread // - // This is only safe to use on the main thread // TODO: Remove if we ever properly wire PeerConnection for cycle-collection. - class WeakConcretePtr + class WeakReminder { public: - WeakConcretePtr() : mObserver(nullptr) {} - void Set(PeerConnectionObserver *aObserver); - PeerConnectionObserver *MayGet(); + WeakReminder() : mObserver(nullptr) {} + void Init(PeerConnectionObserver *aObserver) { + mObserver = aObserver; + } + void Close() { + mObserver = nullptr; + } + PeerConnectionObserver *MayGet() { + return mObserver; + } private: PeerConnectionObserver *mObserver; - nsWeakPtr mWeakPtr; } mPCObserver; nsCOMPtr mWindow; diff --git a/media/webrtc/signaling/test/FakePCObserver.h b/media/webrtc/signaling/test/FakePCObserver.h index ddb42734168..54761a1c8cd 100644 --- a/media/webrtc/signaling/test/FakePCObserver.h +++ b/media/webrtc/signaling/test/FakePCObserver.h @@ -21,7 +21,6 @@ #include "nsIDOMMediaStream.h" #include "mozilla/dom/PeerConnectionObserverEnumsBinding.h" #include "PeerConnectionImpl.h" -#include "nsWeakReference.h" namespace sipcc { class PeerConnectionImpl; @@ -33,7 +32,7 @@ class nsIDOMDataChannel; namespace test { using namespace mozilla::dom; -class AFakePCObserver : public nsSupportsWeakReference +class AFakePCObserver : public nsISupports { protected: typedef mozilla::ErrorResult ER; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index be6e9a6ea66..8122decd5dc 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -273,7 +273,7 @@ public: NS_IMETHODIMP OnIceCandidate(uint16_t level, const char *mid, const char *cand, ER&); }; -NS_IMPL_ISUPPORTS1(TestObserver, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS0(TestObserver) NS_IMETHODIMP TestObserver::OnCreateOfferSuccess(const char* offer, ER&) From 27586aa6a7dc50563c787a59207b99522f90d3b9 Mon Sep 17 00:00:00 2001 From: Georg Fritzsche Date: Sat, 19 Oct 2013 17:15:18 +0200 Subject: [PATCH 15/48] Bug 853694 - Cannot send crash reports for click-to-play plugins. r=jaws --- browser/base/content/browser-plugins.js | 4 + browser/base/content/test/general/browser.ini | 2 + .../general/browser_CTP_crashreporting.js | 132 ++++++++++++++++++ .../base/content/test/general/plugin_big.html | 9 ++ 4 files changed, 147 insertions(+) create mode 100644 browser/base/content/test/general/browser_CTP_crashreporting.js create mode 100644 browser/base/content/test/general/plugin_big.html diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index 9fa06c99d31..59e3f37bbe7 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -804,6 +804,10 @@ var gPluginHandler = { // so the pluginHost.getPermissionStringForType call is protected if (gPluginHandler.canActivatePlugin(plugin) && aPluginInfo.permissionString == pluginHost.getPermissionStringForType(plugin.actualType)) { + let overlay = this.getPluginUI(plugin, "main"); + if (overlay) { + overlay.removeEventListener("click", gPluginHandler._overlayClickListener, true); + } plugin.playPlugin(); } } diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index 49613cab8df..753877bd1a5 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -47,6 +47,7 @@ support-files = page_style_sample.html plugin_add_dynamically.html plugin_alternate_content.html + plugin_big.html plugin_both.html plugin_both2.html plugin_bug744745.html @@ -78,6 +79,7 @@ support-files = video.ogg zoom_test.html +[browser_CTP_crashreporting.js] [browser_CTP_data_urls.js] [browser_CTP_drag_drop.js] [browser_CTP_iframe.js] diff --git a/browser/base/content/test/general/browser_CTP_crashreporting.js b/browser/base/content/test/general/browser_CTP_crashreporting.js new file mode 100644 index 00000000000..26a4750890b --- /dev/null +++ b/browser/base/content/test/general/browser_CTP_crashreporting.js @@ -0,0 +1,132 @@ +/* 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/. */ + +Cu.import("resource://gre/modules/Services.jsm"); + +const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs"; +const gTestRoot = getRootDirectory(gTestPath); +var gTestBrowser = null; + +// Test that plugin crash submissions still work properly after +// click-to-play activation. + +function test() { + waitForExplicitFinish(); + setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY); + + // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin + // crash reports. This test needs them enabled. The test also needs a mock + // report server, and fortunately one is already set up by toolkit/ + // crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL, + // which CrashSubmit.jsm uses as a server override. + let env = Cc["@mozilla.org/process/environment;1"]. + getService(Components.interfaces.nsIEnvironment); + let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT"); + let serverURL = env.get("MOZ_CRASHREPORTER_URL"); + env.set("MOZ_CRASHREPORTER_NO_REPORT", ""); + env.set("MOZ_CRASHREPORTER_URL", SERVER_URL); + + let tab = gBrowser.loadOneTab("about:blank", { inBackground: false }); + gTestBrowser = gBrowser.getBrowserForTab(tab); + gTestBrowser.addEventListener("PluginCrashed", onCrash, false); + gTestBrowser.addEventListener("load", onPageLoad, true); + Services.obs.addObserver(onSubmitStatus, "crash-report-status", false); + + registerCleanupFunction(function cleanUp() { + env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport); + env.set("MOZ_CRASHREPORTER_URL", serverURL); + gTestBrowser.removeEventListener("PluginCrashed", onCrash, false); + gTestBrowser.removeEventListener("load", onPageLoad, true); + Services.obs.removeObserver(onSubmitStatus, "crash-report-status"); + gBrowser.removeCurrentTab(); + }); + + gTestBrowser.contentWindow.location = gTestRoot + "plugin_big.html"; +} +function onPageLoad() { + // Force the plugins binding to attach as layout is async. + let plugin = gTestBrowser.contentDocument.getElementById("test"); + plugin.clientTop; + executeSoon(afterBindingAttached); +} + +function afterBindingAttached() { + let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser); + ok(popupNotification, "Should have a click-to-play notification"); + + let plugin = gTestBrowser.contentDocument.getElementById("test"); + let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); + ok(!objLoadingContent.activated, "Plugin should not be activated"); + + // Simulate clicking the "Allow Always" button. + popupNotification.reshow(); + PopupNotifications.panel.firstChild._primaryButton.click(); + + let condition = function() objLoadingContent.activated; + waitForCondition(condition, pluginActivated, "Waited too long for plugin to activate"); +} + +function pluginActivated() { + let plugin = gTestBrowser.contentDocument.getElementById("test"); + try { + plugin.crash(); + } catch (e) { + // The plugin crashed in the above call, an exception is expected. + } +} + +function onCrash() { + try { + let plugin = gBrowser.contentDocument.getElementById("test"); + let elt = gPluginHandler.getPluginUI.bind(gPluginHandler, plugin); + let style = + gBrowser.contentWindow.getComputedStyle(elt("pleaseSubmit")); + is(style.display, "block", "Submission UI visibility should be correct"); + + elt("submitComment").value = "a test comment"; + is(elt("submitURLOptIn").checked, true, "URL opt-in should default to true"); + EventUtils.synthesizeMouseAtCenter(elt("submitURLOptIn"), {}, gTestBrowser.contentWindow); + EventUtils.synthesizeMouseAtCenter(elt("submitButton"), {}, gTestBrowser.contentWindow); + // And now wait for the submission status notification. + } + catch (err) { + failWithException(err); + } +} + +function onSubmitStatus(subj, topic, data) { + try { + // Wait for success or failed, doesn't matter which. + if (data != "success" && data != "failed") + return; + + let extra = getPropertyBagValue(subj.QueryInterface(Ci.nsIPropertyBag), + "extra"); + ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag"); + + let val = getPropertyBagValue(extra, "PluginUserComment"); + is(val, "a test comment", + "Comment in extra data should match comment in textbox"); + + val = getPropertyBagValue(extra, "PluginContentURL"); + ok(val === undefined, + "URL should be absent from extra data when opt-in not checked"); + } + catch (err) { + failWithException(err); + } + finish(); +} + +function getPropertyBagValue(bag, key) { + try { + var val = bag.getProperty(key); + } + catch (e if e.result == Cr.NS_ERROR_FAILURE) {} + return val; +} + +function failWithException(err) { + ok(false, "Uncaught exception: " + err + "\n" + err.stack); +} diff --git a/browser/base/content/test/general/plugin_big.html b/browser/base/content/test/general/plugin_big.html new file mode 100644 index 00000000000..d11506176c6 --- /dev/null +++ b/browser/base/content/test/general/plugin_big.html @@ -0,0 +1,9 @@ + + + + + + + + + From d55f9aed120b7b050cb6f6d8a2190de0ba50c106 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sat, 19 Oct 2013 17:33:10 +0200 Subject: [PATCH 16/48] Bug 723640 - Don't clone regexps in Ion code if cloning is not observable. r=bhackett --- js/src/jit-test/tests/ion/regexp-clone.js | 8 +++ js/src/jit/IonBuilder.cpp | 28 +++++++- js/src/jit/Lowering.cpp | 78 +++++++++++++++++++++++ js/src/jit/MIR.h | 20 ++++-- 4 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 js/src/jit-test/tests/ion/regexp-clone.js diff --git a/js/src/jit-test/tests/ion/regexp-clone.js b/js/src/jit-test/tests/ion/regexp-clone.js new file mode 100644 index 00000000000..2ed41967fbd --- /dev/null +++ b/js/src/jit-test/tests/ion/regexp-clone.js @@ -0,0 +1,8 @@ +var i=0; +function f() { + assertEq(/^[a-z0-9\.]+$/gi.test("Foo.Bar"), true); + i++; + if (i < 100) + f(); +} +f(); diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 7b3e5d2e528..ae96fe50890 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -23,6 +23,7 @@ #include "jit/MIRGraph.h" #include "vm/ArgumentsObject.h" +#include "vm/RegExpStatics.h" #include "jsinferinlines.h" #include "jsobjinlines.h" @@ -8873,7 +8874,31 @@ IonBuilder::jsop_regexp(RegExpObject *reobj) if (!prototype) return false; - MRegExp *regexp = MRegExp::New(reobj, prototype); + JS_ASSERT(&reobj->JSObject::global() == &script()->global()); + + // JS semantics require regular expression literals to create different + // objects every time they execute. We only need to do this cloning if the + // script could actually observe the effect of such cloning, for instance + // by getting or setting properties on it. + // + // First, make sure the regex is one we can safely optimize. Lowering can + // then check if this regex object only flows into known natives and can + // avoid cloning in this case. + + bool mustClone = true; + types::TypeObjectKey *typeObj = types::TypeObjectKey::get(&script()->global()); + if (!typeObj->hasFlags(constraints(), types::OBJECT_FLAG_REGEXP_FLAGS_SET)) { + RegExpStatics *res = script()->global().getRegExpStatics(); + + DebugOnly origFlags = reobj->getFlags(); + DebugOnly staticsFlags = res->getFlags(); + JS_ASSERT((origFlags & staticsFlags) == staticsFlags); + + if (!reobj->global() && !reobj->sticky()) + mustClone = false; + } + + MRegExp *regexp = MRegExp::New(reobj, prototype, mustClone); current->add(regexp); current->push(regexp); @@ -8883,6 +8908,7 @@ IonBuilder::jsop_regexp(RegExpObject *reobj) // That would be incorrect for global/sticky, because lastIndex could be wrong. // Therefore setting the lastIndex to 0. That is faster than removing the movable flag. if (reobj->sticky() || reobj->global()) { + JS_ASSERT(mustClone); MConstant *zero = MConstant::New(Int32Value(0)); current->add(zero); diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index ec40db7fc8b..d3fd89d5105 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -1776,9 +1776,87 @@ LIRGenerator::visitToString(MToString *ins) } } +static bool +MustCloneRegExpForCall(MPassArg *arg) +{ + // |arg| is a regex literal flowing into a call. Return |false| iff + // this is a native call that does not let the regex escape. + + JS_ASSERT(arg->getArgument()->isRegExp()); + + for (MUseIterator iter(arg->usesBegin()); iter != arg->usesEnd(); iter++) { + MNode *node = iter->consumer(); + if (!node->isDefinition()) + return true; + + MDefinition *def = node->toDefinition(); + if (!def->isCall()) + return true; + + MCall *call = def->toCall(); + JSFunction *target = call->getSingleTarget(); + if (!target || !target->isNative()) + return true; + + if (iter->index() == MCall::IndexOfThis() && + (target->native() == regexp_exec || target->native() == regexp_test)) + { + continue; + } + + if (iter->index() == MCall::IndexOfArgument(0) && + (target->native() == str_split || + target->native() == str_replace || + target->native() == str_match || + target->native() == str_search)) + { + continue; + } + + return true; + } + + return false; +} + + +static bool +MustCloneRegExp(MRegExp *regexp) +{ + if (regexp->mustClone()) + return true; + + // If this regex literal only flows into known natives that don't let + // it escape, we don't have to clone it. + + for (MUseIterator iter(regexp->usesBegin()); iter != regexp->usesEnd(); iter++) { + MNode *node = iter->consumer(); + if (!node->isDefinition()) + return true; + + MDefinition *def = node->toDefinition(); + if (def->isRegExpTest() && iter->index() == 1) { + // Optimized RegExp.prototype.test. + JS_ASSERT(def->toRegExpTest()->regexp() == regexp); + continue; + } + + if (def->isPassArg() && !MustCloneRegExpForCall(def->toPassArg())) + continue; + + return true; + } + return false; +} + bool LIRGenerator::visitRegExp(MRegExp *ins) { + if (!MustCloneRegExp(ins)) { + RegExpObject *source = ins->source(); + return define(new LPointer(source), ins); + } + LRegExp *lir = new LRegExp(); return defineReturn(lir, ins) && assignSafepoint(lir, ins); } diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 935c26db51b..4b2ea4f9412 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -1832,6 +1832,13 @@ class MCall replaceOperand(NumNonArgumentOperands + index, def); } + static size_t IndexOfThis() { + return NumNonArgumentOperands; + } + static size_t IndexOfArgument(size_t index) { + return NumNonArgumentOperands + index + 1; // +1 to skip |this|. + } + // For TI-informed monomorphic callsites. JSFunction *getSingleTarget() const { return target_; @@ -4481,10 +4488,12 @@ class MRegExp : public MNullaryInstruction { CompilerRoot source_; CompilerRootObject prototype_; + bool mustClone_; - MRegExp(RegExpObject *source, JSObject *prototype) + MRegExp(RegExpObject *source, JSObject *prototype, bool mustClone) : source_(source), - prototype_(prototype) + prototype_(prototype), + mustClone_(mustClone) { setResultType(MIRType_Object); @@ -4495,10 +4504,13 @@ class MRegExp : public MNullaryInstruction public: INSTRUCTION_HEADER(RegExp) - static MRegExp *New(RegExpObject *source, JSObject *prototype) { - return new MRegExp(source, prototype); + static MRegExp *New(RegExpObject *source, JSObject *prototype, bool mustClone) { + return new MRegExp(source, prototype, mustClone); } + bool mustClone() const { + return mustClone_; + } RegExpObject *source() const { return source_; } From e9c045806a359cb3667f7f0562b59681564f0484 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 17 Oct 2013 06:24:30 -0700 Subject: [PATCH 17/48] Bug 923486, part 1 - Harmonize ordering of definitions of NS_IsMainThread(). r=ehsan --- xpcom/glue/nsThreadUtils.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp index 661f5a5dadf..b78b2241447 100644 --- a/xpcom/glue/nsThreadUtils.cpp +++ b/xpcom/glue/nsThreadUtils.cpp @@ -114,7 +114,24 @@ NS_GetMainThread(nsIThread **result) #endif } -#ifndef MOZILLA_INTERNAL_API +#if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN) +extern DWORD gTLSThreadIDIndex; +bool +NS_IsMainThread() +{ + return TlsGetValue(gTLSThreadIDIndex) == (void*) mozilla::threads::Main; +} +#elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS) +// NS_IsMainThread() is defined inline in MainThreadUtils.h +#else +#ifdef MOZILLA_INTERNAL_API +bool NS_IsMainThread() +{ + bool result = false; + nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result); + return bool(result); +} +#else bool NS_IsMainThread() { bool result = false; @@ -124,20 +141,7 @@ bool NS_IsMainThread() mgr->GetIsMainThread(&result); return bool(result); } -#elif defined(XP_WIN) -extern DWORD gTLSThreadIDIndex; -bool -NS_IsMainThread() -{ - return TlsGetValue(gTLSThreadIDIndex) == (void*) mozilla::threads::Main; -} -#elif !defined(NS_TLS) -bool NS_IsMainThread() -{ - bool result = false; - nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result); - return bool(result); -} +#endif #endif NS_METHOD From 8cfa1d97d85fc4238ec1608e6608e222b6d80aef Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 3 Oct 2013 11:58:41 -0700 Subject: [PATCH 18/48] Bug 923486, part 2 - Define NS_IsMainThread out-of-line in ASAN builds. r=ehsan --- xpcom/glue/MainThreadUtils.h | 4 ++-- xpcom/glue/nsThreadUtils.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xpcom/glue/MainThreadUtils.h b/xpcom/glue/MainThreadUtils.h index c1d24011b72..2b7731ec618 100644 --- a/xpcom/glue/MainThreadUtils.h +++ b/xpcom/glue/MainThreadUtils.h @@ -29,14 +29,14 @@ bool NS_IsMainThread(); extern NS_TLS mozilla::threads::ID gTLSThreadID; #ifdef MOZ_ASAN // Temporary workaround, see bug 895845 -MOZ_ASAN_BLACKLIST static +MOZ_ASAN_BLACKLIST bool NS_IsMainThread(); #else inline -#endif bool NS_IsMainThread() { return gTLSThreadID == mozilla::threads::Main; } +#endif #else /** * Test to see if the current thread is the main thread. diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp index b78b2241447..a99c2dea3ca 100644 --- a/xpcom/glue/nsThreadUtils.cpp +++ b/xpcom/glue/nsThreadUtils.cpp @@ -122,7 +122,15 @@ NS_IsMainThread() return TlsGetValue(gTLSThreadIDIndex) == (void*) mozilla::threads::Main; } #elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS) +#ifdef MOZ_ASAN +// Temporary workaround, see bug 895845 +bool NS_IsMainThread() +{ + return gTLSThreadID == mozilla::threads::Main; +} +#else // NS_IsMainThread() is defined inline in MainThreadUtils.h +#endif #else #ifdef MOZILLA_INTERNAL_API bool NS_IsMainThread() From 0f573f8018e1882ff6098eacfb32991c62c550c0 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Sat, 19 Oct 2013 12:21:06 -0400 Subject: [PATCH 19/48] Bug 928221: reland (backed out due to bug 924992: webidl changes sometimes fail in incremental builds) r=jesup,abr --- CLOBBER | 2 +- dom/media/PeerConnection.js | 15 +++++++++ dom/webidl/PeerConnectionObserver.webidl | 5 +++ .../src/peerconnection/PeerConnectionImpl.cpp | 33 +++++++++++++++---- .../src/peerconnection/PeerConnectionImpl.h | 27 ++++++--------- media/webrtc/signaling/test/FakePCObserver.h | 3 +- .../signaling/test/signaling_unittests.cpp | 2 +- 7 files changed, 60 insertions(+), 27 deletions(-) diff --git a/CLOBBER b/CLOBBER index 585b368dd31..a7852c5964b 100644 --- a/CLOBBER +++ b/CLOBBER @@ -18,4 +18,4 @@ # Modifying this file will now automatically clobber the buildbot machines \o/ # -Bug 895047 - Clobber needed for touching js/src/js-confdefs.h.in +Bug 924992 - WebIDL headers changes not correctly picked up by the build system somehow diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index f8595d68e1a..bf269c34f05 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -891,6 +891,7 @@ RTCError.prototype = { // This is a separate object because we don't want to expose it to DOM. function PeerConnectionObserver() { this._dompc = null; + this._guard = new WeakReferent(this); } PeerConnectionObserver.prototype = { classDescription: "PeerConnectionObserver", @@ -1192,9 +1193,23 @@ PeerConnectionObserver.prototype = { getSupportedConstraints: function(dict) { return dict; + }, + + get weakReferent() { + return this._guard; } }; +// A PeerConnectionObserver member that c++ can do weak references on + +function WeakReferent(parent) { + this._parent = parent; // prevents parent from going away without us +} +WeakReferent.prototype = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, + Ci.nsISupportsWeakReference]), +}; + this.NSGetFactory = XPCOMUtils.generateNSGetFactory( [GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection, RTCStatsReport, PeerConnectionObserver] diff --git a/dom/webidl/PeerConnectionObserver.webidl b/dom/webidl/PeerConnectionObserver.webidl index 162ff8b4c08..a8bdbd73bfe 100644 --- a/dom/webidl/PeerConnectionObserver.webidl +++ b/dom/webidl/PeerConnectionObserver.webidl @@ -4,6 +4,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ +interface nsISupports; + [ChromeOnly, JSImplementation="@mozilla.org/dom/peerconnectionobserver;1", Constructor (object domPC)] @@ -40,6 +42,9 @@ interface PeerConnectionObserver void onAddTrack(); void onRemoveTrack(); + /* Used by c++ to know when Observer goes away */ + readonly attribute nsISupports weakReferent; + /* Helper function to access supported constraints defined in webidl. Needs to * be in a separate webidl object we hold, so putting it here was convenient. */ diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 5f17923913c..4b4a185c84c 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -655,7 +655,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver, MOZ_ASSERT(aThread); mThread = do_QueryInterface(aThread); - mPCObserver.Init(&aObserver); + mPCObserver.Set(&aObserver); // Find the STS thread @@ -1383,12 +1383,6 @@ PeerConnectionImpl::CloseInt() { PC_AUTO_ENTER_API_CALL_NO_CHECK(); - // Clear raw pointer to observer since PeerConnection.js does not guarantee - // the observer's existence past Close(). - // - // Any outstanding runnables hold RefPtr<> references to observer. - mPCObserver.Close(); - if (mInternal->mCall) { CSFLogInfo(logTag, "%s: Closing PeerConnectionImpl %s; " "ending call", __FUNCTION__, mHandle.c_str()); @@ -1762,5 +1756,30 @@ PeerConnectionImpl::GetRemoteStreams(nsTArray #endif } +// WeakConcretePtr gets around WeakPtr not working on concrete types by using +// the attribute getWeakReferent, a member that supports weak refs, as a guard. + +void +PeerConnectionImpl::WeakConcretePtr::Set(PeerConnectionObserver *aObserver) { + mObserver = aObserver; +#ifdef MOZILLA_INTERNAL_API + MOZ_ASSERT(NS_IsMainThread()); + JSErrorResult rv; + nsCOMPtr tmp = aObserver->GetWeakReferent(rv); + MOZ_ASSERT(!rv.Failed()); + mWeakPtr = do_GetWeakReference(tmp); +#else + mWeakPtr = do_GetWeakReference(aObserver); +#endif +} + +PeerConnectionObserver * +PeerConnectionImpl::WeakConcretePtr::MayGet() { +#ifdef MOZILLA_INTERNAL_API + MOZ_ASSERT(NS_IsMainThread()); +#endif + nsCOMPtr guard = do_QueryReferent(mWeakPtr); + return (!guard) ? nullptr : mObserver; +} } // end sipcc namespace diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 237ba93d51d..de8fef6eb12 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -12,6 +12,9 @@ #include "prlock.h" #include "mozilla/RefPtr.h" +#include "nsWeakPtr.h" +#include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr +#include "IPeerConnection.h" #include "sigslot.h" #include "nricectx.h" #include "nricemediastream.h" @@ -502,29 +505,19 @@ private: mozilla::dom::PCImplIceState mIceState; nsCOMPtr mThread; - // We hold a raw pointer to PeerConnectionObserver (no WeakRefs to concretes!) - // which is an invariant guaranteed to exist between Initialize() and Close(). - // We explicitly clear it in Close(). We wrap it in a helper, to encourage - // testing against nullptr before use. Use in Runnables requires wrapping - // access in RefPtr<> since they may execute after close. This is only safe - // to use on the main thread + // WeakConcretePtr to PeerConnectionObserver. TODO: Remove after bug 928535 // + // This is only safe to use on the main thread // TODO: Remove if we ever properly wire PeerConnection for cycle-collection. - class WeakReminder + class WeakConcretePtr { public: - WeakReminder() : mObserver(nullptr) {} - void Init(PeerConnectionObserver *aObserver) { - mObserver = aObserver; - } - void Close() { - mObserver = nullptr; - } - PeerConnectionObserver *MayGet() { - return mObserver; - } + WeakConcretePtr() : mObserver(nullptr) {} + void Set(PeerConnectionObserver *aObserver); + PeerConnectionObserver *MayGet(); private: PeerConnectionObserver *mObserver; + nsWeakPtr mWeakPtr; } mPCObserver; nsCOMPtr mWindow; diff --git a/media/webrtc/signaling/test/FakePCObserver.h b/media/webrtc/signaling/test/FakePCObserver.h index 54761a1c8cd..ddb42734168 100644 --- a/media/webrtc/signaling/test/FakePCObserver.h +++ b/media/webrtc/signaling/test/FakePCObserver.h @@ -21,6 +21,7 @@ #include "nsIDOMMediaStream.h" #include "mozilla/dom/PeerConnectionObserverEnumsBinding.h" #include "PeerConnectionImpl.h" +#include "nsWeakReference.h" namespace sipcc { class PeerConnectionImpl; @@ -32,7 +33,7 @@ class nsIDOMDataChannel; namespace test { using namespace mozilla::dom; -class AFakePCObserver : public nsISupports +class AFakePCObserver : public nsSupportsWeakReference { protected: typedef mozilla::ErrorResult ER; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 8122decd5dc..be6e9a6ea66 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -273,7 +273,7 @@ public: NS_IMETHODIMP OnIceCandidate(uint16_t level, const char *mid, const char *cand, ER&); }; -NS_IMPL_ISUPPORTS0(TestObserver) +NS_IMPL_ISUPPORTS1(TestObserver, nsISupportsWeakReference) NS_IMETHODIMP TestObserver::OnCreateOfferSuccess(const char* offer, ER&) From c4c16b0062902a08cec015aecd3c4eb3b888bd61 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Sat, 19 Oct 2013 18:39:52 +0200 Subject: [PATCH 20/48] Bug 884410 - Remove JS_ValueToNumber. r=terrence --- dom/base/nsDOMClassInfo.cpp | 6 +++--- dom/bindings/DOMJSProxyHandler.cpp | 6 +++--- dom/workers/WorkerPrivate.cpp | 3 ++- js/src/jsapi.cpp | 13 +++--------- js/src/jsapi.h | 3 --- js/src/shell/js.cpp | 25 +++++++++++++---------- js/xpconnect/src/dictionary_helper_gen.py | 4 ++-- js/xpconnect/src/qsgen.py | 4 ++-- toolkit/components/places/History.cpp | 2 +- 9 files changed, 30 insertions(+), 36 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 526b7dd4620..cdc57802d74 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1419,10 +1419,10 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle id, bool *aI if (JSID_IS_INT(id)) { i = JSID_TO_INT(id); } else { - jsval idval; + JS::RootedValue idval(cx); double array_index; - if (!::JS_IdToValue(cx, id, &idval) || - !::JS_ValueToNumber(cx, idval, &array_index) || + if (!::JS_IdToValue(cx, id, idval.address()) || + !JS::ToNumber(cx, idval, &array_index) || !::JS_DoubleIsInt32(array_index, &i)) { return -1; } diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index b1fdb8a5f6d..2cd4174b72e 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -267,11 +267,11 @@ DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id) { - JS::Value idval; + JS::RootedValue idval(cx); double array_index; int32_t i; - if (!::JS_IdToValue(cx, id, &idval) || - !::JS_ValueToNumber(cx, idval, &array_index) || + if (!::JS_IdToValue(cx, id, idval.address()) || + !JS::ToNumber(cx, idval, &array_index) || !::JS_DoubleIsInt32(array_index, &i)) { return -1; } diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 6835f8aaa75..170e608d2ce 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -4646,7 +4646,8 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp, // See if any of the optional arguments were passed. if (aArgc > 1) { double intervalMS = 0; - if (!JS_ValueToNumber(aCx, argv[1], &intervalMS)) { + JS::RootedValue interval(aCx, argv[1]); + if (!JS::ToNumber(aCx, interval, &intervalMS)) { return false; } newInfo->mInterval = TimeDuration::FromMilliseconds(intervalMS); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index cccd7c80df4..d97609f0b8c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -261,11 +261,11 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for return false; break; case 'd': - if (!JS_ValueToNumber(cx, *sp, va_arg(ap, double *))) + if (!ToNumber(cx, arg, va_arg(ap, double *))) return false; break; case 'I': - if (!JS_ValueToNumber(cx, *sp, &d)) + if (!ToNumber(cx, arg, &d)) return false; *va_arg(ap, double *) = ToInteger(d); break; @@ -356,7 +356,7 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu vp.setString(str); break; case JSTYPE_NUMBER: - ok = JS_ValueToNumber(cx, value, &d); + ok = ToNumber(cx, value, &d); if (ok) vp.setDouble(d); break; @@ -429,13 +429,6 @@ JS_ValueToSource(JSContext *cx, jsval valueArg) return ValueToSource(cx, value); } -JS_PUBLIC_API(bool) -JS_ValueToNumber(JSContext *cx, jsval valueArg, double *dp) -{ - RootedValue value(cx, valueArg); - return JS::ToNumber(cx, value, dp); -} - JS_PUBLIC_API(bool) JS_DoubleIsInt32(double d, int32_t *ip) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 3020101327e..87cc9c29fa5 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1041,9 +1041,6 @@ JS_ValueToString(JSContext *cx, jsval v); extern JS_PUBLIC_API(JSString *) JS_ValueToSource(JSContext *cx, jsval v); -extern JS_PUBLIC_API(bool) -JS_ValueToNumber(JSContext *cx, jsval v, double *dp); - namespace js { /* * DO NOT CALL THIS. Use JS::ToNumber diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 3433177fd44..b84f7a83623 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -2834,16 +2834,17 @@ IsBefore(int64_t t1, int64_t t2) } static bool -Sleep_fn(JSContext *cx, unsigned argc, jsval *vp) +Sleep_fn(JSContext *cx, unsigned argc, Value *vp) { + CallArgs args = CallArgsFromVp(argc, vp); int64_t t_ticks; - if (argc == 0) { + if (args.length() == 0) { t_ticks = 0; } else { double t_secs; - if (!JS_ValueToNumber(cx, argc == 0 ? UndefinedValue() : vp[2], &t_secs)) + if (!ToNumber(cx, args[0], &t_secs)) return false; /* NB: The next condition also filter out NaNs. */ @@ -3092,24 +3093,26 @@ SetTimeoutValue(JSContext *cx, double t) } static bool -Timeout(JSContext *cx, unsigned argc, jsval *vp) +Timeout(JSContext *cx, unsigned argc, Value *vp) { - if (argc == 0) { - JS_SET_RVAL(cx, vp, JS_NumberValue(gTimeoutInterval)); + CallArgs args = CallArgsFromVp(argc, vp); + + if (args.length() == 0) { + args.rval().setNumber(gTimeoutInterval); return true; } - if (argc > 2) { + if (args.length() > 2) { JS_ReportError(cx, "Wrong number of arguments"); return false; } double t; - if (!JS_ValueToNumber(cx, JS_ARGV(cx, vp)[0], &t)) + if (!ToNumber(cx, args[0], &t)) return false; - if (argc > 1) { - RootedValue value(cx, JS_ARGV(cx, vp)[1]); + if (args.length() > 1) { + RootedValue value(cx, args[1]); if (!value.isObject() || !value.toObject().is()) { JS_ReportError(cx, "Second argument must be a timeout function"); return false; @@ -3117,7 +3120,7 @@ Timeout(JSContext *cx, unsigned argc, jsval *vp) gTimeoutFunc = value; } - JS_SET_RVAL(cx, vp, UndefinedValue()); + args.rval().setUndefined(); return SetTimeoutValue(cx, t); } diff --git a/js/xpconnect/src/dictionary_helper_gen.py b/js/xpconnect/src/dictionary_helper_gen.py index 889c38391b1..6b0f777417b 100644 --- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -302,10 +302,10 @@ def write_getter(a, iface, fd): elif realtype.count("int64_t"): fd.write(" NS_ENSURE_STATE(JS::ToInt64(aCx, v, &aDict.%s));\n" % a.name) elif realtype.count("double"): - fd.write(" NS_ENSURE_STATE(JS_ValueToNumber(aCx, v, &aDict.%s));\n" % a.name) + fd.write(" NS_ENSURE_STATE(JS::ToNumber(aCx, v, &aDict.%s));\n" % a.name) elif realtype.count("float"): fd.write(" double d;\n") - fd.write(" NS_ENSURE_STATE(JS_ValueToNumber(aCx, v, &d));") + fd.write(" NS_ENSURE_STATE(JS::ToNumber(aCx, v, &d));") fd.write(" aDict.%s = (float) d;\n" % a.name) elif realtype.count("nsAString"): if a.nullable: diff --git a/js/xpconnect/src/qsgen.py b/js/xpconnect/src/qsgen.py index 29d2242aeac..2e47d7406b4 100644 --- a/js/xpconnect/src/qsgen.py +++ b/js/xpconnect/src/qsgen.py @@ -423,13 +423,13 @@ argumentUnboxingTemplates = { 'float': " double ${name}_dbl;\n" - " if (!JS_ValueToNumber(cx, ${argVal}, &${name}_dbl))\n" + " if (!JS::ToNumber(cx, ${argVal}, &${name}_dbl))\n" " return false;\n" " float ${name} = (float) ${name}_dbl;\n", 'double': " double ${name};\n" - " if (!JS_ValueToNumber(cx, ${argVal}, &${name}))\n" + " if (!JS::ToNumber(cx, ${argVal}, &${name}))\n" " return false;\n", 'boolean': diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 22b224feb93..a59b441a7e3 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -395,7 +395,7 @@ GetIntFromJSObject(JSContext* aCtx, NS_ENSURE_ARG(JSVAL_IS_NUMBER(value)); double num; - rc = JS_ValueToNumber(aCtx, value, &num); + rc = JS::ToNumber(aCtx, value, &num); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); NS_ENSURE_ARG(IntType(num) == num); From 6443188e39ebff8ee7f5f7db7777b9f2320001d4 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 19 Oct 2013 13:35:13 -0400 Subject: [PATCH 21/48] Debugging patch for bug 924771, landed on a CLOSED TREE --- ipc/chromium/src/chrome/common/mach_ipc_mac.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ipc/chromium/src/chrome/common/mach_ipc_mac.mm b/ipc/chromium/src/chrome/common/mach_ipc_mac.mm index 3c95ef6dfb2..c2a423d8cad 100644 --- a/ipc/chromium/src/chrome/common/mach_ipc_mac.mm +++ b/ipc/chromium/src/chrome/common/mach_ipc_mac.mm @@ -237,12 +237,15 @@ ReceivePort::~ReceivePort() { kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message, mach_msg_timeout_t timeout) { if (!out_message) { + printf("WaitForMessage failed because out_message was null\n"); return KERN_INVALID_ARGUMENT; } // return any error condition encountered in constructor - if (init_result_ != KERN_SUCCESS) + if (init_result_ != KERN_SUCCESS) { + printf("WaitForMessage failed because init_result_ was %d\n", init_result_); return init_result_; + } out_message->Head()->msgh_bits = 0; out_message->Head()->msgh_local_port = port_; @@ -258,6 +261,7 @@ kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message, timeout, // timeout in ms MACH_PORT_NULL); + printf("WaitForMessage returned %d\n", result); return result; } From 13a98699f5b21ec4511d01af728bd8deb4fb7235 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Sat, 19 Oct 2013 14:19:50 -0400 Subject: [PATCH 22/48] Bug 748639 - add set of internal accessible relation types, r=tbsaunde --- accessible/src/atk/AccessibleWrap.cpp | 34 ++--- accessible/src/base/Relation.h | 4 +- accessible/src/base/RelationType.h | 119 ++++++++++++++++++ accessible/src/base/moz.build | 1 + accessible/src/generic/Accessible.cpp | 48 +++---- accessible/src/generic/Accessible.h | 3 +- .../src/generic/ApplicationAccessible.cpp | 2 +- .../src/generic/ApplicationAccessible.h | 2 +- accessible/src/generic/RootAccessible.cpp | 4 +- accessible/src/generic/RootAccessible.h | 2 +- .../src/html/HTMLElementAccessibles.cpp | 8 +- accessible/src/html/HTMLElementAccessibles.h | 4 +- .../src/html/HTMLFormControlAccessible.cpp | 16 +-- .../src/html/HTMLFormControlAccessible.h | 8 +- accessible/src/html/HTMLTableAccessible.cpp | 8 +- accessible/src/html/HTMLTableAccessible.h | 4 +- accessible/src/mac/mozAccessible.mm | 2 +- accessible/src/windows/ia2/ia2Accessible.cpp | 12 +- .../src/windows/ia2/ia2AccessibleRelation.cpp | 76 ++++------- .../src/windows/ia2/ia2AccessibleRelation.h | 47 ++++--- .../src/windows/msaa/AccessibleWrap.cpp | 36 +++--- accessible/src/xul/XULElementAccessibles.cpp | 4 +- accessible/src/xul/XULElementAccessibles.h | 2 +- .../src/xul/XULFormControlAccessible.cpp | 9 +- accessible/src/xul/XULFormControlAccessible.h | 2 +- accessible/src/xul/XULTabAccessible.cpp | 8 +- accessible/src/xul/XULTabAccessible.h | 4 +- accessible/src/xul/XULTreeAccessible.cpp | 10 +- accessible/src/xul/XULTreeAccessible.h | 4 +- accessible/src/xul/XULTreeGridAccessible.cpp | 2 +- accessible/src/xul/XULTreeGridAccessible.h | 2 +- 31 files changed, 287 insertions(+), 200 deletions(-) create mode 100644 accessible/src/base/RelationType.h diff --git a/accessible/src/atk/AccessibleWrap.cpp b/accessible/src/atk/AccessibleWrap.cpp index 57801ff3cf1..f5d99f06459 100644 --- a/accessible/src/atk/AccessibleWrap.cpp +++ b/accessible/src/atk/AccessibleWrap.cpp @@ -882,23 +882,23 @@ refRelationSetCB(AtkObject *aAtkObj) return relation_set; // Keep in sync with AtkRelationType enum. - static const uint32_t relationTypes[] = { - nsIAccessibleRelation::RELATION_CONTROLLED_BY, - nsIAccessibleRelation::RELATION_CONTROLLER_FOR, - nsIAccessibleRelation::RELATION_LABEL_FOR, - nsIAccessibleRelation::RELATION_LABELLED_BY, - nsIAccessibleRelation::RELATION_MEMBER_OF, - nsIAccessibleRelation::RELATION_NODE_CHILD_OF, - nsIAccessibleRelation::RELATION_FLOWS_TO, - nsIAccessibleRelation::RELATION_FLOWS_FROM, - nsIAccessibleRelation::RELATION_SUBWINDOW_OF, - nsIAccessibleRelation::RELATION_EMBEDS, - nsIAccessibleRelation::RELATION_EMBEDDED_BY, - nsIAccessibleRelation::RELATION_POPUP_FOR, - nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF, - nsIAccessibleRelation::RELATION_DESCRIBED_BY, - nsIAccessibleRelation::RELATION_DESCRIPTION_FOR, - nsIAccessibleRelation::RELATION_NODE_PARENT_OF + static const RelationType relationTypes[] = { + RelationType::CONTROLLED_BY, + RelationType::CONTROLLER_FOR, + RelationType::LABEL_FOR, + RelationType::LABELLED_BY, + RelationType::MEMBER_OF, + RelationType::NODE_CHILD_OF, + RelationType::FLOWS_TO, + RelationType::FLOWS_FROM, + RelationType::SUBWINDOW_OF, + RelationType::EMBEDS, + RelationType::EMBEDDED_BY, + RelationType::POPUP_FOR, + RelationType::PARENT_WINDOW_OF, + RelationType::DESCRIBED_BY, + RelationType::DESCRIPTION_FOR, + RelationType::NODE_PARENT_OF }; for (uint32_t i = 0; i < ArrayLength(relationTypes); i++) { diff --git a/accessible/src/base/Relation.h b/accessible/src/base/Relation.h index 6a9c9308e5a..f76750dd108 100644 --- a/accessible/src/base/Relation.h +++ b/accessible/src/base/Relation.h @@ -4,8 +4,8 @@ * 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 RELATION_H_ -#define RELATION_H_ +#ifndef mozilla_a11y_relation_h_ +#define mozilla_a11y_relation_h_ #include "AccIterator.h" diff --git a/accessible/src/base/RelationType.h b/accessible/src/base/RelationType.h new file mode 100644 index 00000000000..6ddd8fa8c40 --- /dev/null +++ b/accessible/src/base/RelationType.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 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 mozilla_a11y_relationtype_h_ +#define mozilla_a11y_relationtype_h_ + +#include "mozilla/TypedEnum.h" + +namespace mozilla { +namespace a11y { + +MOZ_BEGIN_ENUM_CLASS(RelationType) + + /** + * This object is labelled by a target object. + */ + LABELLED_BY = 0x00, + + /** + * This object is label for a target object. + */ + LABEL_FOR = 0x01, + + /** + * This object is described by the target object. + */ + DESCRIBED_BY = 0x02, + + /** + * This object is describes the target object. + */ + DESCRIPTION_FOR = 0x3, + + /** + * This object is a child of a target object. + */ + NODE_CHILD_OF = 0x4, + + /** + * This object is a parent of a target object. A dual relation to + * NODE_CHILD_OF. + */ + NODE_PARENT_OF = 0x5, + + /** + * Some attribute of this object is affected by a target object. + */ + CONTROLLED_BY = 0x06, + + /** + * This object is interactive and controls some attribute of a target object. + */ + CONTROLLER_FOR = 0x07, + + /** + * Content flows from this object to a target object, i.e. has content that + * flows logically to another object in a sequential way, e.g. text flow. + */ + FLOWS_TO = 0x08, + + /** + * Content flows to this object from a target object, i.e. has content that + * flows logically from another object in a sequential way, e.g. text flow. + */ + FLOWS_FROM = 0x09, + + /** + * This object is a member of a group of one or more objects. When there is + * more than one object in the group each member may have one and the same + * target, e.g. a grouping object. It is also possible that each member has + * multiple additional targets, e.g. one for every other member in the group. + */ + MEMBER_OF = 0x0a, + + /** + * This object is a sub window of a target object. + */ + SUBWINDOW_OF = 0x0b, + + /** + * This object embeds a target object. This relation can be used on the + * OBJID_CLIENT accessible for a top level window to show where the content + * areas are. + */ + EMBEDS = 0x0c, + + /** + * This object is embedded by a target object. + */ + EMBEDDED_BY = 0x0d, + + /** + * This object is a transient component related to the target object. When + * this object is activated the target object doesn't lose focus. + */ + POPUP_FOR = 0x0e, + + /** + * This object is a parent window of the target object. + */ + PARENT_WINDOW_OF = 0x0f, + + /** + * Part of a form/dialog with a related default button. It is used for + * MSAA/XPCOM, it isn't for IA2 or ATK. + */ + DEFAULT_BUTTON = 0x10, + + LAST = DEFAULT_BUTTON + +MOZ_END_ENUM_CLASS(RelationType) + +} // namespace a11y +} // namespace mozilla + +#endif diff --git a/accessible/src/base/moz.build b/accessible/src/base/moz.build index cbf498a6106..109bd4617ab 100644 --- a/accessible/src/base/moz.build +++ b/accessible/src/base/moz.build @@ -19,6 +19,7 @@ EXPORTS.mozilla.a11y += [ 'DocManager.h', 'FocusManager.h', 'Platform.h', + 'RelationType.h', 'Role.h', 'SelectionManager.h', 'States.h', diff --git a/accessible/src/generic/Accessible.cpp b/accessible/src/generic/Accessible.cpp index 16b54b32e41..1adb688479a 100644 --- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -1519,7 +1519,7 @@ Accessible::State() state |= states::SELECTED; } else { // If focus is in a child of the tab panel surely the tab is selected! - Relation rel = RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR); + Relation rel = RelationByType(RelationType::LABEL_FOR); Accessible* relTarget = nullptr; while ((relTarget = rel.Next())) { if (relTarget->Role() == roles::PROPERTYPAGE && @@ -1814,7 +1814,7 @@ Accessible::ARIATransformRole(role aRole) if (mParent && mParent->Role() == roles::COMBOBOX) { return roles::COMBOBOX_LIST; - Relation rel = RelationByType(nsIAccessibleRelation::RELATION_NODE_CHILD_OF); + Relation rel = RelationByType(RelationType::NODE_CHILD_OF); Accessible* targetAcc = nullptr; while ((targetAcc = rel.Next())) if (targetAcc->Role() == roles::COMBOBOX) @@ -1984,21 +1984,23 @@ Accessible::GetAtomicRegion() const // nsIAccessible getRelationByType() NS_IMETHODIMP -Accessible::GetRelationByType(uint32_t aType, - nsIAccessibleRelation** aRelation) +Accessible::GetRelationByType(uint32_t aType, nsIAccessibleRelation** aRelation) { NS_ENSURE_ARG_POINTER(aRelation); *aRelation = nullptr; + + NS_ENSURE_ARG(aType <= static_cast(RelationType::LAST)); + if (IsDefunct()) return NS_ERROR_FAILURE; - Relation rel = RelationByType(aType); + Relation rel = RelationByType(static_cast(aType)); NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel)); return *aRelation ? NS_OK : NS_ERROR_FAILURE; } Relation -Accessible::RelationByType(uint32_t aType) +Accessible::RelationByType(RelationType aType) { if (!HasOwnContent()) return Relation(); @@ -2006,7 +2008,7 @@ Accessible::RelationByType(uint32_t aType) // Relationships are defined on the same content node that the role would be // defined on. switch (aType) { - case nsIAccessibleRelation::RELATION_LABELLED_BY: { + case RelationType::LABELLED_BY: { Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_labelledby)); if (mContent->IsHTML()) { @@ -2018,7 +2020,7 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_LABEL_FOR: { + case RelationType::LABEL_FOR: { Relation rel(new RelatedAccIterator(Document(), mContent, nsGkAtoms::aria_labelledby)); if (mContent->Tag() == nsGkAtoms::label && mContent->IsXUL()) @@ -2027,7 +2029,7 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_DESCRIBED_BY: { + case RelationType::DESCRIBED_BY: { Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_describedby)); if (mContent->IsXUL()) @@ -2036,7 +2038,7 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR: { + case RelationType::DESCRIPTION_FOR: { Relation rel(new RelatedAccIterator(Document(), mContent, nsGkAtoms::aria_describedby)); @@ -2051,7 +2053,7 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: { + case RelationType::NODE_CHILD_OF: { Relation rel(new RelatedAccIterator(Document(), mContent, nsGkAtoms::aria_owns)); @@ -2082,7 +2084,7 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: { + case RelationType::NODE_PARENT_OF: { Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_owns)); // ARIA tree or treegrid can do the hierarchy by @aria-level, ARIA trees @@ -2100,36 +2102,36 @@ Accessible::RelationByType(uint32_t aType) return rel; } - case nsIAccessibleRelation::RELATION_CONTROLLED_BY: + case RelationType::CONTROLLED_BY: return Relation(new RelatedAccIterator(Document(), mContent, nsGkAtoms::aria_controls)); - case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: { + case RelationType::CONTROLLER_FOR: { Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_controls)); rel.AppendIter(new HTMLOutputIterator(Document(), mContent)); return rel; } - case nsIAccessibleRelation::RELATION_FLOWS_TO: + case RelationType::FLOWS_TO: return Relation(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_flowto)); - case nsIAccessibleRelation::RELATION_FLOWS_FROM: + case RelationType::FLOWS_FROM: return Relation(new RelatedAccIterator(Document(), mContent, nsGkAtoms::aria_flowto)); - case nsIAccessibleRelation::RELATION_MEMBER_OF: + case RelationType::MEMBER_OF: return Relation(mDoc, GetAtomicRegion()); - case nsIAccessibleRelation::RELATION_SUBWINDOW_OF: - case nsIAccessibleRelation::RELATION_EMBEDS: - case nsIAccessibleRelation::RELATION_EMBEDDED_BY: - case nsIAccessibleRelation::RELATION_POPUP_FOR: - case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF: + case RelationType::SUBWINDOW_OF: + case RelationType::EMBEDS: + case RelationType::EMBEDDED_BY: + case RelationType::POPUP_FOR: + case RelationType::PARENT_WINDOW_OF: return Relation(); - case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON: { + case RelationType::DEFAULT_BUTTON: { if (mContent->IsHTML()) { // HTML form controls implements nsIFormControl interface. nsCOMPtr control(do_QueryInterface(mContent)); diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index 5741ab42775..ac63424760c 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -7,6 +7,7 @@ #define _Accessible_H_ #include "mozilla/a11y/AccTypes.h" +#include "mozilla/a11y/RelationType.h" #include "mozilla/a11y/Role.h" #include "mozilla/a11y/States.h" #include "nsAccessNode.h" @@ -294,7 +295,7 @@ public: /** * Get the relation of the given type. */ - virtual mozilla::a11y::Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType); ////////////////////////////////////////////////////////////////////////////// // Initializing methods diff --git a/accessible/src/generic/ApplicationAccessible.cpp b/accessible/src/generic/ApplicationAccessible.cpp index 0a0735b5ac9..e2d1b7bb6a4 100644 --- a/accessible/src/generic/ApplicationAccessible.cpp +++ b/accessible/src/generic/ApplicationAccessible.cpp @@ -141,7 +141,7 @@ ApplicationAccessible::FocusedChild() } Relation -ApplicationAccessible::RelationByType(uint32_t aRelationType) +ApplicationAccessible::RelationByType(RelationType aRelationType) { return Relation(); } diff --git a/accessible/src/generic/ApplicationAccessible.h b/accessible/src/generic/ApplicationAccessible.h index 033df8ed8a8..8ddc3eea488 100644 --- a/accessible/src/generic/ApplicationAccessible.h +++ b/accessible/src/generic/ApplicationAccessible.h @@ -70,7 +70,7 @@ public: virtual mozilla::a11y::role NativeRole(); virtual uint64_t State(); virtual uint64_t NativeState(); - virtual Relation RelationByType(uint32_t aRelType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild); diff --git a/accessible/src/generic/RootAccessible.cpp b/accessible/src/generic/RootAccessible.cpp index 0c24449dff9..bbc55a8e516 100644 --- a/accessible/src/generic/RootAccessible.cpp +++ b/accessible/src/generic/RootAccessible.cpp @@ -481,9 +481,9 @@ RootAccessible::Shutdown() // nsIAccessible method Relation -RootAccessible::RelationByType(uint32_t aType) +RootAccessible::RelationByType(RelationType aType) { - if (!mDocumentNode || aType != nsIAccessibleRelation::RELATION_EMBEDS) + if (!mDocumentNode || aType != RelationType::EMBEDS) return DocAccessibleWrap::RelationByType(aType); nsIDOMWindow* rootWindow = mDocumentNode->GetWindow(); diff --git a/accessible/src/generic/RootAccessible.h b/accessible/src/generic/RootAccessible.h index 6a016e5da58..0b2bd24069c 100644 --- a/accessible/src/generic/RootAccessible.h +++ b/accessible/src/generic/RootAccessible.h @@ -34,7 +34,7 @@ public: // Accessible virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; virtual mozilla::a11y::role NativeRole(); virtual uint64_t NativeState(); diff --git a/accessible/src/html/HTMLElementAccessibles.cpp b/accessible/src/html/HTMLElementAccessibles.cpp index 07e9799867f..99ab04d9d0c 100644 --- a/accessible/src/html/HTMLElementAccessibles.cpp +++ b/accessible/src/html/HTMLElementAccessibles.cpp @@ -65,10 +65,10 @@ HTMLLabelAccessible::NativeName(nsString& aName) } Relation -HTMLLabelAccessible::RelationByType(uint32_t aType) +HTMLLabelAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) { + if (aType == RelationType::LABEL_FOR) { nsRefPtr label = dom::HTMLLabelElement::FromContent(mContent); rel.AppendTarget(mDoc, label->GetControl()); } @@ -89,10 +89,10 @@ HTMLLabelAccessible::NativeRole() NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible) Relation -HTMLOutputAccessible::RelationByType(uint32_t aType) +HTMLOutputAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY) + if (aType == RelationType::CONTROLLED_BY) rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for)); return rel; diff --git a/accessible/src/html/HTMLElementAccessibles.h b/accessible/src/html/HTMLElementAccessibles.h index cd2542c3f76..adebf0f0cbd 100644 --- a/accessible/src/html/HTMLElementAccessibles.h +++ b/accessible/src/html/HTMLElementAccessibles.h @@ -61,7 +61,7 @@ public: // Accessible virtual a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType) MOZ_OVERRIDE; + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; protected: virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; @@ -82,7 +82,7 @@ public: // Accessible virtual a11y::role NativeRole(); virtual already_AddRefed NativeAttributes() MOZ_OVERRIDE; - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; }; } // namespace a11y diff --git a/accessible/src/html/HTMLFormControlAccessible.cpp b/accessible/src/html/HTMLFormControlAccessible.cpp index b95d76f34ca..d694fd6964f 100644 --- a/accessible/src/html/HTMLFormControlAccessible.cpp +++ b/accessible/src/html/HTMLFormControlAccessible.cpp @@ -659,11 +659,11 @@ HTMLGroupboxAccessible::NativeName(nsString& aName) } Relation -HTMLGroupboxAccessible::RelationByType(uint32_t aType) +HTMLGroupboxAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); // No override for label, so use for this
- if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY) + if (aType == RelationType::LABELLED_BY) rel.AppendTarget(mDoc, GetLegend()); return rel; @@ -680,10 +680,10 @@ HTMLLegendAccessible:: } Relation -HTMLLegendAccessible::RelationByType(uint32_t aType) +HTMLLegendAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); - if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR) + if (aType != RelationType::LABEL_FOR) return rel; Accessible* groupbox = Parent(); @@ -742,10 +742,10 @@ HTMLFigureAccessible::NativeName(nsString& aName) } Relation -HTMLFigureAccessible::RelationByType(uint32_t aType) +HTMLFigureAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY) + if (aType == RelationType::LABELLED_BY) rel.AppendTarget(mDoc, Caption()); return rel; @@ -782,10 +782,10 @@ HTMLFigcaptionAccessible::NativeRole() } Relation -HTMLFigcaptionAccessible::RelationByType(uint32_t aType) +HTMLFigcaptionAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); - if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR) + if (aType != RelationType::LABEL_FOR) return rel; Accessible* figure = Parent(); diff --git a/accessible/src/html/HTMLFormControlAccessible.h b/accessible/src/html/HTMLFormControlAccessible.h index 005969dcc94..e670c1a5e10 100644 --- a/accessible/src/html/HTMLFormControlAccessible.h +++ b/accessible/src/html/HTMLFormControlAccessible.h @@ -193,7 +193,7 @@ public: // Accessible virtual mozilla::a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; protected: // Accessible @@ -214,7 +214,7 @@ public: // Accessible virtual mozilla::a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; }; /** @@ -228,7 +228,7 @@ public: // Accessible virtual already_AddRefed NativeAttributes() MOZ_OVERRIDE; virtual mozilla::a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; protected: // Accessible @@ -249,7 +249,7 @@ public: // Accessible virtual mozilla::a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; }; } // namespace a11y diff --git a/accessible/src/html/HTMLTableAccessible.cpp b/accessible/src/html/HTMLTableAccessible.cpp index 4d78d6b778d..56de51094cd 100644 --- a/accessible/src/html/HTMLTableAccessible.cpp +++ b/accessible/src/html/HTMLTableAccessible.cpp @@ -451,10 +451,10 @@ HTMLTableAccessible::NativeAttributes() // HTMLTableAccessible: nsIAccessible implementation Relation -HTMLTableAccessible::RelationByType(uint32_t aType) +HTMLTableAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY) + if (aType == RelationType::LABELLED_BY) rel.AppendTarget(Caption()); return rel; @@ -1118,10 +1118,10 @@ HTMLTableAccessible::IsProbablyLayoutTable() //////////////////////////////////////////////////////////////////////////////// Relation -HTMLCaptionAccessible::RelationByType(uint32_t aType) +HTMLCaptionAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessible::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) + if (aType == RelationType::LABEL_FOR) rel.AppendTarget(Parent()); return rel; diff --git a/accessible/src/html/HTMLTableAccessible.h b/accessible/src/html/HTMLTableAccessible.h index c18c0eb9e46..691aa0842b0 100644 --- a/accessible/src/html/HTMLTableAccessible.h +++ b/accessible/src/html/HTMLTableAccessible.h @@ -172,7 +172,7 @@ public: virtual a11y::role NativeRole(); virtual uint64_t NativeState(); virtual already_AddRefed NativeAttributes() MOZ_OVERRIDE; - virtual Relation RelationByType(uint32_t aRelationType); + virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE; protected: // Accessible @@ -231,7 +231,7 @@ public: // Accessible virtual a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aRelationType); + virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE; }; } // namespace a11y diff --git a/accessible/src/mac/mozAccessible.mm b/accessible/src/mac/mozAccessible.mm index f584bc71b51..891bcbdac0b 100644 --- a/accessible/src/mac/mozAccessible.mm +++ b/accessible/src/mac/mozAccessible.mm @@ -193,7 +193,7 @@ GetClosestInterestingAccessible(id anObject) if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) return [self title]; if ([attribute isEqualToString:NSAccessibilityTitleUIElementAttribute]) { - Relation rel = mGeckoAccessible->RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY); + Relation rel = mGeckoAccessible->RelationByType(RelationType::LABELLED_BY); Accessible* tempAcc = rel.Next(); return tempAcc ? GetNativeFromGeckoAccessible(tempAcc) : nil; } diff --git a/accessible/src/windows/ia2/ia2Accessible.cpp b/accessible/src/windows/ia2/ia2Accessible.cpp index ce3a0cc5663..08cb8f64dd6 100644 --- a/accessible/src/windows/ia2/ia2Accessible.cpp +++ b/accessible/src/windows/ia2/ia2Accessible.cpp @@ -86,10 +86,10 @@ ia2Accessible::get_relation(long aRelationIndex, long relIdx = 0; for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) { - uint32_t relType = sRelationTypesForIA2[idx]; - Relation rel = acc->RelationByType(relType); + RelationType relationType = sRelationTypesForIA2[idx]; + Relation rel = acc->RelationByType(relationType); nsRefPtr ia2Relation = - new ia2AccessibleRelation(relType, &rel); + new ia2AccessibleRelation(relationType, &rel); if (ia2Relation->HasTargets()) { if (relIdx == aRelationIndex) { ia2Relation.forget(aRelation); @@ -122,10 +122,10 @@ ia2Accessible::get_relations(long aMaxRelations, for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2) && *aNRelations < aMaxRelations; idx++) { - uint32_t relType = sRelationTypesForIA2[idx]; - Relation rel = acc->RelationByType(relType); + RelationType relationType = sRelationTypesForIA2[idx]; + Relation rel = acc->RelationByType(relationType); nsRefPtr ia2Rel = - new ia2AccessibleRelation(relType, &rel); + new ia2AccessibleRelation(relationType, &rel); if (ia2Rel->HasTargets()) { ia2Rel.forget(aRelation + (*aNRelations)); (*aNRelations)++; diff --git a/accessible/src/windows/ia2/ia2AccessibleRelation.cpp b/accessible/src/windows/ia2/ia2AccessibleRelation.cpp index 75d7e880133..aeba6ab4958 100644 --- a/accessible/src/windows/ia2/ia2AccessibleRelation.cpp +++ b/accessible/src/windows/ia2/ia2AccessibleRelation.cpp @@ -8,7 +8,6 @@ #include "ia2AccessibleRelation.h" #include "Relation.h" -#include "IUnknownImpl.h" #include "nsIAccessibleRelation.h" #include "nsID.h" @@ -16,8 +15,8 @@ using namespace mozilla::a11y; -ia2AccessibleRelation::ia2AccessibleRelation(uint32_t aType, Relation* aRel) : - mType(aType), mReferences(0) +ia2AccessibleRelation::ia2AccessibleRelation(RelationType aType, Relation* aRel) : + mType(aType) { Accessible* target = nullptr; while ((target = aRel->Next())) @@ -26,39 +25,10 @@ ia2AccessibleRelation::ia2AccessibleRelation(uint32_t aType, Relation* aRel) : // IUnknown -STDMETHODIMP -ia2AccessibleRelation::QueryInterface(REFIID iid, void** ppv) -{ - if (!ppv) - return E_INVALIDARG; - - *ppv = nullptr; - - if (IID_IAccessibleRelation == iid || IID_IUnknown == iid) { - *ppv = static_cast(this); - (reinterpret_cast(*ppv))->AddRef(); - return S_OK; - } - - return E_NOINTERFACE; -} - -ULONG STDMETHODCALLTYPE -ia2AccessibleRelation::AddRef() -{ - return mReferences++; -} - -ULONG STDMETHODCALLTYPE -ia2AccessibleRelation::Release() -{ - mReferences--; - ULONG references = mReferences; - if (!mReferences) - delete this; - - return references; -} +IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleRelation) + IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleRelation) + IMPL_IUNKNOWN_QUERY_IFACE(IUnknown) +IMPL_IUNKNOWN_QUERY_TAIL // IAccessibleRelation @@ -73,56 +43,54 @@ ia2AccessibleRelation::get_relationType(BSTR *aRelationType) *aRelationType = nullptr; switch (mType) { - case nsIAccessibleRelation::RELATION_CONTROLLED_BY: + case RelationType::CONTROLLED_BY: *aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLED_BY); break; - case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: + case RelationType::CONTROLLER_FOR: *aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLER_FOR); break; - case nsIAccessibleRelation::RELATION_DESCRIBED_BY: + case RelationType::DESCRIBED_BY: *aRelationType = ::SysAllocString(IA2_RELATION_DESCRIBED_BY); break; - case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR: + case RelationType::DESCRIPTION_FOR: *aRelationType = ::SysAllocString(IA2_RELATION_DESCRIPTION_FOR); break; - case nsIAccessibleRelation::RELATION_EMBEDDED_BY: + case RelationType::EMBEDDED_BY: *aRelationType = ::SysAllocString(IA2_RELATION_EMBEDDED_BY); break; - case nsIAccessibleRelation::RELATION_EMBEDS: + case RelationType::EMBEDS: *aRelationType = ::SysAllocString(IA2_RELATION_EMBEDS); break; - case nsIAccessibleRelation::RELATION_FLOWS_FROM: + case RelationType::FLOWS_FROM: *aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_FROM); break; - case nsIAccessibleRelation::RELATION_FLOWS_TO: + case RelationType::FLOWS_TO: *aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_TO); break; - case nsIAccessibleRelation::RELATION_LABEL_FOR: + case RelationType::LABEL_FOR: *aRelationType = ::SysAllocString(IA2_RELATION_LABEL_FOR); break; - case nsIAccessibleRelation::RELATION_LABELLED_BY: + case RelationType::LABELLED_BY: *aRelationType = ::SysAllocString(IA2_RELATION_LABELED_BY); break; - case nsIAccessibleRelation::RELATION_MEMBER_OF: + case RelationType::MEMBER_OF: *aRelationType = ::SysAllocString(IA2_RELATION_MEMBER_OF); break; - case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: + case RelationType::NODE_CHILD_OF: *aRelationType = ::SysAllocString(IA2_RELATION_NODE_CHILD_OF); break; - case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: + case RelationType::NODE_PARENT_OF: *aRelationType = ::SysAllocString(IA2_RELATION_NODE_PARENT_OF); break; - case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF: + case RelationType::PARENT_WINDOW_OF: *aRelationType = ::SysAllocString(IA2_RELATION_PARENT_WINDOW_OF); break; - case nsIAccessibleRelation::RELATION_POPUP_FOR: + case RelationType::POPUP_FOR: *aRelationType = ::SysAllocString(IA2_RELATION_POPUP_FOR); break; - case nsIAccessibleRelation::RELATION_SUBWINDOW_OF: + case RelationType::SUBWINDOW_OF: *aRelationType = ::SysAllocString(IA2_RELATION_SUBWINDOW_OF); break; - default: - return E_FAIL; } return *aRelationType ? S_OK : E_OUTOFMEMORY; diff --git a/accessible/src/windows/ia2/ia2AccessibleRelation.h b/accessible/src/windows/ia2/ia2AccessibleRelation.h index f5cdf2053cc..3f6602ca3bf 100644 --- a/accessible/src/windows/ia2/ia2AccessibleRelation.h +++ b/accessible/src/windows/ia2/ia2AccessibleRelation.h @@ -9,6 +9,7 @@ #define _NS_ACCESSIBLE_RELATION_WRAP_H #include "Accessible.h" +#include "IUnknownImpl.h" #include "nsIAccessibleRelation.h" #include "nsTArray.h" @@ -18,16 +19,13 @@ namespace mozilla { namespace a11y { -class ia2AccessibleRelation : public IAccessibleRelation +class ia2AccessibleRelation MOZ_FINAL : public IAccessibleRelation { public: - ia2AccessibleRelation(uint32_t aType, Relation* aRel); - virtual ~ia2AccessibleRelation() { } + ia2AccessibleRelation(RelationType aType, Relation* aRel); // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID aIID, void** aOutPtr); - virtual ULONG STDMETHODCALLTYPE AddRef(); - virtual ULONG STDMETHODCALLTYPE Release(); + DECL_IUNKNOWN // IAccessibleRelation virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType( @@ -56,32 +54,31 @@ private: ia2AccessibleRelation(const ia2AccessibleRelation&); ia2AccessibleRelation& operator = (const ia2AccessibleRelation&); - uint32_t mType; + RelationType mType; nsTArray > mTargets; - ULONG mReferences; }; /** * Relations exposed to IAccessible2. */ -static const uint32_t sRelationTypesForIA2[] = { - nsIAccessibleRelation::RELATION_LABELLED_BY, - nsIAccessibleRelation::RELATION_LABEL_FOR, - nsIAccessibleRelation::RELATION_DESCRIBED_BY, - nsIAccessibleRelation::RELATION_DESCRIPTION_FOR, - nsIAccessibleRelation::RELATION_NODE_CHILD_OF, - nsIAccessibleRelation::RELATION_NODE_PARENT_OF, - nsIAccessibleRelation::RELATION_CONTROLLED_BY, - nsIAccessibleRelation::RELATION_CONTROLLER_FOR, - nsIAccessibleRelation::RELATION_FLOWS_TO, - nsIAccessibleRelation::RELATION_FLOWS_FROM, - nsIAccessibleRelation::RELATION_MEMBER_OF, - nsIAccessibleRelation::RELATION_SUBWINDOW_OF, - nsIAccessibleRelation::RELATION_EMBEDS, - nsIAccessibleRelation::RELATION_EMBEDDED_BY, - nsIAccessibleRelation::RELATION_POPUP_FOR, - nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF +static const RelationType sRelationTypesForIA2[] = { + RelationType::LABELLED_BY, + RelationType::LABEL_FOR, + RelationType::DESCRIBED_BY, + RelationType::DESCRIPTION_FOR, + RelationType::NODE_CHILD_OF, + RelationType::NODE_PARENT_OF, + RelationType::CONTROLLED_BY, + RelationType::CONTROLLER_FOR, + RelationType::FLOWS_TO, + RelationType::FLOWS_FROM, + RelationType::MEMBER_OF, + RelationType::SUBWINDOW_OF, + RelationType::EMBEDS, + RelationType::EMBEDDED_BY, + RelationType::POPUP_FOR, + RelationType::PARENT_WINDOW_OF }; } // namespace a11y diff --git a/accessible/src/windows/msaa/AccessibleWrap.cpp b/accessible/src/windows/msaa/AccessibleWrap.cpp index 0459d7dec3f..ed657f310d0 100644 --- a/accessible/src/windows/msaa/AccessibleWrap.cpp +++ b/accessible/src/windows/msaa/AccessibleWrap.cpp @@ -921,55 +921,55 @@ AccessibleWrap::accNavigate( // MSAA relationship extensions to accNavigate case NAVRELATION_CONTROLLED_BY: - xpRelation = nsIAccessibleRelation::RELATION_CONTROLLED_BY; + xpRelation = RelationType::CONTROLLED_BY; break; case NAVRELATION_CONTROLLER_FOR: - xpRelation = nsIAccessibleRelation::RELATION_CONTROLLER_FOR; + xpRelation = RelationType::CONTROLLER_FOR; break; case NAVRELATION_LABEL_FOR: - xpRelation = nsIAccessibleRelation::RELATION_LABEL_FOR; + xpRelation = RelationType::LABEL_FOR; break; case NAVRELATION_LABELLED_BY: - xpRelation = nsIAccessibleRelation::RELATION_LABELLED_BY; + xpRelation = RelationType::LABELLED_BY; break; case NAVRELATION_MEMBER_OF: - xpRelation = nsIAccessibleRelation::RELATION_MEMBER_OF; + xpRelation = RelationType::MEMBER_OF; break; case NAVRELATION_NODE_CHILD_OF: - xpRelation = nsIAccessibleRelation::RELATION_NODE_CHILD_OF; + xpRelation = RelationType::NODE_CHILD_OF; break; case NAVRELATION_FLOWS_TO: - xpRelation = nsIAccessibleRelation::RELATION_FLOWS_TO; + xpRelation = RelationType::FLOWS_TO; break; case NAVRELATION_FLOWS_FROM: - xpRelation = nsIAccessibleRelation::RELATION_FLOWS_FROM; + xpRelation = RelationType::FLOWS_FROM; break; case NAVRELATION_SUBWINDOW_OF: - xpRelation = nsIAccessibleRelation::RELATION_SUBWINDOW_OF; + xpRelation = RelationType::SUBWINDOW_OF; break; case NAVRELATION_EMBEDS: - xpRelation = nsIAccessibleRelation::RELATION_EMBEDS; + xpRelation = RelationType::EMBEDS; break; case NAVRELATION_EMBEDDED_BY: - xpRelation = nsIAccessibleRelation::RELATION_EMBEDDED_BY; + xpRelation = RelationType::EMBEDDED_BY; break; case NAVRELATION_POPUP_FOR: - xpRelation = nsIAccessibleRelation::RELATION_POPUP_FOR; + xpRelation = RelationType::POPUP_FOR; break; case NAVRELATION_PARENT_WINDOW_OF: - xpRelation = nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF; + xpRelation = RelationType::PARENT_WINDOW_OF; break; case NAVRELATION_DEFAULT_BUTTON: - xpRelation = nsIAccessibleRelation::RELATION_DEFAULT_BUTTON; + xpRelation = RelationType::DEFAULT_BUTTON; break; case NAVRELATION_DESCRIBED_BY: - xpRelation = nsIAccessibleRelation::RELATION_DESCRIBED_BY; + xpRelation = RelationType::DESCRIBED_BY; break; case NAVRELATION_DESCRIPTION_FOR: - xpRelation = nsIAccessibleRelation::RELATION_DESCRIPTION_FOR; + xpRelation = RelationType::DESCRIPTION_FOR; break; case NAVRELATION_NODE_PARENT_OF: - xpRelation = nsIAccessibleRelation::RELATION_NODE_PARENT_OF; + xpRelation = RelationType::NODE_PARENT_OF; break; default: @@ -979,7 +979,7 @@ AccessibleWrap::accNavigate( pvarEndUpAt->vt = VT_EMPTY; if (xpRelation >= 0) { - Relation rel = RelationByType(xpRelation); + Relation rel = RelationByType(static_cast(xpRelation)); navAccessible = rel.Next(); } diff --git a/accessible/src/xul/XULElementAccessibles.cpp b/accessible/src/xul/XULElementAccessibles.cpp index 768f68b9952..2dede9fef03 100644 --- a/accessible/src/xul/XULElementAccessibles.cpp +++ b/accessible/src/xul/XULElementAccessibles.cpp @@ -87,10 +87,10 @@ XULLabelAccessible::NativeState() } Relation -XULLabelAccessible::RelationByType(uint32_t aType) +XULLabelAccessible::RelationByType(RelationType aType) { Relation rel = HyperTextAccessibleWrap::RelationByType(aType); - if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) { + if (aType == RelationType::LABEL_FOR) { // Caption is the label for groupbox nsIContent* parent = mContent->GetFlattenedTreeParent(); if (parent && parent->Tag() == nsGkAtoms::caption) { diff --git a/accessible/src/xul/XULElementAccessibles.h b/accessible/src/xul/XULElementAccessibles.h index c24607444f4..e77775c25a1 100644 --- a/accessible/src/xul/XULElementAccessibles.h +++ b/accessible/src/xul/XULElementAccessibles.h @@ -26,7 +26,7 @@ public: virtual void Shutdown(); virtual a11y::role NativeRole(); virtual uint64_t NativeState(); - virtual Relation RelationByType(uint32_t aRelationType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; void UpdateLabelValue(const nsString& aValue); diff --git a/accessible/src/xul/XULFormControlAccessible.cpp b/accessible/src/xul/XULFormControlAccessible.cpp index 32b1b4bd344..befb3ffb472 100644 --- a/accessible/src/xul/XULFormControlAccessible.cpp +++ b/accessible/src/xul/XULFormControlAccessible.cpp @@ -385,7 +385,7 @@ XULGroupboxAccessible::NativeName(nsString& aName) { // XXX: we use the first related accessible only. Accessible* label = - RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY).Next(); + RelationByType(RelationType::LABELLED_BY).Next(); if (label) return label->Name(aName); @@ -393,10 +393,10 @@ XULGroupboxAccessible::NativeName(nsString& aName) } Relation -XULGroupboxAccessible::RelationByType(uint32_t aType) +XULGroupboxAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY) + if (aType != RelationType::LABELLED_BY) return rel; // The label for xul:groupbox is generated from xul:label that is @@ -407,8 +407,7 @@ XULGroupboxAccessible::RelationByType(uint32_t aType) Accessible* childAcc = GetChildAt(childIdx); if (childAcc->Role() == roles::LABEL) { // Ensure that it's our label - Relation reverseRel = - childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR); + Relation reverseRel = childAcc->RelationByType(RelationType::LABEL_FOR); Accessible* testGroupbox = nullptr; while ((testGroupbox = reverseRel.Next())) if (testGroupbox == this) { diff --git a/accessible/src/xul/XULFormControlAccessible.h b/accessible/src/xul/XULFormControlAccessible.h index 6c23b7a0e23..3d7dbd7b46d 100644 --- a/accessible/src/xul/XULFormControlAccessible.h +++ b/accessible/src/xul/XULFormControlAccessible.h @@ -115,7 +115,7 @@ public: // Accessible virtual mozilla::a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aRelationType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; protected: // Accessible diff --git a/accessible/src/xul/XULTabAccessible.cpp b/accessible/src/xul/XULTabAccessible.cpp index 7a374fd0e86..cfedaf405b5 100644 --- a/accessible/src/xul/XULTabAccessible.cpp +++ b/accessible/src/xul/XULTabAccessible.cpp @@ -108,10 +108,10 @@ XULTabAccessible::NativeInteractiveState() const // nsIAccessible Relation -XULTabAccessible::RelationByType(uint32_t aType) +XULTabAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR) + if (aType != RelationType::LABEL_FOR) return rel; // Expose 'LABEL_FOR' relation on tab accessible for tabpanel accessible. @@ -195,10 +195,10 @@ XULTabpanelAccessible::NativeRole() } Relation -XULTabpanelAccessible::RelationByType(uint32_t aType) +XULTabpanelAccessible::RelationByType(RelationType aType) { Relation rel = AccessibleWrap::RelationByType(aType); - if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY) + if (aType != RelationType::LABELLED_BY) return rel; // Expose 'LABELLED_BY' relation on tabpanel accessible for tab accessible. diff --git a/accessible/src/xul/XULTabAccessible.h b/accessible/src/xul/XULTabAccessible.h index b8fe6ecee09..c57fcd10f89 100644 --- a/accessible/src/xul/XULTabAccessible.h +++ b/accessible/src/xul/XULTabAccessible.h @@ -31,7 +31,7 @@ public: virtual a11y::role NativeRole(); virtual uint64_t NativeState(); virtual uint64_t NativeInteractiveState() const; - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; // ActionAccessible virtual uint8_t ActionCount(); @@ -91,7 +91,7 @@ public: // Accessible virtual a11y::role NativeRole(); - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; }; } // namespace a11y diff --git a/accessible/src/xul/XULTreeAccessible.cpp b/accessible/src/xul/XULTreeAccessible.cpp index f29f785a5cd..a280d7e4937 100644 --- a/accessible/src/xul/XULTreeAccessible.cpp +++ b/accessible/src/xul/XULTreeAccessible.cpp @@ -442,9 +442,9 @@ XULTreeAccessible::ChildCount() const } Relation -XULTreeAccessible::RelationByType(uint32_t aType) +XULTreeAccessible::RelationByType(RelationType aType) { - if (aType == nsIAccessibleRelation::RELATION_NODE_PARENT_OF) { + if (aType == RelationType::NODE_PARENT_OF) { if (mTreeView) return Relation(new XULTreeItemIterator(this, mTreeView, -1)); @@ -808,11 +808,11 @@ XULTreeItemAccessibleBase::TakeFocus() } Relation -XULTreeItemAccessibleBase::RelationByType(uint32_t aType) +XULTreeItemAccessibleBase::RelationByType(RelationType aType) { switch (aType) { - case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: { + case RelationType::NODE_CHILD_OF: { int32_t parentIndex = -1; if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex))) return Relation(); @@ -824,7 +824,7 @@ XULTreeItemAccessibleBase::RelationByType(uint32_t aType) return Relation(treeAcc->GetTreeItemAccessible(parentIndex)); } - case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: { + case RelationType::NODE_PARENT_OF: { bool isTrue = false; if (NS_FAILED(mTreeView->IsContainerEmpty(mRow, &isTrue)) || isTrue) return Relation(); diff --git a/accessible/src/xul/XULTreeAccessible.h b/accessible/src/xul/XULTreeAccessible.h index c6e987df56c..b94fb899e33 100644 --- a/accessible/src/xul/XULTreeAccessible.h +++ b/accessible/src/xul/XULTreeAccessible.h @@ -50,7 +50,7 @@ public: virtual Accessible* GetChildAt(uint32_t aIndex); virtual uint32_t ChildCount() const; - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; // SelectAccessible virtual already_AddRefed SelectedItems(); @@ -163,7 +163,7 @@ public: virtual uint64_t NativeState(); virtual uint64_t NativeInteractiveState() const; virtual int32_t IndexInParent() const; - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; virtual Accessible* FocusedChild(); // ActionAccessible diff --git a/accessible/src/xul/XULTreeGridAccessible.cpp b/accessible/src/xul/XULTreeGridAccessible.cpp index 1374641ccac..fe9ceab7f44 100644 --- a/accessible/src/xul/XULTreeGridAccessible.cpp +++ b/accessible/src/xul/XULTreeGridAccessible.cpp @@ -762,7 +762,7 @@ XULTreeGridCellAccessible::IndexInParent() const } Relation -XULTreeGridCellAccessible::RelationByType(uint32_t aType) +XULTreeGridCellAccessible::RelationByType(RelationType aType) { return Relation(); } diff --git a/accessible/src/xul/XULTreeGridAccessible.h b/accessible/src/xul/XULTreeGridAccessible.h index 341cc13c280..5e8d5e357b2 100644 --- a/accessible/src/xul/XULTreeGridAccessible.h +++ b/accessible/src/xul/XULTreeGridAccessible.h @@ -160,7 +160,7 @@ public: virtual Accessible* FocusedChild(); virtual already_AddRefed NativeAttributes() MOZ_OVERRIDE; virtual int32_t IndexInParent() const; - virtual Relation RelationByType(uint32_t aType); + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; virtual a11y::role NativeRole(); virtual uint64_t NativeState(); virtual uint64_t NativeInteractiveState() const; From 47a24d2894eca744842c0a7d9e2daefab9247a2b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 19 Oct 2013 12:14:51 -0700 Subject: [PATCH 23/48] Revert "Bug 925088 - SpiderMonkey: Micro-optimize x64's testStringTruthy. r=mjrosen" --- js/src/jit/x64/MacroAssembler-x64.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index 9fdb5bf8910..383fdf15a7b 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -1059,11 +1059,14 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared testl(operand.valueReg(), operand.valueReg()); j(truthy ? NonZero : Zero, label); } + // This returns the tag in ScratchReg. Condition testStringTruthy(bool truthy, const ValueOperand &value) { unboxString(value, ScratchReg); Operand lengthAndFlags(ScratchReg, JSString::offsetOfLengthAndFlags()); - testq(lengthAndFlags, Imm32(-1 << JSString::LENGTH_SHIFT)); + movq(lengthAndFlags, ScratchReg); + shrq(Imm32(JSString::LENGTH_SHIFT), ScratchReg); + testq(ScratchReg, ScratchReg); return truthy ? Assembler::NonZero : Assembler::Zero; } From 777dc154bc8981c1ec7c46a20aeb80e2288f637f Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 17 Oct 2013 20:42:59 -0700 Subject: [PATCH 24/48] Bug 925195 - Fix -Wsign-compare warning about GetProtocolId() enum return value. r=bent --- gfx/layers/ipc/ImageBridgeParent.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index ecda4d43354..f230b3dfd42 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -100,7 +100,6 @@ ImageBridgeParent::RecvUpdateNoSwap(const EditArray& aEdits) return success; } - static void ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge, Transport* aTransport, @@ -179,8 +178,6 @@ bool ImageBridgeParent::DeallocPCompositableParent(PCompositableParent* aActor) return true; } - - MessageLoop * ImageBridgeParent::GetMessageLoop() { return mMessageLoop; } @@ -198,7 +195,7 @@ ImageBridgeParent::CloneToplevel(const InfallibleTArray& aFds mozilla::ipc::ProtocolCloneContext* aCtx) { for (unsigned int i = 0; i < aFds.Length(); i++) { - if (aFds[i].protocolId() == (int)GetProtocolId()) { + if (aFds[i].protocolId() == unsigned(GetProtocolId())) { Transport* transport = OpenDescriptor(aFds[i].fd(), Transport::MODE_SERVER); PImageBridgeParent* bridge = Create(transport, base::GetProcId(aPeerProcess)); From e1f1057dd520758a37e917ee3aee4c0cf1650721 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Sat, 19 Oct 2013 13:56:57 -0700 Subject: [PATCH 25/48] Bug 928426 - Don't create template objects for singleton-typed this values. (r=bhackett) --- js/src/jit/BaselineIC.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index f19f329b55a..63bc919a7b3 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -7454,7 +7454,9 @@ GetTemplateObjectForNative(JSContext *cx, HandleScript script, jsbytecode *pc, } if (native == js::array_concat) { - if (args.thisv().isObject() && args.thisv().toObject().is()) { + if (args.thisv().isObject() && args.thisv().toObject().is() && + !args.thisv().toObject().hasSingletonType()) + { res.set(NewDenseEmptyArray(cx, args.thisv().toObject().getProto(), TenuredObject)); if (!res) return false; From fccf27d2ae2b49a31b1c10ebfa17e17663fa4085 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Fri, 11 Oct 2013 16:47:47 -0400 Subject: [PATCH 26/48] Bug 921212 - Rotate buffer in place to avoid gralloc surface allocation. r=Bas --- gfx/2d/2D.h | 9 ++ gfx/2d/DrawTargetCairo.cpp | 28 +++++ gfx/2d/DrawTargetCairo.h | 6 + gfx/layers/BufferUnrotate.cpp | 63 +++++++++++ gfx/layers/BufferUnrotate.h | 14 +++ gfx/layers/ThebesLayerBuffer.cpp | 53 +++++++-- gfx/layers/ThebesLayerBuffer.h | 3 + gfx/layers/client/ContentClient.cpp | 12 +- gfx/layers/moz.build | 1 + gfx/tests/gtest/TestBufferRotation.cpp | 151 +++++++++++++++++++++++++ gfx/tests/gtest/moz.build | 1 + 11 files changed, 323 insertions(+), 18 deletions(-) create mode 100644 gfx/layers/BufferUnrotate.cpp create mode 100644 gfx/layers/BufferUnrotate.h create mode 100644 gfx/tests/gtest/TestBufferRotation.cpp diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 72293602e5e..81d22773c0a 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -578,6 +578,15 @@ public: virtual TemporaryRef Snapshot() = 0; virtual IntSize GetSize() = 0; + /** + * If possible returns the bits to this DrawTarget for direct manipulation. While + * the bits is locked any modifications to this DrawTarget is forbidden. + * Release takes the original data pointer for safety. + */ + virtual bool LockBits(uint8_t** aData, IntSize* aSize, + int32_t* aStride, SurfaceFormat* aFormat) { return false; } + virtual void ReleaseBits(uint8_t* aData) {} + /* Ensure that the DrawTarget backend has flushed all drawing operations to * this draw target. This must be called before using the backing surface of * this draw target outside of GFX 2D code. diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index 57486ac858e..44a5a0cf8db 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -399,6 +399,7 @@ NeedIntermediateSurface(const Pattern& aPattern, const DrawOptions& aOptions) DrawTargetCairo::DrawTargetCairo() : mContext(nullptr) + , mLockedBits(nullptr) { } @@ -408,6 +409,7 @@ DrawTargetCairo::~DrawTargetCairo() if (mSurface) { cairo_surface_destroy(mSurface); } + MOZ_ASSERT(!mLockedBits); } IntSize @@ -433,6 +435,31 @@ DrawTargetCairo::Snapshot() return mSnapshot; } +bool +DrawTargetCairo::LockBits(uint8_t** aData, IntSize* aSize, + int32_t* aStride, SurfaceFormat* aFormat) +{ + if (cairo_surface_get_type(mSurface) == CAIRO_SURFACE_TYPE_IMAGE) { + WillChange(); + + mLockedBits = cairo_image_surface_get_data(mSurface); + *aData = mLockedBits; + *aSize = GetSize(); + *aStride = cairo_image_surface_get_stride(mSurface); + *aFormat = GetFormat(); + return true; + } + + return false; +} + +void +DrawTargetCairo::ReleaseBits(uint8_t* aData) +{ + MOZ_ASSERT(mLockedBits == aData); + mLockedBits = nullptr; +} + void DrawTargetCairo::Flush() { @@ -1152,6 +1179,7 @@ void DrawTargetCairo::WillChange(const Path* aPath /* = nullptr */) { MarkSnapshotIndependent(); + MOZ_ASSERT(!mLockedBits); } void diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h index 7b30707462b..f23b6241dce 100644 --- a/gfx/2d/DrawTargetCairo.h +++ b/gfx/2d/DrawTargetCairo.h @@ -60,6 +60,10 @@ public: virtual TemporaryRef Snapshot(); virtual IntSize GetSize(); + virtual bool LockBits(uint8_t** aData, IntSize* aSize, + int32_t* aStride, SurfaceFormat* aFormat); + virtual void ReleaseBits(uint8_t* aData); + virtual void Flush(); virtual void DrawSurface(SourceSurface *aSurface, const Rect &aDest, @@ -185,6 +189,8 @@ private: // data cairo_surface_t* mSurface; IntSize mSize; + uint8_t* mLockedBits; + // The latest snapshot of this surface. This needs to be told when this // target is modified. We keep it alive as a cache. RefPtr mSnapshot; diff --git a/gfx/layers/BufferUnrotate.cpp b/gfx/layers/BufferUnrotate.cpp new file mode 100644 index 00000000000..e5ba465e4cb --- /dev/null +++ b/gfx/layers/BufferUnrotate.cpp @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include // min & max +#include +#include +#include +#include + +void BufferUnrotate(uint8_t* aBuffer, int aByteWidth, int aHeight, + int aByteStride, int aXBoundary, int aYBoundary) +{ + if (aXBoundary != 0) { + uint8_t* line = new uint8_t[aByteWidth]; + uint32_t smallStart = 0; + uint32_t smallLen = aXBoundary; + uint32_t smallDest = aByteWidth - aXBoundary; + uint32_t largeStart = aXBoundary; + uint32_t largeLen = aByteWidth - aXBoundary; + uint32_t largeDest = 0; + if (aXBoundary > aByteWidth / 2) { + smallStart = aXBoundary; + smallLen = aByteWidth - aXBoundary; + smallDest = 0; + largeStart = 0; + largeLen = aXBoundary; + largeDest = smallLen; + } + + for (int y = 0; y < aHeight; y++) { + int yOffset = y * aByteStride; + memcpy(line, &aBuffer[yOffset + smallStart], smallLen); + memmove(&aBuffer[yOffset + largeDest], &aBuffer[yOffset + largeStart], largeLen); + memcpy(&aBuffer[yOffset + smallDest], line, smallLen); + } + + delete[] line; + } + + if (aYBoundary != 0) { + uint32_t smallestHeight = std::min(aHeight - aYBoundary, aYBoundary); + uint32_t largestHeight = std::max(aHeight - aYBoundary, aYBoundary); + uint32_t smallOffset = 0; + uint32_t largeOffset = aYBoundary * aByteStride; + uint32_t largeDestOffset = 0; + uint32_t smallDestOffset = largestHeight * aByteStride; + if (aYBoundary > aHeight / 2) { + smallOffset = aYBoundary * aByteStride; + largeOffset = 0; + largeDestOffset = smallestHeight * aByteStride; + smallDestOffset = 0; + } + + uint8_t* smallestSide = new uint8_t[aByteStride * smallestHeight]; + memcpy(smallestSide, &aBuffer[smallOffset], aByteStride * smallestHeight); + memmove(&aBuffer[largeDestOffset], &aBuffer[largeOffset], aByteStride * largestHeight); + memcpy(&aBuffer[smallDestOffset], smallestSide, aByteStride * smallestHeight); + delete[] smallestSide; + } +} + diff --git a/gfx/layers/BufferUnrotate.h b/gfx/layers/BufferUnrotate.h new file mode 100644 index 00000000000..a292d02fcfa --- /dev/null +++ b/gfx/layers/BufferUnrotate.h @@ -0,0 +1,14 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GFX_BUFFERUNROTATE_H +#define GFX_BUFFERUNROTATE_H + +#include "mozilla/Types.h" + +void BufferUnrotate(uint8_t* aBuffer, int aByteWidth, int aHeight, + int aByteStride, int aXByteBoundary, int aYBoundary); + +#endif // GFX_BUFFERUNROTATE_H diff --git a/gfx/layers/ThebesLayerBuffer.cpp b/gfx/layers/ThebesLayerBuffer.cpp index 7be8fa56ce3..f41e987ce9c 100644 --- a/gfx/layers/ThebesLayerBuffer.cpp +++ b/gfx/layers/ThebesLayerBuffer.cpp @@ -8,6 +8,7 @@ #include // for max #include "BasicImplData.h" // for BasicImplData #include "BasicLayersImpl.h" // for ToData +#include "BufferUnrotate.h" // for BufferUnrotate #include "GeckoProfiler.h" // for PROFILER_LABEL #include "Layers.h" // for ThebesLayer, Layer, etc #include "gfxColor.h" // for gfxRGBA @@ -675,18 +676,54 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType, } } result.mDidSelfCopy = true; + mDidSelfCopy = true; // Don't set destBuffer; we special-case self-copies, and // just did the necessary work above. mBufferRect = destBufferRect; } else { - // We can't do a real self-copy because the buffer is rotated. - // So allocate a new buffer for the destination. - destBufferRect = ComputeBufferRect(neededRegion.GetBounds()); - CreateBuffer(contentType, destBufferRect, bufferFlags, - getter_AddRefs(destBuffer), getter_AddRefs(destBufferOnWhite), - &destDTBuffer, &destDTBufferOnWhite); - if (!destBuffer && !destDTBuffer) - return result; + // With azure and a data surface perform an buffer unrotate + // (SelfCopy). + if (IsAzureBuffer()) { + unsigned char* data; + IntSize size; + int32_t stride; + SurfaceFormat format; + + if (mDTBuffer->LockBits(&data, &size, &stride, &format)) { + uint8_t bytesPerPixel = BytesPerPixel(format); + BufferUnrotate(data, + size.width * bytesPerPixel, + size.height, stride, + newRotation.x * bytesPerPixel, newRotation.y); + mDTBuffer->ReleaseBits(data); + + if (mode == Layer::SURFACE_COMPONENT_ALPHA) { + mDTBufferOnWhite->LockBits(&data, &size, &stride, &format); + uint8_t bytesPerPixel = BytesPerPixel(format); + BufferUnrotate(data, + size.width * bytesPerPixel, + size.height, stride, + newRotation.x * bytesPerPixel, newRotation.y); + mDTBufferOnWhite->ReleaseBits(data); + } + + // Buffer unrotate moves all the pixels, note that + // we self copied for SyncBackToFrontBuffer + result.mDidSelfCopy = true; + mDidSelfCopy = true; + mBufferRect = destBufferRect; + mBufferRotation = nsIntPoint(0, 0); + } + } + + if (!result.mDidSelfCopy) { + destBufferRect = ComputeBufferRect(neededRegion.GetBounds()); + CreateBuffer(contentType, destBufferRect, bufferFlags, + getter_AddRefs(destBuffer), getter_AddRefs(destBufferOnWhite), + &destDTBuffer, &destDTBufferOnWhite); + if (!destBuffer && !destDTBuffer) + return result; + } } } else { mBufferRect = destBufferRect; diff --git a/gfx/layers/ThebesLayerBuffer.h b/gfx/layers/ThebesLayerBuffer.h index ff2af1745f4..45fdb0e502a 100644 --- a/gfx/layers/ThebesLayerBuffer.h +++ b/gfx/layers/ThebesLayerBuffer.h @@ -146,6 +146,9 @@ protected: * buffer at the other end, not 2D rotation! */ nsIntPoint mBufferRotation; + // When this is true it means that all pixels have moved inside the buffer. + // It's not possible to sync with another buffer without a full copy. + bool mDidSelfCopy; }; /** diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index f46f9044662..5ecf1568ebe 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -479,21 +479,13 @@ ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer() nsIntRegion updateRegion = mFrontUpdatedRegion; - int32_t xBoundary = mBufferRect.XMost() - mBufferRotation.x; - int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y; - - // Figure out whether the area we want to copy wraps the edges of our buffer. - bool needFullCopy = (xBoundary < updateRegion.GetBounds().XMost() && - xBoundary > updateRegion.GetBounds().x) || - (yBoundary < updateRegion.GetBounds().YMost() && - yBoundary > updateRegion.GetBounds().y); - // This is a tricky trade off, we're going to get stuff out of our // frontbuffer now, but the next PaintThebes might throw it all (or mostly) // away if the visible region has changed. This is why in reality we want // this code integrated with PaintThebes to always do the optimal thing. - if (needFullCopy) { + if (mDidSelfCopy) { + mDidSelfCopy = false; // We can't easily draw our front buffer into us, since we're going to be // copying stuff around anyway it's easiest if we just move our situation // to non-rotated while we're at it. If this situation occurs we'll have diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 8a78512c0bf..0db42ef7222 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -194,6 +194,7 @@ CPP_SOURCES += [ 'basic/BasicLayerManager.cpp', 'basic/BasicLayersImpl.cpp', 'basic/BasicThebesLayer.cpp', + 'BufferUnrotate.cpp', 'client/CanvasClient.cpp', 'composite/CanvasLayerComposite.cpp', 'opengl/CanvasLayerOGL.cpp', diff --git a/gfx/tests/gtest/TestBufferRotation.cpp b/gfx/tests/gtest/TestBufferRotation.cpp new file mode 100644 index 00000000000..9fb972adbbc --- /dev/null +++ b/gfx/tests/gtest/TestBufferRotation.cpp @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "gtest/gtest.h" + +#include "BufferUnrotate.h" + +static unsigned char* GenerateBuffer(int bytesPerPixel, + int width, int height, + int stride, int xBoundary, int yBoundary) +{ + unsigned char* buffer = new unsigned char[stride*height]; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int pos = ((yBoundary + y) % height) * stride + + ((xBoundary + x) % width) * bytesPerPixel; + for (int i = 0; i < bytesPerPixel; i++) { + buffer[pos+i] = (x+y+i*2)%256; + } + } + } + return buffer; +} + +static bool CheckBuffer(unsigned char* buffer, int bytesPerPixel, + int width, int height, int stride) +{ + int xBoundary = 0; + int yBoundary = 0; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int pos = ((yBoundary + y) % height) * stride + + ((xBoundary + x) % width) * bytesPerPixel; + for (int i = 0; i < bytesPerPixel; i++) { + if (buffer[pos+i] != (x+y+i*2)%256) { + printf("Buffer differs at %i, %i, is %i\n", x, y, (int)buffer[pos+i]); + return false; + } + } + } + } + return true; +} + +TEST(Gfx, BufferUnrotateHorizontal) { + const int NUM_OF_TESTS = 8; + int bytesPerPixelList[2] = {2,4}; + int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99}; + int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99}; + int xBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31}; + int yBoundary[NUM_OF_TESTS] = {0, 0, 0, 0}; + + for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) { + int bytesPerPixel = bytesPerPixelList[bytesPerId]; + int stride = 256 * bytesPerPixel; + for (int testId = 0; testId < NUM_OF_TESTS; testId++) { + unsigned char* buffer = GenerateBuffer(bytesPerPixel, + width[testId], height[testId], stride, + xBoundary[testId], yBoundary[testId]); + BufferUnrotate(buffer, + width[testId] * bytesPerPixel, height[testId], stride, + xBoundary[testId] * bytesPerPixel, yBoundary[testId]); + + EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel, + width[testId], height[testId], stride)); + delete[] buffer; + } + } +} + +TEST(Gfx, BufferUnrotateVertical) { + const int NUM_OF_TESTS = 8; + int bytesPerPixelList[2] = {2,4}; + int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99}; + int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99}; + int xBoundary[NUM_OF_TESTS] = {0, 0, 0, 0}; + int yBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31}; + + for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) { + int bytesPerPixel = bytesPerPixelList[bytesPerId]; + int stride = 256 * bytesPerPixel; + for (int testId = 0; testId < NUM_OF_TESTS; testId++) { + unsigned char* buffer = GenerateBuffer(bytesPerPixel, + width[testId], height[testId], stride, + xBoundary[testId], yBoundary[testId]); + BufferUnrotate(buffer, width[testId] * bytesPerPixel, + height[testId], stride, + xBoundary[testId] * bytesPerPixel, yBoundary[testId]); + + EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel, + width[testId], height[testId], stride)); + delete[] buffer; + } + } +} + + +TEST(Gfx, BufferUnrotateBoth) { + const int NUM_OF_TESTS = 16; + int bytesPerPixelList[2] = {2,4}; + int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99, 100, 100, 99, 99, 100, 100, 99, 99}; + int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99}; + int xBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31, 30, 30, 30, 30, 31, 31, 31, 31}; + int yBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31}; + + for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) { + int bytesPerPixel = bytesPerPixelList[bytesPerId]; + int stride = 256 * bytesPerPixel; + for (int testId = 0; testId < NUM_OF_TESTS; testId++) { + unsigned char* buffer = GenerateBuffer(bytesPerPixel, + width[testId], height[testId], stride, + xBoundary[testId], yBoundary[testId]); + BufferUnrotate(buffer, + width[testId] * bytesPerPixel, height[testId], stride, + xBoundary[testId] * bytesPerPixel, yBoundary[testId]); + + EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel, + width[testId], height[testId], stride)); + delete[] buffer; + } + } +} + +TEST(Gfx, BufferUnrotateUneven) { + const int NUM_OF_TESTS = 16; + int bytesPerPixelList[2] = {2,4}; + int width[NUM_OF_TESTS] = {10, 100, 99, 39, 100, 40, 99, 39, 100, 50, 39, 99, 74, 60, 99, 39}; + int height[NUM_OF_TESTS] = {100, 39, 10, 99, 10, 99, 40, 99, 73, 39, 100, 39, 67, 99, 84, 99}; + int xBoundary[NUM_OF_TESTS] = {0, 0, 30, 30, 99, 31, 0, 31, 30, 30, 30, 30, 31, 31, 31, 38}; + int yBoundary[NUM_OF_TESTS] = {30, 30, 0, 30, 0, 30, 0, 30, 31, 31, 31, 31, 31, 31, 31, 98}; + + for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) { + int bytesPerPixel = bytesPerPixelList[bytesPerId]; + int stride = 256 * bytesPerPixel; + for (int testId = 0; testId < NUM_OF_TESTS; testId++) { + unsigned char* buffer = GenerateBuffer(bytesPerPixel, + width[testId], height[testId], stride, + xBoundary[testId], yBoundary[testId]); + BufferUnrotate(buffer, + width[testId]*bytesPerPixel, height[testId], stride, + xBoundary[testId]*bytesPerPixel, yBoundary[testId]); + + EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel, width[testId], height[testId], stride)); + delete[] buffer; + } + } +} + + diff --git a/gfx/tests/gtest/moz.build b/gfx/tests/gtest/moz.build index 48892108e39..52693c1bcec 100644 --- a/gfx/tests/gtest/moz.build +++ b/gfx/tests/gtest/moz.build @@ -21,6 +21,7 @@ GTEST_CPP_SOURCES += [ 'TestRegion.cpp', 'TestColorNames.cpp', 'TestTextures.cpp', + 'TestBufferRotation.cpp', ] # Because of gkmedia on windows we wont find these From 87b85dd4d2171973492319a78c730becdf6d4bf3 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Sat, 19 Oct 2013 19:38:32 -0300 Subject: [PATCH 27/48] Bug 850430 - Use jsval instead of nsISupports for passing mozContacts in XPIDL interfaces. r=gwagner --- dom/icc/interfaces/nsIDOMIccManager.idl | 3 +-- dom/icc/interfaces/nsIIccProvider.idl | 3 +-- dom/icc/src/IccManager.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dom/icc/interfaces/nsIDOMIccManager.idl b/dom/icc/interfaces/nsIDOMIccManager.idl index b8ee3675c12..bc6e6ed3828 100644 --- a/dom/icc/interfaces/nsIDOMIccManager.idl +++ b/dom/icc/interfaces/nsIDOMIccManager.idl @@ -5,7 +5,6 @@ #include "nsIDOMEventTarget.idl" #include "SimToolKit.idl" -interface nsIDOMContact; interface nsIDOMDOMRequest; interface nsIDOMEventListener; interface nsIDOMMozIccInfo; @@ -497,7 +496,7 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget * PIN2 is only required for 'fdn'. */ nsIDOMDOMRequest updateContact(in DOMString contactType, - in nsISupports contact, + in jsval contact, [optional] in DOMString pin2); // End of UICC Phonebook Interfaces. diff --git a/dom/icc/interfaces/nsIIccProvider.idl b/dom/icc/interfaces/nsIIccProvider.idl index 36d774b74e2..cf1b321bacd 100644 --- a/dom/icc/interfaces/nsIIccProvider.idl +++ b/dom/icc/interfaces/nsIIccProvider.idl @@ -4,7 +4,6 @@ #include "nsISupports.idl" -interface nsIDOMContact; interface nsIDOMDOMRequest; interface nsIDOMMozIccInfo; interface nsIDOMWindow; @@ -72,7 +71,7 @@ interface nsIIccProvider : nsISupports nsIDOMDOMRequest updateContact(in nsIDOMWindow window, in DOMString contactType, - in nsISupports contact, + in jsval contact, in DOMString pin2); /** diff --git a/dom/icc/src/IccManager.cpp b/dom/icc/src/IccManager.cpp index bd0b34b0e03..efccd9c9cd0 100644 --- a/dom/icc/src/IccManager.cpp +++ b/dom/icc/src/IccManager.cpp @@ -234,7 +234,7 @@ IccManager::ReadContacts(const nsAString& aContactType, nsIDOMDOMRequest** aRequ NS_IMETHODIMP IccManager::UpdateContact(const nsAString& aContactType, - nsISupports* aContact, + const JS::Value& aContact, const nsAString& aPin2, nsIDOMDOMRequest** aRequest) { From 0d908cfe63d62f56b712f733baa6b788c570b9f7 Mon Sep 17 00:00:00 2001 From: Christian Holler Date: Fri, 18 Oct 2013 15:18:18 +0200 Subject: [PATCH 28/48] Bug 928333 - Disable dumpHeap function with --fuzzing-safe. r=waldo --HG-- extra : rebase_source : 6d99227beb04bb93debfd28c0ca188ae1bad5e29 --- js/src/shell/js.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index b84f7a83623..8f2be73c160 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4195,10 +4195,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = { "dissrc([fun])", " Disassemble functions with source lines."), - JS_FN_HELP("dumpHeap", DumpHeap, 0, 0, -"dumpHeap([fileName[, start[, toFind[, maxDepth[, toIgnore]]]]])", -" Interface to JS_DumpHeap with output sent to file."), - JS_FN_HELP("dumpObject", DumpObject, 1, 0, "dumpObject()", " Dump an internal representation of an object."), @@ -4406,6 +4402,10 @@ static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = { " Get a self-hosted value by its name. Note that these values don't get \n" " cached, so repeatedly getting the same value creates multiple distinct clones."), + JS_FN_HELP("dumpHeap", DumpHeap, 0, 0, +"dumpHeap([fileName[, start[, toFind[, maxDepth[, toIgnore]]]]])", +" Interface to JS_DumpHeap with output sent to file."), + JS_FN_HELP("parent", Parent, 1, 0, "parent(obj)", " Returns the parent of obj."), From 2f7d6c435596ff1d90670f80e1684db0c129cfbe Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 19 Oct 2013 19:15:41 -0400 Subject: [PATCH 29/48] Bug 928333 followup - dumpHead() should only be defined in debug mode. r=me --- js/src/shell/js.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 8f2be73c160..3d0d87d4904 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4402,9 +4402,11 @@ static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = { " Get a self-hosted value by its name. Note that these values don't get \n" " cached, so repeatedly getting the same value creates multiple distinct clones."), +#ifdef DEBUG JS_FN_HELP("dumpHeap", DumpHeap, 0, 0, "dumpHeap([fileName[, start[, toFind[, maxDepth[, toIgnore]]]]])", " Interface to JS_DumpHeap with output sent to file."), +#endif JS_FN_HELP("parent", Parent, 1, 0, "parent(obj)", From 33e596616e6a703624e878cbcb9dac4594e3a678 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sat, 19 Oct 2013 17:22:27 -0700 Subject: [PATCH 30/48] Back out 14789271ad20 (bug 853694) for frequent 10.8 and permanent ASan test bustage --- browser/base/content/browser-plugins.js | 4 - browser/base/content/test/general/browser.ini | 2 - .../general/browser_CTP_crashreporting.js | 132 ------------------ .../base/content/test/general/plugin_big.html | 9 -- 4 files changed, 147 deletions(-) delete mode 100644 browser/base/content/test/general/browser_CTP_crashreporting.js delete mode 100644 browser/base/content/test/general/plugin_big.html diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index 59e3f37bbe7..9fa06c99d31 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -804,10 +804,6 @@ var gPluginHandler = { // so the pluginHost.getPermissionStringForType call is protected if (gPluginHandler.canActivatePlugin(plugin) && aPluginInfo.permissionString == pluginHost.getPermissionStringForType(plugin.actualType)) { - let overlay = this.getPluginUI(plugin, "main"); - if (overlay) { - overlay.removeEventListener("click", gPluginHandler._overlayClickListener, true); - } plugin.playPlugin(); } } diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index 753877bd1a5..49613cab8df 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -47,7 +47,6 @@ support-files = page_style_sample.html plugin_add_dynamically.html plugin_alternate_content.html - plugin_big.html plugin_both.html plugin_both2.html plugin_bug744745.html @@ -79,7 +78,6 @@ support-files = video.ogg zoom_test.html -[browser_CTP_crashreporting.js] [browser_CTP_data_urls.js] [browser_CTP_drag_drop.js] [browser_CTP_iframe.js] diff --git a/browser/base/content/test/general/browser_CTP_crashreporting.js b/browser/base/content/test/general/browser_CTP_crashreporting.js deleted file mode 100644 index 26a4750890b..00000000000 --- a/browser/base/content/test/general/browser_CTP_crashreporting.js +++ /dev/null @@ -1,132 +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/. */ - -Cu.import("resource://gre/modules/Services.jsm"); - -const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs"; -const gTestRoot = getRootDirectory(gTestPath); -var gTestBrowser = null; - -// Test that plugin crash submissions still work properly after -// click-to-play activation. - -function test() { - waitForExplicitFinish(); - setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY); - - // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin - // crash reports. This test needs them enabled. The test also needs a mock - // report server, and fortunately one is already set up by toolkit/ - // crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL, - // which CrashSubmit.jsm uses as a server override. - let env = Cc["@mozilla.org/process/environment;1"]. - getService(Components.interfaces.nsIEnvironment); - let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT"); - let serverURL = env.get("MOZ_CRASHREPORTER_URL"); - env.set("MOZ_CRASHREPORTER_NO_REPORT", ""); - env.set("MOZ_CRASHREPORTER_URL", SERVER_URL); - - let tab = gBrowser.loadOneTab("about:blank", { inBackground: false }); - gTestBrowser = gBrowser.getBrowserForTab(tab); - gTestBrowser.addEventListener("PluginCrashed", onCrash, false); - gTestBrowser.addEventListener("load", onPageLoad, true); - Services.obs.addObserver(onSubmitStatus, "crash-report-status", false); - - registerCleanupFunction(function cleanUp() { - env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport); - env.set("MOZ_CRASHREPORTER_URL", serverURL); - gTestBrowser.removeEventListener("PluginCrashed", onCrash, false); - gTestBrowser.removeEventListener("load", onPageLoad, true); - Services.obs.removeObserver(onSubmitStatus, "crash-report-status"); - gBrowser.removeCurrentTab(); - }); - - gTestBrowser.contentWindow.location = gTestRoot + "plugin_big.html"; -} -function onPageLoad() { - // Force the plugins binding to attach as layout is async. - let plugin = gTestBrowser.contentDocument.getElementById("test"); - plugin.clientTop; - executeSoon(afterBindingAttached); -} - -function afterBindingAttached() { - let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser); - ok(popupNotification, "Should have a click-to-play notification"); - - let plugin = gTestBrowser.contentDocument.getElementById("test"); - let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); - ok(!objLoadingContent.activated, "Plugin should not be activated"); - - // Simulate clicking the "Allow Always" button. - popupNotification.reshow(); - PopupNotifications.panel.firstChild._primaryButton.click(); - - let condition = function() objLoadingContent.activated; - waitForCondition(condition, pluginActivated, "Waited too long for plugin to activate"); -} - -function pluginActivated() { - let plugin = gTestBrowser.contentDocument.getElementById("test"); - try { - plugin.crash(); - } catch (e) { - // The plugin crashed in the above call, an exception is expected. - } -} - -function onCrash() { - try { - let plugin = gBrowser.contentDocument.getElementById("test"); - let elt = gPluginHandler.getPluginUI.bind(gPluginHandler, plugin); - let style = - gBrowser.contentWindow.getComputedStyle(elt("pleaseSubmit")); - is(style.display, "block", "Submission UI visibility should be correct"); - - elt("submitComment").value = "a test comment"; - is(elt("submitURLOptIn").checked, true, "URL opt-in should default to true"); - EventUtils.synthesizeMouseAtCenter(elt("submitURLOptIn"), {}, gTestBrowser.contentWindow); - EventUtils.synthesizeMouseAtCenter(elt("submitButton"), {}, gTestBrowser.contentWindow); - // And now wait for the submission status notification. - } - catch (err) { - failWithException(err); - } -} - -function onSubmitStatus(subj, topic, data) { - try { - // Wait for success or failed, doesn't matter which. - if (data != "success" && data != "failed") - return; - - let extra = getPropertyBagValue(subj.QueryInterface(Ci.nsIPropertyBag), - "extra"); - ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag"); - - let val = getPropertyBagValue(extra, "PluginUserComment"); - is(val, "a test comment", - "Comment in extra data should match comment in textbox"); - - val = getPropertyBagValue(extra, "PluginContentURL"); - ok(val === undefined, - "URL should be absent from extra data when opt-in not checked"); - } - catch (err) { - failWithException(err); - } - finish(); -} - -function getPropertyBagValue(bag, key) { - try { - var val = bag.getProperty(key); - } - catch (e if e.result == Cr.NS_ERROR_FAILURE) {} - return val; -} - -function failWithException(err) { - ok(false, "Uncaught exception: " + err + "\n" + err.stack); -} diff --git a/browser/base/content/test/general/plugin_big.html b/browser/base/content/test/general/plugin_big.html deleted file mode 100644 index d11506176c6..00000000000 --- a/browser/base/content/test/general/plugin_big.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - From 5c2c51bc879cb4e9c558d7a50bc14a2f59d190f9 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 19 Oct 2013 17:44:10 -0700 Subject: [PATCH 31/48] Revert "Bug 925088 - SpiderMonkey: Fold loads into branchTest32. r=nbp" --- js/src/jit/CodeGenerator.cpp | 4 ++-- js/src/jit/IonMacroAssembler.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 886adc9a917..1bccce9f787 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -4540,8 +4540,8 @@ CodeGenerator::visitCharCodeAt(LCharCodeAt *lir) return false; Address lengthAndFlagsAddr(str, JSString::offsetOfLengthAndFlags()); - - masm.branchTest32(Assembler::Zero, lengthAndFlagsAddr, Imm32(JSString::FLAGS_MASK), ool->entry()); + masm.loadPtr(lengthAndFlagsAddr, output); + masm.branchTest32(Assembler::Zero, output, Imm32(JSString::FLAGS_MASK), ool->entry()); // getChars Address charsAddr(str, JSString::offsetOfChars()); diff --git a/js/src/jit/IonMacroAssembler.cpp b/js/src/jit/IonMacroAssembler.cpp index 4975b847d45..54c57b7ea3d 100644 --- a/js/src/jit/IonMacroAssembler.cpp +++ b/js/src/jit/IonMacroAssembler.cpp @@ -860,10 +860,11 @@ MacroAssembler::compareStrings(JSOp op, Register left, Register right, Register void MacroAssembler::checkInterruptFlagsPar(const Register &tempReg, - Label *fail) + Label *fail) { movePtr(ImmPtr(&GetIonContext()->runtime->interrupt), tempReg); - branch32(Assembler::NonZero, Address(tempReg, 0), Imm32(0), fail); + load32(Address(tempReg, 0), tempReg); + branch32(Assembler::NonZero, tempReg, tempReg, fail); } void From 68ae16ed62876aaafb93ebe82edb2ecf22966c8d Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Sat, 19 Oct 2013 21:08:25 -0400 Subject: [PATCH 32/48] bug 816472 - incremental downloader error checking around bad server byte ranges r=jduell --- netwerk/base/src/nsIncrementalDownload.cpp | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/netwerk/base/src/nsIncrementalDownload.cpp b/netwerk/base/src/nsIncrementalDownload.cpp index 946fa04aca5..4d12b86d98e 100644 --- a/netwerk/base/src/nsIncrementalDownload.cpp +++ b/netwerk/base/src/nsIncrementalDownload.cpp @@ -156,6 +156,8 @@ private: PRTime mLastProgressUpdate; nsCOMPtr mRedirectCallback; nsCOMPtr mNewRedirectChannel; + nsCString mPartialValidator; + bool mCacheBust; }; nsIncrementalDownload::nsIncrementalDownload() @@ -172,6 +174,7 @@ nsIncrementalDownload::nsIncrementalDownload() , mLastProgressUpdate(0) , mRedirectCallback(nullptr) , mNewRedirectChannel(nullptr) + , mCacheBust(false) { } @@ -282,6 +285,17 @@ nsIncrementalDownload::ProcessTimeout() rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Range"), range, false); if (NS_FAILED(rv)) return rv; + + if (!mPartialValidator.IsEmpty()) + http->SetRequestHeader(NS_LITERAL_CSTRING("If-Range"), + mPartialValidator, false); + + if (mCacheBust) { + http->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"), + NS_LITERAL_CSTRING("no-cache"), false); + http->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"), + NS_LITERAL_CSTRING("no-cache"), false); + } } rv = channel->AsyncOpen(this, nullptr); @@ -565,6 +579,65 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request, // We got a partial response, so clear this counter in case the next chunk // results in a 200 response. mNonPartialCount = 0; + + // confirm that the content-range response header is consistent with + // expectations on each 206. If it is not then drop this response and + // retry with no-cache set. + if (!mCacheBust) { + nsAutoCString buf; + int64_t startByte = 0; + bool confirmedOK = false; + + rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf); + if (NS_FAILED(rv)) + return rv; // it isn't a useful 206 without a CONTENT-RANGE of some sort + + // Content-Range: bytes 0-299999/25604694 + int32_t p = buf.Find("bytes "); + + // first look for the starting point of the content-range + // to make sure it is what we expect + if (p != -1) { + char *endptr = nullptr; + const char *s = buf.get() + p + 6; + while (*s && *s == ' ') + s++; + startByte = strtol(s, &endptr, 10); + + if (*s && endptr && (endptr != s) && + (mCurrentSize == startByte)) { + + // ok the starting point is confirmed. We still need to check the + // total size of the range for consistency if this isn't + // the first chunk + if (mTotalSize == int64_t(-1)) { + // first chunk + confirmedOK = true; + } else { + int32_t slash = buf.FindChar('/'); + int64_t rangeSize = 0; + if (slash != kNotFound && + (PR_sscanf(buf.get() + slash + 1, "%lld", (int64_t *) &rangeSize) == 1) && + rangeSize == mTotalSize) { + confirmedOK = true; + } + } + } + } + + if (!confirmedOK) { + NS_WARNING("unexpected content-range"); + mCacheBust = true; + mChannel = nullptr; + if (++mNonPartialCount > MAX_RETRY_COUNT) { + NS_WARNING("unable to fetch a byte range; giving up"); + return NS_ERROR_FAILURE; + } + // Increase delay with each failure. + StartTimer(mInterval * mNonPartialCount); + return NS_ERROR_DOWNLOAD_NOT_PARTIAL; + } + } } // Do special processing after the first response. @@ -573,6 +646,11 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request, rv = http->GetURI(getter_AddRefs(mFinalURI)); if (NS_FAILED(rv)) return rv; + http->GetResponseHeader(NS_LITERAL_CSTRING("Etag"), mPartialValidator); + if (StringBeginsWith(mPartialValidator, NS_LITERAL_CSTRING("W/"))) + mPartialValidator.Truncate(); // don't use weak validators + if (mPartialValidator.IsEmpty()) + http->GetResponseHeader(NS_LITERAL_CSTRING("Last-Modified"), mPartialValidator); if (code == 206) { // OK, read the Content-Range header to determine the total size of this @@ -778,6 +856,16 @@ nsIncrementalDownload::AsyncOnChannelRedirect(nsIChannel *oldChannel, NS_ENSURE_SUCCESS(rv, rv); } + // A redirection changes the validator + mPartialValidator.Truncate(); + + if (mCacheBust) { + newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"), + NS_LITERAL_CSTRING("no-cache"), false); + newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"), + NS_LITERAL_CSTRING("no-cache"), false); + } + // Prepare to receive callback mRedirectCallback = cb; mNewRedirectChannel = newChannel; From f1ddcb62c6bfab80b5314e3237fac2a051b4fc21 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sat, 19 Oct 2013 18:57:54 -0700 Subject: [PATCH 33/48] Revert 'Revert "Bug 925088 - SpiderMonkey: Fold loads into branchTest32. r=nbp"' for making parallel/timeout-gc.js and parallel/timeout.js timeout --- js/src/jit/CodeGenerator.cpp | 4 ++-- js/src/jit/IonMacroAssembler.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 1bccce9f787..886adc9a917 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -4540,8 +4540,8 @@ CodeGenerator::visitCharCodeAt(LCharCodeAt *lir) return false; Address lengthAndFlagsAddr(str, JSString::offsetOfLengthAndFlags()); - masm.loadPtr(lengthAndFlagsAddr, output); - masm.branchTest32(Assembler::Zero, output, Imm32(JSString::FLAGS_MASK), ool->entry()); + + masm.branchTest32(Assembler::Zero, lengthAndFlagsAddr, Imm32(JSString::FLAGS_MASK), ool->entry()); // getChars Address charsAddr(str, JSString::offsetOfChars()); diff --git a/js/src/jit/IonMacroAssembler.cpp b/js/src/jit/IonMacroAssembler.cpp index 54c57b7ea3d..4975b847d45 100644 --- a/js/src/jit/IonMacroAssembler.cpp +++ b/js/src/jit/IonMacroAssembler.cpp @@ -860,11 +860,10 @@ MacroAssembler::compareStrings(JSOp op, Register left, Register right, Register void MacroAssembler::checkInterruptFlagsPar(const Register &tempReg, - Label *fail) + Label *fail) { movePtr(ImmPtr(&GetIonContext()->runtime->interrupt), tempReg); - load32(Address(tempReg, 0), tempReg); - branch32(Assembler::NonZero, tempReg, tempReg, fail); + branch32(Assembler::NonZero, Address(tempReg, 0), Imm32(0), fail); } void From f86d2e1b187a3e9bb66eacc47a190262507731cf Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sat, 19 Oct 2013 19:10:01 -0700 Subject: [PATCH 34/48] Bug 922951 - Annotate top-fail reftest as random --- layout/reftests/webm-video/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/webm-video/reftest.list b/layout/reftests/webm-video/reftest.list index cbf63a5e191..8ff9c12fdb6 100644 --- a/layout/reftests/webm-video/reftest.list +++ b/layout/reftests/webm-video/reftest.list @@ -31,4 +31,4 @@ random skip-if(Android||B2G) == poster-11.html poster-ref-blue140x100.html random skip-if(Android||B2G) == poster-12.html poster-ref-blue140x100.html skip-if(Android||B2G) == poster-13.html poster-ref-blue400x300.html skip-if(Android||B2G) == poster-15.html poster-ref-green70x30.html -skip-if(Android||B2G) == bug686957.html bug686957-ref.html +random-if(cocoaWidget) skip-if(Android||B2G) == bug686957.html bug686957-ref.html # bug 922951 for OS X From 23df03a94446ac339a5b72a71c455b1b4b60a362 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Sun, 20 Oct 2013 05:08:42 +0200 Subject: [PATCH 35/48] Bug 928674: Add static_cast to explicitly convert RelationType enum values into integer values, to fix build error. r=surkov --- .../src/windows/msaa/AccessibleWrap.cpp | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/accessible/src/windows/msaa/AccessibleWrap.cpp b/accessible/src/windows/msaa/AccessibleWrap.cpp index ed657f310d0..e8bb71b4050 100644 --- a/accessible/src/windows/msaa/AccessibleWrap.cpp +++ b/accessible/src/windows/msaa/AccessibleWrap.cpp @@ -921,55 +921,55 @@ AccessibleWrap::accNavigate( // MSAA relationship extensions to accNavigate case NAVRELATION_CONTROLLED_BY: - xpRelation = RelationType::CONTROLLED_BY; + xpRelation = static_cast(RelationType::CONTROLLED_BY); break; case NAVRELATION_CONTROLLER_FOR: - xpRelation = RelationType::CONTROLLER_FOR; + xpRelation = static_cast(RelationType::CONTROLLER_FOR); break; case NAVRELATION_LABEL_FOR: - xpRelation = RelationType::LABEL_FOR; + xpRelation = static_cast(RelationType::LABEL_FOR); break; case NAVRELATION_LABELLED_BY: - xpRelation = RelationType::LABELLED_BY; + xpRelation = static_cast(RelationType::LABELLED_BY); break; case NAVRELATION_MEMBER_OF: - xpRelation = RelationType::MEMBER_OF; + xpRelation = static_cast(RelationType::MEMBER_OF); break; case NAVRELATION_NODE_CHILD_OF: - xpRelation = RelationType::NODE_CHILD_OF; + xpRelation = static_cast(RelationType::NODE_CHILD_OF); break; case NAVRELATION_FLOWS_TO: - xpRelation = RelationType::FLOWS_TO; + xpRelation = static_cast(RelationType::FLOWS_TO); break; case NAVRELATION_FLOWS_FROM: - xpRelation = RelationType::FLOWS_FROM; + xpRelation = static_cast(RelationType::FLOWS_FROM); break; case NAVRELATION_SUBWINDOW_OF: - xpRelation = RelationType::SUBWINDOW_OF; + xpRelation = static_cast(RelationType::SUBWINDOW_OF); break; case NAVRELATION_EMBEDS: - xpRelation = RelationType::EMBEDS; + xpRelation = static_cast(RelationType::EMBEDS); break; case NAVRELATION_EMBEDDED_BY: - xpRelation = RelationType::EMBEDDED_BY; + xpRelation = static_cast(RelationType::EMBEDDED_BY); break; case NAVRELATION_POPUP_FOR: - xpRelation = RelationType::POPUP_FOR; + xpRelation = static_cast(RelationType::POPUP_FOR); break; case NAVRELATION_PARENT_WINDOW_OF: - xpRelation = RelationType::PARENT_WINDOW_OF; + xpRelation = static_cast(RelationType::PARENT_WINDOW_OF); break; case NAVRELATION_DEFAULT_BUTTON: - xpRelation = RelationType::DEFAULT_BUTTON; + xpRelation = static_cast(RelationType::DEFAULT_BUTTON); break; case NAVRELATION_DESCRIBED_BY: - xpRelation = RelationType::DESCRIBED_BY; + xpRelation = static_cast(RelationType::DESCRIBED_BY); break; case NAVRELATION_DESCRIPTION_FOR: - xpRelation = RelationType::DESCRIPTION_FOR; + xpRelation = static_cast(RelationType::DESCRIPTION_FOR); break; case NAVRELATION_NODE_PARENT_OF: - xpRelation = RelationType::NODE_PARENT_OF; + xpRelation = static_cast(RelationType::NODE_PARENT_OF); break; default: From 7584505c38e3975d8795009c68a13c4546e337b5 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sat, 19 Oct 2013 21:43:24 -0700 Subject: [PATCH 36/48] Bug 924771 - Disable test_browserElement_oop_CloseFromOpener.html until someone teaches it to stop timing out --- dom/browser-element/mochitest/Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dom/browser-element/mochitest/Makefile.in b/dom/browser-element/mochitest/Makefile.in index 535a2f521ac..d23b3e90ad1 100644 --- a/dom/browser-element/mochitest/Makefile.in +++ b/dom/browser-element/mochitest/Makefile.in @@ -218,7 +218,6 @@ MOCHITEST_FILES += \ test_browserElement_oop_PromptConfirm.html \ test_browserElement_oop_CookiesNotThirdParty.html \ test_browserElement_oop_Close.html \ - test_browserElement_oop_CloseFromOpener.html \ test_browserElement_oop_CloseApp.html \ test_browserElement_oop_OpenWindow.html \ test_browserElement_oop_OpenWindowInFrame.html \ @@ -244,6 +243,9 @@ MOCHITEST_FILES += \ test_browserElement_oop_BrowserWindowResize.html \ $(NULL) +# Disabled until bug 924771 makes it stop timing out +# test_browserElement_oop_CloseFromOpener.html \ + # Disabled until we fix bug 906096. # test_browserElement_oop_SetInputMethodActive.html \ From 191efae98969382bf7b8c48d4a297d461f7c8fca Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:18 +0200 Subject: [PATCH 37/48] Bug 923395 - Part a: Remove completely empty makefiles; r=gps --- editor/txmgr/src/Makefile.in | 5 ----- extensions/permissions/Makefile.in | 4 ---- intl/chardet/src/Makefile.in | 5 ----- intl/uconv/util/Makefile.in | 5 ----- modules/libjar/zipwriter/src/Makefile.in | 4 ---- startupcache/Makefile.in | 5 ----- toolkit/components/autocomplete/Makefile.in | 4 ---- toolkit/components/commandlines/Makefile.in | 4 ---- toolkit/components/mediasniffer/Makefile.in | 4 ---- toolkit/identity/Makefile.in | 4 ---- toolkit/system/androidproxy/Makefile.in | 4 ---- toolkit/system/osxproxy/Makefile.in | 4 ---- toolkit/system/windowsproxy/Makefile.in | 4 ---- xpfe/components/windowds/Makefile.in | 5 ----- 14 files changed, 61 deletions(-) delete mode 100644 editor/txmgr/src/Makefile.in delete mode 100644 extensions/permissions/Makefile.in delete mode 100644 intl/chardet/src/Makefile.in delete mode 100644 intl/uconv/util/Makefile.in delete mode 100644 modules/libjar/zipwriter/src/Makefile.in delete mode 100644 startupcache/Makefile.in delete mode 100644 toolkit/components/autocomplete/Makefile.in delete mode 100644 toolkit/components/commandlines/Makefile.in delete mode 100644 toolkit/components/mediasniffer/Makefile.in delete mode 100644 toolkit/identity/Makefile.in delete mode 100644 toolkit/system/androidproxy/Makefile.in delete mode 100644 toolkit/system/osxproxy/Makefile.in delete mode 100644 toolkit/system/windowsproxy/Makefile.in delete mode 100644 xpfe/components/windowds/Makefile.in diff --git a/editor/txmgr/src/Makefile.in b/editor/txmgr/src/Makefile.in deleted file mode 100644 index 24001b5199a..00000000000 --- a/editor/txmgr/src/Makefile.in +++ /dev/null @@ -1,5 +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/. - diff --git a/extensions/permissions/Makefile.in b/extensions/permissions/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/extensions/permissions/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/intl/chardet/src/Makefile.in b/intl/chardet/src/Makefile.in deleted file mode 100644 index 24001b5199a..00000000000 --- a/intl/chardet/src/Makefile.in +++ /dev/null @@ -1,5 +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/. - diff --git a/intl/uconv/util/Makefile.in b/intl/uconv/util/Makefile.in deleted file mode 100644 index 24001b5199a..00000000000 --- a/intl/uconv/util/Makefile.in +++ /dev/null @@ -1,5 +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/. - diff --git a/modules/libjar/zipwriter/src/Makefile.in b/modules/libjar/zipwriter/src/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/modules/libjar/zipwriter/src/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/startupcache/Makefile.in b/startupcache/Makefile.in deleted file mode 100644 index e7617450301..00000000000 --- a/startupcache/Makefile.in +++ /dev/null @@ -1,5 +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/. - - diff --git a/toolkit/components/autocomplete/Makefile.in b/toolkit/components/autocomplete/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/components/autocomplete/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/components/commandlines/Makefile.in b/toolkit/components/commandlines/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/components/commandlines/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/components/mediasniffer/Makefile.in b/toolkit/components/mediasniffer/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/components/mediasniffer/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/identity/Makefile.in b/toolkit/identity/Makefile.in deleted file mode 100644 index 25c413dcb21..00000000000 --- a/toolkit/identity/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/system/androidproxy/Makefile.in b/toolkit/system/androidproxy/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/system/androidproxy/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/system/osxproxy/Makefile.in b/toolkit/system/osxproxy/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/system/osxproxy/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/toolkit/system/windowsproxy/Makefile.in b/toolkit/system/windowsproxy/Makefile.in deleted file mode 100644 index 5501cd4b330..00000000000 --- a/toolkit/system/windowsproxy/Makefile.in +++ /dev/null @@ -1,4 +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/. - diff --git a/xpfe/components/windowds/Makefile.in b/xpfe/components/windowds/Makefile.in deleted file mode 100644 index 24001b5199a..00000000000 --- a/xpfe/components/windowds/Makefile.in +++ /dev/null @@ -1,5 +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/. - From 88f73ee0bb24fc3f8428e4f75b96706ac471b2b2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 38/48] Bug 923395 - Part b: Remove makefiles that only set LOCAL_INCLUDES and DEFINES; r=gps --- accessible/src/windows/sdn/Makefile.in | 10 ---------- accessible/src/windows/sdn/moz.build | 4 ++++ dom/media/bridge/Makefile.in | 14 -------------- dom/media/bridge/moz.build | 11 +++++++++++ dom/system/windows/Makefile.in | 6 ------ dom/system/windows/moz.build | 5 +++++ extensions/auth/Makefile.in | 8 -------- extensions/auth/moz.build | 1 + js/jsd/Makefile.in | 15 --------------- js/jsd/moz.build | 5 +++++ mobile/android/components/build/Makefile.in | 10 ---------- mobile/android/components/build/moz.build | 4 ++++ toolkit/components/ctypes/Makefile.in | 7 ------- toolkit/components/ctypes/moz.build | 4 ++++ toolkit/components/satchel/Makefile.in | 7 ------- toolkit/components/satchel/moz.build | 4 ++++ xpcom/glue/tests/gtest/Makefile.in | 6 ------ xpcom/glue/tests/gtest/moz.build | 4 ++++ xpfe/appshell/src/Makefile.in | 6 ------ xpfe/appshell/src/moz.build | 4 ++++ 20 files changed, 46 insertions(+), 89 deletions(-) delete mode 100644 accessible/src/windows/sdn/Makefile.in delete mode 100644 dom/media/bridge/Makefile.in delete mode 100644 dom/system/windows/Makefile.in delete mode 100644 extensions/auth/Makefile.in delete mode 100644 js/jsd/Makefile.in delete mode 100644 mobile/android/components/build/Makefile.in delete mode 100644 toolkit/components/ctypes/Makefile.in delete mode 100644 toolkit/components/satchel/Makefile.in delete mode 100644 xpcom/glue/tests/gtest/Makefile.in delete mode 100644 xpfe/appshell/src/Makefile.in diff --git a/accessible/src/windows/sdn/Makefile.in b/accessible/src/windows/sdn/Makefile.in deleted file mode 100644 index 74f444c6ee9..00000000000 --- a/accessible/src/windows/sdn/Makefile.in +++ /dev/null @@ -1,10 +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/. - -# The midl generated code include Windows headers which defines min and max -# macros which conflicts with std::min/max. Suppress the macros: -OS_CXXFLAGS += -DNOMINMAX - -include $(topsrcdir)/config/rules.mk - diff --git a/accessible/src/windows/sdn/moz.build b/accessible/src/windows/sdn/moz.build index c6a3952e8d4..734cff4b225 100644 --- a/accessible/src/windows/sdn/moz.build +++ b/accessible/src/windows/sdn/moz.build @@ -23,6 +23,10 @@ LOCAL_INCLUDES += [ '../msaa', ] +# The midl generated code include Windows headers which defines min and max +# macros which conflicts with std::min/max. Suppress the macros: +DEFINES['NOMINMAX'] = True + LIBRARY_NAME = 'accessibility_toolkit_sdn_s' EXPORT_LIBRARY = True diff --git a/dom/media/bridge/Makefile.in b/dom/media/bridge/Makefile.in deleted file mode 100644 index c466ff59cc1..00000000000 --- a/dom/media/bridge/Makefile.in +++ /dev/null @@ -1,14 +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/. - -LOCAL_INCLUDES += \ - -I$(topsrcdir)/media/mtransport \ - -I$(topsrcdir)/media/webrtc/signaling/include \ - -I$(topsrcdir)/media/webrtc/signaling/src/sipcc/include \ - -I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \ - -I$(topsrcdir)/media/webrtc/signaling/src/mediapipeline \ - -I$(topsrcdir)/media/webrtc/signaling/src/media-conduit \ - -I$(topsrcdir)/media/webrtc/signaling/src/common/time_profiling \ - -I$(topsrcdir)/ipc/chromium/src \ - $(NULL) diff --git a/dom/media/bridge/moz.build b/dom/media/bridge/moz.build index 3d5a82815e3..ede35ef1291 100644 --- a/dom/media/bridge/moz.build +++ b/dom/media/bridge/moz.build @@ -14,6 +14,17 @@ CPP_SOURCES += [ 'MediaModule.cpp', ] +LOCAL_INCLUDES += [ + '/ipc/chromium/src', + '/media/mtransport', + '/media/webrtc/signaling/include', + '/media/webrtc/signaling/src/common/time_profiling', + '/media/webrtc/signaling/src/media-conduit', + '/media/webrtc/signaling/src/mediapipeline', + '/media/webrtc/signaling/src/peerconnection', + '/media/webrtc/signaling/src/sipcc/include', +] + LIBRARY_NAME = 'peerconnection' LIBXUL_LIBRARY = True diff --git a/dom/system/windows/Makefile.in b/dom/system/windows/Makefile.in deleted file mode 100644 index 5772c1434ef..00000000000 --- a/dom/system/windows/Makefile.in +++ /dev/null @@ -1,6 +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/. - -# We fire the nsDOMDeviceAcceleration -LOCAL_INCLUDES += -I$(topsrcdir)/content/events/src diff --git a/dom/system/windows/moz.build b/dom/system/windows/moz.build index 97b5ed80326..770b69dc2d1 100644 --- a/dom/system/windows/moz.build +++ b/dom/system/windows/moz.build @@ -10,6 +10,11 @@ CPP_SOURCES += [ 'nsHapticFeedback.cpp', ] +# We fire the nsDOMDeviceAcceleration +LOCAL_INCLUDES += [ + '/content/events/src', +] + FAIL_ON_WARNINGS = True LIBXUL_LIBRARY = True diff --git a/extensions/auth/Makefile.in b/extensions/auth/Makefile.in deleted file mode 100644 index 1a59a0b2eec..00000000000 --- a/extensions/auth/Makefile.in +++ /dev/null @@ -1,8 +0,0 @@ -# vim:set ts=8 sw=8 sts=8 noet: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -ifeq ($(OS_ARCH),WINNT) -LOCAL_INCLUDES += -DUSE_SSPI -endif diff --git a/extensions/auth/moz.build b/extensions/auth/moz.build index 959f7a893af..47a6ac0e817 100644 --- a/extensions/auth/moz.build +++ b/extensions/auth/moz.build @@ -17,6 +17,7 @@ if CONFIG['OS_ARCH'] == 'WINNT': CPP_SOURCES += [ 'nsAuthSSPI.cpp', ] + DEFINES['USE_SSPI'] = True else: CPP_SOURCES += [ 'nsAuthSambaNTLM.cpp', diff --git a/js/jsd/Makefile.in b/js/jsd/Makefile.in deleted file mode 100644 index 9efc81a2c6e..00000000000 --- a/js/jsd/Makefile.in +++ /dev/null @@ -1,15 +0,0 @@ -#!gmake -# -# 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/. - - - -ifdef JS_THREADSAFE -DEFINES += -DJS_THREADSAFE -endif - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DEXPORT_JSD_API diff --git a/js/jsd/moz.build b/js/jsd/moz.build index 9a4df289e97..72efeebe4b2 100644 --- a/js/jsd/moz.build +++ b/js/jsd/moz.build @@ -31,6 +31,11 @@ CPP_SOURCES += [ 'jshash.cpp', ] +DEFINES['EXPORT_JSD_API'] = True + +if CONFIG['JS_THREADSAFE']: + DEFINES['JS_THREADSAFE'] = True + LIBRARY_NAME = 'jsd' LIBXUL_LIBRARY = True diff --git a/mobile/android/components/build/Makefile.in b/mobile/android/components/build/Makefile.in deleted file mode 100644 index 2492cc6e55c..00000000000 --- a/mobile/android/components/build/Makefile.in +++ /dev/null @@ -1,10 +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/. - -ifdef MOZ_ANDROID_HISTORY -LOCAL_INCLUDES += \ - -I$(topsrcdir)/docshell/base \ - -I$(topsrcdir)/content/base/src \ - $(NULL) -endif diff --git a/mobile/android/components/build/moz.build b/mobile/android/components/build/moz.build index 3878f82b46a..dc1d0eb0715 100644 --- a/mobile/android/components/build/moz.build +++ b/mobile/android/components/build/moz.build @@ -23,6 +23,10 @@ if CONFIG['MOZ_ANDROID_HISTORY']: CPP_SOURCES += [ 'nsAndroidHistory.cpp', ] + LOCAL_INCLUDES += [ + '/content/base/src', + '/docshell/base', + ] LIBRARY_NAME = 'browsercomps' diff --git a/toolkit/components/ctypes/Makefile.in b/toolkit/components/ctypes/Makefile.in deleted file mode 100644 index 39bb2a79fa5..00000000000 --- a/toolkit/components/ctypes/Makefile.in +++ /dev/null @@ -1,7 +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/. - -LOCAL_INCLUDES := \ - -I$(topsrcdir)/js/xpconnect/loader \ - $(NULL) diff --git a/toolkit/components/ctypes/moz.build b/toolkit/components/ctypes/moz.build index d7c4474ebb5..76ac4b4f215 100644 --- a/toolkit/components/ctypes/moz.build +++ b/toolkit/components/ctypes/moz.build @@ -12,6 +12,10 @@ CPP_SOURCES += [ 'ctypes.cpp', ] +LOCAL_INCLUDES += [ + '/js/xpconnect/loader', +] + LIBRARY_NAME = 'jsctypes' EXTRA_JS_MODULES += [ diff --git a/toolkit/components/satchel/Makefile.in b/toolkit/components/satchel/Makefile.in deleted file mode 100644 index 4c2365aa6b7..00000000000 --- a/toolkit/components/satchel/Makefile.in +++ /dev/null @@ -1,7 +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/. - -LOCAL_INCLUDES = \ - -I$(srcdir)/../build \ - $(NULL) diff --git a/toolkit/components/satchel/moz.build b/toolkit/components/satchel/moz.build index 3408149a5b5..ce8fa02130a 100644 --- a/toolkit/components/satchel/moz.build +++ b/toolkit/components/satchel/moz.build @@ -19,6 +19,10 @@ CPP_SOURCES += [ 'nsFormFillController.cpp', ] +LOCAL_INCLUDES += [ + '../build', +] + EXTRA_COMPONENTS += [ 'FormHistoryStartup.js', 'nsFormAutoComplete.js', diff --git a/xpcom/glue/tests/gtest/Makefile.in b/xpcom/glue/tests/gtest/Makefile.in deleted file mode 100644 index 718b1b0eb79..00000000000 --- a/xpcom/glue/tests/gtest/Makefile.in +++ /dev/null @@ -1,6 +0,0 @@ -# vim:set ts=8 sw=8 sts=8 noet: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -LOCAL_INCLUDES = -I$(srcdir)/../.. diff --git a/xpcom/glue/tests/gtest/moz.build b/xpcom/glue/tests/gtest/moz.build index 315531b1375..3293f9d437b 100644 --- a/xpcom/glue/tests/gtest/moz.build +++ b/xpcom/glue/tests/gtest/moz.build @@ -10,6 +10,10 @@ CPP_SOURCES += [ 'TestFileUtils.cpp', ] +LOCAL_INCLUDES = [ + '../..', +] + LIBRARY_NAME = 'xpcom_glue_gtest' LIBXUL_LIBRARY = True diff --git a/xpfe/appshell/src/Makefile.in b/xpfe/appshell/src/Makefile.in deleted file mode 100644 index 18c61a7affa..00000000000 --- a/xpfe/appshell/src/Makefile.in +++ /dev/null @@ -1,6 +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/. - -LOCAL_INCLUDES += -I$(topsrcdir)/dom/base diff --git a/xpfe/appshell/src/moz.build b/xpfe/appshell/src/moz.build index 7ab4df90ccd..bf81fb843ed 100644 --- a/xpfe/appshell/src/moz.build +++ b/xpfe/appshell/src/moz.build @@ -19,6 +19,10 @@ CPP_SOURCES += [ 'nsXULWindow.cpp', ] +LOCAL_INCLUDES += [ + '/dom/base', +] + LIBRARY_NAME = 'nsappshell' LIBXUL_LIBRARY = True From d122c47c788a17e54b7571da4ab52d8d306169ed Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 39/48] Bug 923395 - Part c: Remove some makefiles that set EXPORT_LIBRARY; r=gps --- toolkit/components/filepicker/Makefile.in | 11 -------- toolkit/components/filepicker/moz.build | 1 + toolkit/components/places/Makefile.in | 7 ----- toolkit/components/places/moz.build | 11 +++++--- tools/profiler/Makefile.in | 31 ----------------------- tools/profiler/moz.build | 16 ++++++++++++ 6 files changed, 24 insertions(+), 53 deletions(-) delete mode 100644 toolkit/components/filepicker/Makefile.in delete mode 100644 tools/profiler/Makefile.in diff --git a/toolkit/components/filepicker/Makefile.in b/toolkit/components/filepicker/Makefile.in deleted file mode 100644 index 5aa5764bee3..00000000000 --- a/toolkit/components/filepicker/Makefile.in +++ /dev/null @@ -1,11 +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/. - - -ifdef MOZ_XUL -ifeq (,$(filter android qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT))) -EXPORT_LIBRARY = 1 -endif -endif diff --git a/toolkit/components/filepicker/moz.build b/toolkit/components/filepicker/moz.build index fe19915a3d3..395559969dc 100644 --- a/toolkit/components/filepicker/moz.build +++ b/toolkit/components/filepicker/moz.build @@ -7,6 +7,7 @@ if CONFIG['MOZ_XUL'] and \ CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('android', 'qt', 'os2', 'cocoa', 'windows'): LIBXUL_LIBRARY = True + EXPORT_LIBRARY = True MODULE = 'filepicker' LIBRARY_NAME = 'fileview' XPIDL_SOURCES += [ diff --git a/toolkit/components/places/Makefile.in b/toolkit/components/places/Makefile.in index 9819e67912c..deb6de83a14 100644 --- a/toolkit/components/places/Makefile.in +++ b/toolkit/components/places/Makefile.in @@ -2,12 +2,5 @@ # 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/. -ifdef MOZ_PLACES -EXPORT_LIBRARY = 1 - -LOCAL_INCLUDES += -I$(srcdir)/../build - -endif - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build index 1c6ae485f8e..cd300426b74 100644 --- a/toolkit/components/places/moz.build +++ b/toolkit/components/places/moz.build @@ -11,8 +11,11 @@ XPIDL_SOURCES += [ 'nsINavHistoryService.idl', ] +MODULE = 'places' + if CONFIG['MOZ_PLACES']: LIBXUL_LIBRARY = True + EXPORT_LIBRARY = True MSVC_ENABLE_PGO = True LIBRARY_NAME = 'places' @@ -55,6 +58,10 @@ if CONFIG['MOZ_PLACES']: 'Database.cpp', ] + LOCAL_INCLUDES += [ + '../build', + ] + EXTRA_JS_MODULES = [ 'BookmarkJSONUtils.jsm', 'ClusterLib.js', @@ -69,10 +76,6 @@ if CONFIG['MOZ_PLACES']: 'PlacesUtils.jsm', ] -MODULE = 'places' - - -if CONFIG['MOZ_PLACES']: EXTRA_COMPONENTS += [ 'ColorAnalyzer.js', 'PlacesCategoriesStarter.js', diff --git a/tools/profiler/Makefile.in b/tools/profiler/Makefile.in deleted file mode 100644 index 9434ff95d7a..00000000000 --- a/tools/profiler/Makefile.in +++ /dev/null @@ -1,31 +0,0 @@ -#! gmake -# -# 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/. - -VPATH = $(srcdir) -ifdef MOZ_ENABLE_PROFILER_SPS -LOCAL_INCLUDES += \ - -I$(topsrcdir)/mozglue/linker \ - -I$(topsrcdir)/ipc/chromium/src \ - -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src \ - $(NULL) - -# We need access to Breakpad's getcontext(3) which is suitable for Android -ifeq ($(OS_TARGET),Android) -LOCAL_INCLUDES += \ - -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include \ - $(NULL) -endif - -ifneq (,$(filter armeabi,$(ANDROID_CPU_ARCH))) -DEFINES += -DARCH_ARMV6 -endif - -EXPORT_LIBRARY = 1 - -# Uncomment for better debugging in opt builds -#MOZ_OPTIMIZE_FLAGS += -O0 -g - -endif diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index 09ffe074775..fcf92e5c70e 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -8,6 +8,7 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']: FAIL_ON_WARNINGS = not CONFIG['_MSC_VER'] LIBXUL_LIBRARY = True + EXPORT_LIBRARY = True MODULE = 'profiler' LIBRARY_NAME = 'profiler' @@ -68,6 +69,21 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']: 'platform-win32.cc', ] + LOCAL_INCLUDES += [ + '/ipc/chromium/src', + '/mozglue/linker', + '/toolkit/crashreporter/google-breakpad/src', + ] + + # We need access to Breakpad's getcontext(3) which is suitable for Android + if CONFIG['OS_TARGET'] == 'Android': + LOCAL_INCLUDES += [ + '/toolkit/crashreporter/google-breakpad/src/common/android/include', + ] + + if CONFIG['ANDROID_CPU_ARCH'] == 'armeabi': + DEFINES['ARCH_ARMV6'] = True + EXPORTS += [ 'GeckoProfiler.h', ] From cf503efa15cb208555cd4c92dfde35e268aba6e4 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 40/48] Bug 923395 - Part d: Remove some Makefiles in image/; r=gps --- image/decoders/Makefile.in | 8 -------- image/decoders/moz.build | 4 ++++ image/encoders/png/Makefile.in | 5 ----- image/encoders/png/moz.build | 3 +++ 4 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 image/decoders/Makefile.in delete mode 100644 image/encoders/png/Makefile.in diff --git a/image/decoders/Makefile.in b/image/decoders/Makefile.in deleted file mode 100644 index ab49756e3ea..00000000000 --- a/image/decoders/Makefile.in +++ /dev/null @@ -1,8 +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/. - -# Decoders need RasterImage.h -LOCAL_INCLUDES += -I$(topsrcdir)/image/src/ - diff --git a/image/decoders/moz.build b/image/decoders/moz.build index 8cc442fd190..abf358a4ce0 100644 --- a/image/decoders/moz.build +++ b/image/decoders/moz.build @@ -45,3 +45,7 @@ CSRCS += [ 'iccjpeg.c', ] +# Decoders need RasterImage.h +LOCAL_INCLUDES += [ + '/image/src', +] diff --git a/image/encoders/png/Makefile.in b/image/encoders/png/Makefile.in deleted file mode 100644 index bfdc5f722b8..00000000000 --- a/image/encoders/png/Makefile.in +++ /dev/null @@ -1,5 +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/. - -LOCAL_INCLUDES += -I$(topsrcdir)/image/src/ diff --git a/image/encoders/png/moz.build b/image/encoders/png/moz.build index 51c35b04931..0468634db28 100644 --- a/image/encoders/png/moz.build +++ b/image/encoders/png/moz.build @@ -16,3 +16,6 @@ FAIL_ON_WARNINGS = True LIBXUL_LIBRARY = True +LOCAL_INCLUDES += [ + '/image/src', +] From a4f9efba45e9c7380b7481b06699b58830383dcb Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 41/48] Bug 908142 - Part a: Move FAIL_ON_WARNINGS to moz.build in uriloader/exthandler/tests/; r=gps --- uriloader/exthandler/tests/Makefile.in | 4 ---- uriloader/exthandler/tests/moz.build | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/uriloader/exthandler/tests/Makefile.in b/uriloader/exthandler/tests/Makefile.in index deb38ba0bf5..b2e67d12e71 100644 --- a/uriloader/exthandler/tests/Makefile.in +++ b/uriloader/exthandler/tests/Makefile.in @@ -2,10 +2,6 @@ # 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/. -FAIL_ON_WARNINGS = 1 - -include $(topsrcdir)/config/config.mk - LIBS += \ $(NSPR_LIBS) \ $(NULL) diff --git a/uriloader/exthandler/tests/moz.build b/uriloader/exthandler/tests/moz.build index a30474cdee9..9e206f121fd 100644 --- a/uriloader/exthandler/tests/moz.build +++ b/uriloader/exthandler/tests/moz.build @@ -6,6 +6,8 @@ DIRS += ['mochitest'] +FAIL_ON_WARNINGS = True + MODULE = 'test_uriloader_exthandler' XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] From 07dff61e68450b3eac5ad231a4cc6e8088db1c5d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 42/48] Bug 908142 - Part b: Move FAIL_ON_WARNINGS to moz.build in security/sandbox/; r=gps --- security/sandbox/Makefile.in | 1 - security/sandbox/moz.build | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/security/sandbox/Makefile.in b/security/sandbox/Makefile.in index d76e4c6598e..bc4e683f05c 100644 --- a/security/sandbox/Makefile.in +++ b/security/sandbox/Makefile.in @@ -2,7 +2,6 @@ # 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/. -FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/security/sandbox/moz.build b/security/sandbox/moz.build index bec204673a8..dd1e7d85394 100644 --- a/security/sandbox/moz.build +++ b/security/sandbox/moz.build @@ -4,6 +4,8 @@ # 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/. +FAIL_ON_WARNINGS = True + MODULE = 'sandbox' EXPORTS.mozilla += [ From 34421d0936312a90c2d4f5f25f8f10ec0bed3e7d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 43/48] Bug 908142 - Part c: Move FAIL_ON_WARNINGS to moz.build in xpcom/tests/; r=gps --- xpcom/tests/Makefile.in | 4 ---- xpcom/tests/moz.build | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 7ff92a9687e..b256ac81760 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -2,12 +2,8 @@ # 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/. -FAIL_ON_WARNINGS = 1 - VPATH += $(topsrcdir)/build -include $(topsrcdir)/config/config.mk - LIBS += $(XPCOM_LIBS) # Needed to resolve __yylex (?) diff --git a/xpcom/tests/moz.build b/xpcom/tests/moz.build index 91b6fdb944e..aecd55b3e27 100644 --- a/xpcom/tests/moz.build +++ b/xpcom/tests/moz.build @@ -17,6 +17,8 @@ if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['DEHYDRA_PATH']: TEST_TOOL_DIRS += ['static-checker'] +FAIL_ON_WARNINGS = True + EXPORTS.testing += [ 'TestHarness.h', ] From 9325053582c2d7fd411bf51858469eb80f2ed803 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 44/48] Bug 908142 - Part d: Move FAIL_ON_WARNINGS to moz.build in js/xpconnect/shell/; r=gps --- js/xpconnect/shell/Makefile.in | 8 +++----- js/xpconnect/shell/moz.build | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/xpconnect/shell/Makefile.in b/js/xpconnect/shell/Makefile.in index cf95c9653dd..d67b4ff6d11 100644 --- a/js/xpconnect/shell/Makefile.in +++ b/js/xpconnect/shell/Makefile.in @@ -3,7 +3,6 @@ # 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/. -FAIL_ON_WARNINGS := 1 SDK_BINARY = $(PROGRAM) LOCAL_INCLUDES += \ @@ -27,7 +26,9 @@ NSDISTMODE = copy ifeq ($(OS_TEST),ia64) LIBS += $(JEMALLOC_LIBS) endif -include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk +include $(topsrcdir)/ipc/chromium/chromium-config.mk ifdef _MSC_VER # Always enter a Windows program through wmain, whether or not we're @@ -35,9 +36,6 @@ ifdef _MSC_VER WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif -include $(topsrcdir)/config/rules.mk -include $(topsrcdir)/ipc/chromium/chromium-config.mk - DEFINES += -DJS_THREADSAFE ifdef MOZ_SHARK diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build index 64b77c59184..6fbe4270309 100644 --- a/js/xpconnect/shell/moz.build +++ b/js/xpconnect/shell/moz.build @@ -4,6 +4,8 @@ # 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/. +FAIL_ON_WARNINGS = True + MODULE = 'xpcshell' PROGRAM = 'xpcshell' From 23468aaa57726cd7b1b7ef413875541e63e38b31 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:19 +0200 Subject: [PATCH 45/48] Bug 908142 - Part e: Move FAIL_ON_WARNINGS to moz.build in netwerk/test/; r=gps --- netwerk/test/Makefile.in | 2 -- netwerk/test/moz.build | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netwerk/test/Makefile.in b/netwerk/test/Makefile.in index 542298f6f2c..82bad2f537e 100644 --- a/netwerk/test/Makefile.in +++ b/netwerk/test/Makefile.in @@ -4,9 +4,7 @@ # 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/. -FAIL_ON_WARNINGS := 1 -include $(topsrcdir)/config/config.mk LIBS = $(XPCOM_LIBS) \ $(NSPR_LIBS) \ diff --git a/netwerk/test/moz.build b/netwerk/test/moz.build index 5385b03b6b8..776ef34135b 100644 --- a/netwerk/test/moz.build +++ b/netwerk/test/moz.build @@ -6,6 +6,8 @@ TEST_TOOL_DIRS += ['httpserver', 'browser', 'mochitests'] +FAIL_ON_WARNINGS = True + MODULE = 'test_necko' XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] From b261954f7c29b6934b8df4d3d8c5b66edabbaf4d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:20 +0200 Subject: [PATCH 46/48] Bug 908142 - Part g: Remove defines from js/xpconnect/shell/Makefile.in; r=gps --- js/xpconnect/shell/Makefile.in | 9 --------- js/xpconnect/shell/moz.build | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/xpconnect/shell/Makefile.in b/js/xpconnect/shell/Makefile.in index d67b4ff6d11..9afe715b0e6 100644 --- a/js/xpconnect/shell/Makefile.in +++ b/js/xpconnect/shell/Makefile.in @@ -36,16 +36,7 @@ ifdef _MSC_VER WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif -DEFINES += -DJS_THREADSAFE - -ifdef MOZ_SHARK -DEFINES += -DMOZ_SHARK -endif -ifdef MOZ_CALLGRIND -DEFINES += -DMOZ_CALLGRIND -endif ifdef MOZ_VTUNE -DEFINES += -DMOZ_VTUNE CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib endif diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build index 6fbe4270309..178b98b8713 100644 --- a/js/xpconnect/shell/moz.build +++ b/js/xpconnect/shell/moz.build @@ -18,3 +18,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': CMMSRCS += [ 'xpcshellMacUtils.mm', ] + +DEFINES['JS_THREADSAFE'] = True + +if CONFIG['MOZ_SHARK']: + DEFINES['MOZ_SHARK'] = True +if CONFIG['MOZ_CALLGRIND']: + DEFINES['MOZ_CALLGRIND'] = True +if CONFIG['MOZ_VTUNE']: + DEFINES['MOZ_VTUNE'] = True From 7d21e3cacbd9310c91a410e650a52af1c99a7c4c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:20 +0200 Subject: [PATCH 47/48] Bug 923249 - Remove some prtypes use in gfx/; r=roc --- gfx/layers/opengl/CompositorOGL.cpp | 3 +-- gfx/src/nsFont.cpp | 16 +++++++++------- gfx/src/nsRect.cpp | 5 ++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index b2b12cc4afd..55f3f1306ae 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -39,7 +39,6 @@ #include "nsRect.h" // for nsIntRect #include "nsServiceManagerUtils.h" // for do_GetService #include "nsString.h" // for nsString, nsAutoCString, etc -#include "prtypes.h" // for PR_INT32_MAX #if MOZ_ANDROID_OMTC #include "TexturePoolOGL.h" @@ -1356,7 +1355,7 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfxMatrix& aTransform) GLint width = rect.width; GLint height = rect.height; - if ((int64_t(width) * int64_t(height) * int64_t(4)) > PR_INT32_MAX) { + if ((int64_t(width) * int64_t(height) * int64_t(4)) > INT32_MAX) { NS_ERROR("Widget size too big - integer overflow!"); return; } diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index 351f1f39a41..1b2ae7b58b5 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -14,7 +14,6 @@ #include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsUnicharUtils.h" #include "nscore.h" // for PRUnichar -#include "prtypes.h" // for PR_STATIC_ASSERT #include "mozilla/gfx/2D.h" nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant, @@ -255,8 +254,9 @@ const gfxFontFeature eastAsianDefaults[] = { { TRUETYPE_TAG('r','u','b','y'), 1 } }; -PR_STATIC_ASSERT(NS_ARRAY_LENGTH(eastAsianDefaults) == - eFeatureEastAsian_numFeatures); +static_assert(NS_ARRAY_LENGTH(eastAsianDefaults) == + eFeatureEastAsian_numFeatures, + "eFeatureEastAsian_numFeatures should be correct"); // NS_FONT_VARIANT_LIGATURES_xxx values const gfxFontFeature ligDefaults[] = { @@ -270,8 +270,9 @@ const gfxFontFeature ligDefaults[] = { { TRUETYPE_TAG('c','a','l','t'), 0 } }; -PR_STATIC_ASSERT(NS_ARRAY_LENGTH(ligDefaults) == - eFeatureLigatures_numFeatures); +static_assert(NS_ARRAY_LENGTH(ligDefaults) == + eFeatureLigatures_numFeatures, + "eFeatureLigatures_numFeatures should be correct"); // NS_FONT_VARIANT_NUMERIC_xxx values const gfxFontFeature numericDefaults[] = { @@ -285,8 +286,9 @@ const gfxFontFeature numericDefaults[] = { { TRUETYPE_TAG('o','r','d','n'), 1 } }; -PR_STATIC_ASSERT(NS_ARRAY_LENGTH(numericDefaults) == - eFeatureNumeric_numFeatures); +static_assert(NS_ARRAY_LENGTH(numericDefaults) == + eFeatureNumeric_numFeatures, + "eFeatureNumeric_numFeatures should be correct"); static void AddFontFeaturesBitmask(uint32_t aValue, uint32_t aMin, uint32_t aMax, diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 84abd72d8f3..b2ea8fcd71b 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -7,11 +7,10 @@ #include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc #include "nsDeviceContext.h" // for nsDeviceContext #include "nsString.h" // for nsAutoString, etc -#include "prtypes.h" // for PR_STATIC_ASSERT #include "nsMargin.h" // for nsMargin -// the mozilla::css::Side sequence must match the nsMargin nscoord sequence -PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)); +static_assert((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3), + "The mozilla::css::Side sequence must match the nsMargin nscoord sequence"); #ifdef DEBUG // Diagnostics From a2aaf5eeeb6d3eff62fe69f53ffed6e4b44c82c6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 20 Oct 2013 09:25:20 +0200 Subject: [PATCH 48/48] Bug 910121 - Update web-platform-test tests. --- .../failures/html/dom/lists/Makefile.in | 5 + .../failures/html/dom/lists/moz.build | 4 + .../test_DOMTokenList-stringifier.html.json | 3 + .../html/dom/test_interfaces.html.json | 5 - .../html/html/dom/documents/dta/Makefile.in | 1 + .../dta/test_document.images.html.json | 3 + .../microdata-dom-api/test_001.html.json | 20 ++++ dom/imptests/html.mozbuild | 1 + dom/imptests/html/dom/lists/Makefile.in | 5 + dom/imptests/html/dom/lists/moz.build | 4 + .../lists/test_DOMTokenList-stringifier.html | 23 ++++ ..._DOMImplementation-createHTMLDocument.html | 10 +- .../html/dom/nodes/test_attributes.html | 3 +- dom/imptests/html/dom/test_interfaces.html | 4 +- .../html/html/dom/documents/dta/Makefile.in | 1 + .../documents/dta/test_document.images.html | 105 +++++++++++++++++ .../documents/dta/test_document.title-07.html | 5 + .../microdata/microdata-dom-api/test_001.html | 108 +++++++++--------- dom/imptests/moz.build | 1 + 19 files changed, 244 insertions(+), 67 deletions(-) create mode 100644 dom/imptests/failures/html/dom/lists/Makefile.in create mode 100644 dom/imptests/failures/html/dom/lists/moz.build create mode 100644 dom/imptests/failures/html/dom/lists/test_DOMTokenList-stringifier.html.json create mode 100644 dom/imptests/failures/html/html/dom/documents/dta/test_document.images.html.json create mode 100644 dom/imptests/html/dom/lists/Makefile.in create mode 100644 dom/imptests/html/dom/lists/moz.build create mode 100644 dom/imptests/html/dom/lists/test_DOMTokenList-stringifier.html create mode 100644 dom/imptests/html/html/dom/documents/dta/test_document.images.html diff --git a/dom/imptests/failures/html/dom/lists/Makefile.in b/dom/imptests/failures/html/dom/lists/Makefile.in new file mode 100644 index 00000000000..86908efbce0 --- /dev/null +++ b/dom/imptests/failures/html/dom/lists/Makefile.in @@ -0,0 +1,5 @@ +# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT + +MOCHITEST_FILES := \ + test_DOMTokenList-stringifier.html.json \ + $(NULL) diff --git a/dom/imptests/failures/html/dom/lists/moz.build b/dom/imptests/failures/html/dom/lists/moz.build new file mode 100644 index 00000000000..16e83110bc1 --- /dev/null +++ b/dom/imptests/failures/html/dom/lists/moz.build @@ -0,0 +1,4 @@ +# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT + +DIRS += [ +] diff --git a/dom/imptests/failures/html/dom/lists/test_DOMTokenList-stringifier.html.json b/dom/imptests/failures/html/dom/lists/test_DOMTokenList-stringifier.html.json new file mode 100644 index 00000000000..65613108c57 --- /dev/null +++ b/dom/imptests/failures/html/dom/lists/test_DOMTokenList-stringifier.html.json @@ -0,0 +1,3 @@ +{ + "DOMTokenList stringifier": true +} diff --git a/dom/imptests/failures/html/dom/test_interfaces.html.json b/dom/imptests/failures/html/dom/test_interfaces.html.json index 8a6a03cb98d..2e818d05c21 100644 --- a/dom/imptests/failures/html/dom/test_interfaces.html.json +++ b/dom/imptests/failures/html/dom/test_interfaces.html.json @@ -1,10 +1,7 @@ { "DOMException exception: existence and properties of exception interface prototype object": true, "DOMException exception: existence and properties of exception interface prototype object's \"name\" property": true, - "Event interface: document.createEvent(\"Event\") must inherit property \"timeStamp\" with the proper type (15)": true, - "Event interface: new Event(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true, "CustomEvent interface: existence and properties of interface object": true, - "Event interface: new CustomEvent(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true, "EventListener interface: existence and properties of interface prototype object": true, "EventListener interface: existence and properties of interface prototype object's \"constructor\" property": true, "EventListener interface: operation handleEvent(Event)": true, @@ -18,8 +15,6 @@ "Document interface: calling prepend([object Object],[object Object]) on xmlDoc with too few arguments must throw TypeError": true, "Document interface: xmlDoc must inherit property \"append\" with the proper type (29)": true, "Document interface: calling append([object Object],[object Object]) on xmlDoc with too few arguments must throw TypeError": true, - "DOMImplementation interface: operation createDocument(DOMString,DOMString,DocumentType)": true, - "DOMImplementation interface: calling createDocument(DOMString,DOMString,DocumentType) on document.implementation with too few arguments must throw TypeError": true, "DocumentFragment interface: existence and properties of interface object": true, "DocumentFragment interface: operation prepend([object Object],[object Object])": true, "DocumentFragment interface: operation append([object Object],[object Object])": true, diff --git a/dom/imptests/failures/html/html/dom/documents/dta/Makefile.in b/dom/imptests/failures/html/html/dom/documents/dta/Makefile.in index b949a10c5af..d84b26a0a74 100644 --- a/dom/imptests/failures/html/html/dom/documents/dta/Makefile.in +++ b/dom/imptests/failures/html/html/dom/documents/dta/Makefile.in @@ -1,6 +1,7 @@ # THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT MOCHITEST_FILES := \ + test_document.images.html.json \ test_document.title-03.html.json \ test_document.title-04.xhtml.json \ test_document.title-06.html.json \ diff --git a/dom/imptests/failures/html/html/dom/documents/dta/test_document.images.html.json b/dom/imptests/failures/html/html/dom/documents/dta/test_document.images.html.json new file mode 100644 index 00000000000..28f23927ed7 --- /dev/null +++ b/dom/imptests/failures/html/html/dom/documents/dta/test_document.images.html.json @@ -0,0 +1,3 @@ +{ + "The empty string should not be in the collections": true +} diff --git a/dom/imptests/failures/html/microdata/microdata-dom-api/test_001.html.json b/dom/imptests/failures/html/microdata/microdata-dom-api/test_001.html.json index 1cee5fb2bbc..82627099343 100644 --- a/dom/imptests/failures/html/microdata/microdata-dom-api/test_001.html.json +++ b/dom/imptests/failures/html/microdata/microdata-dom-api/test_001.html.json @@ -1,3 +1,23 @@ { + "itemType.remove must remove all useless whitespace": true, + "itemType.remove must collapse multiple whitespace around removed tokens": true, + "itemType.remove must remove duplicates when removing tokens": true, + "itemType.add must remove unused whitespace when the token already exists": true, + "itemType.add should normalize \\t as a space": true, + "itemType.add should normalize \\r as a space": true, + "itemType.add should normalize \\n as a space": true, + "itemType.add should normalize \\f as a space": true, + "itemProp.remove must remove all useless whitespace": true, + "itemProp.add must remove useless whitespace and duplicates when the token already exists": true, + "itemProp.add should normalize \\t as a space": true, + "itemProp.add should normalize \\r as a space": true, + "itemProp.add should normalize \\n as a space": true, + "itemProp.add should normalize \\f as a space": true, + "itemRef.remove must remove useless whitespace when removing tokens": true, + "itemRef.add must remove whitespace and duplicate when the token already exists": true, + "itemRef.add should normalize \\t as a space": true, + "itemRef.add should normalize \\r as a space": true, + "itemRef.add should normalize \\n as a space": true, + "itemRef.add should normalize \\f as a space": true, "itemValue must reflect the src attribute on track elements": true } diff --git a/dom/imptests/html.mozbuild b/dom/imptests/html.mozbuild index b854e497e85..a0945a61aaf 100644 --- a/dom/imptests/html.mozbuild +++ b/dom/imptests/html.mozbuild @@ -5,6 +5,7 @@ DIRS += [ 'html/dom/collections', 'html/dom/errors', 'html/dom/events', + 'html/dom/lists', 'html/dom/nodes', 'html/dom/nodes/Document-createElement-namespace-tests', 'html/dom/ranges', diff --git a/dom/imptests/html/dom/lists/Makefile.in b/dom/imptests/html/dom/lists/Makefile.in new file mode 100644 index 00000000000..4e410b1166c --- /dev/null +++ b/dom/imptests/html/dom/lists/Makefile.in @@ -0,0 +1,5 @@ +# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT + +MOCHITEST_FILES := \ + test_DOMTokenList-stringifier.html \ + $(NULL) diff --git a/dom/imptests/html/dom/lists/moz.build b/dom/imptests/html/dom/lists/moz.build new file mode 100644 index 00000000000..1147426c7da --- /dev/null +++ b/dom/imptests/html/dom/lists/moz.build @@ -0,0 +1,4 @@ +# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT + +DIRS += [ +] diff --git a/dom/imptests/html/dom/lists/test_DOMTokenList-stringifier.html b/dom/imptests/html/dom/lists/test_DOMTokenList-stringifier.html new file mode 100644 index 00000000000..7f2177adf54 --- /dev/null +++ b/dom/imptests/html/dom/lists/test_DOMTokenList-stringifier.html @@ -0,0 +1,23 @@ + + +DOMTokenList stringifier + + + + +
+ + diff --git a/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html b/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html index 3724505449f..d8048281797 100644 --- a/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html +++ b/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html @@ -1,11 +1,11 @@ DOMImplementation.createHTMLDocument - - - - - + + + + +
diff --git a/dom/imptests/html/dom/nodes/test_attributes.html b/dom/imptests/html/dom/nodes/test_attributes.html index 8ecb617747f..04c50ca049c 100644 --- a/dom/imptests/html/dom/nodes/test_attributes.html +++ b/dom/imptests/html/dom/nodes/test_attributes.html @@ -24,7 +24,8 @@ test(function() { assert_throws(new TypeError(), function() { attr.appendChild(document.createTextNode("fail")) }) assert_throws(new TypeError(), function() { attr.appendChild(null) }) assert_equals(attr.value, "pass") - assert_false("childNodes" in attr) + assert_false("childNodes" in attr, "Should not have childNodes") + assert_false("textContent" in attr, "Should not have textContent") }, "AttrExodus") // setAttribute exhaustive tests diff --git a/dom/imptests/html/dom/test_interfaces.html b/dom/imptests/html/dom/test_interfaces.html index a71d3dc63e4..52fde27b0d6 100644 --- a/dom/imptests/html/dom/test_interfaces.html +++ b/dom/imptests/html/dom/test_interfaces.html @@ -61,7 +61,7 @@ interface Event { readonly attribute boolean defaultPrevented; [Unforgeable] readonly attribute boolean isTrusted; - readonly attribute DOMTimeStamp timeStamp; + readonly attribute /* DOMTimeStamp */ unsigned long long timeStamp; void initEvent(DOMString type, boolean bubbles, boolean cancelable); }; @@ -245,7 +245,7 @@ interface XMLDocument : Document {}; interface DOMImplementation { DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId); - XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype); + XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null); Document createHTMLDocument(optional DOMString title); boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version); diff --git a/dom/imptests/html/html/dom/documents/dta/Makefile.in b/dom/imptests/html/html/dom/documents/dta/Makefile.in index d529fa26882..f8be63e8774 100644 --- a/dom/imptests/html/html/dom/documents/dta/Makefile.in +++ b/dom/imptests/html/html/dom/documents/dta/Makefile.in @@ -8,6 +8,7 @@ MOCHITEST_FILES := \ test_document.getElementsByClassName-same.html \ test_document.head-01.html \ test_document.head-02.html \ + test_document.images.html \ test_document.title-01.html \ test_document.title-02.xhtml \ test_document.title-03.html \ diff --git a/dom/imptests/html/html/dom/documents/dta/test_document.images.html b/dom/imptests/html/html/dom/documents/dta/test_document.images.html new file mode 100644 index 00000000000..558fdebc3a0 --- /dev/null +++ b/dom/imptests/html/html/dom/documents/dta/test_document.images.html @@ -0,0 +1,105 @@ + + +Document.images + + +
+
+ + + + + + +
+ diff --git a/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html b/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html index d5d6bac3d16..ad6e7111d27 100644 --- a/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html +++ b/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html @@ -18,4 +18,9 @@ checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz") checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz") checkDoc("foo\f\fbar baz", "foo\f\fbar baz", "foo bar baz") checkDoc("foo\r\rbar baz", "foo\r\rbar baz", "foo bar baz") + +test(function() { + var doc = document.implementation.createHTMLDocument() + assert_equals(doc.title, "") +}, "Missing title argument"); diff --git a/dom/imptests/html/microdata/microdata-dom-api/test_001.html b/dom/imptests/html/microdata/microdata-dom-api/test_001.html index b296cf13f71..c8671647bd7 100644 --- a/dom/imptests/html/microdata/microdata-dom-api/test_001.html +++ b/dom/imptests/html/microdata/microdata-dom-api/test_001.html @@ -387,23 +387,28 @@ test(function () { test(function () { var elem = makeEl('div',{itemtype:' token1 token2 '}); elem.itemType.remove('token2'); - assert_equals( elem.itemType.toString(), ' token1' ); -}, 'itemType.remove must only remove whitespace around removed tokens'); + assert_equals( elem.itemType.toString(), 'token1' ); +}, 'itemType.remove must remove all useless whitespace'); test(function () { - var elem = makeEl('div',{itemtype:' token1 token2 token1 '}); + var elem = makeEl('div',{itemtype:' token1 token2 token3 '}); elem.itemType.remove('token2'); - assert_equals( elem.itemType.toString(), ' token1 token1 ' ); + assert_equals( elem.itemType.toString(), 'token1 token3' ); }, 'itemType.remove must collapse multiple whitespace around removed tokens'); test(function () { var elem = makeEl('div',{itemtype:' token1 token2 token1 '}); - elem.itemType.remove('token1'); + elem.itemType.remove('token2'); + assert_equals( elem.itemType.toString(), 'token1' ); +}, 'itemType.remove must remove duplicates when removing tokens'); +test(function () { + var elem = makeEl('div',{itemtype:' token1 token2 token3 '}); + elem.itemType.remove('token1', 'token3'); assert_equals( elem.itemType.toString(), 'token2' ); }, 'itemType.remove must collapse whitespace when removing multiple tokens'); test(function () { - var elem = makeEl('div',{itemtype:' token1 token1 '}); + var elem = makeEl('div',{itemtype:' token1 token2 '}); elem.itemType.add('token1'); - assert_equals( elem.itemType.toString(), ' token1 token1 ' ); -}, 'itemType.add must not affect whitespace when the token already exists'); + assert_equals( elem.itemType.toString(), 'token1 token2' ); +}, 'itemType.add must remove unused whitespace when the token already exists'); test(function () { var elem = makeEl('div',{itemtype:'FOO'}); assert_true(elem.itemType.toggle('foo')); @@ -456,23 +461,23 @@ test(function () { test(function () { var elem = makeEl('div',{itemtype:'a\t'}); elem.itemType.add('b'); - assert_equals(elem.itemType.toString(),'a\tb'); -}, 'itemType.add should treat \\t as a space'); + assert_equals(elem.itemType.toString(),'a b'); +}, 'itemType.add should normalize \\t as a space'); test(function () { var elem = makeEl('div',{itemtype:'a\r'}); elem.itemType.add('b'); - assert_equals(elem.itemType.toString(),'a\rb'); -}, 'itemType.add should treat \\r as a space'); + assert_equals(elem.itemType.toString(),'a b'); +}, 'itemType.add should normalize \\r as a space'); test(function () { var elem = makeEl('div',{itemtype:'a\n'}); elem.itemType.add('b'); - assert_equals(elem.itemType.toString(),'a\nb'); -}, 'itemType.add should treat \\n as a space'); + assert_equals(elem.itemType.toString(),'a b'); +}, 'itemType.add should normalize \\n as a space'); test(function () { var elem = makeEl('div',{itemtype:'a\f'}); elem.itemType.add('b'); - assert_equals(elem.itemType.toString(),'a\fb'); -}, 'itemType.add should treat \\f as a space'); + assert_equals(elem.itemType.toString(),'a b'); +}, 'itemType.add should normalize \\f as a space'); test(function () { var elem = makeEl('div',{itemtype:'foo'}); elem.itemType.remove('foo'); @@ -675,25 +680,20 @@ test(function () { assert_equals( elem.itemProp.toString(), 'token1 token3' ); }, 'itemProp.remove must collapse whitespace around removed tokens'); test(function () { - var elem = makeEl('div',{itemprop:' token1 token2 '}); + var elem = makeEl('div',{itemprop:' token1 token2 token3 '}); elem.itemProp.remove('token2'); - assert_equals( elem.itemProp.toString(), ' token1' ); -}, 'itemProp.remove must only remove whitespace around removed tokens'); + assert_equals( elem.itemProp.toString(), 'token1 token3' ); +}, 'itemProp.remove must remove all useless whitespace'); test(function () { - var elem = makeEl('div',{itemprop:' token1 token2 token1 '}); - elem.itemProp.remove('token2'); - assert_equals( elem.itemProp.toString(), ' token1 token1 ' ); -}, 'itemProp.remove must collapse multiple whitespace around removed tokens'); -test(function () { - var elem = makeEl('div',{itemprop:' token1 token2 token1 '}); - elem.itemProp.remove('token1'); + var elem = makeEl('div',{itemprop:' token1 token2 token3 '}); + elem.itemProp.remove('token1', 'token3'); assert_equals( elem.itemProp.toString(), 'token2' ); -}, 'itemProp.remove must collapse whitespace when removing multiple tokens'); +}, 'itemProp.remove must remove useless whitespace when removing multiple tokens'); test(function () { var elem = makeEl('div',{itemprop:' token1 token1 '}); elem.itemProp.add('token1'); - assert_equals( elem.itemProp.toString(), ' token1 token1 ' ); -}, 'itemProp.add must not affect whitespace when the token already exists'); + assert_equals( elem.itemProp.toString(), 'token1' ); +}, 'itemProp.add must remove useless whitespace and duplicates when the token already exists'); test(function () { var elem = makeEl('div',{itemprop:'FOO'}); assert_true(elem.itemProp.toggle('foo')); @@ -746,23 +746,23 @@ test(function () { test(function () { var elem = makeEl('div',{itemprop:'a\t'}); elem.itemProp.add('b'); - assert_equals(elem.itemProp.toString(),'a\tb'); -}, 'itemProp.add should treat \\t as a space'); + assert_equals(elem.itemProp.toString(),'a b'); +}, 'itemProp.add should normalize \\t as a space'); test(function () { var elem = makeEl('div',{itemprop:'a\r'}); elem.itemProp.add('b'); - assert_equals(elem.itemProp.toString(),'a\rb'); -}, 'itemProp.add should treat \\r as a space'); + assert_equals(elem.itemProp.toString(),'a b'); +}, 'itemProp.add should normalize \\r as a space'); test(function () { var elem = makeEl('div',{itemprop:'a\n'}); elem.itemProp.add('b'); - assert_equals(elem.itemProp.toString(),'a\nb'); -}, 'itemProp.add should treat \\n as a space'); + assert_equals(elem.itemProp.toString(),'a b'); +}, 'itemProp.add should normalize \\n as a space'); test(function () { var elem = makeEl('div',{itemprop:'a\f'}); elem.itemProp.add('b'); - assert_equals(elem.itemProp.toString(),'a\fb'); -}, 'itemProp.add should treat \\f as a space'); + assert_equals(elem.itemProp.toString(),'a b'); +}, 'itemProp.add should normalize \\f as a space'); test(function () { var elem = makeEl('div',{itemprop:'foo'}); elem.itemProp.remove('foo'); @@ -1009,23 +1009,23 @@ test(function () { test(function () { var elem = makeEl('div',{itemref:' token1 token2 '}); elem.itemRef.remove('token2'); - assert_equals( elem.itemRef.toString(), ' token1' ); -}, 'itemRef.remove must only remove whitespace around removed tokens'); + assert_equals( elem.itemRef.toString(), 'token1' ); +}, 'itemRef.remove must remove useless whitespace when removing tokens'); test(function () { - var elem = makeEl('div',{itemref:' token1 token2 token1 '}); + var elem = makeEl('div',{itemref:' token1 token2 token3 '}); elem.itemRef.remove('token2'); - assert_equals( elem.itemRef.toString(), ' token1 token1 ' ); -}, 'itemRef.remove must collapse multiple whitespace around removed tokens'); + assert_equals( elem.itemRef.toString(), 'token1 token3' ); +}, 'itemRef.remove must remove useless whitespace when removing tokens'); test(function () { - var elem = makeEl('div',{itemref:' token1 token2 token1 '}); - elem.itemRef.remove('token1'); + var elem = makeEl('div',{itemref:' token1 token2 token3 '}); + elem.itemRef.remove('token1', 'token3'); assert_equals( elem.itemRef.toString(), 'token2' ); }, 'itemRef.remove must collapse whitespace when removing multiple tokens'); test(function () { var elem = makeEl('div',{itemref:' token1 token1 '}); elem.itemRef.add('token1'); - assert_equals( elem.itemRef.toString(), ' token1 token1 ' ); -}, 'itemRef.add must not affect whitespace when the token already exists'); + assert_equals( elem.itemRef.toString(), 'token1' ); +}, 'itemRef.add must remove whitespace and duplicate when the token already exists'); test(function () { var elem = makeEl('div',{itemref:'FOO'}); assert_true(elem.itemRef.toggle('foo')); @@ -1078,23 +1078,23 @@ test(function () { test(function () { var elem = makeEl('div',{itemref:'a\t'}); elem.itemRef.add('b'); - assert_equals(elem.itemRef.toString(),'a\tb'); -}, 'itemRef.add should treat \\t as a space'); + assert_equals(elem.itemRef.toString(),'a b'); +}, 'itemRef.add should normalize \\t as a space'); test(function () { var elem = makeEl('div',{itemref:'a\r'}); elem.itemRef.add('b'); - assert_equals(elem.itemRef.toString(),'a\rb'); -}, 'itemRef.add should treat \\r as a space'); + assert_equals(elem.itemRef.toString(),'a b'); +}, 'itemRef.add should normalize \\r as a space'); test(function () { var elem = makeEl('div',{itemref:'a\n'}); elem.itemRef.add('b'); - assert_equals(elem.itemRef.toString(),'a\nb'); -}, 'itemRef.add should treat \\n as a space'); + assert_equals(elem.itemRef.toString(),'a b'); +}, 'itemRef.add should normalize \\n as a space'); test(function () { var elem = makeEl('div',{itemref:'a\f'}); elem.itemRef.add('b'); - assert_equals(elem.itemRef.toString(),'a\fb'); -}, 'itemRef.add should treat \\f as a space'); + assert_equals(elem.itemRef.toString(),'a b'); +}, 'itemRef.add should normalize \\f as a space'); test(function () { var elem = makeEl('div',{itemref:'foo'}); elem.itemRef.remove('foo'); diff --git a/dom/imptests/moz.build b/dom/imptests/moz.build index 91640215b59..14bee54506a 100644 --- a/dom/imptests/moz.build +++ b/dom/imptests/moz.build @@ -10,6 +10,7 @@ DIRS += [ 'failures/html/dom', 'failures/html/dom/collections', 'failures/html/dom/errors', + 'failures/html/dom/lists', 'failures/html/dom/nodes', 'failures/html/dom/ranges', 'failures/html/html/browsers/the-window-object',