diff --git a/browser/config/mozconfigs/macosx64/opt-static-analysis b/browser/config/mozconfigs/macosx64/opt-static-analysis new file mode 100644 index 000000000000..90f9f9269c18 --- /dev/null +++ b/browser/config/mozconfigs/macosx64/opt-static-analysis @@ -0,0 +1,19 @@ +MOZ_AUTOMATION_BUILD_SYMBOLS=0 +MOZ_AUTOMATION_PACKAGE_TESTS=0 +MOZ_AUTOMATION_L10N_CHECK=0 + +. $topsrcdir/build/macosx/mozconfig.common + +ac_add_options --disable-debug +ac_add_options --enable-optimize +ac_add_options --enable-dmd + +# Treat warnings as errors (modulo ALLOW_COMPILER_WARNINGS). +ac_add_options --enable-warnings-as-errors + +ac_add_options --enable-clang-plugin + +. "$topsrcdir/build/macosx/mozconfig.rust" +. "$topsrcdir/build/mozconfig.common.override" +. "$topsrcdir/build/mozconfig.cache" + diff --git a/browser/config/tooltool-manifests/linux32/clang.manifest b/browser/config/tooltool-manifests/linux32/clang.manifest index 227459a06646..05278d7586a1 100644 --- a/browser/config/tooltool-manifests/linux32/clang.manifest +++ b/browser/config/tooltool-manifests/linux32/clang.manifest @@ -6,7 +6,7 @@ "size": 93197192, "digest": "6ebd8994ac76cf6694c3d9054104219836f47578223c799cb9ba9669cfdee00112e9de56aea9d1e6d9d50ee94a201970555de19794b5fbb7546f58fdf8e59a99", "algorithm": "sha512", -"filename": "clang.tar.bz2", +"filename": "clang.tar.xz", "unpack": true, } ] diff --git a/browser/config/tooltool-manifests/macosx64/clang.manifest b/browser/config/tooltool-manifests/macosx64/clang.manifest index 81a6ae165dc3..d572cf39c2f4 100644 --- a/browser/config/tooltool-manifests/macosx64/clang.manifest +++ b/browser/config/tooltool-manifests/macosx64/clang.manifest @@ -6,7 +6,7 @@ "size": 97314461, "digest": "9a74670fa917f760a4767923485d5166bbd258a8023c8aeb899b8c4d22f2847be76508ac5f26d7d2193318a2bb368a71bc62888d1bfe9d81eb45329a60451aa4", "algorithm": "sha512", -"filename": "clang.tar.xz", +"filename": "clang.tar.bz2", "unpack": true }, { diff --git a/build/annotationProcessors/CodeGenerator.java b/build/annotationProcessors/CodeGenerator.java index 0bba34e3af0a..b36d1602eb71 100644 --- a/build/annotationProcessors/CodeGenerator.java +++ b/build/annotationProcessors/CodeGenerator.java @@ -66,15 +66,37 @@ public class CodeGenerator { return (includeScope ? clsName + "::" : "") + uniqueName + "_t"; } + /** + * Return the C++ type name for this class or any class within the chain + * of declaring classes, if the target class matches the given type. + * + * Return null if the given type does not match any class searched. + */ + private String getMatchingClassType(final Class type) { + Class cls = this.cls; + String clsName = this.clsName; + + while (cls != null) { + if (type == cls) { + return clsName; + } + cls = cls.getDeclaringClass(); + clsName = clsName.substring(0, Math.max(0, clsName.lastIndexOf("::"))); + } + return null; + } + private String getNativeParameterType(Class type, AnnotationInfo info) { - if (type == cls) { + final String clsName = getMatchingClassType(type); + if (clsName != null) { return Utils.getUnqualifiedName(clsName) + "::Param"; } return Utils.getNativeParameterType(type, info); } private String getNativeReturnType(Class type, AnnotationInfo info) { - if (type == cls) { + final String clsName = getMatchingClassType(type); + if (clsName != null) { return Utils.getUnqualifiedName(clsName) + "::LocalRef"; } return Utils.getNativeReturnType(type, info); @@ -370,6 +392,7 @@ public class CodeGenerator { if (isStatic && isFinal && (type.isPrimitive() || type == String.class)) { Object val = null; try { + field.setAccessible(true); val = field.get(null); } catch (final IllegalAccessException e) { } diff --git a/build/unix/build-clang/build-clang.py b/build/unix/build-clang/build-clang.py index 973ea6f5dfe0..f418d752b3e0 100755 --- a/build/unix/build-clang/build-clang.py +++ b/build/unix/build-clang/build-clang.py @@ -64,7 +64,7 @@ def updated_env(env): def build_tar_package(tar, name, base, directory): name = os.path.realpath(name) run_in(base, [tar, - "-c -%s -f" % "J" if ".xz" in name else "j", + "-c -%s -f" % ("J" if ".xz" in name else "j"), name, directory]) diff --git a/devtools/client/styleinspector/test/browser_ruleview_authored.js b/devtools/client/styleinspector/test/browser_ruleview_authored.js index 67c02e4a671b..973625278101 100644 --- a/devtools/client/styleinspector/test/browser_ruleview_authored.js +++ b/devtools/client/styleinspector/test/browser_ruleview_authored.js @@ -55,16 +55,17 @@ function* basicTest() { } function* overrideTest() { - let gradientText = "(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);"; + let gradientText1 = "(orange, blue);"; + let gradientText2 = "(pink, teal);"; let view = yield createTestContent("#testid {" + - " background-image: -moz-linear-gradient" + - gradientText + - " background-image: -webkit-linear-gradient" + - gradientText + " background-image: linear-gradient" + - gradientText + + gradientText1 + + " background-image: -ms-linear-gradient" + + gradientText2 + + " background-image: linear-gradient" + + gradientText2 + "} "); let elementStyle = view._elementStyle; diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm index 2415dd221e97..dc5a219fa404 100644 --- a/dom/apps/Webapps.jsm +++ b/dom/apps/Webapps.jsm @@ -4106,11 +4106,6 @@ this.DOMApplicationRegistry = { }, doUninstall: Task.async(function*(aData, aMm) { - // The yields here could get stuck forever, so we only hold - // a weak reference to the message manager while yielding, to avoid - // leaking the whole page associationed with the message manager. - aMm = Cu.getWeakReference(aMm); - let response = "Webapps:Uninstall:Return:OK"; try { @@ -4140,9 +4135,7 @@ this.DOMApplicationRegistry = { response = "Webapps:Uninstall:Return:KO"; } - if ((aMm = aMm.get())) { - aMm.sendAsyncMessage(response, this.formatMessage(aData)); - } + aMm.sendAsyncMessage(response, this.formatMessage(aData)); }), uninstall: function(aManifestURL) { diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index ac35e0d9eb7f..9327cc67e45f 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -114,9 +114,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(EventSource, DOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSrc) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotificationCallbacks) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLoadGroup) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannelEventSink) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHttpChannel) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mUnicodeDecoder) @@ -490,48 +488,6 @@ EventSource::OnStopRequest(nsIRequest *aRequest, return NS_OK; } -/** - * Simple helper class that just forwards the redirect callback back - * to the EventSource. - */ -class AsyncVerifyRedirectCallbackFwr final : public nsIAsyncVerifyRedirectCallback -{ -public: - explicit AsyncVerifyRedirectCallbackFwr(EventSource* aEventsource) - : mEventSource(aEventsource) - { - } - - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(AsyncVerifyRedirectCallbackFwr) - - // nsIAsyncVerifyRedirectCallback implementation - NS_IMETHOD OnRedirectVerifyCallback(nsresult aResult) override - { - nsresult rv = mEventSource->OnRedirectVerifyCallback(aResult); - if (NS_FAILED(rv)) { - mEventSource->mErrorLoadOnRedirect = true; - mEventSource->DispatchFailConnection(); - } - - return NS_OK; - } - -private: - ~AsyncVerifyRedirectCallbackFwr() {} - nsRefPtr mEventSource; -}; - -NS_IMPL_CYCLE_COLLECTION(AsyncVerifyRedirectCallbackFwr, mEventSource) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AsyncVerifyRedirectCallbackFwr) - NS_INTERFACE_MAP_ENTRY(nsISupports) - NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectCallback) -NS_INTERFACE_MAP_END - -NS_IMPL_CYCLE_COLLECTING_ADDREF(AsyncVerifyRedirectCallbackFwr) -NS_IMPL_CYCLE_COLLECTING_RELEASE(AsyncVerifyRedirectCallbackFwr) - //----------------------------------------------------------------------------- // EventSource::nsIChannelEventSink //----------------------------------------------------------------------------- @@ -564,56 +520,20 @@ EventSource::AsyncOnChannelRedirect(nsIChannel *aOldChannel, return NS_ERROR_DOM_SECURITY_ERR; } - // Prepare to receive callback - mRedirectFlags = aFlags; - mRedirectCallback = aCallback; - mNewRedirectChannel = aNewChannel; - - if (mChannelEventSink) { - nsRefPtr fwd = - new AsyncVerifyRedirectCallbackFwr(this); - - rv = mChannelEventSink->AsyncOnChannelRedirect(aOldChannel, - aNewChannel, - aFlags, fwd); - if (NS_FAILED(rv)) { - mRedirectCallback = nullptr; - mNewRedirectChannel = nullptr; - mErrorLoadOnRedirect = true; - DispatchFailConnection(); - } - return rv; - } - OnRedirectVerifyCallback(NS_OK); - return NS_OK; -} - -nsresult -EventSource::OnRedirectVerifyCallback(nsresult aResult) -{ - MOZ_ASSERT(mRedirectCallback, "mRedirectCallback not set in callback"); - MOZ_ASSERT(mNewRedirectChannel, - "mNewRedirectChannel not set in callback"); - - NS_ENSURE_SUCCESS(aResult, aResult); - // update our channel - mHttpChannel = do_QueryInterface(mNewRedirectChannel); + mHttpChannel = do_QueryInterface(aNewChannel); NS_ENSURE_STATE(mHttpChannel); - nsresult rv = SetupHttpChannel(); + rv = SetupHttpChannel(); NS_ENSURE_SUCCESS(rv, rv); - if ((mRedirectFlags & nsIChannelEventSink::REDIRECT_PERMANENT) != 0) { + if ((aFlags & nsIChannelEventSink::REDIRECT_PERMANENT) != 0) { rv = NS_GetFinalChannelURI(mHttpChannel, getter_AddRefs(mSrc)); NS_ENSURE_SUCCESS(rv, rv); } - mNewRedirectChannel = nullptr; - - mRedirectCallback->OnRedirectVerifyCallback(aResult); - mRedirectCallback = nullptr; + aCallback->OnRedirectVerifyCallback(NS_OK); return NS_OK; } @@ -626,27 +546,12 @@ NS_IMETHODIMP EventSource::GetInterface(const nsIID & aIID, void **aResult) { - // Make sure to return ourselves for the channel event sink interface, - // no matter what. We can forward these to mNotificationCallbacks - // if it wants to get notifications for them. But we - // need to see these notifications for proper functioning. if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) { - mChannelEventSink = do_GetInterface(mNotificationCallbacks); *aResult = static_cast(this); NS_ADDREF_THIS(); return NS_OK; } - // Now give mNotificationCallbacks (if non-null) a chance to return the - // desired interface. - if (mNotificationCallbacks) { - nsresult rv = mNotificationCallbacks->GetInterface(aIID, aResult); - if (NS_SUCCEEDED(rv)) { - NS_ASSERTION(*aResult, "Lying nsIInterfaceRequestor implementation!"); - return rv; - } - } - if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) || aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) { nsresult rv = CheckInnerWindowCorrectness(); @@ -807,12 +712,14 @@ EventSource::InitChannelAndRequestEventSource() rv = SetupHttpChannel(); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr notificationCallbacks; - mHttpChannel->GetNotificationCallbacks(getter_AddRefs(notificationCallbacks)); - if (notificationCallbacks != this) { - mNotificationCallbacks = notificationCallbacks; - mHttpChannel->SetNotificationCallbacks(this); +#ifdef DEBUG + { + nsCOMPtr notificationCallbacks; + mHttpChannel->GetNotificationCallbacks(getter_AddRefs(notificationCallbacks)); + MOZ_ASSERT(!notificationCallbacks); } +#endif + mHttpChannel->SetNotificationCallbacks(this); // Start reading from the channel rv = mHttpChannel->AsyncOpen2(this); @@ -878,11 +785,7 @@ EventSource::ResetConnection() mLastConvertionResult = NS_OK; mHttpChannel = nullptr; - mNotificationCallbacks = nullptr; - mChannelEventSink = nullptr; mStatus = PARSE_STATE_OFF; - mRedirectCallback = nullptr; - mNewRedirectChannel = nullptr; mReadyState = CONNECTING; diff --git a/dom/base/EventSource.h b/dom/base/EventSource.h index 995ed47e1ea1..ea1fe10aa8da 100644 --- a/dom/base/EventSource.h +++ b/dom/base/EventSource.h @@ -34,7 +34,6 @@ class ErrorResult; namespace dom { -class AsyncVerifyRedirectCallbackFwr; struct EventSourceInit; class EventSource final : public DOMEventTargetHelper @@ -44,8 +43,6 @@ class EventSource final : public DOMEventTargetHelper , public nsIInterfaceRequestor , public nsSupportsWeakReference { -friend class AsyncVerifyRedirectCallbackFwr; - public: explicit EventSource(nsPIDOMWindow* aOwnerWindow); NS_DECL_ISUPPORTS_INHERITED @@ -232,13 +229,6 @@ protected: nsCOMPtr mLoadGroup; - /** - * The notification callbacks the channel had initially. - * We want to forward things here as needed. - */ - nsCOMPtr mNotificationCallbacks; - nsCOMPtr mChannelEventSink; - nsCOMPtr mHttpChannel; nsCOMPtr mTimer; @@ -249,10 +239,6 @@ protected: nsCOMPtr mPrincipal; nsString mOrigin; - uint32_t mRedirectFlags; - nsCOMPtr mRedirectCallback; - nsCOMPtr mNewRedirectChannel; - // Event Source owner information: // - the script file name // - source code line number and column number where the Event Source object diff --git a/dom/base/WindowNamedPropertiesHandler.cpp b/dom/base/WindowNamedPropertiesHandler.cpp index ca0e4924b69a..ab6ac33716e6 100644 --- a/dom/base/WindowNamedPropertiesHandler.cpp +++ b/dom/base/WindowNamedPropertiesHandler.cpp @@ -274,13 +274,27 @@ WindowNamedPropertiesHandler::Create(JSContext* aCx, // Note: since the scope polluter proxy lives on the window's prototype // chain, it needs a singleton type to avoid polluting type information // for properties on the window. - JS::Rooted gsp(aCx); js::ProxyOptions options; options.setSingleton(true); options.setClass(&WindowNamedPropertiesClass.mBase); - return js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(), - JS::NullHandleValue, aProto, - options); + + JS::Rooted gsp(aCx); + gsp = js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(), + JS::NullHandleValue, aProto, + options); + if (!gsp) { + return nullptr; + } + + bool succeeded; + if (!JS_SetImmutablePrototype(aCx, gsp, &succeeded)) { + return nullptr; + } + MOZ_ASSERT(succeeded, + "errors making the [[Prototype]] of the named properties object " + "immutable should have been JSAPI failures, not !succeeded"); + + return gsp; } } // namespace dom diff --git a/dom/events/MessageEvent.cpp b/dom/events/MessageEvent.cpp index 29cb907678d9..08fe8b54c0d4 100644 --- a/dom/events/MessageEvent.cpp +++ b/dom/events/MessageEvent.cpp @@ -199,6 +199,49 @@ MessageEvent::InitMessageEvent(const nsAString& aType, return NS_OK; } +void +MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType, + bool aCanBubble, bool aCancelable, + JS::Handle aData, + const nsAString& aOrigin, + const nsAString& aLastEventId, + const Nullable& aSource, + const Nullable>>& aPorts, + ErrorResult& aRv) +{ + aRv = Event::InitEvent(aType, aCanBubble, aCancelable); + if (NS_WARN_IF(aRv.Failed())) { + return; + } + + mData = aData; + mozilla::HoldJSObjects(this); + mOrigin = aOrigin; + mLastEventId = aLastEventId; + + mWindowSource = nullptr; + mPortSource = nullptr; + + if (!aSource.IsNull()) { + if (aSource.Value().IsWindowProxy()) { + mWindowSource = aSource.Value().GetAsWindowProxy(); + } else { + mPortSource = &aSource.Value().GetAsMessagePort(); + } + } + + mPorts = nullptr; + + if (!aPorts.IsNull()) { + nsTArray> ports; + for (uint32_t i = 0, len = aPorts.Value().Length(); i < len; ++i) { + ports.AppendElement(aPorts.Value()[i]); + } + + mPorts = new MessagePortList(static_cast(this), ports); + } +} + void MessageEvent::SetPorts(MessagePortList* aPorts) { @@ -227,7 +270,7 @@ using namespace mozilla::dom; already_AddRefed NS_NewDOMMessageEvent(EventTarget* aOwner, nsPresContext* aPresContext, - WidgetEvent* aEvent) + WidgetEvent* aEvent) { nsRefPtr it = new MessageEvent(aOwner, aPresContext, aEvent); return it.forget(); diff --git a/dom/events/MessageEvent.h b/dom/events/MessageEvent.h index e2b4e1afcaa0..a435f1ae798a 100644 --- a/dom/events/MessageEvent.h +++ b/dom/events/MessageEvent.h @@ -8,9 +8,10 @@ #define mozilla_dom_MessageEvent_h_ #include "mozilla/dom/Event.h" +#include "mozilla/dom/BindingUtils.h" +#include "mozilla/dom/MessagePortList.h" #include "nsCycleCollectionParticipant.h" #include "nsIDOMMessageEvent.h" -#include "mozilla/dom/MessagePortList.h" namespace mozilla { namespace dom { @@ -19,6 +20,7 @@ struct MessageEventInit; class MessagePort; class MessagePortList; class OwningWindowProxyOrMessagePortOrClient; +class WindowProxyOrMessagePort; namespace workers { @@ -85,6 +87,13 @@ public: const MessageEventInit& aEventInit, ErrorResult& aRv); + void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble, + bool aCancelable, JS::Handle aData, + const nsAString& aOrigin, const nsAString& aLastEventId, + const Nullable& aSource, + const Nullable>>& aPorts, + ErrorResult& aRv); + protected: ~MessageEvent(); diff --git a/dom/events/test/test_messageEvent.html b/dom/events/test/test_messageEvent.html index b8dc91f86645..249aa9e8c158 100644 --- a/dom/events/test/test_messageEvent.html +++ b/dom/events/test/test_messageEvent.html @@ -13,6 +13,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294