From 4f9f3d2a50deb90fe202b7432ce38dc47fa7117b Mon Sep 17 00:00:00 2001 From: Jason Duell Date: Mon, 18 Jun 2012 22:38:14 -0700 Subject: [PATCH 01/83] Bug 449251 - "Use this proxy for all protocols" should not configure SOCKS. r=bmcbride --- browser/components/preferences/connection.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/browser/components/preferences/connection.js b/browser/components/preferences/connection.js index d369d134aea..9d00bcdf956 100644 --- a/browser/components/preferences/connection.js +++ b/browser/components/preferences/connection.js @@ -27,8 +27,15 @@ var gConnectionsDialog = { var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port"); backupServerURLPref.value = proxyServerURLPref.value; backupPortPref.value = proxyPortPref.value; - proxyServerURLPref.value = httpProxyURLPref.value; - proxyPortPref.value = httpProxyPortPref.value; + // SOCKS: not a protocol: set value to empty/0 while shareProxies is on + if (proxyPrefs[i] == "socks") { + proxyServerURLPref.value = ""; + proxyPortPref.value = 0; + } else { + // protocols get HTTP proxy's values + proxyServerURLPref.value = httpProxyURLPref.value; + proxyPortPref.value = httpProxyPortPref.value; + } } } @@ -134,6 +141,10 @@ var gConnectionsDialog = { { var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings"); if (shareProxiesPref.value) { + // during shareProxiesPref SOCKS values are empty + if (aProtocol == 'socks') { + return aIsPort ? 0 : ""; + } var pref = document.getElementById("network.proxy.http" + (aIsPort ? "_port" : "")); return pref.value; } From d8e818f4c94a85fe316bca1bb5be496d3962fb88 Mon Sep 17 00:00:00 2001 From: Jason Duell Date: Mon, 18 Jun 2012 22:50:20 -0700 Subject: [PATCH 02/83] Bug 713026 - websockets bootstrap via proxy should always CONNECT. r=mcmanus --- netwerk/protocol/http/HttpBaseChannel.cpp | 2 +- netwerk/protocol/http/nsHttpChannel.cpp | 7 ++----- netwerk/protocol/http/nsHttpConnection.cpp | 5 ++--- netwerk/protocol/http/nsHttpConnectionInfo.cpp | 18 +----------------- netwerk/protocol/http/nsHttpConnectionInfo.h | 14 +++++++++++++- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 2 +- netwerk/protocol/http/nsHttpTransaction.cpp | 6 ++---- 7 files changed, 22 insertions(+), 32 deletions(-) diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 3fd20b356a8..b9d495e8d3f 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -130,7 +130,7 @@ HttpBaseChannel::Init(nsIURI *aURI, rv = gHttpHandler-> AddStandardRequestHeaders(&mRequestHead.Headers(), aCaps, - !mConnectionInfo->UsingSSL() && + !mConnectionInfo->UsingConnect() && mConnectionInfo->UsingHttpProxy()); return rv; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index e319b0afcb5..895cc0c4308 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -713,8 +713,7 @@ nsHttpChannel::SetupTransaction() // does not count here). also, figure out what version we should be speaking. nsCAutoString buf, path; nsCString* requestURI; - if (mConnectionInfo->UsingSSL() || - mConnectionInfo->ShouldForceConnectMethod() || + if (mConnectionInfo->UsingConnect() || !mConnectionInfo->UsingHttpProxy()) { rv = mURI->GetPath(path); if (NS_FAILED(rv)) return rv; @@ -4634,9 +4633,7 @@ nsHttpChannel::GetIsSSL(bool *aIsSSL) NS_IMETHODIMP nsHttpChannel::GetProxyMethodIsConnect(bool *aProxyMethodIsConnect) { - *aProxyMethodIsConnect = - (mConnectionInfo->UsingHttpProxy() && mConnectionInfo->UsingSSL()) || - mConnectionInfo->ShouldForceConnectMethod(); + *aProxyMethodIsConnect = mConnectionInfo->UsingConnect(); return NS_OK; } diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index eaf85703939..a83cf9ed2be 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -349,8 +349,7 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, PRUint8 caps, PRInt32 pri) // need to handle HTTP CONNECT tunnels if this is the first time if // we are tunneling through a proxy - if (((mConnInfo->UsingSSL() && mConnInfo->UsingHttpProxy()) || - mConnInfo->ShouldForceConnectMethod()) && !mCompletedProxyConnect) { + if (mConnInfo->UsingConnect() && !mCompletedProxyConnect) { rv = SetupProxyConnect(); if (NS_FAILED(rv)) goto failed_activation; @@ -637,7 +636,7 @@ nsHttpConnection::SupportsPipelining(nsHttpResponseHead *responseHead) return false; // assuming connection is HTTP/1.1 with keep-alive enabled - if (mConnInfo->UsingHttpProxy() && !mConnInfo->UsingSSL()) { + if (mConnInfo->UsingHttpProxy() && !mConnInfo->UsingConnect()) { // XXX check for bad proxy servers... return true; } diff --git a/netwerk/protocol/http/nsHttpConnectionInfo.cpp b/netwerk/protocol/http/nsHttpConnectionInfo.cpp index 8a179b61b33..a797088e551 100644 --- a/netwerk/protocol/http/nsHttpConnectionInfo.cpp +++ b/netwerk/protocol/http/nsHttpConnectionInfo.cpp @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsHttpConnectionInfo.h" -#include "nsIProtocolProxyService.h" void nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port) @@ -25,7 +24,7 @@ nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port) const char *keyHost; PRInt32 keyPort; - if (mUsingHttpProxy && !mUsingSSL) { + if (mUsingHttpProxy && !mUsingConnect) { keyHost = ProxyHost(); keyPort = ProxyPort(); } @@ -66,18 +65,3 @@ nsHttpConnectionInfo::Clone() const return clone; } -bool -nsHttpConnectionInfo::ShouldForceConnectMethod() -{ - if (!mProxyInfo) - return false; - - PRUint32 resolveFlags; - nsresult rv; - - rv = mProxyInfo->GetResolveFlags(&resolveFlags); - if (NS_FAILED(rv)) - return false; - - return resolveFlags & nsIProtocolProxyService::RESOLVE_ALWAYS_TUNNEL; -} diff --git a/netwerk/protocol/http/nsHttpConnectionInfo.h b/netwerk/protocol/http/nsHttpConnectionInfo.h index cbbb3239c61..8b097e271e7 100644 --- a/netwerk/protocol/http/nsHttpConnectionInfo.h +++ b/netwerk/protocol/http/nsHttpConnectionInfo.h @@ -13,6 +13,7 @@ #include "nsString.h" #include "plstr.h" #include "nsCRT.h" +#include "nsIProtocolProxyService.h" //----------------------------------------------------------------------------- // nsHttpConnectionInfo - holds the properties of a connection @@ -27,11 +28,21 @@ public: : mRef(0) , mProxyInfo(proxyInfo) , mUsingSSL(usingSSL) + , mUsingConnect(false) { LOG(("Creating nsHttpConnectionInfo @%x\n", this)); mUsingHttpProxy = (proxyInfo && !nsCRT::strcmp(proxyInfo->Type(), "http")); + if (mUsingHttpProxy) { + mUsingConnect = mUsingSSL; // SSL always uses CONNECT + PRUint32 resolveFlags = 0; + if (NS_SUCCEEDED(mProxyInfo->GetResolveFlags(&resolveFlags)) && + resolveFlags & nsIProtocolProxyService::RESOLVE_ALWAYS_TUNNEL) { + mUsingConnect = true; + } + } + SetOriginServer(host, port); } @@ -89,6 +100,7 @@ public: nsProxyInfo *ProxyInfo() { return mProxyInfo; } bool UsingHttpProxy() const { return mUsingHttpProxy; } bool UsingSSL() const { return mUsingSSL; } + bool UsingConnect() const { return mUsingConnect; } PRInt32 DefaultPort() const { return mUsingSSL ? NS_HTTPS_DEFAULT_PORT : NS_HTTP_DEFAULT_PORT; } void SetAnonymous(bool anon) { mHashKey.SetCharAt(anon ? 'A' : '.', 2); } @@ -96,7 +108,6 @@ public: void SetPrivate(bool priv) { mHashKey.SetCharAt(priv ? 'P' : '.', 3); } bool GetPrivate() const { return mHashKey.CharAt(3) == 'P'; } - bool ShouldForceConnectMethod(); const nsCString &GetHost() { return mHost; } private: @@ -107,6 +118,7 @@ private: nsCOMPtr mProxyInfo; bool mUsingHttpProxy; bool mUsingSSL; + bool mUsingConnect; // if will use CONNECT with http proxy }; #endif // nsHttpConnectionInfo_h__ diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 60a6807ac05..c299c2be532 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -1144,7 +1144,7 @@ nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, PRUint8 cap PRUint16 maxConns; PRUint16 maxPersistConns; - if (ci->UsingHttpProxy() && !ci->UsingSSL()) { + if (ci->UsingHttpProxy() && !ci->UsingConnect()) { maxConns = mMaxConnsPerProxy; maxPersistConns = mMaxPersistConnsPerProxy; } diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 5c9c9bd8b35..280937e954a 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -236,10 +236,8 @@ nsHttpTransaction::Init(PRUint8 caps, mRequestHead = requestHead; // make sure we eliminate any proxy specific headers from - // the request if we are talking HTTPS via a SSL tunnel. - bool pruneProxyHeaders = - cinfo->ShouldForceConnectMethod() || - (cinfo->UsingSSL() && cinfo->UsingHttpProxy()); + // the request if we are using CONNECT + bool pruneProxyHeaders = cinfo->UsingConnect(); mReqHeaderBuf.Truncate(); requestHead->Flatten(mReqHeaderBuf, pruneProxyHeaders); From 92dba1256b811500dcad64478e1e488571846cb9 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 19 Jun 2012 09:12:43 +0200 Subject: [PATCH 03/83] Bug 762358 - Don't create a .mozconfig.mk file, and re-run configure when .mozconfig changed. r=ted --- build/autoconf/mozconfig2client-mk | 30 ++++++++++-------------------- client.mk | 13 +++++++++---- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/build/autoconf/mozconfig2client-mk b/build/autoconf/mozconfig2client-mk index 8018cfc09e8..dc6ace9378a 100755 --- a/build/autoconf/mozconfig2client-mk +++ b/build/autoconf/mozconfig2client-mk @@ -11,7 +11,7 @@ print_header() { _mozconfig=${MOZCONFIG:-$HOME/.mozconfig} - cat >> $tmp_file <> $tmp_file + echo "# $* is used by configure (not client.mk)" } ac_add_app_options() { - echo "# $* is used by configure (not client.mk)" >> $tmp_file + echo "# $* is used by configure (not client.mk)" } mk_add_options() { @@ -35,14 +35,14 @@ mk_add_options() { _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'` echo $_opt; opts="${opts:+$opts^}$_opt"; - done >> $tmp_file + done } mk_echo_options() { - echo "Adding client.mk options from $FOUND_MOZCONFIG:" + echo "Adding client.mk options from $FOUND_MOZCONFIG:" >&2 IFS=^ for _opt in $opts; do - echo " $_opt" + echo " $_opt" >&2 done } @@ -51,23 +51,19 @@ mk_echo_options() { scriptdir=`dirname $0` topsrcdir=$1 -out_file=$2 -tmp_file="$out_file-tmp$$" opts="" -trap "rm -f $tmp_file; exit 1" 1 2 15 - -print_header > $tmp_file +print_header # If the path changes, configure should be rerun -echo "# PATH=$PATH" >> $tmp_file +echo "# PATH=$PATH" # If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out isfoundset=${FOUND_MOZCONFIG+yes} if [ -z $isfoundset ]; then FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir` if [ $? -ne 0 ]; then - echo '$(error Fix above errors before continuing.)' >> $tmp_file + echo '$(error Fix above errors before continuing.)' else isfoundset=yes fi @@ -78,15 +74,9 @@ if [ -n $isfoundset ]; then then . "$FOUND_MOZCONFIG" fi - echo "export FOUND_MOZCONFIG := $FOUND_MOZCONFIG" >> $tmp_file + echo "export FOUND_MOZCONFIG := $FOUND_MOZCONFIG" if [ "$opts" ]; then mk_echo_options fi fi - -if test -f $out_file && cmp -s $tmp_file $out_file; then - rm $tmp_file -else - mv -f $tmp_file $out_file -fi diff --git a/client.mk b/client.mk index 6e907aa8909..6783784867f 100644 --- a/client.mk +++ b/client.mk @@ -95,10 +95,15 @@ MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk MOZCONFIG_FINDER := build/autoconf/mozconfig-find MOZCONFIG_MODULES := build/unix/uniq.pl -run_for_side_effects := \ - $(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) $(TOPSRCDIR)/.mozconfig.mk > $(TOPSRCDIR)/.mozconfig.out) +define CR -include $(TOPSRCDIR)/.mozconfig.mk + +endef + +# As $(shell) doesn't preserve newlines, use sed to replace them with an +# unlikely sequence (||), which is then replaced back to newlines by make +# before evaluation. +$(eval $(subst ||,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/'))) ifndef MOZ_OBJDIR MOZ_OBJDIR = obj-$(CONFIG_GUESS) @@ -293,7 +298,7 @@ configure-preqs = \ save-mozconfig \ $(NULL) -save-mozconfig: +save-mozconfig: $(FOUND_MOZCONFIG) -cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig configure:: $(configure-preqs) From 663586f7218db5072a9502cc64a9d6a3f48adc6b Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 19 Jun 2012 09:13:16 +0200 Subject: [PATCH 04/83] Bug 763920 - Avoid hardcoding page size for jemalloc unless cross compiling. r=khuey --- configure.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index e018aa8c162..6cfa8346def 100644 --- a/configure.in +++ b/configure.in @@ -8941,7 +8941,9 @@ if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'" done - ac_configure_args="$ac_configure_args je_cv_static_page_shift=12" + if test "$CROSS_COMPILE"; then + ac_configure_args="$ac_configure_args je_cv_static_page_shift=12" + fi _save_cache_file="$cache_file" cache_file=$_objdir/memory/jemalloc/src/config.cache AC_OUTPUT_SUBDIRS(memory/jemalloc/src) From aa8b0b1f6b25d5181aa5740fdd5b09de707635b7 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 19 Jun 2012 09:16:33 +0200 Subject: [PATCH 05/83] Bug 764021 - Cleanup Android use of StartupTimeline. r=blassey --- mozglue/android/APKOpen.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mozglue/android/APKOpen.cpp b/mozglue/android/APKOpen.cpp index b144170d6a5..22172560779 100644 --- a/mozglue/android/APKOpen.cpp +++ b/mozglue/android/APKOpen.cpp @@ -62,6 +62,7 @@ extern "C" { } typedef int mozglueresult; +typedef int64_t MOZTime; enum StartupEvent { #define mozilla_StartupTimeline_Event(ev, z) ev, @@ -72,11 +73,11 @@ enum StartupEvent { using namespace mozilla; -static uint64_t *sStartupTimeline; - -void StartupTimeline_Record(StartupEvent ev, struct timeval *tm) +static MOZTime MOZ_Now() { - sStartupTimeline[ev] = (((uint64_t)tm->tv_sec * 1000000LL) + (uint64_t)tm->tv_usec); + struct timeval tm; + gettimeofday(&tm, 0); + return (((MOZTime)tm.tv_sec * 1000000LL) + (MOZTime)tm.tv_usec); } static struct mapping_info * lib_mapping = NULL; @@ -669,8 +670,7 @@ loadGeckoLibs(const char *apkName) apk_mtime = status.st_mtime; #endif - struct timeval t0, t1; - gettimeofday(&t0, 0); + MOZTime t0 = MOZ_Now(); struct rusage usage1; getrusage(RUSAGE_THREAD, &usage1); @@ -742,18 +742,18 @@ loadGeckoLibs(const char *apkName) GETFUNC(onFullScreenPluginHidden); GETFUNC(getNextMessageFromQueue); #undef GETFUNC - sStartupTimeline = (uint64_t *) (uintptr_t) __wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE"); - gettimeofday(&t1, 0); + void (*XRE_StartupTimelineRecord)(int, MOZTime) = (void (*)(int, MOZTime)) __wrap_dlsym(xul_handle, "XRE_StartupTimelineRecord"); + MOZTime t1 = MOZ_Now(); struct rusage usage2; getrusage(RUSAGE_THREAD, &usage2); __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loaded libs in %ldms total, %ldms user, %ldms system, %ld faults", - (t1.tv_sec - t0.tv_sec)*1000 + (t1.tv_usec - t0.tv_usec)/1000, + (t1 - t0) / 1000, (usage2.ru_utime.tv_sec - usage1.ru_utime.tv_sec)*1000 + (usage2.ru_utime.tv_usec - usage1.ru_utime.tv_usec)/1000, (usage2.ru_stime.tv_sec - usage1.ru_stime.tv_sec)*1000 + (usage2.ru_stime.tv_usec - usage1.ru_stime.tv_usec)/1000, usage2.ru_majflt-usage1.ru_majflt); - StartupTimeline_Record(LINKER_INITIALIZED, &t0); - StartupTimeline_Record(LIBRARIES_LOADED, &t1); + XRE_StartupTimelineRecord(LINKER_INITIALIZED, t0); + XRE_StartupTimelineRecord(LIBRARIES_LOADED, t1); return SUCCESS; } From 67f900204964aa907b86f4e9da75e97d930c259f Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Thu, 14 Jun 2012 09:47:03 +0300 Subject: [PATCH 06/83] Bug 764400 - Move various nsIContent methods to nsINode; r=mounir --- content/base/public/nsIContent.h | 59 --------------------------- content/base/public/nsINode.h | 69 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 251cc6bf992..138d8f675e4 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -250,65 +250,6 @@ public: return OwnerDoc()->IsHTML(); } - /** - * Get the namespace that this element's tag is defined in - * @return the namespace - */ - PRInt32 GetNameSpaceID() const - { - return mNodeInfo->NamespaceID(); - } - - /** - * Get the tag for this element. This will always return a non-null - * atom pointer (as implied by the naming of the method). - */ - nsIAtom *Tag() const - { - return mNodeInfo->NameAtom(); - } - - /** - * Get the NodeInfo for this element - * @return the nodes node info - */ - nsINodeInfo *NodeInfo() const - { - return mNodeInfo; - } - - inline bool IsInNamespace(PRInt32 aNamespace) const { - return mNodeInfo->NamespaceID() == aNamespace; - } - - inline bool IsHTML() const { - return IsInNamespace(kNameSpaceID_XHTML); - } - - inline bool IsHTML(nsIAtom* aTag) const { - return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML); - } - - inline bool IsSVG() const { - return IsInNamespace(kNameSpaceID_SVG); - } - - inline bool IsSVG(nsIAtom* aTag) const { - return mNodeInfo->Equals(aTag, kNameSpaceID_SVG); - } - - inline bool IsXUL() const { - return IsInNamespace(kNameSpaceID_XUL); - } - - inline bool IsMathML() const { - return IsInNamespace(kNameSpaceID_MathML); - } - - inline bool IsMathML(nsIAtom* aTag) const { - return mNodeInfo->Equals(aTag, kNameSpaceID_MathML); - } - /** * Returns an atom holding the name of the attribute of type ID on * this content node (if applicable). Returns null for non-element diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 4e2740380ec..e903e5f0ac2 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -476,6 +476,75 @@ public: return mNodeInfo->LocalName(); } + /** + * Get the namespace that this element's tag is defined in + * @return the namespace + */ + PRInt32 GetNameSpaceID() const + { + return mNodeInfo->NamespaceID(); + } + + /** + * Get the tag for this element. This will always return a non-null atom + * pointer (as implied by the naming of the method). For elements this is + * the non-namespaced tag, and for other nodes it's something like "#text", + * "#comment", "#document", etc. + */ + nsIAtom* Tag() const + { + return mNodeInfo->NameAtom(); + } + + /** + * Get the NodeInfo for this element + * @return the nodes node info + */ + nsINodeInfo* NodeInfo() const + { + return mNodeInfo; + } + + bool IsInNamespace(PRInt32 aNamespace) const + { + return mNodeInfo->NamespaceID() == aNamespace; + } + + bool IsHTML() const + { + return IsInNamespace(kNameSpaceID_XHTML); + } + + bool IsHTML(nsIAtom* aTag) const + { + return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML); + } + + bool IsSVG() const + { + return IsInNamespace(kNameSpaceID_SVG); + } + + bool IsSVG(nsIAtom* aTag) const + { + return mNodeInfo->Equals(aTag, kNameSpaceID_SVG); + } + + bool IsXUL() const + { + return IsInNamespace(kNameSpaceID_XUL); + } + + bool IsMathML() const + { + return IsInNamespace(kNameSpaceID_MathML); + } + + bool IsMathML(nsIAtom* aTag) const + { + return mNodeInfo->Equals(aTag, kNameSpaceID_MathML); + } + nsINode* InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn) { From bb1eb60f51c073e6d2cc6f300b530c946c677d5a Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Tue, 19 Jun 2012 16:57:12 +0800 Subject: [PATCH 07/83] Back out 421ed10b0e81(Bug 762760 - Part 2) for wrong Bug number in comment --- dom/sms/src/ril/SmsDatabaseService.js | 4 +- dom/system/gonk/RadioInterfaceLayer.js | 50 +++++++++---------- dom/system/gonk/ril_worker.js | 68 ++++++++++++-------------- 3 files changed, 59 insertions(+), 63 deletions(-) diff --git a/dom/sms/src/ril/SmsDatabaseService.js b/dom/sms/src/ril/SmsDatabaseService.js index ddfc203ca3d..b438a454f0c 100644 --- a/dom/sms/src/ril/SmsDatabaseService.js +++ b/dom/sms/src/ril/SmsDatabaseService.js @@ -349,7 +349,7 @@ SmsDatabaseService.prototype = { saveReceivedMessage: function saveReceivedMessage(sender, body, date) { let message = {delivery: DELIVERY_RECEIVED, sender: sender, - receiver: this.mRIL.rilContext.icc.msisdn, + receiver: this.mRIL.radioState.msisdn, body: body, timestamp: date, read: FILTER_READ_UNREAD}; @@ -358,7 +358,7 @@ SmsDatabaseService.prototype = { saveSentMessage: function saveSentMessage(receiver, body, date) { let message = {delivery: DELIVERY_SENT, - sender: this.mRIL.rilContext.icc.msisdn, + sender: this.mRIL.radioState.msisdn, receiver: receiver, body: body, timestamp: date, diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 4dda84d0180..403c4f57dc2 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -30,7 +30,7 @@ const DOM_SMS_DELIVERY_RECEIVED = "received"; const DOM_SMS_DELIVERY_SENT = "sent"; const RIL_IPC_MSG_NAMES = [ - "RIL:GetRilContext", + "RIL:GetRadioState", "RIL:EnumerateCalls", "RIL:GetMicrophoneMuted", "RIL:SetMicrophoneMuted", @@ -146,7 +146,7 @@ function RadioInterfaceLayer() { this.worker.onerror = this.onerror.bind(this); this.worker.onmessage = this.onmessage.bind(this); - this.rilContext = { + this.radioState = { radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE, cardState: RIL.GECKO_CARDSTATE_UNAVAILABLE, icc: null, @@ -161,7 +161,7 @@ function RadioInterfaceLayer() { type: null, signalStrength: null, relSignalStrength: null}, - data: {connected: false, + data: {connected: false, emergencyCallsOnly: false, roaming: false, network: null, @@ -204,9 +204,9 @@ RadioInterfaceLayer.prototype = { receiveMessage: function receiveMessage(msg) { debug("Received '" + msg.name + "' message from content process"); switch (msg.name) { - case "RIL:GetRilContext": + case "RIL:GetRadioState": // This message is sync. - return this.rilContext; + return this.radioState; case "RIL:EnumerateCalls": this.enumerateCalls(); break; @@ -324,7 +324,7 @@ RadioInterfaceLayer.prototype = { this.handleRadioStateChange(message); break; case "cardstatechange": - this.rilContext.cardState = message.cardState; + this.radioState.cardState = message.cardState; ppmm.sendAsyncMessage("RIL:CardStateChanged", message); break; case "sms-received": @@ -359,7 +359,7 @@ RadioInterfaceLayer.prototype = { " timestamp=" + message.localTimeStampInMS); break; case "iccinfochange": - this.rilContext.icc = message; + this.radioState.icc = message; break; case "iccgetcardlock": this.handleICCGetCardLock(message); @@ -381,7 +381,7 @@ RadioInterfaceLayer.prototype = { } break; case "celllocationchanged": - this.rilContext.cell = message; + this.radioState.cell = message; break; case "ussdreceived": debug("ussdreceived " + JSON.stringify(message)); @@ -399,7 +399,7 @@ RadioInterfaceLayer.prototype = { }, updateVoiceConnection: function updateVoiceConnection(state) { - let voiceInfo = this.rilContext.voice; + let voiceInfo = this.radioState.voice; voiceInfo.type = "gsm"; //TODO see bug 726098. if (!state || state.regState == RIL.NETWORK_CREG_STATE_UNKNOWN) { voiceInfo.connected = false; @@ -466,13 +466,13 @@ RadioInterfaceLayer.prototype = { handleSignalStrengthChange: function handleSignalStrengthChange(message) { // TODO CDMA, EVDO, LTE, etc. (see bug 726098) - this.rilContext.voice.signalStrength = message.gsmDBM; - this.rilContext.voice.relSignalStrength = message.gsmRelative; - ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.rilContext.voice); + this.radioState.voice.signalStrength = message.gsmDBM; + this.radioState.voice.relSignalStrength = message.gsmRelative; + ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.radioState.voice); - this.rilContext.data.signalStrength = message.gsmDBM; - this.rilContext.data.relSignalStrength = message.gsmRelative; - ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.rilContext.data); + this.radioState.data.signalStrength = message.gsmDBM; + this.radioState.data.relSignalStrength = message.gsmRelative; + ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.radioState.data); }, networkChanged: function networkChanged(srcNetwork, destNetwork) { @@ -484,8 +484,8 @@ RadioInterfaceLayer.prototype = { }, handleOperatorChange: function handleOperatorChange(message) { - let voice = this.rilContext.voice; - let data = this.rilContext.data; + let voice = this.radioState.voice; + let data = this.radioState.data; if (this.networkChanged(message, voice.network)) { voice.network = message; @@ -500,34 +500,34 @@ RadioInterfaceLayer.prototype = { handleRadioStateChange: function handleRadioStateChange(message) { let newState = message.radioState; - if (this.rilContext.radioState == newState) { + if (this.radioState.radioState == newState) { return; } - this.rilContext.radioState = newState; + this.radioState.radioState = newState; //TODO Should we notify this change as a card state change? this._ensureRadioState(); }, _ensureRadioState: function _ensureRadioState() { - debug("Reported radio state is " + this.rilContext.radioState + + debug("Reported radio state is " + this.radioState.radioState + ", desired radio enabled state is " + this._radioEnabled); if (this._radioEnabled == null) { // We haven't read the initial value from the settings DB yet. // Wait for that. return; } - if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) { + if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) { // We haven't received a radio state notification from the RIL // yet. Wait for that. return; } - if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_OFF && + if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_OFF && this._radioEnabled) { this.setRadioEnabled(true); } - if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_READY && + if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_READY && !this._radioEnabled) { this.setRadioEnabled(false); } @@ -637,7 +637,7 @@ RadioInterfaceLayer.prototype = { bearer: WAP.WDP_BEARER_GSM_SMS_GSM_MSISDN, sourceAddress: message.sender, sourcePort: message.header.originatorPort, - destinationAddress: this.rilContext.icc.msisdn, + destinationAddress: this.radioState.icc.MSISDN, destinationPort: message.header.destinationPort, }; WAP.WapPushManager.receiveWdpPDU(message.fullData, message.fullData.length, @@ -890,7 +890,7 @@ RadioInterfaceLayer.prototype = { this.worker.postMessage({type: "setRadioPower", on: value}); }, - rilContext: null, + radioState: null, // Handle phone functions of nsIRILContentHelper diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index a63aedc6481..5b6dc97aff6 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -1000,11 +1000,11 @@ let RIL = { debug("ICC_EF_MSISDN: invalid length of BCD number/SSC contents - " + len); return; } - this.iccInfo.msisdn = GsmPDUHelper.readDiallingNumber(len); + this.iccInfo.MSISDN = GsmPDUHelper.readDiallingNumber(len); Buf.readStringDelimiter(length); - if (DEBUG) debug("MSISDN: " + this.iccInfo.msisdn); - if (this.iccInfo.msisdn) { + if (DEBUG) debug("MSISDN: " + this.iccInfo.MSISDN); + if (this.iccInfo.MSISDN) { this._handleICCInfoChange(); } } @@ -1024,30 +1024,30 @@ let RIL = { }, /** - * Read the AD (Administrative Data) from the ICC. + * Read the AD from the ICC. */ getAD: function getAD() { function callback() { let length = Buf.readUint32(); // Each octet is encoded into two chars. let len = length / 2; - this.iccInfo.ad = GsmPDUHelper.readHexOctetArray(len); + this.iccInfo.AD = GsmPDUHelper.readHexOctetArray(len); Buf.readStringDelimiter(length); if (DEBUG) { let str = ""; - for (let i = 0; i < this.iccInfo.ad.length; i++) { - str += this.iccInfo.ad[i] + ", "; + for (let i = 0; i < this.iccInfo.AD.length; i++) { + str += this.iccInfo.AD[i] + ", "; } debug("AD: " + str); } - if (this.iccInfo.imsi) { + if (this.iccInfo.IMSI) { // MCC is the first 3 digits of IMSI - this.iccInfo.mcc = parseInt(this.iccInfo.imsi.substr(0,3)); + this.iccInfo.MCC = this.iccInfo.IMSI.substr(0,3); // The 4th byte of the response is the length of MNC - this.iccInfo.mnc = parseInt(this.iccInfo.imsi.substr(3, this.iccInfo.ad[3])); - if (DEBUG) debug("MCC: " + this.iccInfo.mcc + " MNC: " + this.iccInfo.mnc); + this.iccInfo.MNC = this.iccInfo.IMSI.substr(3, this.iccInfo.AD[3]); + if (DEBUG) debug("MCC: " + this.iccInfo.MCC + " MNC: " + this.iccInfo.MNC); this._handleICCInfoChange(); } } @@ -1079,9 +1079,7 @@ let RIL = { service -= 1; let index = service / 8; let bitmask = 1 << (service % 8); - return this.iccInfo.ust && - (index < this.iccInfo.ust.length) && - (this.iccInfo.ust[index] & bitmask); + return this.UST && (index < this.UST.length) && (this.UST[index] & bitmask); }, /** @@ -1092,13 +1090,13 @@ let RIL = { let length = Buf.readUint32(); // Each octet is encoded into two chars. let len = length / 2; - this.iccInfo.ust = GsmPDUHelper.readHexOctetArray(len); + this.iccInfo.UST = GsmPDUHelper.readHexOctetArray(len); Buf.readStringDelimiter(length); if (DEBUG) { let str = ""; - for (let i = 0; i < this.iccInfo.ust.length; i++) { - str += this.iccInfo.ust[i] + ", "; + for (let i = 0; i < this.iccInfo.UST.length; i++) { + str += this.iccInfo.UST[i] + ", "; } debug("UST: " + str); } @@ -1184,24 +1182,24 @@ let RIL = { getFDN: function getFDN(options) { function callback(options) { function add(contact) { - this.iccInfo.fdn.push(contact); + this.iccInfo.FDN.push(contact); }; function finish() { if (DEBUG) { - for (let i = 0; i < this.iccInfo.fdn.length; i++) { - debug("FDN[" + i + "] alphaId = " + this.iccInfo.fdn[i].alphaId + - " number = " + this.iccInfo.fdn[i].number); + for (let i = 0; i < this.iccInfo.FDN.length; i++) { + debug("FDN[" + i + "] alphaId = " + this.iccInfo.FDN[i].alphaId + + " number = " + this.iccInfo.FDN[i].number); } } this.sendDOMMessage({type: "icccontacts", contactType: "FDN", - contacts: this.iccInfo.fdn, + contacts: this.iccInfo.FDN, requestId: options.requestId}); }; this.parseDiallingNumber(options, add, finish); } - this.iccInfo.fdn = []; + this.iccInfo.FDN = []; this.iccIO({ command: ICC_COMMAND_GET_RESPONSE, fileId: ICC_EF_FDN, @@ -1229,24 +1227,24 @@ let RIL = { getADN: function getADN(options) { function callback(options) { function add(contact) { - this.iccInfo.adn.push(contact); + this.iccInfo.ADN.push(contact); }; function finish() { if (DEBUG) { - for (let i = 0; i < this.iccInfo.adn.length; i++) { - debug("ADN[" + i + "] alphaId = " + this.iccInfo.adn[i].alphaId + - " number = " + this.iccInfo.adn[i].number); + for (let i = 0; i < this.iccInfo.ADN.length; i++) { + debug("ADN[" + i + "] alphaId = " + this.iccInfo.ADN[i].alphaId + + " number = " + this.iccInfo.ADN[i].number); } } this.sendDOMMessage({type: "icccontacts", contactType: "ADN", - contacts: this.iccInfo.adn, + contacts: this.iccInfo.ADN, requestId: options.requestId}); }; this.parseDiallingNumber(options, add, finish); } - this.iccInfo.adn = []; + this.iccInfo.ADN = []; this.iccIO({ command: ICC_COMMAND_GET_RESPONSE, fileId: options.fileId, @@ -2008,15 +2006,13 @@ let RIL = { // From TS 23.003, 0000 and 0xfffe are indicated that no valid LAI exists // in MS. So we still need to report the '0000' as well. - let lac = parseInt(state[1], 16); - if (cell.lac !== lac) { - cell.lac = lac; + if (cell.lac !== state[1]) { + cell.lac = state[1]; cellChanged = true; } - let cid = parseInt(state[2], 16); - if (cell.cid !== cid) { - cell.cid = cid; + if (cell.cid !== state[2]) { + cell.cid = state[2]; cellChanged = true; } @@ -2707,7 +2703,7 @@ RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) { return; } - this.iccInfo.imsi = Buf.readString(); + this.iccInfo.IMSI = Buf.readString(); }; RIL[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) { if (options.rilRequestError) { From 6f3e0ca39e9c985bf3c40595ee9de94998f3928d Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Wed, 13 Jun 2012 10:46:41 +0800 Subject: [PATCH 08/83] Bug 762760 - Part 2: RIL implementation. r=philikon --- dom/sms/src/ril/SmsDatabaseService.js | 4 +- dom/system/gonk/RadioInterfaceLayer.js | 50 +++++++++---------- dom/system/gonk/ril_worker.js | 68 ++++++++++++++------------ 3 files changed, 63 insertions(+), 59 deletions(-) diff --git a/dom/sms/src/ril/SmsDatabaseService.js b/dom/sms/src/ril/SmsDatabaseService.js index b438a454f0c..ddfc203ca3d 100644 --- a/dom/sms/src/ril/SmsDatabaseService.js +++ b/dom/sms/src/ril/SmsDatabaseService.js @@ -349,7 +349,7 @@ SmsDatabaseService.prototype = { saveReceivedMessage: function saveReceivedMessage(sender, body, date) { let message = {delivery: DELIVERY_RECEIVED, sender: sender, - receiver: this.mRIL.radioState.msisdn, + receiver: this.mRIL.rilContext.icc.msisdn, body: body, timestamp: date, read: FILTER_READ_UNREAD}; @@ -358,7 +358,7 @@ SmsDatabaseService.prototype = { saveSentMessage: function saveSentMessage(receiver, body, date) { let message = {delivery: DELIVERY_SENT, - sender: this.mRIL.radioState.msisdn, + sender: this.mRIL.rilContext.icc.msisdn, receiver: receiver, body: body, timestamp: date, diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 403c4f57dc2..4dda84d0180 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -30,7 +30,7 @@ const DOM_SMS_DELIVERY_RECEIVED = "received"; const DOM_SMS_DELIVERY_SENT = "sent"; const RIL_IPC_MSG_NAMES = [ - "RIL:GetRadioState", + "RIL:GetRilContext", "RIL:EnumerateCalls", "RIL:GetMicrophoneMuted", "RIL:SetMicrophoneMuted", @@ -146,7 +146,7 @@ function RadioInterfaceLayer() { this.worker.onerror = this.onerror.bind(this); this.worker.onmessage = this.onmessage.bind(this); - this.radioState = { + this.rilContext = { radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE, cardState: RIL.GECKO_CARDSTATE_UNAVAILABLE, icc: null, @@ -161,7 +161,7 @@ function RadioInterfaceLayer() { type: null, signalStrength: null, relSignalStrength: null}, - data: {connected: false, + data: {connected: false, emergencyCallsOnly: false, roaming: false, network: null, @@ -204,9 +204,9 @@ RadioInterfaceLayer.prototype = { receiveMessage: function receiveMessage(msg) { debug("Received '" + msg.name + "' message from content process"); switch (msg.name) { - case "RIL:GetRadioState": + case "RIL:GetRilContext": // This message is sync. - return this.radioState; + return this.rilContext; case "RIL:EnumerateCalls": this.enumerateCalls(); break; @@ -324,7 +324,7 @@ RadioInterfaceLayer.prototype = { this.handleRadioStateChange(message); break; case "cardstatechange": - this.radioState.cardState = message.cardState; + this.rilContext.cardState = message.cardState; ppmm.sendAsyncMessage("RIL:CardStateChanged", message); break; case "sms-received": @@ -359,7 +359,7 @@ RadioInterfaceLayer.prototype = { " timestamp=" + message.localTimeStampInMS); break; case "iccinfochange": - this.radioState.icc = message; + this.rilContext.icc = message; break; case "iccgetcardlock": this.handleICCGetCardLock(message); @@ -381,7 +381,7 @@ RadioInterfaceLayer.prototype = { } break; case "celllocationchanged": - this.radioState.cell = message; + this.rilContext.cell = message; break; case "ussdreceived": debug("ussdreceived " + JSON.stringify(message)); @@ -399,7 +399,7 @@ RadioInterfaceLayer.prototype = { }, updateVoiceConnection: function updateVoiceConnection(state) { - let voiceInfo = this.radioState.voice; + let voiceInfo = this.rilContext.voice; voiceInfo.type = "gsm"; //TODO see bug 726098. if (!state || state.regState == RIL.NETWORK_CREG_STATE_UNKNOWN) { voiceInfo.connected = false; @@ -466,13 +466,13 @@ RadioInterfaceLayer.prototype = { handleSignalStrengthChange: function handleSignalStrengthChange(message) { // TODO CDMA, EVDO, LTE, etc. (see bug 726098) - this.radioState.voice.signalStrength = message.gsmDBM; - this.radioState.voice.relSignalStrength = message.gsmRelative; - ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.radioState.voice); + this.rilContext.voice.signalStrength = message.gsmDBM; + this.rilContext.voice.relSignalStrength = message.gsmRelative; + ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.rilContext.voice); - this.radioState.data.signalStrength = message.gsmDBM; - this.radioState.data.relSignalStrength = message.gsmRelative; - ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.radioState.data); + this.rilContext.data.signalStrength = message.gsmDBM; + this.rilContext.data.relSignalStrength = message.gsmRelative; + ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.rilContext.data); }, networkChanged: function networkChanged(srcNetwork, destNetwork) { @@ -484,8 +484,8 @@ RadioInterfaceLayer.prototype = { }, handleOperatorChange: function handleOperatorChange(message) { - let voice = this.radioState.voice; - let data = this.radioState.data; + let voice = this.rilContext.voice; + let data = this.rilContext.data; if (this.networkChanged(message, voice.network)) { voice.network = message; @@ -500,34 +500,34 @@ RadioInterfaceLayer.prototype = { handleRadioStateChange: function handleRadioStateChange(message) { let newState = message.radioState; - if (this.radioState.radioState == newState) { + if (this.rilContext.radioState == newState) { return; } - this.radioState.radioState = newState; + this.rilContext.radioState = newState; //TODO Should we notify this change as a card state change? this._ensureRadioState(); }, _ensureRadioState: function _ensureRadioState() { - debug("Reported radio state is " + this.radioState.radioState + + debug("Reported radio state is " + this.rilContext.radioState + ", desired radio enabled state is " + this._radioEnabled); if (this._radioEnabled == null) { // We haven't read the initial value from the settings DB yet. // Wait for that. return; } - if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) { + if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) { // We haven't received a radio state notification from the RIL // yet. Wait for that. return; } - if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_OFF && + if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_OFF && this._radioEnabled) { this.setRadioEnabled(true); } - if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_READY && + if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_READY && !this._radioEnabled) { this.setRadioEnabled(false); } @@ -637,7 +637,7 @@ RadioInterfaceLayer.prototype = { bearer: WAP.WDP_BEARER_GSM_SMS_GSM_MSISDN, sourceAddress: message.sender, sourcePort: message.header.originatorPort, - destinationAddress: this.radioState.icc.MSISDN, + destinationAddress: this.rilContext.icc.msisdn, destinationPort: message.header.destinationPort, }; WAP.WapPushManager.receiveWdpPDU(message.fullData, message.fullData.length, @@ -890,7 +890,7 @@ RadioInterfaceLayer.prototype = { this.worker.postMessage({type: "setRadioPower", on: value}); }, - radioState: null, + rilContext: null, // Handle phone functions of nsIRILContentHelper diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 5b6dc97aff6..a63aedc6481 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -1000,11 +1000,11 @@ let RIL = { debug("ICC_EF_MSISDN: invalid length of BCD number/SSC contents - " + len); return; } - this.iccInfo.MSISDN = GsmPDUHelper.readDiallingNumber(len); + this.iccInfo.msisdn = GsmPDUHelper.readDiallingNumber(len); Buf.readStringDelimiter(length); - if (DEBUG) debug("MSISDN: " + this.iccInfo.MSISDN); - if (this.iccInfo.MSISDN) { + if (DEBUG) debug("MSISDN: " + this.iccInfo.msisdn); + if (this.iccInfo.msisdn) { this._handleICCInfoChange(); } } @@ -1024,30 +1024,30 @@ let RIL = { }, /** - * Read the AD from the ICC. + * Read the AD (Administrative Data) from the ICC. */ getAD: function getAD() { function callback() { let length = Buf.readUint32(); // Each octet is encoded into two chars. let len = length / 2; - this.iccInfo.AD = GsmPDUHelper.readHexOctetArray(len); + this.iccInfo.ad = GsmPDUHelper.readHexOctetArray(len); Buf.readStringDelimiter(length); if (DEBUG) { let str = ""; - for (let i = 0; i < this.iccInfo.AD.length; i++) { - str += this.iccInfo.AD[i] + ", "; + for (let i = 0; i < this.iccInfo.ad.length; i++) { + str += this.iccInfo.ad[i] + ", "; } debug("AD: " + str); } - if (this.iccInfo.IMSI) { + if (this.iccInfo.imsi) { // MCC is the first 3 digits of IMSI - this.iccInfo.MCC = this.iccInfo.IMSI.substr(0,3); + this.iccInfo.mcc = parseInt(this.iccInfo.imsi.substr(0,3)); // The 4th byte of the response is the length of MNC - this.iccInfo.MNC = this.iccInfo.IMSI.substr(3, this.iccInfo.AD[3]); - if (DEBUG) debug("MCC: " + this.iccInfo.MCC + " MNC: " + this.iccInfo.MNC); + this.iccInfo.mnc = parseInt(this.iccInfo.imsi.substr(3, this.iccInfo.ad[3])); + if (DEBUG) debug("MCC: " + this.iccInfo.mcc + " MNC: " + this.iccInfo.mnc); this._handleICCInfoChange(); } } @@ -1079,7 +1079,9 @@ let RIL = { service -= 1; let index = service / 8; let bitmask = 1 << (service % 8); - return this.UST && (index < this.UST.length) && (this.UST[index] & bitmask); + return this.iccInfo.ust && + (index < this.iccInfo.ust.length) && + (this.iccInfo.ust[index] & bitmask); }, /** @@ -1090,13 +1092,13 @@ let RIL = { let length = Buf.readUint32(); // Each octet is encoded into two chars. let len = length / 2; - this.iccInfo.UST = GsmPDUHelper.readHexOctetArray(len); + this.iccInfo.ust = GsmPDUHelper.readHexOctetArray(len); Buf.readStringDelimiter(length); if (DEBUG) { let str = ""; - for (let i = 0; i < this.iccInfo.UST.length; i++) { - str += this.iccInfo.UST[i] + ", "; + for (let i = 0; i < this.iccInfo.ust.length; i++) { + str += this.iccInfo.ust[i] + ", "; } debug("UST: " + str); } @@ -1182,24 +1184,24 @@ let RIL = { getFDN: function getFDN(options) { function callback(options) { function add(contact) { - this.iccInfo.FDN.push(contact); + this.iccInfo.fdn.push(contact); }; function finish() { if (DEBUG) { - for (let i = 0; i < this.iccInfo.FDN.length; i++) { - debug("FDN[" + i + "] alphaId = " + this.iccInfo.FDN[i].alphaId + - " number = " + this.iccInfo.FDN[i].number); + for (let i = 0; i < this.iccInfo.fdn.length; i++) { + debug("FDN[" + i + "] alphaId = " + this.iccInfo.fdn[i].alphaId + + " number = " + this.iccInfo.fdn[i].number); } } this.sendDOMMessage({type: "icccontacts", contactType: "FDN", - contacts: this.iccInfo.FDN, + contacts: this.iccInfo.fdn, requestId: options.requestId}); }; this.parseDiallingNumber(options, add, finish); } - this.iccInfo.FDN = []; + this.iccInfo.fdn = []; this.iccIO({ command: ICC_COMMAND_GET_RESPONSE, fileId: ICC_EF_FDN, @@ -1227,24 +1229,24 @@ let RIL = { getADN: function getADN(options) { function callback(options) { function add(contact) { - this.iccInfo.ADN.push(contact); + this.iccInfo.adn.push(contact); }; function finish() { if (DEBUG) { - for (let i = 0; i < this.iccInfo.ADN.length; i++) { - debug("ADN[" + i + "] alphaId = " + this.iccInfo.ADN[i].alphaId + - " number = " + this.iccInfo.ADN[i].number); + for (let i = 0; i < this.iccInfo.adn.length; i++) { + debug("ADN[" + i + "] alphaId = " + this.iccInfo.adn[i].alphaId + + " number = " + this.iccInfo.adn[i].number); } } this.sendDOMMessage({type: "icccontacts", contactType: "ADN", - contacts: this.iccInfo.ADN, + contacts: this.iccInfo.adn, requestId: options.requestId}); }; this.parseDiallingNumber(options, add, finish); } - this.iccInfo.ADN = []; + this.iccInfo.adn = []; this.iccIO({ command: ICC_COMMAND_GET_RESPONSE, fileId: options.fileId, @@ -2006,13 +2008,15 @@ let RIL = { // From TS 23.003, 0000 and 0xfffe are indicated that no valid LAI exists // in MS. So we still need to report the '0000' as well. - if (cell.lac !== state[1]) { - cell.lac = state[1]; + let lac = parseInt(state[1], 16); + if (cell.lac !== lac) { + cell.lac = lac; cellChanged = true; } - if (cell.cid !== state[2]) { - cell.cid = state[2]; + let cid = parseInt(state[2], 16); + if (cell.cid !== cid) { + cell.cid = cid; cellChanged = true; } @@ -2703,7 +2707,7 @@ RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) { return; } - this.iccInfo.IMSI = Buf.readString(); + this.iccInfo.imsi = Buf.readString(); }; RIL[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) { if (options.rilRequestError) { From 470c53a48e99fcd4965374f76cdf1b9784ef2029 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Thu, 14 Jun 2012 16:56:38 +0200 Subject: [PATCH 09/83] Fix for bug 764277 (New DOM bindings codegen doesn't register classes with constructors). r=jst. --- dom/base/nsDOMClassInfo.cpp | 92 ++++++++++++++------------- dom/base/nsScriptNameSpaceManager.cpp | 25 +++++--- dom/base/nsScriptNameSpaceManager.h | 13 +++- 3 files changed, 74 insertions(+), 56 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index e5836d6c721..35386394c31 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -6751,6 +6751,34 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx, return NS_OK; } +static bool +ConstructorEnabled(const nsGlobalNameStruct *aStruct, nsGlobalWindow *aWin) +{ + MOZ_ASSERT(aStruct->mType == nsGlobalNameStruct::eTypeClassConstructor || + aStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo); + + // Don't expose chrome only constructors to content windows. + if (aStruct->mChromeOnly && + !nsContentUtils::IsSystemPrincipal(aWin->GetPrincipal())) { + return false; + } + + // For now don't expose web sockets unless user has explicitly enabled them + if (aStruct->mDOMClassInfoID == eDOMClassInfo_WebSocket_id) { + if (!nsWebSocket::PrefEnabled()) { + return false; + } + } + + // For now don't expose server events unless user has explicitly enabled them + if (aStruct->mDOMClassInfoID == eDOMClassInfo_EventSource_id) { + if (!nsEventSource::PrefEnabled()) { + return false; + } + } + + return true; +} // static nsresult @@ -6785,19 +6813,30 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, } } - if (name_struct->mType == nsGlobalNameStruct::eTypeInterface) { - // We're resolving a name of a DOM interface for which there is no - // direct DOM class, create a constructor object... - + if (name_struct->mType == nsGlobalNameStruct::eTypeNewDOMBinding || + name_struct->mType == nsGlobalNameStruct::eTypeInterface || + name_struct->mType == nsGlobalNameStruct::eTypeClassProto || + name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) { // Lookup new DOM bindings. mozilla::dom::binding::DefineInterface define = name_struct->mDefineDOMInterface; - if (define && mozilla::dom::binding::DefineConstructor(cx, obj, define, &rv)) { - *did_resolve = NS_SUCCEEDED(rv); + if (define) { + if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor && + !ConstructorEnabled(name_struct, aWin)) { + return NS_OK; + } - return rv; + if (mozilla::dom::binding::DefineConstructor(cx, obj, define, &rv)) { + *did_resolve = NS_SUCCEEDED(rv); + + return rv; + } } + } + if (name_struct->mType == nsGlobalNameStruct::eTypeInterface) { + // We're resolving a name of a DOM interface for which there is no + // direct DOM class, create a constructor object... nsRefPtr constructor; rv = nsDOMConstructor::Create(class_name, nsnull, @@ -6832,37 +6871,10 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor || name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) { - // Don't expose chrome only constructors to content windows. - if (name_struct->mChromeOnly && - !nsContentUtils::IsSystemPrincipal(aWin->GetPrincipal())) { + if (!ConstructorEnabled(name_struct, aWin)) { return NS_OK; } - // For now don't expose web sockets unless user has explicitly enabled them - if (name_struct->mDOMClassInfoID == eDOMClassInfo_WebSocket_id) { - if (!nsWebSocket::PrefEnabled()) { - return NS_OK; - } - } - - // For now don't expose server events unless user has explicitly enabled them - if (name_struct->mDOMClassInfoID == eDOMClassInfo_EventSource_id) { - if (!nsEventSource::PrefEnabled()) { - return NS_OK; - } - } - - // Lookup new DOM bindings. - if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) { - mozilla::dom::binding::DefineInterface define = - name_struct->mDefineDOMInterface; - if (define && mozilla::dom::binding::DefineConstructor(cx, obj, define, &rv)) { - *did_resolve = NS_SUCCEEDED(rv); - - return rv; - } - } - // Create the XPConnect prototype for our classinfo, PostCreateProto will // set up the prototype chain. nsCOMPtr proto_holder; @@ -6894,16 +6906,6 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, if (name_struct->mType == nsGlobalNameStruct::eTypeClassProto) { // We don't have a XPConnect prototype object, let ResolvePrototype create // one. - - // Lookup new DOM bindings. - mozilla::dom::binding::DefineInterface define = - name_struct->mDefineDOMInterface; - if (define && mozilla::dom::binding::DefineConstructor(cx, obj, define, &rv)) { - *did_resolve = NS_SUCCEEDED(rv); - - return rv; - } - return ResolvePrototype(sXPConnect, aWin, cx, obj, class_name, nsnull, name_struct, nameSpaceManager, nsnull, true, did_resolve); diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp index 25738de5651..56f380b4cce 100644 --- a/dom/base/nsScriptNameSpaceManager.cpp +++ b/dom/base/nsScriptNameSpaceManager.cpp @@ -124,13 +124,12 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager() } nsGlobalNameStruct * -nsScriptNameSpaceManager::AddToHash(PLDHashTable *aTable, const char *aKey, +nsScriptNameSpaceManager::AddToHash(PLDHashTable *aTable, const nsAString *aKey, const PRUnichar **aClassName) { - NS_ConvertASCIItoUTF16 key(aKey); GlobalNameMapEntry *entry = static_cast - (PL_DHashTableOperate(aTable, &key, PL_DHASH_ADD)); + (PL_DHashTableOperate(aTable, aKey, PL_DHASH_ADD)); if (!entry) { return nsnull; @@ -345,7 +344,8 @@ nsScriptNameSpaceManager::RegisterInterface(const char* aIfName, nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aIfName); NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY); - if (s->mType != nsGlobalNameStruct::eTypeNotInitialized) { + if (s->mType != nsGlobalNameStruct::eTypeNotInitialized && + s->mType != nsGlobalNameStruct::eTypeNewDOMBinding) { *aFoundOld = true; return NS_OK; @@ -534,6 +534,7 @@ nsScriptNameSpaceManager::RegisterClassName(const char *aClassName, } NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized || + s->mType == nsGlobalNameStruct::eTypeNewDOMBinding || s->mType == nsGlobalNameStruct::eTypeInterface, "Whaaa, JS environment name clash!"); @@ -558,6 +559,7 @@ nsScriptNameSpaceManager::RegisterClassProto(const char *aClassName, NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY); if (s->mType != nsGlobalNameStruct::eTypeNotInitialized && + s->mType != nsGlobalNameStruct::eTypeNewDOMBinding && s->mType != nsGlobalNameStruct::eTypeInterface) { *aFoundOld = true; @@ -585,6 +587,7 @@ nsScriptNameSpaceManager::RegisterExternalClassName(const char *aClassName, } NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized || + s->mType == nsGlobalNameStruct::eTypeNewDOMBinding || s->mType == nsGlobalNameStruct::eTypeInterface, "Whaaa, JS environment name clash!"); @@ -617,6 +620,7 @@ nsScriptNameSpaceManager::RegisterDOMCIData(const char *aName, // XXX Should we bail out here? NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized || + s->mType == nsGlobalNameStruct::eTypeNewDOMBinding || s->mType == nsGlobalNameStruct::eTypeExternalClassInfoCreator, "Someone tries to register classinfo data for a class that isn't new or external!"); @@ -708,7 +712,8 @@ nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryMa nsGlobalNameStruct *s = AddToHash(&mGlobalNames, categoryEntry.get()); NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY); - if (s->mType == nsGlobalNameStruct::eTypeNotInitialized) { + if (s->mType == nsGlobalNameStruct::eTypeNotInitialized || + s->mType == nsGlobalNameStruct::eTypeNewDOMBinding) { s->mAlias = new nsGlobalNameStruct::ConstructorAlias; s->mType = nsGlobalNameStruct::eTypeExternalConstructorAlias; s->mChromeOnly = false; @@ -733,7 +738,8 @@ nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryMa nsGlobalNameStruct *s = AddToHash(table, categoryEntry.get()); NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY); - if (s->mType == nsGlobalNameStruct::eTypeNotInitialized) { + if (s->mType == nsGlobalNameStruct::eTypeNotInitialized || + s->mType == nsGlobalNameStruct::eTypeNewDOMBinding) { s->mType = type; s->mCID = cid; s->mChromeOnly = @@ -772,11 +778,14 @@ nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic, } void -nsScriptNameSpaceManager::RegisterDefineDOMInterface(const nsAString& aName, +nsScriptNameSpaceManager::RegisterDefineDOMInterface(const nsAFlatString& aName, mozilla::dom::binding::DefineInterface aDefineDOMInterface) { - nsGlobalNameStruct* s = LookupNameInternal(aName); + nsGlobalNameStruct *s = AddToHash(&mGlobalNames, &aName); if (s) { + if (s->mType == nsGlobalNameStruct::eTypeNotInitialized) { + s->mType = nsGlobalNameStruct::eTypeNewDOMBinding; + } s->mDefineDOMInterface = aDefineDOMInterface; } } diff --git a/dom/base/nsScriptNameSpaceManager.h b/dom/base/nsScriptNameSpaceManager.h index c0d688a4b70..d47eedd9e7c 100644 --- a/dom/base/nsScriptNameSpaceManager.h +++ b/dom/base/nsScriptNameSpaceManager.h @@ -41,6 +41,7 @@ struct nsGlobalNameStruct enum nametype { eTypeNotInitialized, + eTypeNewDOMBinding, eTypeInterface, eTypeProperty, eTypeNavigatorProperty, @@ -62,7 +63,7 @@ struct nsGlobalNameStruct nsIID mIID; // eTypeInterface, eTypeClassProto nsExternalDOMClassInfoData* mData; // eTypeExternalClassInfo ConstructorAlias* mAlias; // eTypeExternalConstructorAlias - nsCID mCID; // All other types... + nsCID mCID; // All other types except eTypeNewDOMBinding }; // For new style DOM bindings. @@ -137,7 +138,7 @@ public: nsGlobalNameStruct* GetConstructorProto(const nsGlobalNameStruct* aStruct); - void RegisterDefineDOMInterface(const nsAString& aName, + void RegisterDefineDOMInterface(const nsAFlatString& aName, mozilla::dom::binding::DefineInterface aDefineDOMInterface); private: @@ -145,8 +146,14 @@ private: // that aKey will be mapped to. If mType in the returned // nsGlobalNameStruct is != eTypeNotInitialized, an entry for aKey // already existed. - nsGlobalNameStruct *AddToHash(PLDHashTable *aTable, const char *aKey, + nsGlobalNameStruct *AddToHash(PLDHashTable *aTable, const nsAString *aKey, const PRUnichar **aClassName = nsnull); + nsGlobalNameStruct *AddToHash(PLDHashTable *aTable, const char *aKey, + const PRUnichar **aClassName = nsnull) + { + NS_ConvertASCIItoUTF16 key(aKey); + return AddToHash(aTable, &key, aClassName); + } nsresult FillHash(nsICategoryManager *aCategoryManager, const char *aCategory); From eeca8d5fd4c3d28f34f1dbf9c430b9cca13e328b Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Mon, 4 Jun 2012 21:41:51 +0200 Subject: [PATCH 10/83] Fix for bug 762651 (Add wrappercache to CanvasRenderingContext2D). r=bz. --- .../nsICanvasRenderingContextInternal.h | 4 + content/canvas/src/WebGLContext.cpp | 3 +- content/canvas/src/WebGLContext.h | 4 - .../canvas/src/nsCanvasRenderingContext2D.cpp | 13 ++- .../src/nsCanvasRenderingContext2DAzure.cpp | 48 ++++++++-- dom/base/nsDOMClassInfo.cpp | 67 +++++++++----- dom/base/nsDOMClassInfo.h | 89 ++++++++++++------- dom/bindings/BindingUtils.h | 4 +- js/xpconnect/src/nsDOMQS.h | 17 ++++ 9 files changed, 170 insertions(+), 79 deletions(-) diff --git a/content/canvas/public/nsICanvasRenderingContextInternal.h b/content/canvas/public/nsICanvasRenderingContextInternal.h index ab66374adc0..2f394d1716a 100644 --- a/content/canvas/public/nsICanvasRenderingContextInternal.h +++ b/content/canvas/public/nsICanvasRenderingContextInternal.h @@ -50,6 +50,10 @@ public: { mCanvasElement = aParentCanvas; } + nsHTMLCanvasElement* GetParentObject() const + { + return mCanvasElement; + } // Sets the dimensions of the canvas, in pixels. Called // whenever the size of the element changes. diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 3bcd06d2978..100c310c7e6 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -1240,7 +1240,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext) NS_INTERFACE_MAP_ENTRY(nsITimerCallback) // If the exact way we cast to nsISupports here ever changes, fix our // PreCreate hook! - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, + nsICanvasRenderingContextInternal) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext) NS_INTERFACE_MAP_END diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 8209e3a39d4..cb7c14e8ff5 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -482,10 +482,6 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext, nsIDOMWebGLRenderingContext) - nsINode* GetParentObject() { - return mCanvasElement; - } - virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index b39644c7d52..0f1a600c7d4 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -595,9 +595,8 @@ protected: * Gets the pres shell from either the canvas element or the doc shell */ nsIPresShell *GetPresShell() { - nsCOMPtr content = do_QueryObject(mCanvasElement); - if (content) { - return content->OwnerDoc()->GetShell(); + if (mCanvasElement) { + return mCanvasElement->OwnerDoc()->GetShell(); } if (mDocShell) { nsCOMPtr shell; @@ -772,7 +771,8 @@ DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2D) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2D) NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D) NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, + nsICanvasRenderingContextInternal) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D) NS_INTERFACE_MAP_END @@ -1177,10 +1177,9 @@ nsCanvasRenderingContext2D::EnsureSurface() gfxASurface::gfxImageFormat format = GetImageFormat(); if (!PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) { - nsCOMPtr content = do_QueryObject(mCanvasElement); nsIDocument* ownerDoc = nsnull; - if (content) - ownerDoc = content->OwnerDoc(); + if (mCanvasElement) + ownerDoc = mCanvasElement->OwnerDoc(); nsRefPtr layerManager = nsnull; if (ownerDoc) diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp index 73ec7e8bf01..0e56dd835a3 100644 --- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -89,6 +89,8 @@ #include "mozilla/ipc/PDocumentRendererParent.h" #include "mozilla/Preferences.h" #include "mozilla/unused.h" +#include "nsCCUncollectableMarker.h" +#include "nsWrapperCacheInlines.h" #ifdef XP_WIN #include "gfxWindowsPlatform.h" @@ -364,7 +366,8 @@ static const Float SIGMA_MAX = 100; **/ class nsCanvasRenderingContext2DAzure : public nsIDOMCanvasRenderingContext2D, - public nsICanvasRenderingContextInternal + public nsICanvasRenderingContextInternal, + public nsWrapperCache { public: nsCanvasRenderingContext2DAzure(); @@ -405,7 +408,8 @@ public: // nsISupports interface + CC NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCanvasRenderingContext2DAzure, nsIDOMCanvasRenderingContext2D) + NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS( + nsCanvasRenderingContext2DAzure, nsIDOMCanvasRenderingContext2D) // nsIDOMCanvasRenderingContext2D interface NS_DECL_NSIDOMCANVASRENDERINGCONTEXT2D @@ -586,9 +590,8 @@ protected: * Gets the pres shell from either the canvas element or the doc shell */ nsIPresShell *GetPresShell() { - nsCOMPtr content = do_QueryObject(mCanvasElement); - if (content) { - return content->OwnerDoc()->GetShell(); + if (mCanvasElement) { + return mCanvasElement->OwnerDoc()->GetShell(); } if (mDocShell) { nsCOMPtr shell; @@ -938,18 +941,46 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCanvasRenderingContext2DAzure) NS_IMPL_CYCLE_COLLECTION_CLASS(nsCanvasRenderingContext2DAzure) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCanvasRenderingContext2DAzure) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement) + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsCanvasRenderingContext2DAzure) + NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCanvasRenderingContext2DAzure) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mCanvasElement, nsINode) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsCanvasRenderingContext2DAzure) + if (nsCCUncollectableMarker::sGeneration && tmp->IsBlack()) { + nsGenericElement* canvasElement = tmp->mCanvasElement; + if (canvasElement) { + if (canvasElement->IsPurple()) { + canvasElement->RemovePurple(); + } + nsGenericElement::MarkNodeChildren(canvasElement); + } + return true; + } +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END + +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsCanvasRenderingContext2DAzure) + return nsCCUncollectableMarker::sGeneration && tmp->IsBlack(); +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END + +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsCanvasRenderingContext2DAzure) + return nsCCUncollectableMarker::sGeneration && tmp->IsBlack(); +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END + // XXX // DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2DAzure) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2DAzure) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D) NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, + nsICanvasRenderingContextInternal) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D) NS_INTERFACE_MAP_END @@ -1241,10 +1272,9 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height) if (size.width <= 0xFFFF && size.height <= 0xFFFF && size.width >= 0 && size.height >= 0) { SurfaceFormat format = GetSurfaceFormat(); - nsCOMPtr content = do_QueryObject(mCanvasElement); nsIDocument* ownerDoc = nsnull; - if (content) { - ownerDoc = content->OwnerDoc(); + if (mCanvasElement) { + ownerDoc = mCanvasElement->OwnerDoc(); } nsRefPtr layerManager = nsnull; diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 35386394c31..55fa98ce9bb 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -24,6 +24,8 @@ #include "xpcpublic.h" #include "xpcprivate.h" #include "XPCWrapper.h" +#include "XPCQuickStubs.h" +#include "nsDOMQS.h" #include "mozilla/dom/RegisterBindings.h" @@ -415,8 +417,7 @@ #include "nsIDOMSVGZoomAndPan.h" #include "nsIDOMSVGZoomEvent.h" -#include "nsIDOMCanvasRenderingContext2D.h" -#include "nsIDOMWebGLRenderingContext.h" +#include "nsICanvasRenderingContextInternal.h" #include "nsIImageDocument.h" @@ -621,13 +622,21 @@ static const char kDOMStringBundleURL[] = // nothing #endif -DOMCI_DATA(Crypto, void) -DOMCI_DATA(CRMFObject, void) -DOMCI_DATA(SmartCardEvent, void) -DOMCI_DATA(ContentFrameMessageManager, void) +/** + * To generate the bitmap for a class that we're sure doesn't implement any of + * the interfaces in DOMCI_CASTABLE_INTERFACES. + */ +#define DOMCI_DATA_NO_CLASS(_dom_class) \ +const PRUint32 kDOMClassInfo_##_dom_class##_interfaces = \ + 0; -DOMCI_DATA(DOMPrototype, void) -DOMCI_DATA(DOMConstructor, void) +DOMCI_DATA_NO_CLASS(Crypto) +DOMCI_DATA_NO_CLASS(CRMFObject) +DOMCI_DATA_NO_CLASS(SmartCardEvent) +DOMCI_DATA_NO_CLASS(ContentFrameMessageManager) + +DOMCI_DATA_NO_CLASS(DOMPrototype) +DOMCI_DATA_NO_CLASS(DOMConstructor) #define NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _name, _helper, \ _flags) \ @@ -691,6 +700,10 @@ public: } // anonymous namespace +typedef nsNewDOMBindingSH + nsCanvasRenderingContextSH; + + // This list of NS_DEFINE_CLASSINFO_DATA macros is what gives the DOM // classes their correct behavior when used through XPConnect. The // arguments that are passed to NS_DEFINE_CLASSINFO_DATA are @@ -1317,7 +1330,8 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(HTMLCanvasElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContext2D, nsDOMGenericSH, + NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContext2D, + nsCanvasRenderingContextSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(CanvasGradient, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -2002,8 +2016,7 @@ WrapNative(JSContext *cx, JSObject *scope, nsISupports *native, // nsWrapperCache. static inline nsresult WrapNativeParent(JSContext *cx, JSObject *scope, nsISupports *native, - nsWrapperCache *nativeWrapperCache, - JSObject **parentObj) + nsWrapperCache *nativeWrapperCache, JSObject **parentObj) { // In the common case, |native| is a wrapper cache with an existing wrapper #ifdef DEBUG @@ -2033,6 +2046,14 @@ WrapNativeParent(JSContext *cx, JSObject *scope, nsISupports *native, return NS_OK; } +template +static inline nsresult +WrapNativeParent(JSContext *cx, JSObject *scope, P *parent, + JSObject **parentObj) +{ + return WrapNativeParent(cx, scope, ToSupports(parent), parent, parentObj); +} + // Helper to handle torn-down inner windows. static inline nsresult SetParentToWindow(nsGlobalWindow *win, JSObject **parent) @@ -7976,8 +7997,7 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, // to wrap here? But that's not always reachable, let's use // globalObj for now... - nsresult rv = WrapNativeParent(cx, globalObj, native_parent, native_parent, - parentObj); + nsresult rv = WrapNativeParent(cx, globalObj, native_parent, parentObj); NS_ENSURE_SUCCESS(rv, rv); return node->IsInNativeAnonymousSubtree() ? @@ -10312,7 +10332,7 @@ nsCSSStyleDeclSH::PreCreate(nsISupports *nativeObj, JSContext *cx, } nsresult rv = - WrapNativeParent(cx, globalObj, native_parent, native_parent, parentObj); + WrapNativeParent(cx, globalObj, native_parent, parentObj); NS_ENSURE_SUCCESS(rv, rv); return NS_SUCCESS_ALLOW_SLIM_WRAPPERS; @@ -10927,7 +10947,7 @@ WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx, WebGLContext *webgl = ext->Context(); nsINode *node = webgl->GetParentObject(); - return WrapNativeParent(cx, globalObj, node, node, parentObj); + return WrapNativeParent(cx, globalObj, node, parentObj); } nsresult @@ -10940,15 +10960,18 @@ nsNewDOMBindingNoWrapperCacheSH::PreCreate(nsISupports *nativeObj, return NS_ERROR_UNEXPECTED; } +template NS_IMETHODIMP -nsWebGLViewportHandlerSH::PreCreate(nsISupports *nativeObj, JSContext *cx, - JSObject *globalObj, JSObject **parentObj) +nsNewDOMBindingSH::PreCreate(nsISupports *nativeObj, + JSContext *cx, + JSObject *globalObj, + JSObject **parentObj) { *parentObj = globalObj; - WebGLContext *webgl = static_cast( - static_cast(nativeObj)); - nsINode *node = webgl->GetParentObject(); - - return WrapNativeParent(cx, globalObj, node, node, parentObj); + T *native = static_cast(static_cast(nativeObj)); + if (!native->GetParentObject()) { + return NS_OK; + } + return WrapNativeParent(cx, globalObj, native->GetParentObject(), parentObj); } diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 9c4a481756a..53d6f15dc38 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -26,6 +26,7 @@ class DOMSVGStringList; class DOMSVGTransformList; } class nsGlobalWindow; +class nsICanvasRenderingContextInternal; class nsIDOMDocument; class nsIDOMHTMLOptionsCollection; class nsIDOMSVGLength; @@ -1531,40 +1532,6 @@ public: } }; -class nsWebGLViewportHandlerSH : public nsDOMGenericSH -{ -protected: - nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData) - { - } - - virtual ~nsWebGLViewportHandlerSH() - { - } - -public: - NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) { - nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto); - if (NS_SUCCEEDED(rv)) { - if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2), - nsnull, nsnull, JSPROP_ENUMERATE)) - { - return NS_ERROR_UNEXPECTED; - } - } - return rv; - } - - NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, - JSObject *globalObj, JSObject **parentObj); - - static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) - { - return new nsWebGLViewportHandlerSH(aData); - } -}; - - // Template for SVGXXXList helpers template @@ -1614,4 +1581,58 @@ public: } }; +template +class nsNewDOMBindingSH : public nsDOMGenericSH +{ +protected: + nsNewDOMBindingSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) + { + } + + virtual ~nsNewDOMBindingSH() + { + } + +public: + NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, + JSObject *globalObj, JSObject **parentObj); + + static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) + { + return new nsNewDOMBindingSH(aData); + } +}; + +class nsWebGLViewportHandlerSH + : public nsNewDOMBindingSH +{ +protected: + nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData) + : nsNewDOMBindingSH(aData) + { + } + + virtual ~nsWebGLViewportHandlerSH() + { + } + +public: + NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) { + nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto); + if (NS_SUCCEEDED(rv)) { + if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2), + nsnull, nsnull, JSPROP_ENUMERATE)) + { + return NS_ERROR_UNEXPECTED; + } + } + return rv; + } + + static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) + { + return new nsWebGLViewportHandlerSH(aData); + } +}; + #endif /* nsDOMClassInfo_h___ */ diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index b0807abdbfd..ed45df08a2f 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -502,13 +502,13 @@ template inline nsISupports* GetParentPointer(T* aObject) { - return aObject; + return ToSupports(aObject); } inline nsISupports* GetParentPointer(const ParentObject& aObject) { - return aObject.mObject; + return ToSupports(aObject.mObject); } // Only set allowNativeWrapper to false if you really know you need it, if in diff --git a/js/xpconnect/src/nsDOMQS.h b/js/xpconnect/src/nsDOMQS.h index 55af6db2719..f996b8a08e3 100644 --- a/js/xpconnect/src/nsDOMQS.h +++ b/js/xpconnect/src/nsDOMQS.h @@ -179,6 +179,23 @@ DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement) DEFINE_UNWRAP_CAST_HTML(img, nsHTMLImageElement) DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement) +template <> +inline nsresult +xpc_qsUnwrapArg(JSContext *cx, jsval v, + mozilla::dom::ImageData **ppArg, + mozilla::dom::ImageData **ppArgRef, + jsval *vp) +{ + nsIDOMImageData* arg; + nsIDOMImageData* argRef; + nsresult rv = xpc_qsUnwrapArg(cx, v, &arg, &argRef, vp); + if (NS_SUCCEEDED(rv)) { + *ppArg = static_cast(arg); + *ppArgRef = static_cast(argRef); + } + return rv; +} + inline nsISupports* ToSupports(nsContentList *p) { From b02a1ce6f45d61eb5f7e063512ebf2b74b53619a Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Fri, 25 May 2012 16:27:18 +0200 Subject: [PATCH 11/83] Fix for bug 762657 (Fix canvas tests and drop support for fake ImageData in putImageData to comply with spec). r=Ms2ger. --- content/canvas/src/CustomQS_Canvas.h | 51 ++++--------------- content/canvas/test/test_bug613794.html | 14 +---- content/canvas/test/test_canvas.html | 44 +++++++--------- .../canvas/nsIDOMCanvasRenderingContext2D.idl | 2 +- dom/tests/mochitest/bugs/test_bug389366.html | 43 +++------------- 5 files changed, 37 insertions(+), 117 deletions(-) diff --git a/content/canvas/src/CustomQS_Canvas.h b/content/canvas/src/CustomQS_Canvas.h index 44c54914716..c04e99eb801 100644 --- a/content/canvas/src/CustomQS_Canvas.h +++ b/content/canvas/src/CustomQS_Canvas.h @@ -9,22 +9,6 @@ #include "mozilla/dom/ImageData.h" -static bool -GetPositiveInt(JSContext* cx, JSObject& obj, const char* name, uint32_t* out) -{ - JS::Value temp; - int32_t signedInt; - if (!JS_GetProperty(cx, &obj, name, &temp) || - !JS_ValueToECMAInt32(cx, temp, &signedInt)) { - return false; - } - if (signedInt <= 0) { - return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR); - } - *out = uint32_t(signedInt); - return true; -} - static bool GetImageData(JSContext* cx, JS::Value& imageData, uint32_t* width, uint32_t* height, JS::Anchor* array) @@ -35,34 +19,17 @@ GetImageData(JSContext* cx, JS::Value& imageData, nsIDOMImageData* domImageData; xpc_qsSelfRef imageDataRef; - if (NS_SUCCEEDED(xpc_qsUnwrapArg(cx, imageData, - &domImageData, - &imageDataRef.ptr, - &imageData))) { - mozilla::dom::ImageData* concreteImageData = - static_cast(domImageData); - *width = concreteImageData->GetWidth(); - *height = concreteImageData->GetHeight(); - array->set(concreteImageData->GetDataObject()); - return true; + nsresult rv = xpc_qsUnwrapArg(cx, imageData, &domImageData, + &imageDataRef.ptr, &imageData); + if (NS_FAILED(rv)) { + return xpc_qsThrow(cx, rv); } - // TODO - bug 625804: Remove support for duck-typed ImageData. - JSObject& dataObject = imageData.toObject(); - - if (!GetPositiveInt(cx, dataObject, "width", width) || - !GetPositiveInt(cx, dataObject, "height", height)) { - return false; - } - - JS::Value temp; - if (!JS_GetProperty(cx, &dataObject, "data", &temp)) { - return false; - } - if (!temp.isObject()) { - return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR); - } - array->set(&temp.toObject()); + mozilla::dom::ImageData* concreteImageData = + static_cast(domImageData); + *width = concreteImageData->GetWidth(); + *height = concreteImageData->GetHeight(); + array->set(concreteImageData->GetDataObject()); return true; } diff --git a/content/canvas/test/test_bug613794.html b/content/canvas/test/test_bug613794.html index fce078c41eb..d17a5263725 100644 --- a/content/canvas/test/test_bug613794.html +++ b/content/canvas/test/test_bug613794.html @@ -32,18 +32,8 @@ try { threw = true; } -is(threw, false, "Should be able to pass in custom imagedata objects with array data"); - -threw = false; -try { - c.putImageData({ width: 1, height: 1, data: null }, 0, 0); - threw = false; -} catch(e) { - threw = e.name; -} - -is(threw, "TypeMismatchError", - "Should throw TypeMismatchError when data is not an array"); +ok(threw, + "Should not be able to pass in custom imagedata objects with array data"); diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 231bc35174a..9d28bc566aa 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -3521,7 +3521,7 @@ var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.drawImage(null, 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -3693,23 +3693,21 @@ isPixel(ctx, 50,25, 0,255,0,255, 2); function test_2d_drawImage_wrongtype() { -netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var canvas = document.getElementById('c127'); var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.drawImage(undefined, 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); var _thrown = undefined; try { ctx.drawImage(0, 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.result == Components.results.NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL, "should throw NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); var _thrown = undefined; try { ctx.drawImage("", 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.result == Components.results.NS_ERROR_XPC_BAD_CONVERT_JS, "should throw NS_ERROR_XPC_BAD_CONVERT_JS"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); var _thrown = undefined; try { ctx.drawImage(document.createElement('p'), 0, 0); -} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -9192,7 +9190,7 @@ var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.putImageData(null, 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -9304,13 +9302,13 @@ var ctx = canvas.getContext('2d'); var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; var _thrown = undefined; try { ctx.putImageData(imgdata, 0, 0); -} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); var _thrown = undefined; try { ctx.putImageData("cheese", 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); var _thrown = undefined; try { ctx.putImageData(42, 0, 0); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -15097,7 +15095,7 @@ var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.createPattern(null, 'repeat'); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -15116,7 +15114,7 @@ var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.createPattern('image_red.png', 'repeat'); -} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -15135,7 +15133,7 @@ var ctx = canvas.getContext('2d'); var _thrown = undefined; try { ctx.createPattern(undefined, 'repeat'); -} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "TypeMismatchError" && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TypeMismatchError"); +} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "TypeError", "should throw TypeError"); } @@ -15977,17 +15975,9 @@ function test_2d_pattern_repeat_null() { var canvas = document.getElementById('c494'); var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var img = document.getElementById('green-1x1_2.png'); -var pattern = ctx.createPattern(img, null); -ctx.fillStyle = pattern; -ctx.fillRect(0, 0, 100, 50); - -isPixel(ctx, 1,1, 0,255,0,255, 0); -isPixel(ctx, 98,1, 0,255,0,255, 0); -isPixel(ctx, 1,48, 0,255,0,255, 0); -isPixel(ctx, 98,48, 0,255,0,255, 0); +var _thrown = undefined; try { + ctx.createPattern(canvas, null); +} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError"); } @@ -19548,6 +19538,7 @@ function test_2d_type_prototype() { var canvas = document.getElementById('c611'); var ctx = canvas.getContext('2d'); +var fill = window.CanvasRenderingContext2D.prototype.fill; ok(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype"); ok(window.CanvasRenderingContext2D.prototype.fill, "window.CanvasRenderingContext2D.prototype.fill"); window.CanvasRenderingContext2D.prototype = null; @@ -19559,7 +19550,8 @@ ok(window.CanvasRenderingContext2D.prototype.fill === 1, "window.CanvasRendering delete window.CanvasRenderingContext2D.prototype.fill; todo(window.CanvasRenderingContext2D.prototype.fill === undefined, "window.CanvasRenderingContext2D.prototype.fill === undefined"); - +//restore the original method to ensure that other tests can run successfully +window.CanvasRenderingContext2D.prototype.fill = fill; } diff --git a/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl b/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl index 35bbff3f916..2409cacece9 100644 --- a/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl +++ b/dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl @@ -91,7 +91,7 @@ enum CanvasMultiGetterType { nsIDOMCanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1); nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1); - nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, in DOMString repetition); + nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, [Null(Stringify)] in DOMString repetition); attribute float lineWidth; /* default 1 */ attribute DOMString lineCap; /* "butt", "round", "square" (default) */ attribute DOMString lineJoin; /* "round", "bevel", "miter" (default) */ diff --git a/dom/tests/mochitest/bugs/test_bug389366.html b/dom/tests/mochitest/bugs/test_bug389366.html index 01d77a5d704..7567bacc5fb 100644 --- a/dom/tests/mochitest/bugs/test_bug389366.html +++ b/dom/tests/mochitest/bugs/test_bug389366.html @@ -39,42 +39,13 @@ function test() isDeeply(data1, [255, 0, 0, 128], "expected half-transparent red canvas 1"); // half-transparent red 10x10 square - var imgData = { - width : 10, - height : 10, - data : [ - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 128, - - ] - }; + var imgData = ctx1.createImageData(10, 10); + var rgba = [ 255, 0, 0, 128 ]; + for (i = 0; i < 50; ++i) { + for (j = 0; j < 4; ++j) { + imgData.data[(i * 4) + j] = rgba[j]; + } + } var canvas2 = document.getElementById("canvas2"); var ctx2 = canvas2.getContext("2d"); From ed96f79b86d4a9e4ec36fb34101cac33db99de68 Mon Sep 17 00:00:00 2001 From: Tatiana Meshkova Date: Wed, 13 Jun 2012 16:41:50 -0700 Subject: [PATCH 12/83] Bug 761981 & Bug 762568 - Intermittent test-pos-fixed-transform.html&test-bg-attachment-fixed.html | image comparison (==) r=roc --- layout/reftests/reftest-sanity/reftest.list | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/reftests/reftest-sanity/reftest.list b/layout/reftests/reftest-sanity/reftest.list index a6857bef3de..b0c05c4151c 100644 --- a/layout/reftests/reftest-sanity/reftest.list +++ b/layout/reftests/reftest-sanity/reftest.list @@ -95,9 +95,9 @@ skip-if(!browserIsRemote) == test-displayport-bg.html test-displayport-ref.html # IPC Position-fixed frames/layers test # Fixed layers are temporarily disabled (bug 656167). -#== test-pos-fixed.html test-pos-fixed-ref.html -== test-bg-attachment-fixed.html test-bg-attachment-fixed-ref.html -== test-pos-fixed-transform.html test-pos-fixed-transform-ref.html +#skip-if(!browserIsRemote) == test-pos-fixed.html test-pos-fixed-ref.html +skip-if(!browserIsRemote) == test-bg-attachment-fixed.html test-bg-attachment-fixed-ref.html +skip-if(!browserIsRemote) == test-pos-fixed-transform.html test-pos-fixed-transform-ref.html # reftest syntax: require-or require-or(unrecognizedCondition,skip) script scripttest-fail.html From 5e33b7294c820199e245c4ed9be933ee85297c5e Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 19 Jun 2012 16:17:37 +0300 Subject: [PATCH 13/83] Bug 765799 - Uninitialized variable use in nsRange::InsertNode; r=smaug --- content/base/src/nsRange.cpp | 37 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 8f179a42a39..7d37e893b4f 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -2081,28 +2081,29 @@ nsRange::InsertNode(nsIDOMNode* aNode) NS_ENSURE_SUCCESS(res, res); } - // We might need to update the end to include the new node (bug 433662) + // We might need to update the end to include the new node (bug 433662). + // Ideally we'd only do this if needed, but it's tricky to know when it's + // needed in advance (bug 765799). PRInt32 newOffset; - if (Collapsed()) { - if (referenceNode) { - newOffset = IndexOf(referenceNode); - } else { - PRUint32 length; - res = tChildList->GetLength(&length); - NS_ENSURE_SUCCESS(res, res); - newOffset = length; - } - - nsCOMPtr node = do_QueryInterface(aNode); - NS_ENSURE_STATE(node); - if (node->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) { - newOffset += node->GetChildCount(); - } else { - newOffset++; - } + if (referenceNode) { + newOffset = IndexOf(referenceNode); + } else { + PRUint32 length; + res = tChildList->GetLength(&length); + NS_ENSURE_SUCCESS(res, res); + newOffset = length; } + nsCOMPtr node = do_QueryInterface(aNode); + NS_ENSURE_STATE(node); + if (node->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) { + newOffset += node->GetChildCount(); + } else { + newOffset++; + } + + // Now actually insert the node nsCOMPtr tResultNode; res = referenceParentNode->InsertBefore(aNode, referenceNode, getter_AddRefs(tResultNode)); NS_ENSURE_SUCCESS(res, res); From b66f78936ec565c51f76e987aaef868044d43195 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 21:21:14 -0400 Subject: [PATCH 14/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (more dom parts); r=bzbarsky --HG-- extra : rebase_source : e31b077d8556626aa46ac33abbe2997e86ba68df --- dom/devicestorage/nsDeviceStorage.cpp | 3 ++- dom/sms/src/fallback/SmsDatabaseService.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 6352d836e06..338a9e1c587 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -17,12 +17,13 @@ #include "mozilla/Preferences.h" #include "nsJSUtils.h" #include "DictionaryHelpers.h" +#include "mozilla/Attributes.h" using namespace mozilla::dom; #include "nsDirectoryServiceDefs.h" -class DeviceStorageFile : public nsISupports { +class DeviceStorageFile MOZ_FINAL : public nsISupports { public: nsCOMPtr mFile; diff --git a/dom/sms/src/fallback/SmsDatabaseService.h b/dom/sms/src/fallback/SmsDatabaseService.h index 08b736c4223..0e6730bad5d 100644 --- a/dom/sms/src/fallback/SmsDatabaseService.h +++ b/dom/sms/src/fallback/SmsDatabaseService.h @@ -7,12 +7,13 @@ #define mozilla_dom_sms_SmsDatabaseService_h #include "nsISmsDatabaseService.h" +#include "mozilla/Attributes.h" namespace mozilla { namespace dom { namespace sms { -class SmsDatabaseService : public nsISmsDatabaseService +class SmsDatabaseService MOZ_FINAL : public nsISmsDatabaseService { public: NS_DECL_ISUPPORTS From d40ed1738aaab8a66491428d0564d8ae1bbc6bd5 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 21:24:02 -0400 Subject: [PATCH 15/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (view parts); r=roc --HG-- extra : rebase_source : 5492f4c6d1cab22211b760edf8c77b889c651d76 --- view/src/nsView.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index ef6b20cc9a7..d25535c53a1 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -11,6 +11,7 @@ #include "nsIComponentManager.h" #include "nsGfxCIID.h" #include "nsIInterfaceRequestor.h" +#include "mozilla/Attributes.h" //mmptemp @@ -26,7 +27,7 @@ static nsEventStatus HandleEvent(nsGUIEvent *aEvent); /** * nsISupports-derived helper class that allows to store and get a view */ -class ViewWrapper : public nsIInterfaceRequestor +class ViewWrapper MOZ_FINAL : public nsIInterfaceRequestor { public: NS_DECLARE_STATIC_IID_ACCESSOR(VIEW_WRAPPER_IID) From 32d9a6d91950c2152d725d0d1bb1a53ec91657e1 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 21:28:00 -0400 Subject: [PATCH 16/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (widget parts); r=roc --HG-- extra : rebase_source : 36430dcdd81a80d8ee2cd21f698a9289f327e2b6 --- widget/xpwidgets/PuppetWidget.h | 3 ++- widget/xpwidgets/nsBaseWidget.cpp | 3 ++- widget/xpwidgets/nsClipboardPrivacyHandler.h | 5 +++-- widget/xpwidgets/nsNativeTheme.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/widget/xpwidgets/PuppetWidget.h b/widget/xpwidgets/PuppetWidget.h index e42ae9f27b4..3e768cfe058 100644 --- a/widget/xpwidgets/PuppetWidget.h +++ b/widget/xpwidgets/PuppetWidget.h @@ -20,6 +20,7 @@ #include "nsIScreenManager.h" #include "nsThreadUtils.h" #include "nsWeakReference.h" +#include "mozilla/Attributes.h" class gfxASurface; @@ -220,7 +221,7 @@ public: NS_IMETHOD SetRotation(PRUint32 aRotation) MOZ_OVERRIDE; }; -class PuppetScreenManager : public nsIScreenManager +class PuppetScreenManager MOZ_FINAL : public nsIScreenManager { public: PuppetScreenManager(); diff --git a/widget/xpwidgets/nsBaseWidget.cpp b/widget/xpwidgets/nsBaseWidget.cpp index 8bd6a45bb57..919d03369c4 100644 --- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -26,6 +26,7 @@ #include "npapi.h" #include "base/thread.h" #include "prenv.h" +#include "mozilla/Attributes.h" #ifdef DEBUG #include "nsIObserver.h" @@ -1489,7 +1490,7 @@ static void debug_SetCachedBoolPref(const char * aPrefName,bool aValue) } ////////////////////////////////////////////////////////////// -class Debug_PrefObserver : public nsIObserver { +class Debug_PrefObserver MOZ_FINAL : public nsIObserver { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER diff --git a/widget/xpwidgets/nsClipboardPrivacyHandler.h b/widget/xpwidgets/nsClipboardPrivacyHandler.h index 7d244d1c84b..2f1bea5d2a6 100644 --- a/widget/xpwidgets/nsClipboardPrivacyHandler.h +++ b/widget/xpwidgets/nsClipboardPrivacyHandler.h @@ -10,6 +10,7 @@ #include "nsIPrivateBrowsingService.h" #include "nsWeakReference.h" #include "nsCOMPtr.h" +#include "mozilla/Attributes.h" class nsITransferable; @@ -20,8 +21,8 @@ class nsITransferable; // nsIClipboard::SetData implementation before starting to use the // nsITransferable object in any way. -class nsClipboardPrivacyHandler : public nsIObserver, - public nsSupportsWeakReference +class nsClipboardPrivacyHandler MOZ_FINAL : public nsIObserver, + public nsSupportsWeakReference { public: diff --git a/widget/xpwidgets/nsNativeTheme.h b/widget/xpwidgets/nsNativeTheme.h index 3e65520cce5..49db563c585 100644 --- a/widget/xpwidgets/nsNativeTheme.h +++ b/widget/xpwidgets/nsNativeTheme.h @@ -42,6 +42,7 @@ class nsNativeTheme : public nsITimerCallback }; nsNativeTheme(); + virtual ~nsNativeTheme() {} // Returns the content state (hover, focus, etc), see nsEventStateManager.h nsEventStates GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType); From aef7f91aa1a26d768270c9f8ace66269693e9d8e Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 22:30:09 -0400 Subject: [PATCH 17/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (content parts); r=bzbarsky --HG-- extra : rebase_source : e25a064995914ca4f7b1db16b5725eb440d3e531 --- content/base/src/ThirdPartyUtil.h | 3 ++- content/base/src/nsCCUncollectableMarker.h | 3 ++- content/base/src/nsContentUtils.cpp | 7 ++++--- content/base/src/nsCrossSiteListenerProxy.cpp | 6 +++--- content/base/src/nsCrossSiteListenerProxy.h | 9 +++++---- content/base/src/nsDOMBlobBuilder.h | 5 +++-- content/base/src/nsDOMFile.cpp | 5 +++-- content/base/src/nsDOMTokenList.h | 2 +- content/base/src/nsDataDocumentContentPolicy.h | 3 ++- content/base/src/nsDocument.cpp | 5 ++--- content/base/src/nsDocument.h | 9 +++++---- content/base/src/nsEventSource.cpp | 3 ++- content/base/src/nsFrameLoader.h | 7 ++++--- content/base/src/nsFrameMessageManager.h | 7 ++++--- content/base/src/nsGenericElement.h | 13 +++++++------ content/base/src/nsMappedAttributes.h | 3 ++- content/base/src/nsNoDataProtocolContentPolicy.h | 3 ++- content/base/src/nsScriptLoader.cpp | 3 ++- content/base/src/nsXMLHttpRequest.cpp | 3 ++- content/events/src/nsDOMDataTransfer.h | 3 ++- content/events/src/nsDOMDeviceMotionEvent.h | 9 +++++---- content/events/src/nsDOMEventTargetHelper.h | 3 ++- content/events/src/nsDOMTouchEvent.h | 3 ++- content/events/src/nsEventListenerService.h | 3 ++- content/events/src/nsEventStateManager.cpp | 3 ++- content/events/src/nsIMEStateManager.cpp | 5 +++-- content/events/src/nsPaintRequest.h | 3 ++- content/events/src/nsPrivateTextRange.h | 5 +++-- content/events/src/nsXMLEventsManager.h | 5 +++-- content/media/MediaResource.h | 7 ++++--- content/media/MediaStreamGraph.cpp | 3 ++- content/media/nsMediaCache.cpp | 5 +++-- content/svg/content/src/DOMSVGAnimatedLengthList.h | 3 ++- content/svg/content/src/DOMSVGAnimatedNumberList.h | 3 ++- .../svg/content/src/DOMSVGAnimatedTransformList.h | 3 ++- content/svg/content/src/DOMSVGLength.h | 3 ++- content/svg/content/src/DOMSVGLengthList.h | 5 +++-- content/svg/content/src/DOMSVGMatrix.h | 3 ++- content/svg/content/src/DOMSVGNumber.h | 3 ++- content/svg/content/src/DOMSVGNumberList.h | 5 +++-- content/svg/content/src/DOMSVGPathSegList.h | 5 +++-- content/svg/content/src/DOMSVGPoint.h | 3 ++- content/svg/content/src/DOMSVGPointList.h | 5 +++-- content/svg/content/src/DOMSVGStringList.h | 3 ++- content/svg/content/src/DOMSVGTests.h | 2 ++ content/svg/content/src/DOMSVGTransform.h | 3 ++- content/svg/content/src/DOMSVGTransformList.h | 5 +++-- .../content/src/SVGAnimatedPreserveAspectRatio.h | 9 +++++---- content/svg/content/src/nsSVGAngle.cpp | 3 ++- content/svg/content/src/nsSVGAngle.h | 9 +++++---- content/svg/content/src/nsSVGBoolean.h | 3 ++- content/svg/content/src/nsSVGClass.h | 3 ++- content/svg/content/src/nsSVGEnum.h | 3 ++- content/svg/content/src/nsSVGInteger.h | 3 ++- content/svg/content/src/nsSVGIntegerPair.h | 3 ++- content/svg/content/src/nsSVGMarkerElement.h | 3 ++- content/svg/content/src/nsSVGNumber2.cpp | 3 ++- content/svg/content/src/nsSVGNumber2.h | 3 ++- content/svg/content/src/nsSVGNumberPair.h | 3 ++- content/svg/content/src/nsSVGRect.h | 3 ++- content/svg/content/src/nsSVGSVGElement.h | 3 ++- content/svg/content/src/nsSVGString.h | 3 ++- content/svg/content/src/nsSVGViewBox.h | 7 ++++--- content/xbl/src/nsXBLService.cpp | 4 +++- content/xslt/src/xpath/nsXPathEvaluator.h | 5 +++-- content/xslt/src/xpath/nsXPathExpression.h | 5 +++-- content/xslt/src/xpath/nsXPathNSResolver.h | 3 ++- content/xslt/src/xpath/nsXPathResult.h | 7 ++++--- content/xslt/src/xpath/txXPCOMExtensionFunction.cpp | 3 ++- content/xslt/src/xpath/txXPathObjectAdaptor.h | 1 + .../xslt/src/xslt/txMozillaStylesheetCompiler.cpp | 13 +++++++------ content/xslt/src/xslt/txMozillaXMLOutput.h | 5 +++-- content/xslt/src/xslt/txMozillaXSLTProcessor.h | 11 ++++++----- content/xtf/src/nsXMLContentBuilder.cpp | 3 ++- content/xtf/src/nsXTFElementWrapper.h | 3 ++- content/xtf/src/nsXTFInterfaceAggregator.cpp | 3 ++- content/xtf/src/nsXTFService.cpp | 3 ++- content/xtf/src/nsXTFWeakTearoff.cpp | 3 ++- content/xul/content/src/nsXULElement.cpp | 7 ++++--- content/xul/templates/src/nsRDFQuery.h | 3 ++- content/xul/templates/src/nsXMLBinding.h | 3 ++- .../templates/src/nsXULTemplateQueryProcessorRDF.h | 5 +++-- .../src/nsXULTemplateQueryProcessorStorage.h | 5 +++-- .../templates/src/nsXULTemplateQueryProcessorXML.h | 9 +++++---- content/xul/templates/src/nsXULTemplateResultRDF.h | 3 ++- .../xul/templates/src/nsXULTemplateResultSetRDF.h | 3 ++- .../xul/templates/src/nsXULTemplateResultStorage.h | 3 ++- content/xul/templates/src/nsXULTemplateResultXML.h | 3 ++- layout/forms/nsFileControlFrame.h | 3 ++- layout/printing/nsPagePrintTimer.h | 3 ++- layout/printing/nsPrintEngine.h | 3 ++- layout/printing/nsPrintPreviewListener.h | 3 ++- layout/style/AnimationCommon.h | 3 ++- layout/style/Loader.h | 3 ++- layout/xul/base/src/tree/src/nsTreeColumns.h | 5 +++-- layout/xul/base/src/tree/src/nsTreeContentView.h | 7 ++++--- layout/xul/base/src/tree/src/nsTreeImageListener.h | 3 ++- 97 files changed, 259 insertions(+), 164 deletions(-) diff --git a/content/base/src/ThirdPartyUtil.h b/content/base/src/ThirdPartyUtil.h index 269069b86eb..3f50ac3926e 100644 --- a/content/base/src/ThirdPartyUtil.h +++ b/content/base/src/ThirdPartyUtil.h @@ -9,12 +9,13 @@ #include "nsString.h" #include "mozIThirdPartyUtil.h" #include "nsIEffectiveTLDService.h" +#include "mozilla/Attributes.h" class nsIURI; class nsIChannel; class nsIDOMWindow; -class ThirdPartyUtil : public mozIThirdPartyUtil +class ThirdPartyUtil MOZ_FINAL : public mozIThirdPartyUtil { public: NS_DECL_ISUPPORTS diff --git a/content/base/src/nsCCUncollectableMarker.h b/content/base/src/nsCCUncollectableMarker.h index 93fcf26c877..9e76149300b 100644 --- a/content/base/src/nsCCUncollectableMarker.h +++ b/content/base/src/nsCCUncollectableMarker.h @@ -5,10 +5,11 @@ #include "nsIObserver.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" struct JSTracer; -class nsCCUncollectableMarker : public nsIObserver +class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver { NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 1a4ccdce4aa..3bf7fa1440d 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -181,6 +181,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID); #include "nsICharsetDetector.h" #include "nsICharsetDetectionObserver.h" #include "nsIPlatformCharset.h" +#include "mozilla/Attributes.h" extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end, const char** next, PRUnichar* result); @@ -307,15 +308,15 @@ EventListenerManagerHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) lm->~EventListenerManagerMapEntry(); } -class SameOriginChecker : public nsIChannelEventSink, - public nsIInterfaceRequestor +class SameOriginChecker MOZ_FINAL : public nsIChannelEventSink, + public nsIInterfaceRequestor { NS_DECL_ISUPPORTS NS_DECL_NSICHANNELEVENTSINK NS_DECL_NSIINTERFACEREQUESTOR }; -class CharsetDetectionObserver : public nsICharsetDetectionObserver +class CharsetDetectionObserver MOZ_FINAL : public nsICharsetDetectionObserver { public: NS_DECL_ISUPPORTS diff --git a/content/base/src/nsCrossSiteListenerProxy.cpp b/content/base/src/nsCrossSiteListenerProxy.cpp index 69cbdb14759..d2d833e56ba 100644 --- a/content/base/src/nsCrossSiteListenerProxy.cpp +++ b/content/base/src/nsCrossSiteListenerProxy.cpp @@ -809,9 +809,9 @@ nsCORSListenerProxy::UpdateChannel(nsIChannel* aChannel, bool aAllowDataURI) // Class used as streamlistener and notification callback when // doing the initial OPTIONS request for a CORS check -class nsCORSPreflightListener : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink +class nsCORSPreflightListener MOZ_FINAL : public nsIStreamListener, + public nsIInterfaceRequestor, + public nsIChannelEventSink { public: nsCORSPreflightListener(nsIChannel* aOuterChannel, diff --git a/content/base/src/nsCrossSiteListenerProxy.h b/content/base/src/nsCrossSiteListenerProxy.h index 08f856b1137..ebf0fec866d 100644 --- a/content/base/src/nsCrossSiteListenerProxy.h +++ b/content/base/src/nsCrossSiteListenerProxy.h @@ -15,6 +15,7 @@ #include "nsIInterfaceRequestor.h" #include "nsIChannelEventSink.h" #include "nsIAsyncVerifyRedirectCallback.h" +#include "mozilla/Attributes.h" class nsIURI; class nsIParser; @@ -31,10 +32,10 @@ NS_StartCORSPreflight(nsIChannel* aRequestChannel, nsTArray& aACUnsafeHeaders, nsIChannel** aPreflightChannel); -class nsCORSListenerProxy : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink, - public nsIAsyncVerifyRedirectCallback +class nsCORSListenerProxy MOZ_FINAL : public nsIStreamListener, + public nsIInterfaceRequestor, + public nsIChannelEventSink, + public nsIAsyncVerifyRedirectCallback { public: nsCORSListenerProxy(nsIStreamListener* aOuter, diff --git a/content/base/src/nsDOMBlobBuilder.h b/content/base/src/nsDOMBlobBuilder.h index 315254e3b0e..34dbd72f9ee 100644 --- a/content/base/src/nsDOMBlobBuilder.h +++ b/content/base/src/nsDOMBlobBuilder.h @@ -9,6 +9,7 @@ #include "nsDOMFile.h" #include "mozilla/CheckedInt.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -141,8 +142,8 @@ protected: PRUint64 mDataBufferLen; }; -class nsDOMBlobBuilder : public nsIDOMMozBlobBuilder, - public nsIJSNativeInitializer +class nsDOMBlobBuilder MOZ_FINAL : public nsIDOMMozBlobBuilder, + public nsIJSNativeInitializer { public: nsDOMBlobBuilder() diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index e9d42967925..9b94271c8c7 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -31,6 +31,7 @@ #include "nsJSUtils.h" #include "mozilla/CheckedInt.h" #include "mozilla/Preferences.h" +#include "mozilla/Attributes.h" #include "plbase64.h" #include "prmem.h" @@ -44,8 +45,8 @@ using namespace mozilla::dom; // ensure that the buffer underlying the stream we get // from NS_NewByteInputStream is held alive as long as the // stream is. We do that by passing back this class instead. -class DataOwnerAdapter : public nsIInputStream, - public nsISeekableStream +class DataOwnerAdapter MOZ_FINAL : public nsIInputStream, + public nsISeekableStream { typedef nsDOMMemoryFile::DataOwner DataOwner; public: diff --git a/content/base/src/nsDOMTokenList.h b/content/base/src/nsDOMTokenList.h index 72befdd37ba..9728d83df22 100644 --- a/content/base/src/nsDOMTokenList.h +++ b/content/base/src/nsDOMTokenList.h @@ -44,7 +44,7 @@ public: } protected: - ~nsDOMTokenList(); + virtual ~nsDOMTokenList(); nsresult CheckToken(const nsAString& aStr); void AddInternal(const nsAttrValue* aAttr, const nsAString& aToken); diff --git a/content/base/src/nsDataDocumentContentPolicy.h b/content/base/src/nsDataDocumentContentPolicy.h index 2a09413c066..c0930f6d234 100644 --- a/content/base/src/nsDataDocumentContentPolicy.h +++ b/content/base/src/nsDataDocumentContentPolicy.h @@ -20,8 +20,9 @@ #include "nsIContentPolicy.h" +#include "mozilla/Attributes.h" -class nsDataDocumentContentPolicy : public nsIContentPolicy +class nsDataDocumentContentPolicy MOZ_FINAL : public nsIContentPolicy { public: NS_DECL_ISUPPORTS diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 62565e866b9..4fc4c535c10 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1169,8 +1169,7 @@ nsExternalResourceMap::ExternalResource::~ExternalResource() // If we ever have an nsIDocumentObserver notification for stylesheet title // changes, we could make this inherit from nsDOMStringList instead of // reimplementing nsIDOMDOMStringList. -class nsDOMStyleSheetSetList : public nsIDOMDOMStringList - +class nsDOMStyleSheetSetList MOZ_FINAL : public nsIDOMDOMStringList { public: NS_DECL_ISUPPORTS @@ -7687,7 +7686,7 @@ namespace { * Stub for LoadSheet(), since all we want is to get the sheet into * the CSSLoader's style cache */ -class StubCSSLoaderObserver : public nsICSSLoaderObserver { +class StubCSSLoaderObserver MOZ_FINAL : public nsICSSLoaderObserver { public: NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*, bool, nsresult) diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index ed48e0ad360..843e1fb73c9 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -68,6 +68,7 @@ #include "nsIInlineEventHandlers.h" #include "nsDataHashtable.h" #include "mozilla/TimeStamp.h" +#include "mozilla/Attributes.h" #define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0) #define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1) @@ -286,7 +287,7 @@ protected: nsIDocument* mDocument; }; -class nsOnloadBlocker : public nsIRequest +class nsOnloadBlocker MOZ_FINAL : public nsIRequest { public: nsOnloadBlocker() {} @@ -388,7 +389,7 @@ protected: }; friend class PendingLoad; - class LoadgroupCallbacks : public nsIInterfaceRequestor + class LoadgroupCallbacks MOZ_FINAL : public nsIInterfaceRequestor { public: LoadgroupCallbacks(nsIInterfaceRequestor* aOtherCallbacks) @@ -409,8 +410,8 @@ protected: // XXXbz I wish we could just derive the _allcaps thing from _i #define DECL_SHIM(_i, _allcaps) \ - class _i##Shim : public nsIInterfaceRequestor, \ - public _i \ + class _i##Shim MOZ_FINAL : public nsIInterfaceRequestor, \ + public _i \ { \ public: \ _i##Shim(nsIInterfaceRequestor* aIfreq, _i* aRealPtr) \ diff --git a/content/base/src/nsEventSource.cpp b/content/base/src/nsEventSource.cpp index fa45c3b65cd..774e8fed2a8 100644 --- a/content/base/src/nsEventSource.cpp +++ b/content/base/src/nsEventSource.cpp @@ -31,6 +31,7 @@ #include "nsCrossSiteListenerProxy.h" #include "nsWrapperCacheInlines.h" #include "nsDOMEventTargetHelper.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -638,7 +639,7 @@ nsEventSource::OnStopRequest(nsIRequest *aRequest, * Simple helper class that just forwards the redirect callback back * to the nsEventSource. */ -class AsyncVerifyRedirectCallbackFwr : public nsIAsyncVerifyRedirectCallback +class AsyncVerifyRedirectCallbackFwr MOZ_FINAL : public nsIAsyncVerifyRedirectCallback { public: AsyncVerifyRedirectCallbackFwr(nsEventSource* aEventsource) diff --git a/content/base/src/nsFrameLoader.h b/content/base/src/nsFrameLoader.h index 97f3bbd1fab..50f445f7ed6 100644 --- a/content/base/src/nsFrameLoader.h +++ b/content/base/src/nsFrameLoader.h @@ -21,6 +21,7 @@ #include "nsFrameMessageManager.h" #include "Layers.h" #include "mozilla/dom/Element.h" +#include "mozilla/Attributes.h" class nsIURI; class nsSubDocumentFrame; @@ -56,7 +57,7 @@ class QX11EmbedContainer; * Used to support asynchronous re-paints of content pixels; see * nsIContentView. */ -class nsContentView : public nsIContentView +class nsContentView MOZ_FINAL : public nsIContentView { public: typedef mozilla::layers::FrameMetrics::ViewID ViewID; @@ -133,8 +134,8 @@ private: }; -class nsFrameLoader : public nsIFrameLoader, - public nsIContentViewManager +class nsFrameLoader MOZ_FINAL : public nsIFrameLoader, + public nsIContentViewManager { friend class AutoResetInShow; typedef mozilla::dom::PBrowserParent PBrowserParent; diff --git a/content/base/src/nsFrameMessageManager.h b/content/base/src/nsFrameMessageManager.h index a5cb5ec256d..1cbd9301269 100644 --- a/content/base/src/nsFrameMessageManager.h +++ b/content/base/src/nsFrameMessageManager.h @@ -20,6 +20,7 @@ #include "mozilla/Services.h" #include "nsIObserverService.h" #include "nsThreadUtils.h" +#include "mozilla/Attributes.h" namespace mozilla { namespace dom { @@ -46,8 +47,8 @@ typedef bool (*nsAsyncMessageCallback)(void* aCallbackData, const nsAString& aMessage, const nsAString& aJSON); -class nsFrameMessageManager : public nsIContentFrameMessageManager, - public nsIChromeFrameMessageManager +class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager, + public nsIChromeFrameMessageManager { public: nsFrameMessageManager(bool aChrome, @@ -236,7 +237,7 @@ public: nsFrameScriptExecutor* mExec; }; -class nsScriptCacheCleaner : public nsIObserver +class nsScriptCacheCleaner MOZ_FINAL : public nsIObserver { NS_DECL_ISUPPORTS diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index d72fcc2f3b0..2388956a85e 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -34,6 +34,7 @@ #include "nsIDOMTouchEvent.h" #include "nsIInlineEventHandlers.h" #include "mozilla/CORSMode.h" +#include "mozilla/Attributes.h" #include "nsISMILAttr.h" @@ -62,7 +63,7 @@ typedef PRUptrdiff PtrBits; * and Item to its existing child list. * @see nsIDOMNodeList */ -class nsChildContentList : public nsINodeList +class nsChildContentList MOZ_FINAL : public nsINodeList { public: nsChildContentList(nsINode* aNode) @@ -126,7 +127,7 @@ private: * A class that implements nsIWeakReference */ -class nsNodeWeakReference : public nsIWeakReference +class nsNodeWeakReference MOZ_FINAL : public nsIWeakReference { public: nsNodeWeakReference(nsINode* aNode) @@ -154,7 +155,7 @@ private: /** * Tearoff to use for nodes to implement nsISupportsWeakReference */ -class nsNodeSupportsWeakRefTearoff : public nsISupportsWeakReference +class nsNodeSupportsWeakRefTearoff MOZ_FINAL : public nsISupportsWeakReference { public: nsNodeSupportsWeakRefTearoff(nsINode* aNode) @@ -177,7 +178,7 @@ private: /** * A tearoff class for nsGenericElement to implement NodeSelector */ -class nsNodeSelectorTearoff : public nsIDOMNodeSelector +class nsNodeSelectorTearoff MOZ_FINAL : public nsIDOMNodeSelector { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -1038,7 +1039,7 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \ /** * Tearoff class to implement nsITouchEventReceiver */ -class nsTouchEventReceiverTearoff : public nsITouchEventReceiver +class nsTouchEventReceiverTearoff MOZ_FINAL : public nsITouchEventReceiver { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -1058,7 +1059,7 @@ private: /** * Tearoff class to implement nsIInlineEventHandlers */ -class nsInlineEventHandlersTearoff : public nsIInlineEventHandlers +class nsInlineEventHandlersTearoff MOZ_FINAL : public nsIInlineEventHandlers { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/base/src/nsMappedAttributes.h b/content/base/src/nsMappedAttributes.h index da035e065b1..3a771f48d47 100644 --- a/content/base/src/nsMappedAttributes.h +++ b/content/base/src/nsMappedAttributes.h @@ -14,12 +14,13 @@ #include "nsAttrAndChildArray.h" #include "nsMappedAttributeElement.h" #include "nsIStyleRule.h" +#include "mozilla/Attributes.h" class nsIAtom; class nsHTMLStyleSheet; class nsRuleWalker; -class nsMappedAttributes : public nsIStyleRule +class nsMappedAttributes MOZ_FINAL : public nsIStyleRule { public: nsMappedAttributes(nsHTMLStyleSheet* aSheet, diff --git a/content/base/src/nsNoDataProtocolContentPolicy.h b/content/base/src/nsNoDataProtocolContentPolicy.h index de16049d7b4..51a24fc504b 100644 --- a/content/base/src/nsNoDataProtocolContentPolicy.h +++ b/content/base/src/nsNoDataProtocolContentPolicy.h @@ -20,8 +20,9 @@ #include "nsIContentPolicy.h" +#include "mozilla/Attributes.h" -class nsNoDataProtocolContentPolicy : public nsIContentPolicy +class nsNoDataProtocolContentPolicy MOZ_FINAL : public nsIContentPolicy { public: NS_DECL_ISUPPORTS diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 54378fa1022..590617dd240 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -45,6 +45,7 @@ #include "mozilla/FunctionTimer.h" #include "mozilla/CORSMode.h" +#include "mozilla/Attributes.h" #ifdef PR_LOGGING static PRLogModuleInfo* gCspPRLog; @@ -57,7 +58,7 @@ using namespace mozilla::dom; // Per-request data structure ////////////////////////////////////////////////////////////// -class nsScriptLoadRequest : public nsISupports { +class nsScriptLoadRequest MOZ_FINAL : public nsISupports { public: nsScriptLoadRequest(nsIScriptElement* aElement, PRUint32 aVersion, diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 9664c051524..a47c80d02b9 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -76,6 +76,7 @@ #include "mozilla/dom/XMLHttpRequestBinding.h" #include "nsIDOMFormData.h" #include "DictionaryHelpers.h" +#include "mozilla/Attributes.h" #include "nsWrapperCacheInlines.h" #include "nsStreamListenerWrapper.h" @@ -3546,7 +3547,7 @@ nsXMLHttpRequest::ChangeState(PRUint32 aState, bool aBroadcast) * Simple helper class that just forwards the redirect callback back * to the nsXMLHttpRequest. */ -class AsyncVerifyRedirectCallbackForwarder : public nsIAsyncVerifyRedirectCallback +class AsyncVerifyRedirectCallbackForwarder MOZ_FINAL : public nsIAsyncVerifyRedirectCallback { public: AsyncVerifyRedirectCallbackForwarder(nsXMLHttpRequest *xhr) diff --git a/content/events/src/nsDOMDataTransfer.h b/content/events/src/nsDOMDataTransfer.h index dbe22c2a887..4249368ca77 100644 --- a/content/events/src/nsDOMDataTransfer.h +++ b/content/events/src/nsDOMDataTransfer.h @@ -18,6 +18,7 @@ #include "nsAutoPtr.h" #include "nsIFile.h" #include "nsDOMFile.h" +#include "mozilla/Attributes.h" class nsITransferable; @@ -34,7 +35,7 @@ struct TransferItem { nsCOMPtr mData; }; -class nsDOMDataTransfer : public nsIDOMDataTransfer +class nsDOMDataTransfer MOZ_FINAL : public nsIDOMDataTransfer { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/events/src/nsDOMDeviceMotionEvent.h b/content/events/src/nsDOMDeviceMotionEvent.h index f352bdafa3b..9f8c48b4c03 100644 --- a/content/events/src/nsDOMDeviceMotionEvent.h +++ b/content/events/src/nsDOMDeviceMotionEvent.h @@ -7,8 +7,9 @@ #include "nsIDOMDeviceMotionEvent.h" #include "nsDOMEvent.h" +#include "mozilla/Attributes.h" -class nsDOMDeviceRotationRate : public nsIDOMDeviceRotationRate +class nsDOMDeviceRotationRate MOZ_FINAL : public nsIDOMDeviceRotationRate { public: NS_DECL_ISUPPORTS @@ -23,7 +24,7 @@ protected: double mAlpha, mBeta, mGamma; }; -class nsDOMDeviceAcceleration : public nsIDOMDeviceAcceleration +class nsDOMDeviceAcceleration MOZ_FINAL : public nsIDOMDeviceAcceleration { public: NS_DECL_ISUPPORTS @@ -38,8 +39,8 @@ protected: double mX, mY, mZ; }; -class nsDOMDeviceMotionEvent : public nsDOMEvent, - public nsIDOMDeviceMotionEvent +class nsDOMDeviceMotionEvent MOZ_FINAL : public nsDOMEvent, + public nsIDOMDeviceMotionEvent { public: diff --git a/content/events/src/nsDOMEventTargetHelper.h b/content/events/src/nsDOMEventTargetHelper.h index 8901928335d..9786857cdb0 100644 --- a/content/events/src/nsDOMEventTargetHelper.h +++ b/content/events/src/nsDOMEventTargetHelper.h @@ -17,8 +17,9 @@ #include "nsIScriptContext.h" #include "nsWrapperCache.h" #include "mozilla/ErrorResult.h" +#include "mozilla/Attributes.h" -class nsDOMEventListenerWrapper : public nsIDOMEventListener +class nsDOMEventListenerWrapper MOZ_FINAL : public nsIDOMEventListener { public: nsDOMEventListenerWrapper(nsIDOMEventListener* aListener) diff --git a/content/events/src/nsDOMTouchEvent.h b/content/events/src/nsDOMTouchEvent.h index 023fff3957b..c4e84dfe5eb 100644 --- a/content/events/src/nsDOMTouchEvent.h +++ b/content/events/src/nsDOMTouchEvent.h @@ -11,8 +11,9 @@ #include "nsTArray.h" #include "nsIDocument.h" #include "dombindings.h" +#include "mozilla/Attributes.h" -class nsDOMTouch : public nsIDOMTouch +class nsDOMTouch MOZ_FINAL : public nsIDOMTouch { public: nsDOMTouch(nsIDOMEventTarget* aTarget, diff --git a/content/events/src/nsEventListenerService.h b/content/events/src/nsEventListenerService.h index b11064caa93..2eb2359ed44 100644 --- a/content/events/src/nsEventListenerService.h +++ b/content/events/src/nsEventListenerService.h @@ -12,6 +12,7 @@ #include "nsString.h" #include "nsCycleCollectionParticipant.h" #include "jsapi.h" +#include "mozilla/Attributes.h" class nsEventListenerInfo : public nsIEventListenerInfo @@ -38,7 +39,7 @@ protected: bool mInSystemEventGroup; }; -class nsEventListenerService : public nsIEventListenerService +class nsEventListenerService MOZ_FINAL : public nsIEventListenerService { public: NS_DECL_ISUPPORTS diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index e7c73a1b597..e2ac9a5724e 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -96,6 +96,7 @@ #include "mozilla/Preferences.h" #include "mozilla/LookAndFeel.h" +#include "mozilla/Attributes.h" #include "sampler.h" #include "nsIDOMClientRect.h" @@ -217,7 +218,7 @@ PrintDocTreeAll(nsIDocShellTreeItem* aItem) } #endif -class nsUITimerCallback : public nsITimerCallback +class nsUITimerCallback MOZ_FINAL : public nsITimerCallback { public: nsUITimerCallback() : mPreviousCount(0) {} diff --git a/content/events/src/nsIMEStateManager.cpp b/content/events/src/nsIMEStateManager.cpp index 4fd91231868..e4ad2c1ad87 100644 --- a/content/events/src/nsIMEStateManager.cpp +++ b/content/events/src/nsIMEStateManager.cpp @@ -34,6 +34,7 @@ #include "nsIFormControl.h" #include "nsIForm.h" #include "nsHTMLFormElement.h" +#include "mozilla/Attributes.h" using namespace mozilla::widget; @@ -386,8 +387,8 @@ nsIMEStateManager::GetWidget(nsPresContext* aPresContext) // sTextStateObserver points to the currently active nsTextStateManager // sTextStateObserver is null if there is no focused editor -class nsTextStateManager : public nsISelectionListener, - public nsStubMutationObserver +class nsTextStateManager MOZ_FINAL : public nsISelectionListener, + public nsStubMutationObserver { public: nsTextStateManager(); diff --git a/content/events/src/nsPaintRequest.h b/content/events/src/nsPaintRequest.h index b88a99d65e7..3cf9f4f70f9 100644 --- a/content/events/src/nsPaintRequest.h +++ b/content/events/src/nsPaintRequest.h @@ -11,8 +11,9 @@ #include "nsPresContext.h" #include "nsIDOMEvent.h" #include "dombindings.h" +#include "mozilla/Attributes.h" -class nsPaintRequest : public nsIDOMPaintRequest +class nsPaintRequest MOZ_FINAL : public nsIDOMPaintRequest { public: NS_DECL_ISUPPORTS diff --git a/content/events/src/nsPrivateTextRange.h b/content/events/src/nsPrivateTextRange.h index 57090f599ca..a0639b03fee 100644 --- a/content/events/src/nsPrivateTextRange.h +++ b/content/events/src/nsPrivateTextRange.h @@ -9,8 +9,9 @@ #include "nsIPrivateTextRange.h" #include "nsTArray.h" #include "nsAutoPtr.h" +#include "mozilla/Attributes.h" -class nsPrivateTextRange : public nsIPrivateTextRange +class nsPrivateTextRange MOZ_FINAL : public nsIPrivateTextRange { NS_DECL_ISUPPORTS public: @@ -31,7 +32,7 @@ protected: nsTextRangeStyle mRangeStyle; }; -class nsPrivateTextRangeList: public nsIPrivateTextRangeList +class nsPrivateTextRangeList MOZ_FINAL : public nsIPrivateTextRangeList { NS_DECL_ISUPPORTS public: diff --git a/content/events/src/nsXMLEventsManager.h b/content/events/src/nsXMLEventsManager.h index 9bcc45448ec..068ce1c5499 100644 --- a/content/events/src/nsXMLEventsManager.h +++ b/content/events/src/nsXMLEventsManager.h @@ -14,13 +14,14 @@ #include "nsInterfaceHashtable.h" #include "nsIAtom.h" #include "nsStubDocumentObserver.h" +#include "mozilla/Attributes.h" /* * The implementation of the XML Events Basic profile */ class nsXMLEventsManager; -class nsXMLEventsListener : public nsIDOMEventListener { +class nsXMLEventsListener MOZ_FINAL : public nsIDOMEventListener { public: static bool InitXMLEventsListener(nsIDocument * aDocument, nsXMLEventsManager * aManager, @@ -57,7 +58,7 @@ private: }; -class nsXMLEventsManager : public nsStubDocumentObserver { +class nsXMLEventsManager MOZ_FINAL : public nsStubDocumentObserver { public: nsXMLEventsManager(); ~nsXMLEventsManager(); diff --git a/content/media/MediaResource.h b/content/media/MediaResource.h index 040737def7a..6099bb15bc2 100644 --- a/content/media/MediaResource.h +++ b/content/media/MediaResource.h @@ -15,6 +15,7 @@ #include "nsIChannelEventSink.h" #include "nsIInterfaceRequestor.h" #include "nsMediaCache.h" +#include "mozilla/Attributes.h" // For HTTP seeking, if number of bytes needing to be // seeked forward is less than this value then a read is @@ -390,9 +391,9 @@ public: virtual bool IsSuspendedByCache(MediaResource** aActiveResource); virtual bool IsSuspended(); - class Listener : public nsIStreamListener, - public nsIInterfaceRequestor, - public nsIChannelEventSink + class Listener MOZ_FINAL : public nsIStreamListener, + public nsIInterfaceRequestor, + public nsIChannelEventSink { public: Listener(ChannelMediaResource* aResource) : mResource(aResource) {} diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index e4f8441f262..d194d34d4fc 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -17,6 +17,7 @@ #include "nsXPCOMCIDInternal.h" #include "prlog.h" #include "VideoUtils.h" +#include "mozilla/Attributes.h" using namespace mozilla::layers; @@ -1469,7 +1470,7 @@ public: } }; -class MediaStreamGraphShutdownObserver : public nsIObserver +class MediaStreamGraphShutdownObserver MOZ_FINAL : public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/content/media/nsMediaCache.cpp b/content/media/nsMediaCache.cpp index 2fc84b1d88c..6be500a4592 100644 --- a/content/media/nsMediaCache.cpp +++ b/content/media/nsMediaCache.cpp @@ -20,6 +20,7 @@ #include "prlog.h" #include "mozilla/Preferences.h" #include "FileBlockCache.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -59,8 +60,8 @@ static const PRUint32 FREE_BLOCK_SCAN_LIMIT = 16; // size limits). static nsMediaCache* gMediaCache; -class nsMediaCacheFlusher : public nsIObserver, - public nsSupportsWeakReference { +class nsMediaCacheFlusher MOZ_FINAL : public nsIObserver, + public nsSupportsWeakReference { nsMediaCacheFlusher() {} ~nsMediaCacheFlusher(); public: diff --git a/content/svg/content/src/DOMSVGAnimatedLengthList.h b/content/svg/content/src/DOMSVGAnimatedLengthList.h index 71850809d4d..3d53bccc4a4 100644 --- a/content/svg/content/src/DOMSVGAnimatedLengthList.h +++ b/content/svg/content/src/DOMSVGAnimatedLengthList.h @@ -11,6 +11,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGAnimatedLengthList.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" namespace mozilla { @@ -103,7 +104,7 @@ class DOMSVGLengthList; * One drawback of this design is that objects must look up their parent * chain to find their element, but that overhead is relatively small. */ -class DOMSVGAnimatedLengthList : public nsIDOMSVGAnimatedLengthList +class DOMSVGAnimatedLengthList MOZ_FINAL : public nsIDOMSVGAnimatedLengthList { friend class DOMSVGLengthList; diff --git a/content/svg/content/src/DOMSVGAnimatedNumberList.h b/content/svg/content/src/DOMSVGAnimatedNumberList.h index f5f297b569d..a1d8ee37b0f 100644 --- a/content/svg/content/src/DOMSVGAnimatedNumberList.h +++ b/content/svg/content/src/DOMSVGAnimatedNumberList.h @@ -11,6 +11,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGAnimatedNumberList.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" namespace mozilla { @@ -33,7 +34,7 @@ class SVGNumberList; * out our pointers to them when they die (making our pointers to them true * weak refs). */ -class DOMSVGAnimatedNumberList : public nsIDOMSVGAnimatedNumberList +class DOMSVGAnimatedNumberList MOZ_FINAL : public nsIDOMSVGAnimatedNumberList { friend class DOMSVGNumberList; diff --git a/content/svg/content/src/DOMSVGAnimatedTransformList.h b/content/svg/content/src/DOMSVGAnimatedTransformList.h index bdbfc3ed60b..840e0d6b68d 100644 --- a/content/svg/content/src/DOMSVGAnimatedTransformList.h +++ b/content/svg/content/src/DOMSVGAnimatedTransformList.h @@ -12,6 +12,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGAnimTransformList.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" namespace mozilla { @@ -34,7 +35,7 @@ class SVGAnimatedTransformList; * nulling out our pointers to them when they die (making our pointers to them * true weak refs). */ -class DOMSVGAnimatedTransformList : public nsIDOMSVGAnimatedTransformList +class DOMSVGAnimatedTransformList MOZ_FINAL : public nsIDOMSVGAnimatedTransformList { friend class DOMSVGTransformList; diff --git a/content/svg/content/src/DOMSVGLength.h b/content/svg/content/src/DOMSVGLength.h index dbf001e6149..be5bd226f2c 100644 --- a/content/svg/content/src/DOMSVGLength.h +++ b/content/svg/content/src/DOMSVGLength.h @@ -13,6 +13,7 @@ #include "nsIDOMSVGLength.h" #include "nsTArray.h" #include "SVGLength.h" +#include "mozilla/Attributes.h" class nsSVGElement; @@ -65,7 +66,7 @@ namespace mozilla { * if-else as appropriate. The bug for doing that work is: * https://bugzilla.mozilla.org/show_bug.cgi?id=571734 */ -class DOMSVGLength : public nsIDOMSVGLength +class DOMSVGLength MOZ_FINAL : public nsIDOMSVGLength { public: NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGLENGTH_IID) diff --git a/content/svg/content/src/DOMSVGLengthList.h b/content/svg/content/src/DOMSVGLengthList.h index fcff466c29f..696bfdfa962 100644 --- a/content/svg/content/src/DOMSVGLengthList.h +++ b/content/svg/content/src/DOMSVGLengthList.h @@ -13,6 +13,7 @@ #include "nsIDOMSVGLengthList.h" #include "nsTArray.h" #include "SVGLengthList.h" +#include "mozilla/Attributes.h" class nsIDOMSVGLength; class nsSVGElement; @@ -38,8 +39,8 @@ class DOMSVGLength; * * Our DOM items are created lazily on demand as and when script requests them. */ -class DOMSVGLengthList : public nsIDOMSVGLengthList, - public nsWrapperCache +class DOMSVGLengthList MOZ_FINAL : public nsIDOMSVGLengthList, + public nsWrapperCache { friend class DOMSVGLength; diff --git a/content/svg/content/src/DOMSVGMatrix.h b/content/svg/content/src/DOMSVGMatrix.h index b1da045cd38..46ad0aeeb6a 100644 --- a/content/svg/content/src/DOMSVGMatrix.h +++ b/content/svg/content/src/DOMSVGMatrix.h @@ -42,6 +42,7 @@ #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGMatrix.h" +#include "mozilla/Attributes.h" // We make DOMSVGMatrix a pseudo-interface to allow us to QI to it in order // to check that the objects that scripts pass in are our *native* matrix @@ -57,7 +58,7 @@ namespace mozilla { /** * DOM wrapper for an SVG matrix. */ -class DOMSVGMatrix : public nsIDOMSVGMatrix +class DOMSVGMatrix MOZ_FINAL : public nsIDOMSVGMatrix { public: NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGMATRIX_IID) diff --git a/content/svg/content/src/DOMSVGNumber.h b/content/svg/content/src/DOMSVGNumber.h index fc3731f5fdb..eca0ff7ddd1 100644 --- a/content/svg/content/src/DOMSVGNumber.h +++ b/content/svg/content/src/DOMSVGNumber.h @@ -11,6 +11,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGNumber.h" #include "nsTArray.h" +#include "mozilla/Attributes.h" class nsSVGElement; @@ -40,7 +41,7 @@ namespace mozilla { * * See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too. */ -class DOMSVGNumber : public nsIDOMSVGNumber +class DOMSVGNumber MOZ_FINAL : public nsIDOMSVGNumber { public: NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGNUMBER_IID) diff --git a/content/svg/content/src/DOMSVGNumberList.h b/content/svg/content/src/DOMSVGNumberList.h index 52b77fa2498..2a2ebaee6ba 100644 --- a/content/svg/content/src/DOMSVGNumberList.h +++ b/content/svg/content/src/DOMSVGNumberList.h @@ -13,6 +13,7 @@ #include "nsIDOMSVGNumberList.h" #include "nsTArray.h" #include "SVGNumberList.h" +#include "mozilla/Attributes.h" class nsSVGElement; @@ -37,8 +38,8 @@ class DOMSVGNumber; * * Our DOM items are created lazily on demand as and when script requests them. */ -class DOMSVGNumberList : public nsIDOMSVGNumberList, - public nsWrapperCache +class DOMSVGNumberList MOZ_FINAL : public nsIDOMSVGNumberList, + public nsWrapperCache { friend class DOMSVGNumber; diff --git a/content/svg/content/src/DOMSVGPathSegList.h b/content/svg/content/src/DOMSVGPathSegList.h index be04e50bda3..a9372bb6779 100644 --- a/content/svg/content/src/DOMSVGPathSegList.h +++ b/content/svg/content/src/DOMSVGPathSegList.h @@ -14,6 +14,7 @@ #include "nsSVGElement.h" #include "nsTArray.h" #include "SVGPathData.h" // IWYU pragma: keep +#include "mozilla/Attributes.h" class nsIDOMSVGPathSeg; @@ -47,8 +48,8 @@ class SVGAnimatedPathSegList; * * Our DOM items are created lazily on demand as and when script requests them. */ -class DOMSVGPathSegList : public nsIDOMSVGPathSegList, - public nsWrapperCache +class DOMSVGPathSegList MOZ_FINAL : public nsIDOMSVGPathSegList, + public nsWrapperCache { friend class DOMSVGPathSeg; diff --git a/content/svg/content/src/DOMSVGPoint.h b/content/svg/content/src/DOMSVGPoint.h index 12996d4567c..7da5af3fbe4 100644 --- a/content/svg/content/src/DOMSVGPoint.h +++ b/content/svg/content/src/DOMSVGPoint.h @@ -14,6 +14,7 @@ #include "nsIDOMSVGPoint.h" #include "nsTArray.h" #include "SVGPoint.h" +#include "mozilla/Attributes.h" class nsSVGElement; @@ -44,7 +45,7 @@ namespace mozilla { * See the architecture comment in DOMSVGLength.h (yes, LENGTH) for an overview * of the important points regarding how this specific class works. */ -class DOMSVGPoint : public nsIDOMSVGPoint +class DOMSVGPoint MOZ_FINAL : public nsIDOMSVGPoint { public: NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGPOINT_IID) diff --git a/content/svg/content/src/DOMSVGPointList.h b/content/svg/content/src/DOMSVGPointList.h index 3a73fa0f43c..7c99aa4a1ee 100644 --- a/content/svg/content/src/DOMSVGPointList.h +++ b/content/svg/content/src/DOMSVGPointList.h @@ -14,6 +14,7 @@ #include "nsSVGElement.h" #include "nsTArray.h" #include "SVGPointList.h" // IWYU pragma: keep +#include "mozilla/Attributes.h" class nsIDOMSVGPoint; @@ -47,8 +48,8 @@ class SVGAnimatedPointList; * * Our DOM items are created lazily on demand as and when script requests them. */ -class DOMSVGPointList : public nsIDOMSVGPointList, - public nsWrapperCache +class DOMSVGPointList MOZ_FINAL : public nsIDOMSVGPointList, + public nsWrapperCache { friend class DOMSVGPoint; diff --git a/content/svg/content/src/DOMSVGStringList.h b/content/svg/content/src/DOMSVGStringList.h index 6e2a186e89e..e6f866d71cd 100644 --- a/content/svg/content/src/DOMSVGStringList.h +++ b/content/svg/content/src/DOMSVGStringList.h @@ -11,6 +11,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMSVGStringList.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" namespace mozilla { @@ -42,7 +43,7 @@ class SVGStringList; * them so it can return the same objects each time. It simply returns a new * string each time any given item is requested. */ -class DOMSVGStringList : public nsIDOMSVGStringList +class DOMSVGStringList MOZ_FINAL : public nsIDOMSVGStringList { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/svg/content/src/DOMSVGTests.h b/content/svg/content/src/DOMSVGTests.h index d9d967ec927..836d5194b2b 100644 --- a/content/svg/content/src/DOMSVGTests.h +++ b/content/svg/content/src/DOMSVGTests.h @@ -24,6 +24,8 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMSVGTESTS + virtual ~DOMSVGTests() {} + friend class mozilla::DOMSVGStringList; typedef mozilla::SVGStringList SVGStringList; diff --git a/content/svg/content/src/DOMSVGTransform.h b/content/svg/content/src/DOMSVGTransform.h index 1d0dfdb5b47..0de96ec6d6e 100644 --- a/content/svg/content/src/DOMSVGTransform.h +++ b/content/svg/content/src/DOMSVGTransform.h @@ -15,6 +15,7 @@ #include "nsIDOMSVGTransform.h" #include "nsTArray.h" #include "SVGTransform.h" +#include "mozilla/Attributes.h" class nsSVGElement; @@ -38,7 +39,7 @@ class DOMSVGMatrix; /** * DOM wrapper for an SVG transform. See DOMSVGLength.h. */ -class DOMSVGTransform : public nsIDOMSVGTransform +class DOMSVGTransform MOZ_FINAL : public nsIDOMSVGTransform { public: NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGTRANSFORM_IID) diff --git a/content/svg/content/src/DOMSVGTransformList.h b/content/svg/content/src/DOMSVGTransformList.h index d860ef80c77..7a5f42c2e8f 100644 --- a/content/svg/content/src/DOMSVGTransformList.h +++ b/content/svg/content/src/DOMSVGTransformList.h @@ -14,6 +14,7 @@ #include "nsIDOMSVGTransformList.h" #include "nsTArray.h" #include "SVGTransformList.h" +#include "mozilla/Attributes.h" class nsIDOMSVGTransform; class nsSVGElement; @@ -30,8 +31,8 @@ class DOMSVGTransform; * * See the architecture comment in DOMSVGAnimatedTransformList.h. */ -class DOMSVGTransformList : public nsIDOMSVGTransformList, - public nsWrapperCache +class DOMSVGTransformList MOZ_FINAL : public nsIDOMSVGTransformList, + public nsWrapperCache { friend class DOMSVGTransform; diff --git a/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h b/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h index 470e959e295..375b3cc16e3 100644 --- a/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h +++ b/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h @@ -14,6 +14,7 @@ #include "nsIDOMSVGPresAspectRatio.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -147,7 +148,7 @@ private: nsSVGElement* aSVGElement); public: - struct DOMBaseVal : public nsIDOMSVGPreserveAspectRatio + struct DOMBaseVal MOZ_FINAL : public nsIDOMSVGPreserveAspectRatio { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal) @@ -169,7 +170,7 @@ public: { return mVal->SetBaseMeetOrSlice(aMeetOrSlice, mSVGElement); } }; - struct DOMAnimVal : public nsIDOMSVGPreserveAspectRatio + struct DOMAnimVal MOZ_FINAL : public nsIDOMSVGPreserveAspectRatio { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal) @@ -201,7 +202,7 @@ public: { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } }; - struct DOMAnimPAspectRatio : public nsIDOMSVGAnimatedPreserveAspectRatio + struct DOMAnimPAspectRatio MOZ_FINAL : public nsIDOMSVGAnimatedPreserveAspectRatio { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimPAspectRatio) @@ -222,7 +223,7 @@ public: { return mVal->ToDOMAnimVal(aAnimVal, mSVGElement); } }; - struct SMILPreserveAspectRatio : public nsISMILAttr + struct SMILPreserveAspectRatio MOZ_FINAL : public nsISMILAttr { public: SMILPreserveAspectRatio(SVGAnimatedPreserveAspectRatio* aVal, diff --git a/content/svg/content/src/nsSVGAngle.cpp b/content/svg/content/src/nsSVGAngle.cpp index 8beedb4d29c..f3ae3362c28 100644 --- a/content/svg/content/src/nsSVGAngle.cpp +++ b/content/svg/content/src/nsSVGAngle.cpp @@ -14,6 +14,7 @@ #include "nsContentUtils.h" // NS_ENSURE_FINITE #include "nsSMILValue.h" #include "SVGOrientSMILType.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -25,7 +26,7 @@ using namespace mozilla; * any DOMSVGAngle passed in. Perhaps this is wrong and inconsistent with * other parts of SVG, but it's how the code works for now. */ -class DOMSVGAngle : public nsIDOMSVGAngle +class DOMSVGAngle MOZ_FINAL : public nsIDOMSVGAngle { public: NS_DECL_ISUPPORTS diff --git a/content/svg/content/src/nsSVGAngle.h b/content/svg/content/src/nsSVGAngle.h index 6fef9e00b40..d9baff22a3f 100644 --- a/content/svg/content/src/nsSVGAngle.h +++ b/content/svg/content/src/nsSVGAngle.h @@ -14,6 +14,7 @@ #include "nsIDOMSVGAnimatedAngle.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -77,7 +78,7 @@ private: nsresult ToDOMAnimVal(nsIDOMSVGAngle **aResult, nsSVGElement* aSVGElement); public: - struct DOMBaseVal : public nsIDOMSVGAngle + struct DOMBaseVal MOZ_FINAL : public nsIDOMSVGAngle { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal) @@ -116,7 +117,7 @@ public: { return mVal->ConvertToSpecifiedUnits(unitType, mSVGElement); } }; - struct DOMAnimVal : public nsIDOMSVGAngle + struct DOMAnimVal MOZ_FINAL : public nsIDOMSVGAngle { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal) @@ -153,7 +154,7 @@ public: { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } }; - struct DOMAnimatedAngle : public nsIDOMSVGAnimatedAngle + struct DOMAnimatedAngle MOZ_FINAL : public nsIDOMSVGAnimatedAngle { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedAngle) @@ -176,7 +177,7 @@ public: // 'marker' element, and 'orient' must be special cased since it can also // take the value 'auto', making it a more complex type. - struct SMILOrient : public nsISMILAttr + struct SMILOrient MOZ_FINAL : public nsISMILAttr { public: SMILOrient(nsSVGOrientType* aOrientType, diff --git a/content/svg/content/src/nsSVGBoolean.h b/content/svg/content/src/nsSVGBoolean.h index 0e6c922b797..09cfa499588 100644 --- a/content/svg/content/src/nsSVGBoolean.h +++ b/content/svg/content/src/nsSVGBoolean.h @@ -13,6 +13,7 @@ #include "nsISMILAttr.h" #include "nsISupportsImpl.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -51,7 +52,7 @@ private: PRUint8 mAttrEnum; // element specified tracking for attribute public: - struct DOMAnimatedBoolean : public nsIDOMSVGAnimatedBoolean + struct DOMAnimatedBoolean MOZ_FINAL : public nsIDOMSVGAnimatedBoolean { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedBoolean) diff --git a/content/svg/content/src/nsSVGClass.h b/content/svg/content/src/nsSVGClass.h index 060d90a2541..9d2b966aab0 100644 --- a/content/svg/content/src/nsSVGClass.h +++ b/content/svg/content/src/nsSVGClass.h @@ -12,6 +12,7 @@ #include "nsIDOMSVGAnimatedString.h" #include "nsISMILAttr.h" #include "nsString.h" +#include "mozilla/Attributes.h" class nsSVGStylableElement; @@ -43,7 +44,7 @@ private: nsAutoPtr mAnimVal; public: - struct DOMAnimatedString : public nsIDOMSVGAnimatedString + struct DOMAnimatedString MOZ_FINAL : public nsIDOMSVGAnimatedString { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString) diff --git a/content/svg/content/src/nsSVGEnum.h b/content/svg/content/src/nsSVGEnum.h index c41c2cc76f4..d5c9298d5a4 100644 --- a/content/svg/content/src/nsSVGEnum.h +++ b/content/svg/content/src/nsSVGEnum.h @@ -12,6 +12,7 @@ #include "nsIDOMSVGAnimatedEnum.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsIAtom; class nsISMILAnimationElement; @@ -62,7 +63,7 @@ private: nsSVGEnumMapping *GetMapping(nsSVGElement *aSVGElement); public: - struct DOMAnimatedEnum : public nsIDOMSVGAnimatedEnumeration + struct DOMAnimatedEnum MOZ_FINAL : public nsIDOMSVGAnimatedEnumeration { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedEnum) diff --git a/content/svg/content/src/nsSVGInteger.h b/content/svg/content/src/nsSVGInteger.h index f301959d423..79adfc380f4 100644 --- a/content/svg/content/src/nsSVGInteger.h +++ b/content/svg/content/src/nsSVGInteger.h @@ -12,6 +12,7 @@ #include "nsIDOMSVGAnimatedInteger.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -61,7 +62,7 @@ private: bool mIsBaseSet; public: - struct DOMAnimatedInteger : public nsIDOMSVGAnimatedInteger + struct DOMAnimatedInteger MOZ_FINAL : public nsIDOMSVGAnimatedInteger { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedInteger) diff --git a/content/svg/content/src/nsSVGIntegerPair.h b/content/svg/content/src/nsSVGIntegerPair.h index 07abcfb50a5..3f1790b2235 100644 --- a/content/svg/content/src/nsSVGIntegerPair.h +++ b/content/svg/content/src/nsSVGIntegerPair.h @@ -12,6 +12,7 @@ #include "nsIDOMSVGAnimatedInteger.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -68,7 +69,7 @@ private: bool mIsBaseSet; public: - struct DOMAnimatedInteger : public nsIDOMSVGAnimatedInteger + struct DOMAnimatedInteger MOZ_FINAL : public nsIDOMSVGAnimatedInteger { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedInteger) diff --git a/content/svg/content/src/nsSVGMarkerElement.h b/content/svg/content/src/nsSVGMarkerElement.h index 8174f943622..6df409c9cda 100644 --- a/content/svg/content/src/nsSVGMarkerElement.h +++ b/content/svg/content/src/nsSVGMarkerElement.h @@ -15,6 +15,7 @@ #include "nsSVGLength2.h" #include "nsSVGViewBox.h" #include "SVGAnimatedPreserveAspectRatio.h" +#include "mozilla/Attributes.h" class nsSVGOrientType { @@ -46,7 +47,7 @@ private: nsSVGEnumValue mAnimVal; nsSVGEnumValue mBaseVal; - struct DOMAnimatedEnum : public nsIDOMSVGAnimatedEnumeration + struct DOMAnimatedEnum MOZ_FINAL : public nsIDOMSVGAnimatedEnumeration { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedEnum) diff --git a/content/svg/content/src/nsSVGNumber2.cpp b/content/svg/content/src/nsSVGNumber2.cpp index 23b6e4c75e8..3bb34feeb6c 100644 --- a/content/svg/content/src/nsSVGNumber2.cpp +++ b/content/svg/content/src/nsSVGNumber2.cpp @@ -12,8 +12,9 @@ #include "nsSMILValue.h" #include "nsSMILFloatType.h" #include "nsIDOMSVGNumber.h" +#include "mozilla/Attributes.h" -class DOMSVGNumber : public nsIDOMSVGNumber +class DOMSVGNumber MOZ_FINAL : public nsIDOMSVGNumber { public: NS_DECL_ISUPPORTS diff --git a/content/svg/content/src/nsSVGNumber2.h b/content/svg/content/src/nsSVGNumber2.h index d88c2db3c94..a3217133165 100644 --- a/content/svg/content/src/nsSVGNumber2.h +++ b/content/svg/content/src/nsSVGNumber2.h @@ -13,6 +13,7 @@ #include "nsISMILAttr.h" #include "nsMathUtils.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -61,7 +62,7 @@ private: bool mIsBaseSet; public: - struct DOMAnimatedNumber : public nsIDOMSVGAnimatedNumber + struct DOMAnimatedNumber MOZ_FINAL : public nsIDOMSVGAnimatedNumber { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedNumber) diff --git a/content/svg/content/src/nsSVGNumberPair.h b/content/svg/content/src/nsSVGNumberPair.h index baa40653af5..b099eb8ab7a 100644 --- a/content/svg/content/src/nsSVGNumberPair.h +++ b/content/svg/content/src/nsSVGNumberPair.h @@ -13,6 +13,7 @@ #include "nsISMILAttr.h" #include "nsMathUtils.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -69,7 +70,7 @@ private: bool mIsBaseSet; public: - struct DOMAnimatedNumber : public nsIDOMSVGAnimatedNumber + struct DOMAnimatedNumber MOZ_FINAL : public nsIDOMSVGAnimatedNumber { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedNumber) diff --git a/content/svg/content/src/nsSVGRect.h b/content/svg/content/src/nsSVGRect.h index c5395f3d88c..648d46d6768 100644 --- a/content/svg/content/src/nsSVGRect.h +++ b/content/svg/content/src/nsSVGRect.h @@ -8,6 +8,7 @@ #include "gfxRect.h" #include "nsIDOMSVGRect.h" +#include "mozilla/Attributes.h" nsresult NS_NewSVGRect(nsIDOMSVGRect** result, @@ -20,7 +21,7 @@ NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect); //////////////////////////////////////////////////////////////////////// // nsSVGRect class -class nsSVGRect : public nsIDOMSVGRect +class nsSVGRect MOZ_FINAL : public nsIDOMSVGRect { public: nsSVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f); diff --git a/content/svg/content/src/nsSVGSVGElement.h b/content/svg/content/src/nsSVGSVGElement.h index e4c26f45d77..267f72982a7 100644 --- a/content/svg/content/src/nsSVGSVGElement.h +++ b/content/svg/content/src/nsSVGSVGElement.h @@ -18,6 +18,7 @@ #include "nsSVGStylableElement.h" #include "nsSVGViewBox.h" #include "SVGAnimatedPreserveAspectRatio.h" +#include "mozilla/Attributes.h" class nsIDOMSVGMatrix; class nsSMILTimeContainer; @@ -59,7 +60,7 @@ public: private: - struct DOMVal : public nsIDOMSVGPoint { + struct DOMVal MOZ_FINAL : public nsIDOMSVGPoint { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMVal) diff --git a/content/svg/content/src/nsSVGString.h b/content/svg/content/src/nsSVGString.h index 15d78c260c4..f2f508831f8 100644 --- a/content/svg/content/src/nsSVGString.h +++ b/content/svg/content/src/nsSVGString.h @@ -9,6 +9,7 @@ #include "nsDOMError.h" #include "nsIDOMSVGAnimatedString.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsSVGString { @@ -49,7 +50,7 @@ private: bool mIsBaseSet; public: - struct DOMAnimatedString : public nsIDOMSVGAnimatedString + struct DOMAnimatedString MOZ_FINAL : public nsIDOMSVGAnimatedString { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString) diff --git a/content/svg/content/src/nsSVGViewBox.h b/content/svg/content/src/nsSVGViewBox.h index c3ec84f5d6e..226ea7440c2 100644 --- a/content/svg/content/src/nsSVGViewBox.h +++ b/content/svg/content/src/nsSVGViewBox.h @@ -14,6 +14,7 @@ #include "nsIDOMSVGRect.h" #include "nsISMILAttr.h" #include "nsSVGElement.h" +#include "mozilla/Attributes.h" class nsISMILAnimationElement; class nsSMILValue; @@ -78,7 +79,7 @@ private: nsAutoPtr mAnimVal; bool mHasBaseVal; - struct DOMBaseVal : public nsIDOMSVGRect + struct DOMBaseVal MOZ_FINAL : public nsIDOMSVGRect { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal) @@ -104,7 +105,7 @@ private: NS_IMETHOD SetHeight(float aHeight); }; - struct DOMAnimVal : public nsIDOMSVGRect + struct DOMAnimVal MOZ_FINAL : public nsIDOMSVGRect { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal) @@ -153,7 +154,7 @@ private: }; public: - struct DOMAnimatedRect : public nsIDOMSVGAnimatedRect + struct DOMAnimatedRect MOZ_FINAL : public nsIDOMSVGAnimatedRect { NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedRect) diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 5d9145c6be4..9cd4ee2812c 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -53,6 +53,7 @@ #include "nsIDOMEventListener.h" #include "mozilla/Preferences.h" #include "mozilla/dom/Element.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -182,7 +183,8 @@ static const PRInt32 kInitialSize = sizeof(nsXBLBindingRequest) * kNumElements; // nsXBLStreamListener, a helper class used for // asynchronous parsing of URLs /* Header file */ -class nsXBLStreamListener : public nsIStreamListener, public nsIDOMEventListener +class nsXBLStreamListener MOZ_FINAL : public nsIStreamListener, + public nsIDOMEventListener { public: NS_DECL_ISUPPORTS diff --git a/content/xslt/src/xpath/nsXPathEvaluator.h b/content/xslt/src/xpath/nsXPathEvaluator.h index 691b5f95187..3324249ca25 100644 --- a/content/xslt/src/xpath/nsXPathEvaluator.h +++ b/content/xslt/src/xpath/nsXPathEvaluator.h @@ -14,12 +14,13 @@ #include "txResultRecycler.h" #include "nsAgg.h" #include "nsTArray.h" +#include "mozilla/Attributes.h" /** * A class for evaluating an XPath expression string */ -class nsXPathEvaluator : public nsIDOMXPathEvaluator, - public nsIXPathEvaluatorInternal +class nsXPathEvaluator MOZ_FINAL : public nsIDOMXPathEvaluator, + public nsIXPathEvaluatorInternal { public: nsXPathEvaluator(nsISupports *aOuter); diff --git a/content/xslt/src/xpath/nsXPathExpression.h b/content/xslt/src/xpath/nsXPathExpression.h index 1a98f41922e..a54f8e651e4 100644 --- a/content/xslt/src/xpath/nsXPathExpression.h +++ b/content/xslt/src/xpath/nsXPathExpression.h @@ -12,6 +12,7 @@ #include "txResultRecycler.h" #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" class Expr; class txXPathNode; @@ -19,8 +20,8 @@ class txXPathNode; /** * A class for evaluating an XPath expression string */ -class nsXPathExpression : public nsIDOMXPathExpression, - public nsIDOMNSXPathExpression +class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression, + public nsIDOMNSXPathExpression { public: nsXPathExpression(nsAutoPtr& aExpression, txResultRecycler* aRecycler, diff --git a/content/xslt/src/xpath/nsXPathNSResolver.h b/content/xslt/src/xpath/nsXPathNSResolver.h index 12a69f840b8..88b7d0680e2 100644 --- a/content/xslt/src/xpath/nsXPathNSResolver.h +++ b/content/xslt/src/xpath/nsXPathNSResolver.h @@ -10,11 +10,12 @@ #include "nsIDOMNode.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" /** * A class for evaluating an XPath expression string */ -class nsXPathNSResolver : public nsIDOMXPathNSResolver +class nsXPathNSResolver MOZ_FINAL : public nsIDOMXPathNSResolver { public: nsXPathNSResolver(nsIDOMNode* aNode); diff --git a/content/xslt/src/xpath/nsXPathResult.h b/content/xslt/src/xpath/nsXPathResult.h index 3ced114c45e..34618d0da09 100644 --- a/content/xslt/src/xpath/nsXPathResult.h +++ b/content/xslt/src/xpath/nsXPathResult.h @@ -14,6 +14,7 @@ #include "nsCOMArray.h" #include "nsWeakPtr.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" // {662f2c9a-c7cd-4cab-9349-e733df5a838c} #define NS_IXPATHRESULT_IID \ @@ -35,9 +36,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIXPathResult, NS_IXPATHRESULT_IID) /** * A class for evaluating an XPath expression string */ -class nsXPathResult : public nsIDOMXPathResult, - public nsStubMutationObserver, - public nsIXPathResult +class nsXPathResult MOZ_FINAL : public nsIDOMXPathResult, + public nsStubMutationObserver, + public nsIXPathResult { public: nsXPathResult(); diff --git a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp index 2a075e2bc07..a7a8b52645c 100644 --- a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp +++ b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp @@ -16,10 +16,11 @@ #include "txXPathTreeWalker.h" #include "xptcall.h" #include "txXPathObjectAdaptor.h" +#include "mozilla/Attributes.h" NS_IMPL_ISUPPORTS1(txXPathObjectAdaptor, txIXPathObject) -class txFunctionEvaluationContext : public txIFunctionEvaluationContext +class txFunctionEvaluationContext MOZ_FINAL : public txIFunctionEvaluationContext { public: txFunctionEvaluationContext(txIEvalContext *aContext, nsISupports *aState); diff --git a/content/xslt/src/xpath/txXPathObjectAdaptor.h b/content/xslt/src/xpath/txXPathObjectAdaptor.h index da2677c80e7..acc1b50d003 100644 --- a/content/xslt/src/xpath/txXPathObjectAdaptor.h +++ b/content/xslt/src/xpath/txXPathObjectAdaptor.h @@ -24,6 +24,7 @@ public: "Don't create a txXPathObjectAdaptor if you don't have a " "txAExprResult"); } + virtual ~txXPathObjectAdaptor() {} NS_DECL_ISUPPORTS diff --git a/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp b/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp index 7d2c74d864d..c5373debc0d 100644 --- a/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp +++ b/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp @@ -40,6 +40,7 @@ #include "nsCrossSiteListenerProxy.h" #include "nsDOMError.h" #include "mozilla/dom/Element.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -63,10 +64,10 @@ getSpec(nsIChannel* aChannel, nsAString& aSpec) AppendUTF8toUTF16(spec, aSpec); } -class txStylesheetSink : public nsIXMLContentSink, - public nsIExpatSink, - public nsIStreamListener, - public nsIInterfaceRequestor +class txStylesheetSink MOZ_FINAL : public nsIXMLContentSink, + public nsIExpatSink, + public nsIStreamListener, + public nsIInterfaceRequestor { public: txStylesheetSink(txStylesheetCompiler* aCompiler, nsIParser* aParser); @@ -363,7 +364,7 @@ txStylesheetSink::GetInterface(const nsIID& aIID, void** aResult) return NS_ERROR_NO_INTERFACE; } -class txCompileObserver : public txACompileObserver +class txCompileObserver MOZ_FINAL : public txACompileObserver { public: txCompileObserver(txMozillaXSLTProcessor* aProcessor, @@ -596,7 +597,7 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler) return NS_OK; } -class txSyncCompileObserver : public txACompileObserver +class txSyncCompileObserver MOZ_FINAL : public txACompileObserver { public: txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor); diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.h b/content/xslt/src/xslt/txMozillaXMLOutput.h index ed72d4c9858..130a8ab4f27 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.h +++ b/content/xslt/src/xslt/txMozillaXMLOutput.h @@ -13,6 +13,7 @@ #include "nsCOMArray.h" #include "nsICSSLoaderObserver.h" #include "txStack.h" +#include "mozilla/Attributes.h" class nsIContent; class nsIDOMDocument; @@ -26,8 +27,8 @@ class nsNodeInfoManager; class nsIDocument; class nsINode; -class txTransformNotifier : public nsIScriptLoaderObserver, - public nsICSSLoaderObserver +class txTransformNotifier MOZ_FINAL : public nsIScriptLoaderObserver, + public nsICSSLoaderObserver { public: txTransformNotifier(); diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.h b/content/xslt/src/xslt/txMozillaXSLTProcessor.h index 08813e2cfea..3a867df8840 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.h +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.h @@ -15,6 +15,7 @@ #include "txNamespaceMap.h" #include "nsIJSNativeInitializer.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" class nsIDOMNode; class nsIPrincipal; @@ -36,11 +37,11 @@ class txIGlobalParameter; /** * txMozillaXSLTProcessor is a front-end to the XSLT Processor. */ -class txMozillaXSLTProcessor : public nsIXSLTProcessor, - public nsIXSLTProcessorPrivate, - public nsIDocumentTransformer, - public nsStubMutationObserver, - public nsIJSNativeInitializer +class txMozillaXSLTProcessor MOZ_FINAL : public nsIXSLTProcessor, + public nsIXSLTProcessorPrivate, + public nsIDocumentTransformer, + public nsStubMutationObserver, + public nsIJSNativeInitializer { public: /** diff --git a/content/xtf/src/nsXMLContentBuilder.cpp b/content/xtf/src/nsXMLContentBuilder.cpp index 3d969174bbb..6abe074841d 100644 --- a/content/xtf/src/nsXMLContentBuilder.cpp +++ b/content/xtf/src/nsXMLContentBuilder.cpp @@ -20,10 +20,11 @@ #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" #include "nsContentUtils.h" +#include "mozilla/Attributes.h" static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); -class nsXMLContentBuilder : public nsIXMLContentBuilder +class nsXMLContentBuilder MOZ_FINAL : public nsIXMLContentBuilder { protected: friend nsresult NS_NewXMLContentBuilder(nsIXMLContentBuilder** aResult); diff --git a/content/xtf/src/nsXTFElementWrapper.h b/content/xtf/src/nsXTFElementWrapper.h index 008fb3ae20e..5dc4fc73659 100644 --- a/content/xtf/src/nsXTFElementWrapper.h +++ b/content/xtf/src/nsXTFElementWrapper.h @@ -10,6 +10,7 @@ #include "nsXMLElement.h" #include "nsIXTFAttributeHandler.h" #include "nsIXTFElement.h" +#include "mozilla/Attributes.h" typedef nsXMLElement nsXTFElementWrapperBase; class nsXTFClassInfo; @@ -166,7 +167,7 @@ protected: NS_DEFINE_STATIC_IID_ACCESSOR(nsXTFElementWrapper, NS_XTFELEMENTWRAPPER_IID) -class nsXTFClassInfo : public nsXPCClassInfo +class nsXTFClassInfo MOZ_FINAL : public nsXPCClassInfo { public: nsXTFClassInfo(nsXTFElementWrapper* aWrapper) : mWrapper(aWrapper) {} diff --git a/content/xtf/src/nsXTFInterfaceAggregator.cpp b/content/xtf/src/nsXTFInterfaceAggregator.cpp index 56592d0d4b8..0a1a135b029 100644 --- a/content/xtf/src/nsXTFInterfaceAggregator.cpp +++ b/content/xtf/src/nsXTFInterfaceAggregator.cpp @@ -9,6 +9,7 @@ #include "nsIInterfaceInfoManager.h" #include "nsServiceManagerUtils.h" #include "nsAutoPtr.h" +#include "mozilla/Attributes.h" #ifdef DEBUG #include #endif @@ -16,7 +17,7 @@ //////////////////////////////////////////////////////////////////////// // nsXTFInterfaceAggregator class -class nsXTFInterfaceAggregator : protected nsAutoXPTCStub +class nsXTFInterfaceAggregator MOZ_FINAL : protected nsAutoXPTCStub { protected: friend nsresult diff --git a/content/xtf/src/nsXTFService.cpp b/content/xtf/src/nsXTFService.cpp index c3f063c5faf..ed5e67a8dd9 100644 --- a/content/xtf/src/nsXTFService.cpp +++ b/content/xtf/src/nsXTFService.cpp @@ -12,11 +12,12 @@ #include "nsInterfaceHashtable.h" #include "nsString.h" #include "nsXTFElementWrapper.h" +#include "mozilla/Attributes.h" //////////////////////////////////////////////////////////////////////// // nsXTFService class -class nsXTFService : public nsIXTFService +class nsXTFService MOZ_FINAL : public nsIXTFService { protected: friend nsresult NS_NewXTFService(nsIXTFService** aResult); diff --git a/content/xtf/src/nsXTFWeakTearoff.cpp b/content/xtf/src/nsXTFWeakTearoff.cpp index 14a04c6c699..d2acfc1d788 100644 --- a/content/xtf/src/nsXTFWeakTearoff.cpp +++ b/content/xtf/src/nsXTFWeakTearoff.cpp @@ -9,6 +9,7 @@ #include "nsIInterfaceInfoManager.h" #include "nsServiceManagerUtils.h" #include "nsAutoPtr.h" +#include "mozilla/Attributes.h" #ifdef DEBUG #include #endif @@ -16,7 +17,7 @@ //////////////////////////////////////////////////////////////////////// // nsXTFWeakTearoff class -class nsXTFWeakTearoff : protected nsAutoXPTCStub +class nsXTFWeakTearoff MOZ_FINAL : protected nsAutoXPTCStub { protected: ~nsXTFWeakTearoff(); diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 924e3b9a2ed..2a333f35c7c 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -87,6 +87,7 @@ #include "rdf.h" #include "nsIControllers.h" #include "nsAttrValueOrString.h" +#include "mozilla/Attributes.h" // The XUL doc interface #include "nsIDOMXULDocument.h" @@ -106,7 +107,7 @@ namespace css = mozilla::css; /** * A tearoff class for nsXULElement to implement nsIScriptEventHandlerOwner. */ -class nsScriptEventHandlerOwnerTearoff : public nsIScriptEventHandlerOwner +class nsScriptEventHandlerOwnerTearoff MOZ_FINAL : public nsIScriptEventHandlerOwner { public: nsScriptEventHandlerOwnerTearoff(nsXULElement* aElement) @@ -145,8 +146,8 @@ PRUint32 nsXULPrototypeAttribute::gNumCacheSets; PRUint32 nsXULPrototypeAttribute::gNumCacheFills; #endif -class nsXULElementTearoff : public nsIDOMElementCSSInlineStyle, - public nsIFrameLoaderOwner +class nsXULElementTearoff MOZ_FINAL : public nsIDOMElementCSSInlineStyle, + public nsIFrameLoaderOwner { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/xul/templates/src/nsRDFQuery.h b/content/xul/templates/src/nsRDFQuery.h index 09b7fe38215..5aa4ded9642 100644 --- a/content/xul/templates/src/nsRDFQuery.h +++ b/content/xul/templates/src/nsRDFQuery.h @@ -9,6 +9,7 @@ #include "nsAutoPtr.h" #include "nsISimpleEnumerator.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" #define NS_ITEMPLATERDFQUERY_IID \ {0x8929ff60, 0x1c9c, 0x4d87, \ @@ -36,7 +37,7 @@ public: virtual void ClearCachedResults() = 0; }; -class nsRDFQuery : public nsITemplateRDFQuery +class nsRDFQuery MOZ_FINAL : public nsITemplateRDFQuery { public: diff --git a/content/xul/templates/src/nsXMLBinding.h b/content/xul/templates/src/nsXMLBinding.h index 4c2e302f54e..77afe9955e0 100644 --- a/content/xul/templates/src/nsXMLBinding.h +++ b/content/xul/templates/src/nsXMLBinding.h @@ -9,6 +9,7 @@ #include "nsAutoPtr.h" #include "nsIAtom.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" class nsXULTemplateResultXML; class nsXMLBindingValues; @@ -42,7 +43,7 @@ struct nsXMLBinding { * a collection of descriptors. This object is refcounted by * nsXMLBindingValues objects and the query processor. */ -class nsXMLBindingSet +class nsXMLBindingSet MOZ_FINAL { public: diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h index fadad444666..35b98ef44d6 100644 --- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h +++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h @@ -30,6 +30,7 @@ #include "nsClassHashtable.h" #include "nsRefPtrHashtable.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" #include "prlog.h" #ifdef PR_LOGGING @@ -42,8 +43,8 @@ class nsXULTemplateResultRDF; /** * An object that generates results from a query on an RDF graph */ -class nsXULTemplateQueryProcessorRDF : public nsIXULTemplateQueryProcessor, - public nsIRDFObserver +class nsXULTemplateQueryProcessorRDF MOZ_FINAL : public nsIXULTemplateQueryProcessor, + public nsIRDFObserver { public: diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorStorage.h b/content/xul/templates/src/nsXULTemplateQueryProcessorStorage.h index 4cbd7a90473..609d35c7e90 100644 --- a/content/xul/templates/src/nsXULTemplateQueryProcessorStorage.h +++ b/content/xul/templates/src/nsXULTemplateQueryProcessorStorage.h @@ -16,10 +16,11 @@ #include "mozIStorageValueArray.h" #include "mozIStorageStatement.h" #include "mozIStorageConnection.h" +#include "mozilla/Attributes.h" class nsXULTemplateQueryProcessorStorage; -class nsXULTemplateResultSetStorage : public nsISimpleEnumerator +class nsXULTemplateResultSetStorage MOZ_FINAL : public nsISimpleEnumerator { private: @@ -43,7 +44,7 @@ public: }; -class nsXULTemplateQueryProcessorStorage : public nsIXULTemplateQueryProcessor +class nsXULTemplateQueryProcessorStorage MOZ_FINAL : public nsIXULTemplateQueryProcessor { public: diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorXML.h b/content/xul/templates/src/nsXULTemplateQueryProcessorXML.h index 5d35c3c9030..5972d94ac71 100644 --- a/content/xul/templates/src/nsXULTemplateQueryProcessorXML.h +++ b/content/xul/templates/src/nsXULTemplateQueryProcessorXML.h @@ -21,6 +21,7 @@ #include "nsXMLBinding.h" #include "nsCycleCollectionParticipant.h" #include "nsIXMLHttpRequest.h" +#include "mozilla/Attributes.h" class nsXULTemplateQueryProcessorXML; @@ -28,7 +29,7 @@ class nsXULTemplateQueryProcessorXML; {0x0358d692, 0xccce, 0x4a97, \ { 0xb2, 0x51, 0xba, 0x8f, 0x17, 0x0f, 0x3b, 0x6f }} -class nsXMLQuery : public nsISupports +class nsXMLQuery MOZ_FINAL : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXMLQUERY_IID) @@ -79,7 +80,7 @@ class nsXMLQuery : public nsISupports NS_DEFINE_STATIC_IID_ACCESSOR(nsXMLQuery, NS_IXMLQUERY_IID) -class nsXULTemplateResultSetXML : public nsISimpleEnumerator +class nsXULTemplateResultSetXML MOZ_FINAL : public nsISimpleEnumerator { private: @@ -113,8 +114,8 @@ public: {} }; -class nsXULTemplateQueryProcessorXML : public nsIXULTemplateQueryProcessor, - public nsIDOMEventListener +class nsXULTemplateQueryProcessorXML MOZ_FINAL : public nsIXULTemplateQueryProcessor, + public nsIDOMEventListener { public: diff --git a/content/xul/templates/src/nsXULTemplateResultRDF.h b/content/xul/templates/src/nsXULTemplateResultRDF.h index 8a916c13678..037baa45b5c 100644 --- a/content/xul/templates/src/nsXULTemplateResultRDF.h +++ b/content/xul/templates/src/nsXULTemplateResultRDF.h @@ -13,11 +13,12 @@ #include "nsRuleNetwork.h" #include "nsIXULTemplateResult.h" #include "nsRDFBinding.h" +#include "mozilla/Attributes.h" /** * A single result of a query on an RDF graph */ -class nsXULTemplateResultRDF : public nsIXULTemplateResult +class nsXULTemplateResultRDF MOZ_FINAL : public nsIXULTemplateResult { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/xul/templates/src/nsXULTemplateResultSetRDF.h b/content/xul/templates/src/nsXULTemplateResultSetRDF.h index 27b8bf64375..4bc990188ba 100644 --- a/content/xul/templates/src/nsXULTemplateResultSetRDF.h +++ b/content/xul/templates/src/nsXULTemplateResultSetRDF.h @@ -11,6 +11,7 @@ #include "nsRuleNetwork.h" #include "nsRDFQuery.h" #include "nsXULTemplateResultRDF.h" +#include "mozilla/Attributes.h" class nsXULTemplateQueryProcessorRDF; class nsXULTemplateResultRDF; @@ -18,7 +19,7 @@ class nsXULTemplateResultRDF; /** * An enumerator used to iterate over a set of results. */ -class nsXULTemplateResultSetRDF : public nsISimpleEnumerator +class nsXULTemplateResultSetRDF MOZ_FINAL : public nsISimpleEnumerator { private: nsXULTemplateQueryProcessorRDF* mProcessor; diff --git a/content/xul/templates/src/nsXULTemplateResultStorage.h b/content/xul/templates/src/nsXULTemplateResultStorage.h index e8685b73804..308c93b58ab 100644 --- a/content/xul/templates/src/nsXULTemplateResultStorage.h +++ b/content/xul/templates/src/nsXULTemplateResultStorage.h @@ -10,11 +10,12 @@ #include "nsIRDFResource.h" #include "nsIXULTemplateResult.h" #include "nsAutoPtr.h" +#include "mozilla/Attributes.h" /** * A single result of a query from mozstorage */ -class nsXULTemplateResultStorage : public nsIXULTemplateResult +class nsXULTemplateResultStorage MOZ_FINAL : public nsIXULTemplateResult { public: NS_DECL_ISUPPORTS diff --git a/content/xul/templates/src/nsXULTemplateResultXML.h b/content/xul/templates/src/nsXULTemplateResultXML.h index 0c2180395b9..f54985323f2 100644 --- a/content/xul/templates/src/nsXULTemplateResultXML.h +++ b/content/xul/templates/src/nsXULTemplateResultXML.h @@ -11,11 +11,12 @@ #include "nsIRDFResource.h" #include "nsXULTemplateQueryProcessorXML.h" #include "nsIXULTemplateResult.h" +#include "mozilla/Attributes.h" /** * An single result of an query */ -class nsXULTemplateResultXML : public nsIXULTemplateResult +class nsXULTemplateResultXML MOZ_FINAL : public nsIXULTemplateResult { public: NS_DECL_ISUPPORTS diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index aeaf345da2d..d5e3931ae48 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -12,6 +12,7 @@ #include "nsIAnonymousContentCreator.h" #include "nsICapturePicker.h" #include "nsCOMPtr.h" +#include "mozilla/Attributes.h" class nsTextControlFrame; class nsIDOMDragEvent; @@ -77,7 +78,7 @@ protected: class MouseListener; friend class MouseListener; - class MouseListener : public nsIDOMEventListener { + class MouseListener MOZ_FINAL : public nsIDOMEventListener { public: NS_DECL_ISUPPORTS diff --git a/layout/printing/nsPagePrintTimer.h b/layout/printing/nsPagePrintTimer.h index 517e590a809..90869677e8f 100644 --- a/layout/printing/nsPagePrintTimer.h +++ b/layout/printing/nsPagePrintTimer.h @@ -10,13 +10,14 @@ #include "nsIDocumentViewerPrint.h" #include "nsPrintObject.h" +#include "mozilla/Attributes.h" class nsPrintEngine; //--------------------------------------------------- //-- Page Timer Class //--------------------------------------------------- -class nsPagePrintTimer : public nsITimerCallback +class nsPagePrintTimer MOZ_FINAL : public nsITimerCallback { public: diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index d370482af7e..8b46e1eeca0 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -12,6 +12,7 @@ #include "nsPrintObject.h" #include "nsPrintData.h" #include "nsFrameList.h" +#include "mozilla/Attributes.h" // Interfaces #include "nsIDocument.h" @@ -32,7 +33,7 @@ class nsIWeakReference; // nsPrintEngine Class // //------------------------------------------------------------------------ -class nsPrintEngine : public nsIObserver +class nsPrintEngine MOZ_FINAL : public nsIObserver { public: // nsISupports interface... diff --git a/layout/printing/nsPrintPreviewListener.h b/layout/printing/nsPrintPreviewListener.h index da35c076c5f..92275f6d860 100644 --- a/layout/printing/nsPrintPreviewListener.h +++ b/layout/printing/nsPrintPreviewListener.h @@ -12,6 +12,7 @@ #include "nsIDOMEventTarget.h" // Helper Classes #include "nsCOMPtr.h" +#include "mozilla/Attributes.h" // // class nsPrintPreviewListener @@ -21,7 +22,7 @@ // with the DOM with AddChromeListeners() and removing itself with // RemoveChromeListeners(). // -class nsPrintPreviewListener : public nsIDOMEventListener +class nsPrintPreviewListener MOZ_FINAL : public nsIDOMEventListener { public: diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 974d4022cbd..04ddb6afc23 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -15,6 +15,7 @@ #include "mozilla/dom/Element.h" #include "nsSMILKeySpline.h" #include "nsStyleStruct.h" +#include "mozilla/Attributes.h" class nsPresContext; @@ -66,7 +67,7 @@ protected: /** * A style rule that maps property-nsStyleAnimation::Value pairs. */ -class AnimValuesStyleRule : public nsIStyleRule +class AnimValuesStyleRule MOZ_FINAL : public nsIStyleRule { public: // nsISupports implementation diff --git a/layout/style/Loader.h b/layout/style/Loader.h index 559a7d7755b..42361d176f3 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -18,6 +18,7 @@ #include "nsTArray.h" #include "nsTObserverArray.h" #include "nsURIHashKey.h" +#include "mozilla/Attributes.h" class nsIAtom; class nsICSSLoaderObserver; @@ -106,7 +107,7 @@ enum StyleSheetState { eSheetComplete }; -class Loader { +class Loader MOZ_FINAL { public: Loader(); Loader(nsIDocument*); diff --git a/layout/xul/base/src/tree/src/nsTreeColumns.h b/layout/xul/base/src/tree/src/nsTreeColumns.h index efdef849e58..f7bd836edc4 100644 --- a/layout/xul/base/src/tree/src/nsTreeColumns.h +++ b/layout/xul/base/src/tree/src/nsTreeColumns.h @@ -10,6 +10,7 @@ #include "nsITreeBoxObject.h" #include "nsIContent.h" #include "nsIFrame.h" +#include "mozilla/Attributes.h" class nsTreeBodyFrame; class nsTreeColumns; @@ -24,7 +25,7 @@ class nsTreeColumns; // This class is our column info. We use it to iterate our columns and to obtain // information about each column. -class nsTreeColumn : public nsITreeColumn { +class nsTreeColumn MOZ_FINAL : public nsITreeColumn { public: nsTreeColumn(nsTreeColumns* aColumns, nsIContent* aContent); ~nsTreeColumn(); @@ -110,7 +111,7 @@ private: NS_DEFINE_STATIC_IID_ACCESSOR(nsTreeColumn, NS_TREECOLUMN_IMPL_CID) -class nsTreeColumns : public nsITreeColumns { +class nsTreeColumns MOZ_FINAL : public nsITreeColumns { public: nsTreeColumns(nsITreeBoxObject* aTree); ~nsTreeColumns(); diff --git a/layout/xul/base/src/tree/src/nsTreeContentView.h b/layout/xul/base/src/tree/src/nsTreeContentView.h index 26006a40286..25622994fb2 100644 --- a/layout/xul/base/src/tree/src/nsTreeContentView.h +++ b/layout/xul/base/src/tree/src/nsTreeContentView.h @@ -15,14 +15,15 @@ #include "nsITreeView.h" #include "nsITreeContentView.h" #include "nsITreeSelection.h" +#include "mozilla/Attributes.h" class Row; nsresult NS_NewTreeContentView(nsITreeView** aResult); -class nsTreeContentView : public nsINativeTreeView, - public nsITreeContentView, - public nsStubDocumentObserver +class nsTreeContentView MOZ_FINAL : public nsINativeTreeView, + public nsITreeContentView, + public nsStubDocumentObserver { public: nsTreeContentView(void); diff --git a/layout/xul/base/src/tree/src/nsTreeImageListener.h b/layout/xul/base/src/tree/src/nsTreeImageListener.h index 2b36bc885eb..d5af585ac1c 100644 --- a/layout/xul/base/src/tree/src/nsTreeImageListener.h +++ b/layout/xul/base/src/tree/src/nsTreeImageListener.h @@ -11,9 +11,10 @@ #include "nsITreeColumns.h" #include "nsStubImageDecoderObserver.h" #include "nsTreeBodyFrame.h" +#include "mozilla/Attributes.h" // This class handles image load observation. -class nsTreeImageListener : public nsStubImageDecoderObserver +class nsTreeImageListener MOZ_FINAL : public nsStubImageDecoderObserver { public: nsTreeImageListener(nsTreeBodyFrame *aTreeFrame); From 217735f7256375dc9423af43592867449a0453d0 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 23:26:34 -0400 Subject: [PATCH 18/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (layout parts); r=roc --HG-- extra : rebase_source : 9f3da1b47dcb9d7cc950488b9b70aa682b6984de --- gfx/tests/gfxWordCacheTest.cpp | 3 ++- layout/base/nsFrameTraversal.cpp | 2 ++ layout/base/nsLayoutHistoryState.cpp | 5 +++-- layout/base/nsPresShell.h | 3 ++- layout/base/nsRefreshDriver.h | 3 ++- layout/base/nsStyleSheetService.h | 3 ++- layout/build/nsLayoutModule.cpp | 3 ++- layout/forms/nsFileControlFrame.h | 4 ++-- layout/forms/nsListControlFrame.cpp | 3 ++- layout/generic/nsAutoCopyListener.h | 3 ++- layout/generic/nsGfxScrollFrame.cpp | 5 +++-- layout/generic/nsImageFrame.h | 5 +++-- layout/generic/nsTextFrameThebes.cpp | 3 ++- layout/mathml/nsMathMLmactionFrame.h | 3 ++- layout/style/nsDOMMediaQueryList.h | 5 +++-- layout/style/nsHTMLCSSStyleSheet.h | 4 ++-- layout/style/nsHTMLStyleSheet.h | 15 ++++++++++----- layout/style/nsIMediaList.h | 3 ++- layout/style/nsLayoutStylesheetCache.h | 3 ++- layout/style/nsStyleSet.h | 5 +++-- layout/xul/base/public/nsXULPopupManager.h | 9 +++++---- layout/xul/base/src/nsMenuFrame.h | 3 ++- layout/xul/base/src/nsXULTooltipListener.h | 3 ++- layout/xul/base/src/tree/src/nsTreeSelection.h | 3 ++- 24 files changed, 64 insertions(+), 37 deletions(-) diff --git a/gfx/tests/gfxWordCacheTest.cpp b/gfx/tests/gfxWordCacheTest.cpp index 70bed86c136..16838ec7594 100644 --- a/gfx/tests/gfxWordCacheTest.cpp +++ b/gfx/tests/gfxWordCacheTest.cpp @@ -15,6 +15,7 @@ #include "gfxPlatform.h" #include "gfxFontTest.h" +#include "mozilla/Attributes.h" #if defined(XP_MACOSX) #include "gfxTestCocoaHelper.h" @@ -31,7 +32,7 @@ static FrameTextRunCache *gTextRuns = nsnull; /* * Cache textruns and expire them after 3*10 seconds of no use. */ -class FrameTextRunCache : public nsExpirationTracker { +class FrameTextRunCache MOZ_FINAL : public nsExpirationTracker { public: enum { TIMEOUT_SECONDS = 10 }; FrameTextRunCache() diff --git a/layout/base/nsFrameTraversal.cpp b/layout/base/nsFrameTraversal.cpp index a0dc0ab2260..dc4fd4b8223 100644 --- a/layout/base/nsFrameTraversal.cpp +++ b/layout/base/nsFrameTraversal.cpp @@ -17,6 +17,8 @@ public: NS_DECL_ISUPPORTS + virtual ~nsFrameIterator() {} + virtual void First(); virtual void Next(); virtual nsIFrame* CurrentItem(); diff --git a/layout/base/nsLayoutHistoryState.cpp b/layout/base/nsLayoutHistoryState.cpp index 31aedd928af..9751b50851f 100644 --- a/layout/base/nsLayoutHistoryState.cpp +++ b/layout/base/nsLayoutHistoryState.cpp @@ -12,9 +12,10 @@ #include "nsWeakReference.h" #include "nsClassHashtable.h" #include "nsPresState.h" +#include "mozilla/Attributes.h" -class nsLayoutHistoryState : public nsILayoutHistoryState, - public nsSupportsWeakReference +class nsLayoutHistoryState MOZ_FINAL : public nsILayoutHistoryState, + public nsSupportsWeakReference { public: NS_HIDDEN_(nsresult) Init(); diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index d42b643815a..f6ea7f062e0 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -35,6 +35,7 @@ #include "nsGUIEvent.h" #include "nsContentUtils.h" #include "nsRefreshDriver.h" +#include "mozilla/Attributes.h" class nsRange; class nsIDragService; @@ -596,7 +597,7 @@ protected: // Check if aEvent is a mouse event and record the mouse location for later // synth mouse moves. void RecordMouseLocation(nsGUIEvent* aEvent); - class nsSynthMouseMoveEvent : public nsARefreshObserver { + class nsSynthMouseMoveEvent MOZ_FINAL : public nsARefreshObserver { public: nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll) : mPresShell(aPresShell), mFromScroll(aFromScroll) { diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 1eabc0f2cf4..0ae6c88e949 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -20,6 +20,7 @@ #include "nsAutoPtr.h" #include "nsTHashtable.h" #include "nsHashKeys.h" +#include "mozilla/Attributes.h" class nsPresContext; class nsIPresShell; @@ -45,7 +46,7 @@ public: virtual void WillRefresh(mozilla::TimeStamp aTime) = 0; }; -class nsRefreshDriver : public nsITimerCallback { +class nsRefreshDriver MOZ_FINAL : public nsITimerCallback { public: nsRefreshDriver(nsPresContext *aPresContext); ~nsRefreshDriver(); diff --git a/layout/base/nsStyleSheetService.h b/layout/base/nsStyleSheetService.h index acc6735d748..7cd7f63b655 100644 --- a/layout/base/nsStyleSheetService.h +++ b/layout/base/nsStyleSheetService.h @@ -11,6 +11,7 @@ #include "nsIStyleSheetService.h" #include "nsCOMArray.h" #include "nsIStyleSheet.h" +#include "mozilla/Attributes.h" class nsISimpleEnumerator; class nsICategoryManager; @@ -21,7 +22,7 @@ class nsICategoryManager; #define NS_STYLESHEETSERVICE_CONTRACTID \ "@mozilla.org/content/style-sheet-service;1" -class nsStyleSheetService : public nsIStyleSheetService +class nsStyleSheetService MOZ_FINAL : public nsIStyleSheetService { public: nsStyleSheetService() NS_HIDDEN; diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index c6010235e3d..def05a4306f 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -52,6 +52,7 @@ #include "ThirdPartyUtil.h" #include "mozilla/Services.h" #include "nsStructuredCloneContainer.h" +#include "mozilla/Attributes.h" #include "nsIEventListenerService.h" #include "nsIFrameMessageManager.h" @@ -281,7 +282,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(SmsRequestManager) // references to objects in other component libraries that have already been // shutdown (and possibly unloaded if 60709 is ever fixed). -class LayoutShutdownObserver : public nsIObserver +class LayoutShutdownObserver MOZ_FINAL : public nsIObserver { public: NS_DECL_ISUPPORTS diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index d5e3931ae48..92399185134 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -12,7 +12,6 @@ #include "nsIAnonymousContentCreator.h" #include "nsICapturePicker.h" #include "nsCOMPtr.h" -#include "mozilla/Attributes.h" class nsTextControlFrame; class nsIDOMDragEvent; @@ -78,13 +77,14 @@ protected: class MouseListener; friend class MouseListener; - class MouseListener MOZ_FINAL : public nsIDOMEventListener { + class MouseListener : public nsIDOMEventListener { public: NS_DECL_ISUPPORTS MouseListener(nsFileControlFrame* aFrame) : mFrame(aFrame) {} + virtual ~MouseListener() {} void ForgetFrame() { mFrame = nsnull; diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index c67e062855c..74d4ee836b5 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -48,6 +48,7 @@ #include "nsDisplayList.h" #include "nsContentUtils.h" #include "mozilla/LookAndFeel.h" +#include "mozilla/Attributes.h" using namespace mozilla; @@ -74,7 +75,7 @@ DOMTimeStamp nsListControlFrame::gLastKeyTime = 0; * Frames are not refcounted so they can't be used as event listeners. *****************************************************************************/ -class nsListEventListener : public nsIDOMEventListener +class nsListEventListener MOZ_FINAL : public nsIDOMEventListener { public: nsListEventListener(nsListControlFrame *aFrame) diff --git a/layout/generic/nsAutoCopyListener.h b/layout/generic/nsAutoCopyListener.h index ca5f24d8d4b..ca33cdc9a1b 100644 --- a/layout/generic/nsAutoCopyListener.h +++ b/layout/generic/nsAutoCopyListener.h @@ -8,8 +8,9 @@ #include "nsISelectionListener.h" #include "nsISelectionPrivate.h" +#include "mozilla/Attributes.h" -class nsAutoCopyListener : public nsISelectionListener +class nsAutoCopyListener MOZ_FINAL : public nsISelectionListener { public: NS_DECL_ISUPPORTS diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 61472e7490f..52e1c384dc7 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -51,6 +51,7 @@ #include "nsSMILKeySpline.h" #include "nsSubDocumentFrame.h" #include "nsSVGOuterSVGFrame.h" +#include "mozilla/Attributes.h" using namespace mozilla; using namespace mozilla::dom; @@ -1281,7 +1282,7 @@ const double kCurrentVelocityWeighting = 0.25; const double kStopDecelerationWeighting = 0.4; // AsyncScroll has ref counting. -class nsGfxScrollFrameInner::AsyncScroll : public nsARefreshObserver { +class nsGfxScrollFrameInner::AsyncScroll MOZ_FINAL : public nsARefreshObserver { public: typedef mozilla::TimeStamp TimeStamp; typedef mozilla::TimeDuration TimeDuration; @@ -1553,7 +1554,7 @@ IsSmoothScrollingEnabled() return Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false); } -class ScrollFrameActivityTracker : public nsExpirationTracker { +class ScrollFrameActivityTracker MOZ_FINAL : public nsExpirationTracker { public: // Wait for 3-4s between scrolls before we remove our layers. // That's 4 generations of 1s each. diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 81450f94d6d..6f0f4413c3c 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -17,6 +17,7 @@ #include "nsDisplayList.h" #include "imgIContainer.h" +#include "mozilla/Attributes.h" class nsIFrame; class nsImageMap; @@ -309,8 +310,8 @@ private: nsresult LoadIcon(const nsAString& aSpec, nsPresContext *aPresContext, imgIRequest **aRequest); - class IconLoad : public nsIObserver, - public imgIDecoderObserver { + class IconLoad MOZ_FINAL : public nsIObserver, + public imgIDecoderObserver { // private class that wraps the data and logic needed for // broken image and loading image icons public: diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 80ba15f08d7..2bcbfc26c79 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -71,6 +71,7 @@ #include "mozilla/dom/Element.h" #include "mozilla/Util.h" // for DebugOnly #include "mozilla/LookAndFeel.h" +#include "mozilla/Attributes.h" #include "sampler.h" @@ -841,7 +842,7 @@ public: } }; - class BreakSink : public nsILineBreakSink { + class BreakSink MOZ_FINAL : public nsILineBreakSink { public: BreakSink(gfxTextRun* aTextRun, gfxContext* aContext, PRUint32 aOffsetIntoTextRun, bool aExistingTextRun) : diff --git a/layout/mathml/nsMathMLmactionFrame.h b/layout/mathml/nsMathMLmactionFrame.h index 0ff4bde93bd..dec23b20458 100644 --- a/layout/mathml/nsMathMLmactionFrame.h +++ b/layout/mathml/nsMathMLmactionFrame.h @@ -9,6 +9,7 @@ #include "nsCOMPtr.h" #include "nsMathMLContainerFrame.h" #include "nsIDOMEventListener.h" +#include "mozilla/Attributes.h" // // -- bind actions to a subexpression @@ -60,7 +61,7 @@ private: void MouseOver(); void MouseOut(); - class MouseListener : public nsIDOMEventListener + class MouseListener MOZ_FINAL : public nsIDOMEventListener { NS_DECL_ISUPPORTS NS_DECL_NSIDOMEVENTLISTENER diff --git a/layout/style/nsDOMMediaQueryList.h b/layout/style/nsDOMMediaQueryList.h index de9f6d508a3..ba10c42822d 100644 --- a/layout/style/nsDOMMediaQueryList.h +++ b/layout/style/nsDOMMediaQueryList.h @@ -14,12 +14,13 @@ #include "nsCOMPtr.h" #include "nsTArray.h" #include "prclist.h" +#include "mozilla/Attributes.h" class nsPresContext; class nsMediaList; -class nsDOMMediaQueryList : public nsIDOMMediaQueryList, - public PRCList +class nsDOMMediaQueryList MOZ_FINAL : public nsIDOMMediaQueryList, + public PRCList { public: // The caller who constructs is responsible for calling Evaluate diff --git a/layout/style/nsHTMLCSSStyleSheet.h b/layout/style/nsHTMLCSSStyleSheet.h index 793cb7db54a..e9cfa1d04f8 100644 --- a/layout/style/nsHTMLCSSStyleSheet.h +++ b/layout/style/nsHTMLCSSStyleSheet.h @@ -15,8 +15,8 @@ #include "nsIStyleSheet.h" #include "nsIStyleRuleProcessor.h" -class nsHTMLCSSStyleSheet : public nsIStyleSheet, - public nsIStyleRuleProcessor { +class nsHTMLCSSStyleSheet MOZ_FINAL : public nsIStyleSheet, + public nsIStyleRuleProcessor { public: nsHTMLCSSStyleSheet(); diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index 2c4130600c9..804a77e39e5 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -20,9 +20,13 @@ #include "pldhash.h" #include "nsCOMPtr.h" #include "nsColor.h" +#include "mozilla/Attributes.h" + class nsMappedAttributes; -class nsHTMLStyleSheet : public nsIStyleSheet, public nsIStyleRuleProcessor { +class nsHTMLStyleSheet MOZ_FINAL : public nsIStyleSheet, + public nsIStyleRuleProcessor +{ public: nsHTMLStyleSheet(void); nsresult Init(); @@ -83,7 +87,7 @@ private: class HTMLColorRule; friend class HTMLColorRule; - class HTMLColorRule : public nsIStyleRule { + class HTMLColorRule MOZ_FINAL : public nsIStyleRule { public: HTMLColorRule() {} @@ -103,9 +107,10 @@ private: class GenericTableRule; friend class GenericTableRule; - class GenericTableRule: public nsIStyleRule { + class GenericTableRule : public nsIStyleRule { public: GenericTableRule() {} + virtual ~GenericTableRule() {} NS_DECL_ISUPPORTS @@ -119,7 +124,7 @@ private: // this rule handles inheritance class TableTHRule; friend class TableTHRule; - class TableTHRule: public GenericTableRule { + class TableTHRule MOZ_FINAL : public GenericTableRule { public: TableTHRule() {} @@ -127,7 +132,7 @@ private: }; // Rule to handle quirk table colors - class TableQuirkColorRule : public GenericTableRule { + class TableQuirkColorRule MOZ_FINAL : public GenericTableRule { public: TableQuirkColorRule() {} diff --git a/layout/style/nsIMediaList.h b/layout/style/nsIMediaList.h index 9839b4a660b..bfa50fd5d4c 100644 --- a/layout/style/nsIMediaList.h +++ b/layout/style/nsIMediaList.h @@ -16,6 +16,7 @@ #include "nsTArray.h" #include "nsIAtom.h" #include "nsCSSValue.h" +#include "mozilla/Attributes.h" class nsPresContext; class nsCSSStyleSheet; @@ -142,7 +143,7 @@ private: nsTArray mExpressions; }; -class nsMediaList : public nsIDOMMediaList { +class nsMediaList MOZ_FINAL : public nsIDOMMediaList { public: nsMediaList(); diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index e8b78a7b65a..7d697f34889 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -9,6 +9,7 @@ #include "nsCOMPtr.h" #include "nsIObserver.h" #include "nsAutoPtr.h" +#include "mozilla/Attributes.h" class nsIFile; class nsCSSStyleSheet; @@ -22,7 +23,7 @@ class Loader; class nsIMemoryReporter; -class nsLayoutStylesheetCache +class nsLayoutStylesheetCache MOZ_FINAL : public nsIObserver { NS_DECL_ISUPPORTS diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index 87ac1050b92..a91e9056375 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -24,6 +24,7 @@ #include "nsIStyleRule.h" #include "nsCSSPseudoElements.h" #include "nsCSSAnonBoxes.h" +#include "mozilla/Attributes.h" class nsIURI; class nsCSSFontFaceRule; @@ -32,7 +33,7 @@ class nsRuleWalker; struct RuleProcessorData; struct TreeMatchContext; -class nsEmptyStyleRule : public nsIStyleRule +class nsEmptyStyleRule MOZ_FINAL : public nsIStyleRule { NS_DECL_ISUPPORTS virtual void MapRuleInfoInto(nsRuleData* aRuleData); @@ -41,7 +42,7 @@ class nsEmptyStyleRule : public nsIStyleRule #endif }; -class nsInitialStyleRule : public nsIStyleRule +class nsInitialStyleRule MOZ_FINAL : public nsIStyleRule { NS_DECL_ISUPPORTS virtual void MapRuleInfoInto(nsRuleData* aRuleData); diff --git a/layout/xul/base/public/nsXULPopupManager.h b/layout/xul/base/public/nsXULPopupManager.h index f7c2b607473..fea4b2747c4 100644 --- a/layout/xul/base/public/nsXULPopupManager.h +++ b/layout/xul/base/public/nsXULPopupManager.h @@ -22,6 +22,7 @@ #include "nsIReflowCallback.h" #include "nsThreadUtils.h" #include "nsStyleConsts.h" +#include "mozilla/Attributes.h" // X.h defines KeyPress #ifdef KeyPress @@ -268,10 +269,10 @@ private: CloseMenuMode mCloseMenuMode; }; -class nsXULPopupManager : public nsIDOMEventListener, - public nsIRollupListener, - public nsITimerCallback, - public nsIObserver +class nsXULPopupManager MOZ_FINAL : public nsIDOMEventListener, + public nsIRollupListener, + public nsITimerCallback, + public nsIObserver { public: diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index ea6276e14f7..dc4b7e49acf 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -21,6 +21,7 @@ #include "nsXULPopupManager.h" #include "nsITimer.h" #include "nsIContent.h" +#include "mozilla/Attributes.h" nsIFrame* NS_NewMenuFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); nsIFrame* NS_NewMenuItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -55,7 +56,7 @@ class nsMenuFrame; * to it. The callback is delegated to the contained nsMenuFrame as long as * the contained nsMenuFrame has not been destroyed. */ -class nsMenuTimerMediator : public nsITimerCallback +class nsMenuTimerMediator MOZ_FINAL : public nsITimerCallback { public: nsMenuTimerMediator(nsMenuFrame* aFrame); diff --git a/layout/xul/base/src/nsXULTooltipListener.h b/layout/xul/base/src/nsXULTooltipListener.h index 9f044a62079..1cf4395eb3e 100644 --- a/layout/xul/base/src/nsXULTooltipListener.h +++ b/layout/xul/base/src/nsXULTooltipListener.h @@ -18,8 +18,9 @@ #include "nsITreeColumns.h" #endif #include "nsWeakPtr.h" +#include "mozilla/Attributes.h" -class nsXULTooltipListener : public nsIDOMEventListener +class nsXULTooltipListener MOZ_FINAL : public nsIDOMEventListener { public: NS_DECL_ISUPPORTS diff --git a/layout/xul/base/src/tree/src/nsTreeSelection.h b/layout/xul/base/src/tree/src/nsTreeSelection.h index 5701bc3fed2..14788a64c2e 100644 --- a/layout/xul/base/src/tree/src/nsTreeSelection.h +++ b/layout/xul/base/src/tree/src/nsTreeSelection.h @@ -11,11 +11,12 @@ #include "nsITreeColumns.h" #include "nsITimer.h" #include "nsCycleCollectionParticipant.h" +#include "mozilla/Attributes.h" class nsITreeBoxObject; struct nsTreeRange; -class nsTreeSelection : public nsINativeTreeSelection +class nsTreeSelection MOZ_FINAL : public nsINativeTreeSelection { public: nsTreeSelection(nsITreeBoxObject* aTree); From 6b818da602a4e19c003bf02cc7080633cf9a9e12 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 19 Jun 2012 14:33:58 +0100 Subject: [PATCH 19/83] Bug 765182 - Re-disable test_bug13871.html on Android for now, for too many intermittent failures; r=jmaher --- testing/mochitest/android.json | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/mochitest/android.json b/testing/mochitest/android.json index b29521b9e3c..3b0f99ce7e9 100644 --- a/testing/mochitest/android.json +++ b/testing/mochitest/android.json @@ -111,6 +111,7 @@ "content/smil/test/test_smilRepeatTiming.xhtml": "TIMED_OUT", "content/smil/test/test_smilExtDoc.xhtml": "", "content/xul/content/test/test_bug486990.xul": "TIMED_OUT", + "docshell/test/navigation/test_bug13871.html": "RANDOM", "docshell/test/navigation/test_bug430723.html": "TIMED_OUT", "docshell/test/navigation/test_sessionhistory.html": "RANDOM", "docshell/test/test_bug344861.html": "", From 47a35ef4c647b3709a5d42e5659e5834f156e26b Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 19 Jun 2012 14:34:02 +0100 Subject: [PATCH 20/83] Bug 765193 - Re-disable test_text_wholeText.html for now, for too many intermittent failures; r=jmaher --- testing/mochitest/android.json | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/mochitest/android.json b/testing/mochitest/android.json index 3b0f99ce7e9..eda2668c039 100644 --- a/testing/mochitest/android.json +++ b/testing/mochitest/android.json @@ -21,6 +21,7 @@ "content/base/test/test_range_bounds.html": "", "content/base/test/test_reentrant_flush.html": "RANDOM", "content/base/test/test_sync_xhr_timer.xhtml": "RANDOM", + "content/base/test/test_text_wholeText.html": "RANDOM", "content/base/test/test_websocket.html": "", "content/base/test/test_websocket_basic.html": "", "content/base/test/test_websocket_hello.html": "", From 517c7b93f29cbebad935acd657deda93aab0a62a Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 18 Jun 2012 21:19:06 -0400 Subject: [PATCH 21/83] Bug 766000 - CompositionNotifySink needs a virtual destructor; r=roc --- gfx/layers/ImageLayers.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/layers/ImageLayers.h b/gfx/layers/ImageLayers.h index d79f86d3dcd..7c57a489b55 100644 --- a/gfx/layers/ImageLayers.h +++ b/gfx/layers/ImageLayers.h @@ -189,6 +189,7 @@ class CompositionNotifySink { public: virtual void DidComposite() = 0; + virtual ~CompositionNotifySink() {} }; /** From 70c43e268a59f16b3f954c038652ad2c42519eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 19 Jun 2012 16:07:24 +0200 Subject: [PATCH 22/83] Bug 764755 - Remove the aero glass style border of arrow panels and reduce the arrow size. r=enndeakin --- browser/themes/winstripe/browser.css | 16 +- .../winstripe/downloads/downloads-aero.css | 4 - .../themes/winstripe/downloads/downloads.css | 5 - toolkit/content/widgets/popup.xml | 8 +- .../global/arrow/panelarrow-down-aero.png | Bin 1208 -> 0 bytes .../global/arrow/panelarrow-down.png | Bin 1336 -> 0 bytes .../global/arrow/panelarrow-horiz-aero.png | Bin 1152 -> 0 bytes .../global/arrow/panelarrow-horiz.png | Bin 1314 -> 0 bytes .../arrow/panelarrow-horizontal-white.png | Bin 0 -> 293 bytes .../global/arrow/panelarrow-horizontal.svg | 8 +- .../global/arrow/panelarrow-up-aero.png | Bin 917 -> 0 bytes .../winstripe/global/arrow/panelarrow-up.png | Bin 1236 -> 0 bytes .../arrow/panelarrow-vertical-white.png | Bin 0 -> 291 bytes .../global/arrow/panelarrow-vertical.svg | 8 +- toolkit/themes/winstripe/global/jar.mn | 12 +- .../themes/winstripe/global/popup-aero.css | 7 - toolkit/themes/winstripe/global/popup.css | 227 ++++++------------ 17 files changed, 101 insertions(+), 194 deletions(-) delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-down-aero.png delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-down.png delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-horiz-aero.png delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-horiz.png create mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-horizontal-white.png delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-up-aero.png delete mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-up.png create mode 100644 toolkit/themes/winstripe/global/arrow/panelarrow-vertical-white.png delete mode 100644 toolkit/themes/winstripe/global/popup-aero.css diff --git a/browser/themes/winstripe/browser.css b/browser/themes/winstripe/browser.css index 0220eb92c1f..b7252a47837 100644 --- a/browser/themes/winstripe/browser.css +++ b/browser/themes/winstripe/browser.css @@ -1676,18 +1676,18 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- } .panel-promo-box { - margin: 16px 0 -2px; + margin: 10px -10px -10px; + padding: 8px 10px; + border-top: 1px solid ThreeDShadow; + background-image: -moz-linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px); + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; } @media (-moz-windows-default-theme) { .panel-promo-box { - margin: 8px -16px -16px; - padding: 8px 16px; -%ifndef WINSTRIPE_AERO - border-bottom-left-radius: 6px; - border-bottom-right-radius: 6px; -%endif - background-color: #f1f5fb; + border-top-style: none; + background: #f1f5fb; color: GrayText; box-shadow: 0px 1px 2px rgb(204,214,234) inset; } diff --git a/browser/themes/winstripe/downloads/downloads-aero.css b/browser/themes/winstripe/downloads/downloads-aero.css index b5bb0799f99..88d5751d262 100644 --- a/browser/themes/winstripe/downloads/downloads-aero.css +++ b/browser/themes/winstripe/downloads/downloads-aero.css @@ -6,10 +6,6 @@ %include downloads.css %undef WINSTRIPE_AERO -#downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent > .panel-inner-arrowcontent { - padding: 0; -} - @media (-moz-windows-default-theme) { #downloadsPanel[hasdownloads] > #downloadsHistory { background-color: #f1f5fb; diff --git a/browser/themes/winstripe/downloads/downloads.css b/browser/themes/winstripe/downloads/downloads.css index 8b3146eae58..32838cb743b 100644 --- a/browser/themes/winstripe/downloads/downloads.css +++ b/browser/themes/winstripe/downloads/downloads.css @@ -16,11 +16,6 @@ border-top-left-radius: 6px; border-top-right-radius: 6px; } - -#downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent { - /* Avoid that the arrow overlaps the selection on first item */ - padding-top: 5px; -} %endif #downloadsPanel > .panel-arrowcontainer > .panel-arrowcontent { diff --git a/toolkit/content/widgets/popup.xml b/toolkit/content/widgets/popup.xml index 77893b846e4..341c95fe84f 100644 --- a/toolkit/content/widgets/popup.xml +++ b/toolkit/content/widgets/popup.xml @@ -310,11 +310,9 @@ - - - - + + + diff --git a/toolkit/themes/winstripe/global/arrow/panelarrow-down-aero.png b/toolkit/themes/winstripe/global/arrow/panelarrow-down-aero.png deleted file mode 100644 index 6ec2dbc9a7cf455b6b737b0a0c970e8f8c1e3716..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1208 zcmV;p1V{UcP)jNacTOm5Ala@qR9_rnJ=H$Rkowdv-e8J`Hi7a=y#~CA4Kzf z0mVQGP!hBNS_B#JyQvCsOeO=}b$E`x_y_{4nx^f%aJjP)upi7slJA!bz+Y5QzP;4d z*m3Smc~4KzbIAFKWiJB{qXsIt{}2Z zWWTpyZFPz3z}ZtLOZ)oz{-${#UmWLW^%zzlYKGVxfJ>uRLf|=Qt0%p^y$XD;y3`qJ zl8JPGDw25X7@){qzSXN7Jbj|g8xDtG!Pie|9@aLRP={_6M@243f)jicG!~FL5oZaW z0f-E(RdMzDjV4(l_okwWcZQLE&o;p3)$a9GtJH%h+kPz^7#NsBzulafkf1aQLtWu*79HLx_O95?z>Zw_**+5iY&<$#qJH8JtT0vHMnAM zaBv!8j>1o$*(9a|HE%VM?X;7L<^#P_%psXc;)0}fQF{h0K){iWH+p{y$N(}i8~-;O z2nEG?~N0!!z*Sa|?hu1i)KK z7hK5bgdLCsOMpRU8OSId*|uMfP>^QYG8`mdk=5!_Pi2`oA8c-FTo@S{$>hM20SN1D z@@>QZ;gZmNP?-2`?qa+7O3*60tAkd9iXqmn`uckRt#Chiqp5dhB8mS1Xj9SRm*&Pj z4Rd2-V-(;|<|3a1QK5xw1ElNE0$~@V5P?t?LA;u}y1I(n;r@Kd<9(6*^saW_o`%`+ z@$uJ??*$wAD4N8M0PI581@RzP(hfn)+M1f0ZQb47l`SnTW0RAUFIfxW1%kKFyc2+> zK-dAH5N-rS507q$yB+QopmE6a58p7EVrUsnpjF5=0EbX*Zm>L%k!2y!(Gi7$#UKIg z`w_HUr_chCu-KKC1n{%7lM@iW%codz`OGnXoLNL58d8eMa00MYh)f{jlAL0#mWOtE zQ#=*3=N6Cyh7$lM5LO`gv(92JAQ$j^i^2(6&lSKaL^elwfie<7&*J|ortqC3fLtI% z5MGds?!>|glHp&PV}M*Ch;Xi#&|OCWl6d~NDBR4Yh+H8=0Mo*OOyFcW0O<8qfB^ur W3cBqH|L&In0000R zW_r52%I{X)8mil#I6THlzVxK0`_^y1y7yMKP)d33D~hGyx5E4XUK*mS9E3@JM77(p#Vm!Qkg4Jd8Gv1{bmdgv+W z38)Y1>9Bj`S`E4Y{R;gA&4Wj~r{Sd3E|N1=f+7H7X5yI>4v~$R+Iu7%SOi_1U55$dd>k`biitMM^dV}tzz&u%QE zwRDw3+Jkx2u(6ux7NbnpzuCh$Pb-tBX7=oQgOdMG{=!RKoffRY#UNY3**#sraCtzz zojP#j*siCa+1hUa(X7Kj1Jd0TFHV&Pix_Nr;$-E6!8ea^p&4=0Mk-99-DF^YvlmP=!EhSeq%YYG^m~zJ~V%Hva9G zrvNs}j=5m99GG;$EKjo_>$urj@22A9HT{j{KQvZ@7=Rw z)TzpA`~_7iP~)o&4nEkH&HCZ`KM!H5e)_0{iWc zrA)JYtgp8it_{GzspKAhFe>x;lws=puwucaut6C}r6L8pAM8M>`oppxHV~ZjFX&GWQDm}W znN~@ct{s_3kz{St8mmd}+BBEs?tDJwbK|oQmt2yj2XCIc&%ul5p3n1qp68HZ7~ED| zJhw#`+9D1@RRSXR9#sj5NLcS$v`HvW2|o)U5nHrLs6bf^bPy|w6?$yKXkZPoPJEBb z1hUW?N-iP{cA*NPBIO;H1af1G5PBT!b9{xKI*4}|wvDJBpih9>#>U2uiWPpo39SXy zVK4w60lhdnI{NIvw)U&yCZKgh+X1*6bolb+Z=P=J>Yca|lYizbfVwD8cMxdX#Y>kC z9rd341)$^qq_YZN2GmKQbtI-3`T&Lo0)a!v-#PVrXi2_?p;o6`F{qn??gSkf85wEq zIdvuop8oXrS~g{MY?cbeF>M09HatAs>VN;knH$T>Re&a~&f`KUguXsBG<4w1 zM<0i$mgFCo6*XaX(6c8LPYS?{sYF5V!_a|&0nZ0#KlyViCjYRcsQ=k@5E^Qhsp&1w z(?$&K@9*~vp8G5kT2j7`DeAv=t%>$nWb+k(4H(+j*XKF==@;{}@$`2KsmzL9&$BuQ zL^BKk#2L`;_xnBPzC0hBiLYI`lgh+PZKhTpI{;Vk2OkrL;(rqfZ0*Vp!DnX^z_YMZ&$XN&v^GWNV^3d@#TcV1nIEML-hP4-EZR8RByn~mqtWQL>8W7T>61PC4Z*RHRCB8^ z_8E3y#DIA!pB-c^6^TS@Z{M0}I_>Le$s=Jtv7S?kfw=dvnf3k5qhBC?U}J00Mu z+1Xhsxf0*y>*{RIXvShny%%06FAWCHt{WI03WeP1RATRm&SUqlYsP}C=F@gyM5Q1{ z(vXGYwNx+|bnBUPi?^e_aaGk8m8`a249pe_3+Je{B;>iPhST>SZ+~?=fMcrwFQr6j zxWPPcR6Y*N#KeTNUUEKp?3I@#Ig?*3we}0a4GJ!gkB^JZjrC6*dFgqVXtQ~Gk$(;P zUWd}(I1UB}2MwpwdC+d!v>OR(sZnbO>5a``Jpxz$MTbPEtVV?MdA<^`72E{pK{-&i zQZT!Tw8t2n+YFd15Q=;?z*gbVstM)@@GiU>U^eeJ;MM$>zNcYq+28;F0t^6X2AS_S S5R3u<0000O3IP)Kl5+ z#fHQ<_S3wqRLY`Ma6~chh@4|7+mfP?vlpU0lCpS*$DgJq?1?AZi zovg3~#4<$JC_pQqL426QsTy`3`in)cgNp(OZY)dF7z1n;eK!yFKs2j9XoDqXiKYg* zG6ww!&9T#(lL3|tn+E0C6~V4q)jzNb^>B}6$*TaRhsG$~&b!Z+d&@WFY)b$t@CY~w*F#t8dT}~{*#?kuR-_^+SNg7g?}OnTcdWbX-eSQP zj$;X`%sAyzPtMWBh0^QQry2LP#T$Osx&81DLKzf|UV#6R-ygIfB_D59$0#89Ph`8cp2} zR$^EmU~d8TAc4po!JJ01w1zbtrT}%XB`dOg;LE998de~f6T|Ebur#3QPQ!}4WK{s$ zjRJW{!wOEbDzm^MATL?1`mF)mKQg(CV0oRhWiXKmW>%>Qb&U0~M~4xxM+jEb1+om5 zk(LOlFmk7hq!-TK0PN8`05J^Z&%M?uEVy2Oc zMin*-T3j|@bj9zF&VHc}grO36KuXa5M+tS=fOMshwg#{6+%hpe@%0cL^n+0N^-$CU zB?5xujO50v8=x{aJ*4W+=bza>J~ncY9J+oWJcz&nh?fFQbLc|WO96Tg51?8y!Akk>mcadsioqxO<=%4njP&wPScL-rEMFBr@kGVj-UuH zwtP`RbqY<(VZf?!F8_i4rY+x#TQ}^PnfzvkpsrW%3Yr9(&^kN)*L1q$xu^FYni`+= z80vKhwTxYxY5}b=^o(}8eallrvojM%Je|`B%6-}f8ae#=_cJQRWoY!}1x{bsy#AvI z>IZS3QXxfss-bN{+6L;UI3?(w!{1HKxdt>2ZM+1kc57({Xf**{*tY43y+>xJe{gAG zh?c-GT7S9r%`~Mh-dVz1HNqP?-MaDdj}hKufQHCrh_Hr$*1^;5JXBs}$)f_Kp0W#}aomP^t$x zq`Ij>1Uya?qWiy!reu|^uXS(I4J|(DXHkaaC z>VVgB?eH9q&*1~fr|L<0%W~N6--)z;HdJ#UdJ0igK3{l=^Sa2DOg{iFoCW%yjQ<4~ Y00bbhci2Uj^8f$<07*qoM6N<$g1hQ-lK=n! diff --git a/toolkit/themes/winstripe/global/arrow/panelarrow-horizontal-white.png b/toolkit/themes/winstripe/global/arrow/panelarrow-horizontal-white.png new file mode 100644 index 0000000000000000000000000000000000000000..24f06bcd5e3a7515bf82fa84fe30b61f21021d75 GIT binary patch literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^Ahrkx8<5=cZcP}FVk{1FcVbv~PUa<$!O>_4Ag!dgc+SQW>)|O*-JcqUD@xj@pG#h>?xVE0w}c9)5S4F&SmU3e7da?dj3V@Bc2!}q4KT7D>0 h53QBkS - + - diff --git a/toolkit/themes/winstripe/global/arrow/panelarrow-up-aero.png b/toolkit/themes/winstripe/global/arrow/panelarrow-up-aero.png deleted file mode 100644 index b5e194e7b46dfd230764294f8acd7822a47d691a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 917 zcmV;G18V$mNy0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU#H%UZ6RCwC7md|SwK@`Wcvy6H{;IS8}VChxpUtq0T z>5pW0eNW!XbebQV-8k^&&Fn5S?=$bs+ff|H2`P#a3fPnuW3f3c#%(q9pNE1sMR2-N z-*wiJ`VM^)2!wYC0L3ILzLx=P$p(rD?*IU+BUOMAA<$`ytWEFSzHboTApn)c1*vr) z5TGW=66W*`!UF=hJ01pUWL=3MB0!aNKvpaSzCd_D0F@lp2_oY5q2gix3RI66^gl!Y zBlP#l`8_G+szD;cIsgzMnV@b^FF1V)bR!;*r#3e?!89PC&sl^QOUN|!WU|2OfE?d@7JnOt98UHt;X53ufc zu)hdq$1e!_&wNBclK|WlItey8F)=YB17Pdz>*JM5B?>7vjG**=4{d-cM78bIY8Ht` z0J;RwgJ%G2VsdgaS|}6-Rn8kOy0^P)r_f3Z~X>I}vFX39kSc zfz!CNnM@}3qENU10P?lskRpbmtgNgILCRf5a3Lb%VUN&yo+8400LWEnd}?YcwzQNV zP*o0*#ocMHu%?Gzmr55Q^`bD(IBi6|s^tlU`-p()MgTN6Jv|-EK7P`#FxJ)|3PE1J zDh_Iz#)`!vOr?}DH9XvUkNih?i@Q)*ILP7|K!EX?nVH!A2aD$cz}KAzQ|~!MP=_Lr z&*yRNx6WabdN7C(=^rj`S}o~mL*&mYeLCYj?`H%VsLO578br*wo^N> ro&EnMoFCW0^-zucbZ^Mm|0BQvJ&@Nz9BKAE00000NkvXXu0mjf6U&kq diff --git a/toolkit/themes/winstripe/global/arrow/panelarrow-up.png b/toolkit/themes/winstripe/global/arrow/panelarrow-up.png deleted file mode 100644 index 2f7ffbed4660d30b7b08ad3ee87d5e16ee26f878..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1236 zcmV;_1S|WAP)V4|_>b=jFpPLUR(rZKaH1kxOULqjfyS{+y39yt9J%G7zI>oA!mwp~!v2yiZH^*OpUi)(A z_BX%4$Nypf!D_GuTg;ZQWyvCwq?8b%Ty)!GAww;O4MM3y5{%mGYsWr1cIMlI^gSzE z75lKGg0fuY!dm#EQz#|a(5dr3eEQm&(Vf0$R22BC8v5uxi zzmLaPIslgIsi=*vxN0%5-5w)H0|1*?JGSAyz&9$Wc&Y+G4Jeyf)rb>SYs9M2Ow`nG zzns~#W9#P_a}V|}hq}(z6d{heR@-iHUYq?T6(g|m6bw)iET|Z$Wfa&H*i;j6b%53C z&9uMv`>&I`KY05H13nUf4F+_OaW}Xklq(mmObni!{C<3N-Nx-9ph5;C)ePWhX*6F9 z!e**o3GlNHfEgsl$0azSS|B!WD9XhkhjQCfFbbzup4U>%onE9~3^)pJ9e^_kaUJ%@ z)YXf--rsT^BESYt!7*GyR_wC1oRC2q}Kz z+@%RhCQ%C`k;SG{5q25ss{SGd8#;aAatZy-N$_Ebiy1 z^s(Pu<`$LnSTzSWj6F87W^~qUF0BKW$Gun7{~$CCFmoS|xr9 zj;dP;j?$bH*iw-Ph}E)osb>e1fT?yozcne8@rLQKQUH2aTpa4aO9ZMR@o z8EBbHZMAUC`JHCJxA@uS4u0GqJg(GBVXyGn=f42BCM$Lub_e!2teCh6r^P7|iVNpL yH+Ru=zcUiR+0uPZK&k~+tet|&LAmxsfB^uhAEFT!P~!Ul0000| zgW!U_%O?XxI14-?i-Fp&gD|6$#_S59AbW|YuPgfjYfr!Jy#T~KMB_DO?cuQ}1Z@**L?(DjEvNA%`MVyx2y0%$$LcjOBzV~k%l?%>2 z*Z#nyB)zJE?ZuqpYnJJadiO)4HwY)Vs4R(b(|6d*Caazu8hUw&K-2jbi#*-WtXQ>V z=AQ3j2HqFgB%C<({+@{X&2Z~anwYWohDZMMkIt`4ddd{GsMa!*_luHJW^!fV;SRZ^ fp6y@i%Nxw)CS{-1b-T|FbS{IZtDnm{r-UW|s=aLJ literal 0 HcmV?d00001 diff --git a/toolkit/themes/winstripe/global/arrow/panelarrow-vertical.svg b/toolkit/themes/winstripe/global/arrow/panelarrow-vertical.svg index 3509a9d9475..4bcac9da33a 100644 --- a/toolkit/themes/winstripe/global/arrow/panelarrow-vertical.svg +++ b/toolkit/themes/winstripe/global/arrow/panelarrow-vertical.svg @@ -4,10 +4,10 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + - diff --git a/toolkit/themes/winstripe/global/jar.mn b/toolkit/themes/winstripe/global/jar.mn index 2f43afa63bd..c14de25d008 100644 --- a/toolkit/themes/winstripe/global/jar.mn +++ b/toolkit/themes/winstripe/global/jar.mn @@ -82,11 +82,10 @@ toolkit.jar: skin/classic/global/arrow/arrow-up-dis.gif (arrow/arrow-up-dis.gif) skin/classic/global/arrow/arrow-up-hov.gif (arrow/arrow-up-hov.gif) skin/classic/global/arrow/arrow-up-sharp.gif (arrow/arrow-up-sharp.gif) - skin/classic/global/arrow/panelarrow-up.png (arrow/panelarrow-up.png) - skin/classic/global/arrow/panelarrow-down.png (arrow/panelarrow-down.png) - skin/classic/global/arrow/panelarrow-horiz.png (arrow/panelarrow-horiz.png) skin/classic/global/arrow/panelarrow-horizontal.svg (arrow/panelarrow-horizontal.svg) + skin/classic/global/arrow/panelarrow-horizontal-white.png (arrow/panelarrow-horizontal-white.png) skin/classic/global/arrow/panelarrow-vertical.svg (arrow/panelarrow-vertical.svg) + skin/classic/global/arrow/panelarrow-vertical-white.png (arrow/panelarrow-vertical-white.png) skin/classic/global/checkbox/cbox-check.gif (checkbox/cbox-check.gif) skin/classic/global/checkbox/cbox-check-dis.gif (checkbox/cbox-check-dis.gif) skin/classic/global/console/console.css (console/console.css) @@ -217,7 +216,7 @@ toolkit.jar: skin/classic/aero/global/numberbox.css * skin/classic/aero/global/notification.css (notification-aero.css) skin/classic/aero/global/passwordmgr.css -* skin/classic/aero/global/popup.css (popup-aero.css) +* skin/classic/aero/global/popup.css skin/classic/aero/global/preferences.css skin/classic/aero/global/printPageSetup.css skin/classic/aero/global/printPreview.css @@ -259,11 +258,10 @@ toolkit.jar: skin/classic/aero/global/arrow/arrow-up-dis.gif (arrow/arrow-up-dis.gif) skin/classic/aero/global/arrow/arrow-up-hov.gif (arrow/arrow-up-hov.gif) skin/classic/aero/global/arrow/arrow-up-sharp.gif (arrow/arrow-up-sharp.gif) - skin/classic/aero/global/arrow/panelarrow-up.png (arrow/panelarrow-up-aero.png) - skin/classic/aero/global/arrow/panelarrow-down.png (arrow/panelarrow-down-aero.png) - skin/classic/aero/global/arrow/panelarrow-horiz.png (arrow/panelarrow-horiz-aero.png) skin/classic/aero/global/arrow/panelarrow-horizontal.svg (arrow/panelarrow-horizontal.svg) + skin/classic/aero/global/arrow/panelarrow-horizontal-white.png (arrow/panelarrow-horizontal-white.png) skin/classic/aero/global/arrow/panelarrow-vertical.svg (arrow/panelarrow-vertical.svg) + skin/classic/aero/global/arrow/panelarrow-vertical-white.png (arrow/panelarrow-vertical-white.png) skin/classic/aero/global/checkbox/cbox-check.gif (checkbox/cbox-check.gif) skin/classic/aero/global/checkbox/cbox-check-dis.gif (checkbox/cbox-check-dis.gif) * skin/classic/aero/global/console/console.css (console/console-aero.css) diff --git a/toolkit/themes/winstripe/global/popup-aero.css b/toolkit/themes/winstripe/global/popup-aero.css deleted file mode 100644 index e30c960e0b1..00000000000 --- a/toolkit/themes/winstripe/global/popup-aero.css +++ /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/. */ - -%define WINSTRIPE_AERO -%include popup.css -%undef WINSTRIPE_AERO diff --git a/toolkit/themes/winstripe/global/popup.css b/toolkit/themes/winstripe/global/popup.css index 54adefc940c..3175caccaef 100644 --- a/toolkit/themes/winstripe/global/popup.css +++ b/toolkit/themes/winstripe/global/popup.css @@ -36,166 +36,93 @@ panel[type="arrow"] { -moz-transition: opacity 300ms; } +panel[type="arrow"][side="top"], +panel[type="arrow"][side="bottom"] { + margin-left: -20px; + margin-right: -20px; +} + +panel[type="arrow"][side="left"], +panel[type="arrow"][side="right"] { + margin-top: -20px; + margin-bottom: -20px; +} + +.panel-arrowcontent { + border-radius: 4px; + padding: 10px; + color: -moz-DialogText; + background: -moz-Dialog; + background-clip: padding-box; + border: 1px solid ThreeDShadow; + margin: 4px; +} + +.panel-arrow[side="top"], +.panel-arrow[side="bottom"] { + list-style-image: url("chrome://global/skin/arrow/panelarrow-vertical.svg"); + position: relative; + margin-left: 10px; + margin-right: 10px; +} + +.panel-arrow[side="top"] { + margin-bottom: -5px; +} + +.panel-arrow[side="bottom"] { + -moz-transform: scaleY(-1); + margin-top: -5px; +} + +.panel-arrow[side="left"], +.panel-arrow[side="right"] { + list-style-image: url("chrome://global/skin/arrow/panelarrow-horizontal.svg"); + position: relative; + margin-top: 10px; + margin-bottom: 10px; +} + +.panel-arrow[side="left"] { + margin-right: -5px; +} + +.panel-arrow[side="right"] { + -moz-transform: scaleX(-1); + margin-left: -5px; +} + %ifdef XP_WIN -@media not all and (-moz-windows-default-theme) { -%endif - panel[type="arrow"][side="top"], - panel[type="arrow"][side="bottom"] { - margin-left: -23px; - margin-right: -23px; - } - - panel[type="arrow"][side="left"], - panel[type="arrow"][side="right"] { - margin-top: -23px; - margin-bottom: -23px; - } - +@media (-moz-windows-default-theme) { .panel-arrowcontent { - border-radius: 6px; - padding: 10px; - color: -moz-DialogText; - background: -moz-Dialog; - border: 1px solid ThreeDShadow; + border-color: rgba(0,0,0,.3); + box-shadow: 0 0 4px rgba(0,0,0,.3); + } + + .panel-arrowcontent[side="top"] { + background-image: -moz-linear-gradient(top, white 1px, rgba(255,255,255,0) 15px); + } + + .panel-arrowcontent[side="bottom"] { + background-image: -moz-linear-gradient(bottom, white 1px, rgba(255,255,255,0) 15px); + } + + .panel-arrowcontent[side="left"] { + background-image: -moz-linear-gradient(left, white 1px, rgba(255,255,255,0) 15px); + } + + .panel-arrowcontent[side="right"] { + background-image: -moz-linear-gradient(right, white 1px, rgba(255,255,255,0) 15px); } .panel-arrow[side="top"], .panel-arrow[side="bottom"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-vertical.svg"); - position: relative; - margin-left: 6px; - margin-right: 6px; - } - - .panel-arrow[side="top"] { - margin-bottom: -1px; - } - - .panel-arrow[side="bottom"] { - -moz-transform: scaleY(-1); - margin-top: -1px; + list-style-image: url("chrome://global/skin/arrow/panelarrow-vertical-white.png"); } .panel-arrow[side="left"], .panel-arrow[side="right"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-horizontal.svg"); - position: relative; - margin-top: 6px; - margin-bottom: 6px; - } - - .panel-arrow[side="left"] { - margin-right: -1px; - } - - .panel-arrow[side="right"] { - -moz-transform: scaleX(-1); - margin-left: -1px; - } -%ifdef XP_WIN -} -%endif - -%ifdef XP_WIN -@media (-moz-windows-default-theme) { - panel[type="arrow"][side="top"], - panel[type="arrow"][side="bottom"] { - margin-left: -25px; - margin-right: -25px; - } - - panel[type="arrow"][side="left"], - panel[type="arrow"][side="right"] { - margin-top: -25px; - margin-bottom: -25px; - } - - .panel-arrowcontent { - border-radius: 6px; -%ifdef WINSTRIPE_AERO - background-color: rgba(179,230,255,.35); - background-image: -moz-linear-gradient(rgba(250,253,255,.9), rgba(250,253,255,.75) 20px, rgba(250,253,255,.70) 39px, rgba(250,253,255,0) 41px, rgba(250,253,255,0)); - margin: 5px; - box-shadow: 0 0 0 1px rgba(255,255,255,.65) inset, - 0 1px 0 rgba(255,255,255,.3) inset, - 0 0 0 1px rgba(0,0,0,.75), - 0 1px 3px 2px rgba(0,0,0,.65); -%else - background: rgb(250,251,253); - padding: 16px; - margin: 3px; - box-shadow: 0 0 5px 1px rgba(184,205,232,1) inset, - 0 0 0 1px rgba(0,0,0,.25), - 0 1px 5px rgba(0,0,0,.5); -%endif - } - -%ifdef WINSTRIPE_AERO - .panel-inner-arrowcontent { - background-color: rgb(250,250,250); - background-clip: padding-box; - margin: 4px; - border: 2px solid; - border-radius: 2px; - -moz-border-top-colors: rgba(255,255,255,.6) rgba(0,0,0,.7); - -moz-border-left-colors: rgba(255,255,255,.6) rgba(0,0,0,.7); - -moz-border-bottom-colors: rgba(255,255,255,.6) rgba(0,0,0,.7); - -moz-border-right-colors: rgba(255,255,255,.6) rgba(0,0,0,.7); - padding: 16px; - } -%endif - - .panel-arrow[side="top"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-up.png"); -%ifdef WINSTRIPE_AERO - margin-bottom: -5px; - margin-top: -5px; -%else - margin-left: 6px; - margin-right: 6px; - margin-bottom: -13px; - margin-top: -4px; -%endif - } - - .panel-arrow[side="bottom"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-down.png"); -%ifdef WINSTRIPE_AERO - margin-top: -5px; - margin-bottom: -5px; -%else - margin-left: 6px; - margin-right: 6px; - margin-top: -12px; - margin-bottom: -4px; -%endif - } - - .panel-arrow[side="left"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-horiz.png"); -%ifdef WINSTRIPE_AERO - margin-right: -5px; - margin-left: -5px; -%else - margin-top: 6px; - margin-bottom: 6px; - margin-right: -12px; - margin-left: -4px; -%endif - } - - .panel-arrow[side="right"] { - list-style-image: url("chrome://global/skin/arrow/panelarrow-horiz.png"); - -moz-transform: scaleX(-1); -%ifdef WINSTRIPE_AERO - margin-left: -5px; - margin-right: -5px; -%else - margin-top: 6px; - margin-bottom: 6px; - margin-left: -12px; - margin-right: -4px; -%endif + list-style-image: url("chrome://global/skin/arrow/panelarrow-horizontal-white.png"); } } %endif From decce3d948b8674c416cdb08164b8213f876274e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 19 Jun 2012 16:08:11 +0200 Subject: [PATCH 23/83] Bug 765714 - Reduce the arrow panel arrow size. r=enndeakin --- .../gnomestripe/global/icons/panelarrow-horizontal.svg | 6 +++--- .../gnomestripe/global/icons/panelarrow-vertical.svg | 6 +++--- toolkit/themes/gnomestripe/global/popup.css | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/toolkit/themes/gnomestripe/global/icons/panelarrow-horizontal.svg b/toolkit/themes/gnomestripe/global/icons/panelarrow-horizontal.svg index 32b1cc4c128..120b7fb4471 100644 --- a/toolkit/themes/gnomestripe/global/icons/panelarrow-horizontal.svg +++ b/toolkit/themes/gnomestripe/global/icons/panelarrow-horizontal.svg @@ -4,8 +4,8 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + diff --git a/toolkit/themes/gnomestripe/global/icons/panelarrow-vertical.svg b/toolkit/themes/gnomestripe/global/icons/panelarrow-vertical.svg index dfee571b801..98e0f9e34d3 100644 --- a/toolkit/themes/gnomestripe/global/icons/panelarrow-vertical.svg +++ b/toolkit/themes/gnomestripe/global/icons/panelarrow-vertical.svg @@ -4,8 +4,8 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + diff --git a/toolkit/themes/gnomestripe/global/popup.css b/toolkit/themes/gnomestripe/global/popup.css index ee3b41ef56d..f73e272e975 100644 --- a/toolkit/themes/gnomestripe/global/popup.css +++ b/toolkit/themes/gnomestripe/global/popup.css @@ -22,14 +22,14 @@ panel[type="arrow"] { panel[type="arrow"][side="top"], panel[type="arrow"][side="bottom"] { - margin-left: -23px; - margin-right: -23px; + margin-left: -16px; + margin-right: -16px; } panel[type="arrow"][side="left"], panel[type="arrow"][side="right"] { - margin-top: -23px; - margin-bottom: -23px; + margin-top: -16px; + margin-bottom: -16px; } .panel-arrowcontent { From 327ff7e058fe19da1538605e273e39e19190574a Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Thu, 24 May 2012 11:58:35 -0400 Subject: [PATCH 24/83] bug 764671 - Stop uploading symbols for test programs/libs to the symbol server. r=nthomas --- Makefile.in | 1 + toolkit/crashreporter/Makefile.in | 3 + toolkit/crashreporter/tools/symbolstore.py | 25 ++++- .../crashreporter/tools/unit-symbolstore.py | 96 +++++++++++++++++++ 4 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 toolkit/crashreporter/tools/unit-symbolstore.py diff --git a/Makefile.in b/Makefile.in index 8b476560f93..7a9d128d8ec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -166,6 +166,7 @@ endif OBJCOPY="$(OBJCOPY)" \ $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \ $(MAKE_SYM_STORE_ARGS) \ + --exclude="*test*" --exclude="*Test*" \ $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \ $(DUMP_SYMS_BIN) \ $(DIST)/crashreporter-symbols \ diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 69891a26a53..b2a4c094351 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -98,3 +98,6 @@ endif include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk + +check:: + $(PYTHON) $(srcdir)/tools/unit-symbolstore.py diff --git a/toolkit/crashreporter/tools/symbolstore.py b/toolkit/crashreporter/tools/symbolstore.py index 9d2b705bf37..807b06a90f5 100755 --- a/toolkit/crashreporter/tools/symbolstore.py +++ b/toolkit/crashreporter/tools/symbolstore.py @@ -26,6 +26,7 @@ import os import re import shutil import textwrap +import fnmatch from subprocess import call, Popen, PIPE, STDOUT from optparse import OptionParser @@ -390,7 +391,12 @@ class Dumper: ProcessDir. Instead, call GetPlatformSpecificDumper to get an instance of a subclass.""" def __init__(self, dump_syms, symbol_path, - archs=None, srcdirs=None, copy_debug=False, vcsinfo=False, srcsrv=False): + archs=None, + srcdirs=None, + copy_debug=False, + vcsinfo=False, + srcsrv=False, + exclude=[]): # popen likes absolute paths, at least on windows self.dump_syms = os.path.abspath(dump_syms) self.symbol_path = symbol_path @@ -406,10 +412,11 @@ class Dumper: self.copy_debug = copy_debug self.vcsinfo = vcsinfo self.srcsrv = srcsrv + self.exclude = exclude[:] # subclasses override this def ShouldProcess(self, file): - return False + return not any(fnmatch.fnmatch(os.path.basename(file), exclude) for exclude in self.exclude) # and can override this def ShouldSkipDir(self, dir): @@ -545,6 +552,8 @@ class Dumper_Win32(Dumper): def ShouldProcess(self, file): """This function will allow processing of pdb files that have dll or exe files with the same base name next to them.""" + if not Dumper.ShouldProcess(self, file): + return False if file.endswith(".pdb"): (path,ext) = os.path.splitext(file) if os.path.isfile(path + ".exe") or os.path.isfile(path + ".dll"): @@ -616,6 +625,8 @@ class Dumper_Linux(Dumper): executable, or end with the .so extension, and additionally file(1) reports as being ELF files. It expects to find the file command in PATH.""" + if not Dumper.ShouldProcess(self, file): + return False if file.endswith(".so") or os.access(file, os.X_OK): return self.RunFileCommand(file).startswith("ELF") return False @@ -654,6 +665,8 @@ class Dumper_Solaris(Dumper): executable, or end with the .so extension, and additionally file(1) reports as being ELF files. It expects to find the file command in PATH.""" + if not Dumper.ShouldProcess(self, file): + return False if file.endswith(".so") or os.access(file, os.X_OK): return self.RunFileCommand(file).startswith("ELF") return False @@ -664,6 +677,8 @@ class Dumper_Mac(Dumper): executable, or end with the .dylib extension, and additionally file(1) reports as being Mach-O files. It expects to find the file command in PATH.""" + if not Dumper.ShouldProcess(self, file): + return False if file.endswith(".dylib") or os.access(file, os.X_OK): return self.RunFileCommand(file).startswith("Mach-O") return False @@ -736,6 +751,9 @@ def main(): parser.add_option("-i", "--source-index", action="store_true", dest="srcsrv", default=False, help="Add source index information to debug files, making them suitable for use in a source server.") + parser.add_option("-x", "--exclude", + action="append", dest="exclude", default=[], metavar="PATTERN", + help="Skip processing files matching PATTERN.") (options, args) = parser.parse_args() #check to see if the pdbstr.exe exists @@ -755,7 +773,8 @@ def main(): archs=options.archs, srcdirs=options.srcdir, vcsinfo=options.vcsinfo, - srcsrv=options.srcsrv) + srcsrv=options.srcsrv, + exclude=options.exclude) for arg in args[2:]: dumper.Process(arg) diff --git a/toolkit/crashreporter/tools/unit-symbolstore.py b/toolkit/crashreporter/tools/unit-symbolstore.py new file mode 100644 index 00000000000..24a29e74bde --- /dev/null +++ b/toolkit/crashreporter/tools/unit-symbolstore.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import os, tempfile, unittest, shutil, struct, platform +import symbolstore + +# Some simple functions to mock out files that the platform-specific dumpers will accept. +# dump_syms itself will not be run (we mock that call out), but we can't override +# the ShouldProcessFile method since we actually want to test that. +def write_elf(filename): + open(filename, "wb").write(struct.pack("<7B45x", 0x7f, ord("E"), ord("L"), ord("F"), 1, 1, 1)) + +def write_macho(filename): + open(filename, "wb").write(struct.pack(" Date: Tue, 19 Jun 2012 09:24:49 -0400 Subject: [PATCH 25/83] bug 587073 - stop uploading duplicate dSYM files in the symbol package. r=nthomas --- toolkit/crashreporter/tools/symbolstore.py | 49 +++++++------ .../crashreporter/tools/unit-symbolstore.py | 73 ++++++++++++++++++- 2 files changed, 98 insertions(+), 24 deletions(-) diff --git a/toolkit/crashreporter/tools/symbolstore.py b/toolkit/crashreporter/tools/symbolstore.py index 807b06a90f5..727c4273647 100755 --- a/toolkit/crashreporter/tools/symbolstore.py +++ b/toolkit/crashreporter/tools/symbolstore.py @@ -27,7 +27,7 @@ import re import shutil import textwrap import fnmatch -from subprocess import call, Popen, PIPE, STDOUT +import subprocess from optparse import OptionParser # Utility classes @@ -229,7 +229,7 @@ class SVNFileInfo(VCSFileInfo): return self.file def read_output(*args): - (stdout, _) = Popen(args=args, stdout=PIPE).communicate() + (stdout, _) = subprocess.Popen(args=args, stdout=subprocess.PIPE).communicate() return stdout.rstrip() class HGRepoInfo: @@ -471,15 +471,17 @@ class Dumper: """Dump symbols from this file into a symbol file, stored in the proper directory structure in |symbol_path|.""" print >> sys.stderr, "Processing file: %s" % file + sys.stderr.flush() result = False sourceFileStream = '' # tries to get the vcs root from the .mozconfig first - if it's not set # the tinderbox vcs path will be assigned further down vcs_root = os.environ.get("SRCSRV_ROOT") - for arch in self.archs: + for arch_num, arch in enumerate(self.archs): try: - cmd = os.popen("%s %s %s" % (self.dump_syms, arch, file), "r") - module_line = cmd.next() + proc = subprocess.Popen([self.dump_syms] + arch.split() + [file], + stdout=subprocess.PIPE) + module_line = proc.stdout.next() if module_line.startswith("MODULE"): # MODULE os cpu guid debug_file (guid, debug_file) = (module_line.split())[3:5] @@ -498,17 +500,17 @@ class Dumper: f = open(full_path, "w") f.write(module_line) # now process the rest of the output - for line in cmd: + for line in proc.stdout: if line.startswith("FILE"): # FILE index filename - (x, index, filename) = line.split(None, 2) + (x, index, filename) = line.rstrip().split(None, 2) if sys.platform == "sunos5": for srcdir in self.srcdirs: start = filename.find(self.srcdir) if start != -1: filename = filename[start:] break - filename = self.FixFilenameCase(filename.rstrip()) + filename = self.FixFilenameCase(filename) sourcepath = filename if self.vcsinfo: (filename, rootname) = GetVCSFilename(filename, self.srcdirs) @@ -527,14 +529,15 @@ class Dumper: # we want to return true only if at least one line is not a MODULE or FILE line result = True f.close() - cmd.close() + proc.wait() # we output relative paths so callers can get a list of what # was generated print rel_path if self.srcsrv and vcs_root: # add source server indexing to the pdb file self.SourceServerIndexing(file, guid, sourceFileStream, vcs_root) - if self.copy_debug: + # only copy debug the first time if we have multiple architectures + if self.copy_debug and arch_num == 0: self.CopyDebug(file, debug_file, guid) except StopIteration: pass @@ -593,8 +596,10 @@ class Dumper_Win32(Dumper): # try compressing it compressed_file = os.path.splitext(full_path)[0] + ".pd_" # ignore makecab's output - success = call(["makecab.exe", "/D", "CompressionType=LZX", "/D", "CompressionMemory=21", - full_path, compressed_file], stdout=open("NUL:","w"), stderr=STDOUT) + success = subprocess.call(["makecab.exe", "/D", "CompressionType=LZX", "/D", + "CompressionMemory=21", + full_path, compressed_file], + stdout=open("NUL:","w"), stderr=subprocess.STDOUT) if success == 0 and os.path.exists(compressed_file): os.unlink(full_path) print os.path.splitext(rel_path)[0] + ".pd_" @@ -611,9 +616,9 @@ class Dumper_Win32(Dumper): if self.copy_debug: pdbstr_path = os.environ.get("PDBSTR_PATH") pdbstr = os.path.normpath(pdbstr_path) - call([pdbstr, "-w", "-p:" + os.path.basename(debug_file), - "-i:" + os.path.basename(streamFilename), "-s:srcsrv"], - cwd=os.path.dirname(stream_output_path)) + subprocess.call([pdbstr, "-w", "-p:" + os.path.basename(debug_file), + "-i:" + os.path.basename(streamFilename), "-s:srcsrv"], + cwd=os.path.dirname(stream_output_path)) # clean up all the .stream files when done os.remove(stream_output_path) return result @@ -636,8 +641,8 @@ class Dumper_Linux(Dumper): # .gnu_debuglink section to the object, so the debugger can # actually load our debug info later. file_dbg = file + ".dbg" - if call([self.objcopy, '--only-keep-debug', file, file_dbg]) == 0 and \ - call([self.objcopy, '--add-gnu-debuglink=%s' % file_dbg, file]) == 0: + if subprocess.call([self.objcopy, '--only-keep-debug', file, file_dbg]) == 0 and \ + subprocess.call([self.objcopy, '--add-gnu-debuglink=%s' % file_dbg, file]) == 0: rel_path = os.path.join(debug_file, guid, debug_file + ".dbg") @@ -700,8 +705,8 @@ class Dumper_Mac(Dumper): if os.path.exists(dsymbundle): shutil.rmtree(dsymbundle) # dsymutil takes --arch=foo instead of -a foo like everything else - os.system("dsymutil %s %s >/dev/null" % (' '.join([a.replace('-a ', '--arch=') for a in self.archs]), - file)) + subprocess.call(["dsymutil"] + [a.replace('-a ', '--arch=') for a in self.archs if a] + + [file]) if not os.path.exists(dsymbundle): # dsymutil won't produce a .dSYM for files without symbols return False @@ -727,9 +732,9 @@ class Dumper_Mac(Dumper): os.path.basename(file) + ".tar.bz2") full_path = os.path.abspath(os.path.join(self.symbol_path, rel_path)) - success = call(["tar", "cjf", full_path, os.path.basename(file)], - cwd=os.path.dirname(file), - stdout=open("/dev/null","w"), stderr=STDOUT) + success = subprocess.call(["tar", "cjf", full_path, os.path.basename(file)], + cwd=os.path.dirname(file), + stdout=open("/dev/null","w"), stderr=subprocess.STDOUT) if success == 0 and os.path.exists(full_path): print rel_path diff --git a/toolkit/crashreporter/tools/unit-symbolstore.py b/toolkit/crashreporter/tools/unit-symbolstore.py index 24a29e74bde..0a0bcbc717b 100644 --- a/toolkit/crashreporter/tools/unit-symbolstore.py +++ b/toolkit/crashreporter/tools/unit-symbolstore.py @@ -3,7 +3,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/. -import os, tempfile, unittest, shutil, struct, platform +import os, tempfile, unittest, shutil, struct, platform, subprocess import symbolstore # Some simple functions to mock out files that the platform-specific dumpers will accept. @@ -34,7 +34,7 @@ extension = {'Windows': ".pdb", def add_extension(files): return [f + extension for f in files] -class TestExclude(unittest.TestCase): +class HelperMixin(object): """ Test that passing filenames to exclude from processing works. """ @@ -54,6 +54,7 @@ class TestExclude(unittest.TestCase): os.makedirs(d) writer(f) +class TestExclude(HelperMixin, unittest.TestCase): def test_exclude_wildcard(self): """ Test that using an exclude list with a wildcard pattern works. @@ -92,5 +93,73 @@ class TestExclude(unittest.TestCase): expected.sort() self.assertEqual(processed, expected) +def popen_factory(stdouts): + """ + Generate a class that can mock subprocess.Popen. |stdouts| is an iterable that + should return an iterable for the stdout of each process in turn. + """ + class mock_popen(object): + def __init__(self, args, *args_rest, **kwargs): + self.stdout = stdouts.next() + + def wait(self): + return 0 + return mock_popen + +def mock_dump_syms(module_id, filename): + return ["MODULE os x86 %s %s" % (module_id, filename), + "FILE 0 foo.c", + "PUBLIC xyz 123"] + +class TestCopyDebugUniversal(HelperMixin, unittest.TestCase): + """ + Test that CopyDebug does the right thing when dumping multiple architectures. + """ + def setUp(self): + HelperMixin.setUp(self) + self.symbol_dir = tempfile.mkdtemp() + self._subprocess_call = subprocess.call + subprocess.call = self.mock_call + self._subprocess_popen = subprocess.Popen + subprocess.Popen = popen_factory(self.next_mock_stdout()) + self.stdouts = [] + + def tearDown(self): + HelperMixin.tearDown(self) + shutil.rmtree(self.symbol_dir) + subprocess.call = self._subprocess_call + subprocess.Popen = self._subprocess_popen + + def mock_call(self, args, **kwargs): + if args[0].endswith("dsymutil"): + filename = args[-1] + os.makedirs(filename + ".dSYM") + return 0 + + def next_mock_stdout(self): + if not self.stdouts: + yield iter([]) + for s in self.stdouts: + yield iter(s) + + def test_copy_debug_universal(self): + """ + Test that dumping symbols for multiple architectures only copies debug symbols once + per file. + """ + copied = [] + def mock_copy_debug(filename, debug_file, guid): + copied.append(filename[len(self.symbol_dir):] if filename.startswith(self.symbol_dir) else filename) + self.add_test_files(add_extension(["foo"])) + self.stdouts.append(mock_dump_syms("X" * 33, add_extension(["foo"])[0])) + self.stdouts.append(mock_dump_syms("Y" * 33, add_extension(["foo"])[0])) + d = symbolstore.GetPlatformSpecificDumper(dump_syms="dump_syms", + symbol_path=self.symbol_dir, + copy_debug=True, + archs="abc xyz") + d.CopyDebug = mock_copy_debug + self.assertTrue(d.Process(self.test_dir)) + self.assertEqual(1, len(copied)) + if __name__ == '__main__': unittest.main() From 8e6d1b86af243f6717ecac87959164990f46f735 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Tue, 19 Jun 2012 09:24:53 -0400 Subject: [PATCH 26/83] bug 761454 - distinguish armv6 builds from armv7 builds by changing package name. r=glandium --- mobile/android/config/mozconfigs/android-armv6/debug | 1 + mobile/android/config/mozconfigs/android-armv6/l10n-nightly | 1 + mobile/android/config/mozconfigs/android-armv6/l10n-release | 1 + mobile/android/config/mozconfigs/android-armv6/nightly | 1 + mobile/android/config/mozconfigs/android-armv6/release | 1 + 5 files changed, 5 insertions(+) diff --git a/mobile/android/config/mozconfigs/android-armv6/debug b/mobile/android/config/mozconfigs/android-armv6/debug index c235cd1f141..57959f2db93 100644 --- a/mobile/android/config/mozconfigs/android-armv6/debug +++ b/mobile/android/config/mozconfigs/android-armv6/debug @@ -17,6 +17,7 @@ ac_add_options --with-system-zlib export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 export MOZ_TELEMETRY_REPORTING=1 +export MOZ_PKG_SPECIAL=armv6 ac_add_options --with-branding=mobile/android/branding/nightly diff --git a/mobile/android/config/mozconfigs/android-armv6/l10n-nightly b/mobile/android/config/mozconfigs/android-armv6/l10n-nightly index 34fcb34e5ce..ce0f605b777 100644 --- a/mobile/android/config/mozconfigs/android-armv6/l10n-nightly +++ b/mobile/android/config/mozconfigs/android-armv6/l10n-nightly @@ -24,5 +24,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 +export MOZ_PKG_SPECIAL=armv6 ac_add_options --with-branding=mobile/android/branding/nightly diff --git a/mobile/android/config/mozconfigs/android-armv6/l10n-release b/mobile/android/config/mozconfigs/android-armv6/l10n-release index 453605864ac..bc40afbdb81 100644 --- a/mobile/android/config/mozconfigs/android-armv6/l10n-release +++ b/mobile/android/config/mozconfigs/android-armv6/l10n-release @@ -20,6 +20,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 +export MOZ_PKG_SPECIAL=armv6 ac_add_options --enable-official-branding ac_add_options --with-branding=mobile/android/branding/beta diff --git a/mobile/android/config/mozconfigs/android-armv6/nightly b/mobile/android/config/mozconfigs/android-armv6/nightly index 88246a7cb40..03817c571f8 100644 --- a/mobile/android/config/mozconfigs/android-armv6/nightly +++ b/mobile/android/config/mozconfigs/android-armv6/nightly @@ -17,6 +17,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 export MOZ_TELEMETRY_REPORTING=1 +export MOZ_PKG_SPECIAL=armv6 ac_add_options --with-branding=mobile/android/branding/nightly diff --git a/mobile/android/config/mozconfigs/android-armv6/release b/mobile/android/config/mozconfigs/android-armv6/release index bee56923719..1477db8600e 100644 --- a/mobile/android/config/mozconfigs/android-armv6/release +++ b/mobile/android/config/mozconfigs/android-armv6/release @@ -18,6 +18,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 export MOZ_TELEMETRY_REPORTING=1 +export MOZ_PKG_SPECIAL=armv6 ac_add_options --enable-official-branding ac_add_options --with-branding=mobile/android/branding/beta From 30fbb12128b8b82d9bb4225a4ad681a04bfb174a Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Tue, 19 Jun 2012 15:58:39 +0100 Subject: [PATCH 27/83] Bug 467498 - Second level of use is not live to changes. r=dholbert --HG-- rename : layout/reftests/svg/dynamic-use-nested-01.svg => layout/reftests/svg/dynamic-use-nested-01a.svg rename : layout/reftests/svg/dynamic-use-nested-01.svg => layout/reftests/svg/dynamic-use-nested-01b.svg --- content/base/src/nsGkAtomList.h | 1 + content/svg/content/src/nsSVGSVGElement.cpp | 10 ------ content/svg/content/src/nsSVGSVGElement.h | 2 -- content/svg/content/src/nsSVGUseElement.cpp | 7 ++++ ...sted-01.svg => dynamic-use-nested-01a.svg} | 0 .../reftests/svg/dynamic-use-nested-01b.svg | 34 +++++++++++++++++++ layout/reftests/svg/reftest.list | 3 +- layout/svg/crashtests/467498-1.svg | 12 +++++++ layout/svg/crashtests/crashtests.list | 1 + 9 files changed, 57 insertions(+), 13 deletions(-) rename layout/reftests/svg/{dynamic-use-nested-01.svg => dynamic-use-nested-01a.svg} (100%) create mode 100644 layout/reftests/svg/dynamic-use-nested-01b.svg create mode 100644 layout/svg/crashtests/467498-1.svg diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index a1e9269bd58..c7fdb17be59 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -1218,6 +1218,7 @@ GK_ATOM(matrix, "matrix") GK_ATOM(metadata, "metadata") GK_ATOM(missingGlyph, "missing-glyph") GK_ATOM(mm, "mm") +GK_ATOM(mozUseChangeDummyAttr, "_mozUseChangeDummyAttr") GK_ATOM(mpath, "mpath") GK_ATOM(noStitch, "noStitch") GK_ATOM(numOctaves, "numOctaves") diff --git a/content/svg/content/src/nsSVGSVGElement.cpp b/content/svg/content/src/nsSVGSVGElement.cpp index 23789d87142..10331773344 100644 --- a/content/svg/content/src/nsSVGSVGElement.cpp +++ b/content/svg/content/src/nsSVGSVGElement.cpp @@ -1145,16 +1145,6 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType) return 0; } -void -nsSVGSVGElement::SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const -{ - NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height, - "The clue is in the function name"); - - PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT; - aTarget->SetLength(aName, mLengthAttributes[index]); -} - //---------------------------------------------------------------------- // nsSVGElement methods diff --git a/content/svg/content/src/nsSVGSVGElement.h b/content/svg/content/src/nsSVGSVGElement.h index 267f72982a7..c39b36cea48 100644 --- a/content/svg/content/src/nsSVGSVGElement.h +++ b/content/svg/content/src/nsSVGSVGElement.h @@ -174,8 +174,6 @@ public: // nsSVGSVGElement methods: float GetLength(PRUint8 mCtxType); - // Copy our width or height to the target - void SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const; // public helpers: diff --git a/content/svg/content/src/nsSVGUseElement.cpp b/content/svg/content/src/nsSVGUseElement.cpp index 385e01c9505..bc3faa7be5e 100644 --- a/content/svg/content/src/nsSVGUseElement.cpp +++ b/content/svg/content/src/nsSVGUseElement.cpp @@ -9,6 +9,7 @@ #include "nsIDOMSVGGElement.h" #include "nsGkAtoms.h" #include "nsIDOMDocument.h" +#include "nsIDOMMutationEvent.h" #include "nsSVGSVGElement.h" #include "nsIDOMSVGSymbolElement.h" #include "nsIDocument.h" @@ -436,6 +437,12 @@ nsSVGUseElement::TriggerReclone() if (!presShell) return; presShell->PostRecreateFramesFor(this); + + // We may be the target of other use elements + // so we need to notify them that things have changed + nsNodeUtils::AttributeChanged(this, kNameSpaceID_None, + nsGkAtoms::mozUseChangeDummyAttr, + nsIDOMMutationEvent::MODIFICATION); } void diff --git a/layout/reftests/svg/dynamic-use-nested-01.svg b/layout/reftests/svg/dynamic-use-nested-01a.svg similarity index 100% rename from layout/reftests/svg/dynamic-use-nested-01.svg rename to layout/reftests/svg/dynamic-use-nested-01a.svg diff --git a/layout/reftests/svg/dynamic-use-nested-01b.svg b/layout/reftests/svg/dynamic-use-nested-01b.svg new file mode 100644 index 00000000000..47b04ec1c64 --- /dev/null +++ b/layout/reftests/svg/dynamic-use-nested-01b.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 968e1466683..53bac72b38a 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -110,7 +110,8 @@ random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dyna == dynamic-use-04.svg pass.svg == dynamic-use-05.svg pass.svg == dynamic-use-06.svg pass.svg -random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498 +== dynamic-use-nested-01a.svg dynamic-use-nested-01-ref.svg +== dynamic-use-nested-01b.svg dynamic-use-nested-01-ref.svg == dynamic-use-remove-width.svg dynamic-use-remove-width-ref.svg == fragmentIdentifier-01.xhtml pass.svg == linked-filter-01.svg pass.svg diff --git a/layout/svg/crashtests/467498-1.svg b/layout/svg/crashtests/467498-1.svg new file mode 100644 index 00000000000..9839e6c30df --- /dev/null +++ b/layout/svg/crashtests/467498-1.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index 02e89eb3b24..fd7315d64f3 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -78,6 +78,7 @@ load 461289-1.svg load 464374-1.svg load 466585-1.svg load 467323-1.svg +load 467498-1.svg load 470124-1.svg load 474700-1.svg load 472782-1.svg From c2a30c889c43daf5773d97181bebc761d9556f89 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 19 Jun 2012 10:59:03 -0400 Subject: [PATCH 28/83] Bug 627699 - Port GTK2 to GTK3, export gtk2compat.h; r=karlt --- widget/gtk2/Makefile.in | 1 + widget/gtk2/gtk2compat.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/widget/gtk2/Makefile.in b/widget/gtk2/Makefile.in index 754e209be86..fef8e93a1b5 100644 --- a/widget/gtk2/Makefile.in +++ b/widget/gtk2/Makefile.in @@ -78,6 +78,7 @@ EXPORTS = \ nsGTKToolkit.h \ nsIImageToPixbuf.h \ mozcontainer.h \ + gtk2compat.h \ $(NULL) ifdef NATIVE_THEME_SUPPORT diff --git a/widget/gtk2/gtk2compat.h b/widget/gtk2/gtk2compat.h index 094cbb1a35a..db03364bc28 100644 --- a/widget/gtk2/gtk2compat.h +++ b/widget/gtk2/gtk2compat.h @@ -48,6 +48,12 @@ gtk_dialog_get_content_area(GtkDialog *dialog) { return dialog->vbox; } + +static inline GdkWindow * +gtk_plug_get_socket_window(GtkPlug *plug) +{ + return plug->socket_window; +} #endif From a609b6f9e962b667123cafaeeaaf9f6c969a8bbb Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Tue, 19 Jun 2012 17:24:57 +0200 Subject: [PATCH 29/83] Bug 720396 - Fix Debugger.addDebuggee with Debuger.prototype. r=jorendorff --- .../tests/debug/Debugger-add-Debugger-prototype.js | 6 ++++++ js/src/vm/Debugger.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 js/src/jit-test/tests/debug/Debugger-add-Debugger-prototype.js diff --git a/js/src/jit-test/tests/debug/Debugger-add-Debugger-prototype.js b/js/src/jit-test/tests/debug/Debugger-add-Debugger-prototype.js new file mode 100644 index 00000000000..ba98347a7a8 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-add-Debugger-prototype.js @@ -0,0 +1,6 @@ +load(libdir + "asserts.js"); + +assertThrowsInstanceOf(function () { + var dbg = new Debugger(); + dbg.addDebuggee(Debugger.Object.prototype); +}, TypeError); \ No newline at end of file diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index ffa64d26ec2..8b19148a4a1 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -712,9 +712,9 @@ Debugger::unwrapDebuggeeValue(JSContext *cx, Value *vp) } Value owner = dobj->getReservedSlot(JSSLOT_DEBUGOBJECT_OWNER); - if (owner.toObjectOrNull() != object) { + if (owner.isUndefined() || &owner.toObject() != object) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, - owner.isNull() + owner.isUndefined() ? JSMSG_DEBUG_OBJECT_PROTO : JSMSG_DEBUG_OBJECT_WRONG_OWNER); return false; @@ -4516,7 +4516,8 @@ JS_DefineDebuggerObject(JSContext *cx, JSObject *obj_) debugProto(cx), frameProto(cx), scriptProto(cx), - objectProto(cx); + objectProto(cx), + envProto(cx); objProto = obj->asGlobal().getOrCreateObjectPrototype(cx); if (!objProto) @@ -4551,7 +4552,7 @@ JS_DefineDebuggerObject(JSContext *cx, JSObject *obj_) if (!objectProto) return false; - JSObject *envProto = js_InitClass(cx, debugCtor, objProto, &DebuggerEnv_class, + envProto = js_InitClass(cx, debugCtor, objProto, &DebuggerEnv_class, DebuggerEnv_construct, 0, DebuggerEnv_properties, DebuggerEnv_methods, NULL, NULL); From adfcd4895ac070c0da62af45e57099d2a0fa6823 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Tue, 19 Jun 2012 17:24:58 +0200 Subject: [PATCH 30/83] Bug 764346 - Let Error Console filter match more properties like source, line. r=jaws --- toolkit/components/console/content/consoleBindings.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toolkit/components/console/content/consoleBindings.xml b/toolkit/components/console/content/consoleBindings.xml index 165399204f1..3b9febf6211 100644 --- a/toolkit/components/console/content/consoleBindings.xml +++ b/toolkit/components/console/content/consoleBindings.xml @@ -310,7 +310,12 @@ Date: Tue, 19 Jun 2012 16:28:04 +0100 Subject: [PATCH 31/83] Bug 766120 - Stop conflating effects offset and continuation union size in nsSVGIntegrationUtils. r=longsonr. --- content/svg/content/src/nsSVGLength2.cpp | 9 +- gfx/src/nsPoint.h | 10 ++ gfx/src/nsSize.h | 16 ++ layout/base/nsCSSRendering.cpp | 12 +- layout/svg/base/src/nsSVGIntegrationUtils.cpp | 160 +++++++++++------- layout/svg/base/src/nsSVGIntegrationUtils.h | 53 +++++- 6 files changed, 181 insertions(+), 79 deletions(-) diff --git a/content/svg/content/src/nsSVGLength2.cpp b/content/svg/content/src/nsSVGLength2.cpp index 7553e64fd67..a4ae827e6f8 100644 --- a/content/svg/content/src/nsSVGLength2.cpp +++ b/content/svg/content/src/nsSVGLength2.cpp @@ -177,13 +177,14 @@ nsSVGLength2::GetAxisLength(nsSVGSVGElement *aCtx) const float nsSVGLength2::GetAxisLength(nsIFrame *aNonSVGFrame) const { - gfxRect rect = nsSVGIntegrationUtils::GetSVGRectForNonSVGFrame(aNonSVGFrame); + gfxSize size = + nsSVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(aNonSVGFrame); float length; switch (mCtxType) { - case nsSVGUtils::X: length = rect.Width(); break; - case nsSVGUtils::Y: length = rect.Height(); break; + case nsSVGUtils::X: length = size.width; break; + case nsSVGUtils::Y: length = size.height; break; case nsSVGUtils::XY: - length = nsSVGUtils::ComputeNormalizedHypotenuse(rect.Width(), rect.Height()); + length = nsSVGUtils::ComputeNormalizedHypotenuse(size.width, size.height); break; default: NS_NOTREACHED("Unknown axis type"); diff --git a/gfx/src/nsPoint.h b/gfx/src/nsPoint.h index 945764b3956..8573a21e2e8 100644 --- a/gfx/src/nsPoint.h +++ b/gfx/src/nsPoint.h @@ -34,6 +34,8 @@ struct nsIntPoint : public mozilla::gfx::BasePoint { nsIntPoint() : Super() {} nsIntPoint(const nsIntPoint& aPoint) : Super(aPoint) {} nsIntPoint(PRInt32 aX, PRInt32 aY) : Super(aX, aY) {} + + inline nsPoint ToAppUnits(nscoord aAppUnitsPerPixel) const; }; inline nsIntPoint @@ -63,4 +65,12 @@ nsPoint::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const return *this; } +// app units are integer multiples of pixels, so no rounding needed +inline nsPoint +nsIntPoint::ToAppUnits(nscoord aAppUnitsPerPixel) const +{ + return nsPoint(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(y, aAppUnitsPerPixel)); +} + #endif /* NSPOINT_H */ diff --git a/gfx/src/nsSize.h b/gfx/src/nsSize.h index 43977730648..cd1366302f1 100644 --- a/gfx/src/nsSize.h +++ b/gfx/src/nsSize.h @@ -22,6 +22,7 @@ struct nsSize : public mozilla::gfx::BaseSize { inline nsIntSize ScaleToNearestPixels(float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const; + inline nsIntSize ToNearestPixels(nscoord aAppUnitsPerPixel) const; // Converts this size from aFromAPP, an appunits per pixel ratio, to aToAPP. inline nsSize ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const; @@ -32,6 +33,8 @@ struct nsIntSize : public mozilla::gfx::BaseSize { nsIntSize() : Super() {} nsIntSize(PRInt32 aWidth, PRInt32 aHeight) : Super(aWidth, aHeight) {} + + inline nsSize ToAppUnits(nscoord aAppUnitsPerPixel) const; }; inline nsIntSize @@ -43,6 +46,12 @@ nsSize::ScaleToNearestPixels(float aXScale, float aYScale, NSToIntRoundUp(NSAppUnitsToDoublePixels(height, aAppUnitsPerPixel) * aYScale)); } +inline nsIntSize +nsSize::ToNearestPixels(nscoord aAppUnitsPerPixel) const +{ + return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel); +} + inline nsSize nsSize::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const { if (aFromAPP != aToAPP) { @@ -54,4 +63,11 @@ nsSize::ConvertAppUnits(PRInt32 aFromAPP, PRInt32 aToAPP) const { return *this; } +inline nsSize +nsIntSize::ToAppUnits(nscoord aAppUnitsPerPixel) const +{ + return nsSize(NSIntPixelsToAppUnits(width, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(height, aAppUnitsPerPixel)); +} + #endif /* NSSIZE_H */ diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 07fe1748890..0350f8937fc 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -3801,14 +3801,14 @@ nsImageRenderer::ComputeUnscaledDimensions(const nsSize& aBgPositioningArea, size = aBgPositioningArea; } else { // The intrinsic image size for a generic nsIFrame paint server is - // the frame's bbox size rounded to device pixels. + // the union of the border-box rects of all of its continuations, + // rounded to device pixels. PRInt32 appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect rect = - nsSVGIntegrationUtils::GetNonSVGUserSpace(mPaintServerFrame); - nsRect rectSize = rect - rect.TopLeft(); - nsIntRect rounded = rectSize.ToNearestPixels(appUnitsPerDevPixel); - size = rounded.ToAppUnits(appUnitsPerDevPixel).Size(); + size = + nsSVGIntegrationUtils::GetContinuationUnionSize(mPaintServerFrame). + ToNearestPixels(appUnitsPerDevPixel). + ToAppUnits(appUnitsPerDevPixel); } } else { NS_ASSERTION(mImageElementSurface.mSurface, "Surface should be ready."); diff --git a/layout/svg/base/src/nsSVGIntegrationUtils.cpp b/layout/svg/base/src/nsSVGIntegrationUtils.cpp index a2af8938c8d..95b31ccfb50 100644 --- a/layout/svg/base/src/nsSVGIntegrationUtils.cpp +++ b/layout/svg/base/src/nsSVGIntegrationUtils.cpp @@ -31,11 +31,42 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) return (style->mFilter || style->mClipPath || style->mMask); } -/* static */ nsRect -nsSVGIntegrationUtils::GetNonSVGUserSpace(nsIFrame* aFirst) +/* static */ nsPoint +nsSVGIntegrationUtils::GetOffsetToUserSpace(nsIFrame* aFrame) { - NS_ASSERTION(!aFirst->GetPrevContinuation(), "Not first continuation"); - return nsLayoutUtils::GetAllInFlowRectsUnion(aFirst, aFirst); + // We could allow aFrame to be any continuation, but since that would require + // a GetPrevContinuation() virtual call and conditional returns, and since + // all our current consumers always pass in the first continuation, we don't + // currently bother. + NS_ASSERTION(!aFrame->GetPrevContinuation(), "Not first continuation"); + + // The GetAllInFlowRectsUnion() call gets the union of the frame border-box + // rects over all continuations, relative to the origin (top-left of the + // border box) of its second argument (here, aFrame, the first continuation). + return -nsLayoutUtils::GetAllInFlowRectsUnion(aFrame, aFrame).TopLeft(); +} + +/* static */ nsSize +nsSVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) +{ + NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG), + "SVG frames should not get here"); + nsIFrame* firstFrame = + nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aNonSVGFrame); + return nsLayoutUtils::GetAllInFlowRectsUnion(firstFrame, firstFrame).Size(); +} + +/* static */ gfxSize +nsSVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(nsIFrame* aNonSVGFrame) +{ + NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG), + "SVG frames should not get here"); + nsIFrame* firstFrame = + nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aNonSVGFrame); + nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(firstFrame, firstFrame); + nsPresContext* presContext = firstFrame->PresContext(); + return gfxSize(presContext->AppUnitsToFloatCSSPixels(r.width), + presContext->AppUnitsToFloatCSSPixels(r.height)); } static nsRect @@ -67,16 +98,19 @@ struct BBoxCollector : public nsLayoutUtils::BoxCallback { }; static nsRect -GetSVGBBox(nsIFrame* aNonSVGFrame, nsIFrame* aCurrentFrame, - const nsRect& aCurrentOverflow, const nsRect& aUserSpaceRect) +GetSVGBBox(nsIFrame* aFirstContinuation, + nsIFrame* aCurrentFrame, + const nsRect& aCurrentFramesPreEffectsOverflow, + const nsPoint& aFirstContinuationToUserSpace) { - NS_ASSERTION(!aNonSVGFrame->GetPrevContinuation(), + NS_ASSERTION(!aFirstContinuation->GetPrevContinuation(), "Need first continuation here"); - // Compute union of all overflow areas relative to 'first'. - BBoxCollector collector(aNonSVGFrame, aCurrentFrame, aCurrentOverflow); - nsLayoutUtils::GetAllInFlowBoxes(aNonSVGFrame, &collector); + // Compute union of all overflow areas relative to aFirstContinuation: + BBoxCollector collector(aFirstContinuation, aCurrentFrame, + aCurrentFramesPreEffectsOverflow); + nsLayoutUtils::GetAllInFlowBoxes(aFirstContinuation, &collector); // Get it into "user space" for non-SVG frames - return collector.mResult - aUserSpaceRect.TopLeft(); + return collector.mResult + aFirstContinuationToUserSpace; } nsRect @@ -95,15 +129,16 @@ nsSVGIntegrationUtils::ComputeFrameEffectsRect(nsIFrame* aFrame, // XXX this isn't really right. We can't compute the correct filter // bbox until all aFrame's continuations have been reflowed. // but then it's too late to set the overflow areas for the earlier frames. - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); - nsRect r = GetSVGBBox(firstFrame, aFrame, aOverflowRect, userSpaceRect); + nsPoint firstFrameToUserSpace = GetOffsetToUserSpace(firstFrame); + nsRect r = GetSVGBBox(firstFrame, aFrame, aOverflowRect, + firstFrameToUserSpace); // r is relative to user space PRUint32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel(); nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); p = filterFrame->GetPostFilterBounds(firstFrame, &p); r = p.ToAppUnits(appUnitsPerDevPixel); // Make it relative to aFrame again - return r + userSpaceRect.TopLeft() - aFrame->GetOffsetTo(firstFrame); + return r - (aFrame->GetOffsetTo(firstFrame) + firstFrameToUserSpace); } nsRect @@ -132,19 +167,23 @@ nsSVGIntegrationUtils::GetInvalidAreaForChangedSource(nsIFrame* aFrame, return aFrame->GetVisualOverflowRect(); } + // Convert aInvalidRect into "user space" in dev pixels: PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); - nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft(); - nsRect r = aInvalidRect + offset; - nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); - p = filterFrame->GetPostFilterDirtyArea(firstFrame, p); - r = p.ToAppUnits(appUnitsPerDevPixel); - return r - offset; + nsPoint toUserSpace = + aFrame->GetOffsetTo(firstFrame) + GetOffsetToUserSpace(firstFrame); + nsIntRect preEffectsRect = + (aInvalidRect + toUserSpace).ToOutsidePixels(appUnitsPerDevPixel); + + nsIntRect postEffectsRect = + filterFrame->GetPostFilterDirtyArea(firstFrame, preEffectsRect); + + // Return result relative to aFrame, rather than "user space": + return postEffectsRect.ToAppUnits(appUnitsPerDevPixel) - toUserSpace; } nsRect nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame, - const nsRect& aDamageRect) + const nsRect& aDirtyRect) { // Don't bother calling GetEffectProperties; the filter property should // already have been set up during reflow/ComputeFrameEffectsRect @@ -153,16 +192,20 @@ nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame, nsSVGFilterFrame* filterFrame = nsSVGEffects::GetFilterFrame(firstFrame); if (!filterFrame) - return aDamageRect; + return aDirtyRect; + // Convert aDirtyRect into "user space" in dev pixels: PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); - nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft(); - nsRect r = aDamageRect + offset; - nsIntRect p = r.ToOutsidePixels(appUnitsPerDevPixel); - p = filterFrame->GetPreFilterNeededArea(firstFrame, p); - r = p.ToAppUnits(appUnitsPerDevPixel); - return r - offset; + nsPoint toUserSpace = + aFrame->GetOffsetTo(firstFrame) + GetOffsetToUserSpace(firstFrame); + nsIntRect postEffectsRect = + (aDirtyRect + toUserSpace).ToOutsidePixels(appUnitsPerDevPixel); + + nsIntRect preEffectsRect = + filterFrame->GetPreFilterNeededArea(firstFrame, postEffectsRect); + + // Return result relative to aFrame, rather than "user space": + return preEffectsRect.ToAppUnits(appUnitsPerDevPixel) - toUserSpace; } bool @@ -170,9 +213,10 @@ nsSVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame, const nsPoint& a { nsIFrame* firstFrame = nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aFrame); - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); - // get point relative to userSpaceRect - nsPoint pt = aPt + aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft(); + // Convert aPt to user space: + nsPoint toUserSpace = + aFrame->GetOffsetTo(firstFrame) + GetOffsetToUserSpace(firstFrame); + nsPoint pt = aPt + toUserSpace; return nsSVGUtils::HitTestClip(firstFrame, pt); } @@ -252,10 +296,13 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, gfxContext* gfx = aCtx->ThebesContext(); gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx); - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame) + aBuilder->ToReferenceFrame(firstFrame); - PRInt32 appUnitsPerDevPixel = aEffectsFrame->PresContext()->AppUnitsPerDevPixel(); - userSpaceRect = userSpaceRect.ToNearestPixels(appUnitsPerDevPixel).ToAppUnits(appUnitsPerDevPixel); - aCtx->Translate(userSpaceRect.TopLeft()); + PRInt32 appUnitsPerDevPixel = + aEffectsFrame->PresContext()->AppUnitsPerDevPixel(); + nsPoint firstFrameOffset = GetOffsetToUserSpace(firstFrame); + nsPoint offset = (aBuilder->ToReferenceFrame(firstFrame) - firstFrameOffset). + ToNearestPixels(appUnitsPerDevPixel). + ToAppUnits(appUnitsPerDevPixel); + aCtx->Translate(offset); gfxMatrix matrix = GetInitialMatrix(aEffectsFrame); @@ -280,15 +327,15 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, /* Paint the child */ if (filterFrame) { RegularFramePaintCallback callback(aBuilder, aInnerList, aEffectsFrame, - userSpaceRect.TopLeft()); - nsIntRect dirtyRect = (aDirtyRect - userSpaceRect.TopLeft()) + offset); + nsIntRect dirtyRect = (aDirtyRect - offset) .ToOutsidePixels(appUnitsPerDevPixel); filterFrame->PaintFilteredFrame(aCtx, aEffectsFrame, &callback, &dirtyRect); } else { gfx->SetMatrix(matrixAutoSaveRestore.Matrix()); aInnerList->PaintForFrame(aBuilder, aCtx, aEffectsFrame, nsDisplayList::PAINT_DEFAULT); - aCtx->Translate(userSpaceRect.TopLeft()); + aCtx->Translate(offset); } if (clipPathFrame && isTrivialClip) { @@ -348,19 +395,6 @@ nsSVGIntegrationUtils::GetInitialMatrix(nsIFrame* aNonSVGFrame) 0.0, 0.0); } -gfxRect -nsSVGIntegrationUtils::GetSVGRectForNonSVGFrame(nsIFrame* aNonSVGFrame) -{ - NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG), - "SVG frames should not get here"); - nsIFrame* firstFrame = - nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aNonSVGFrame); - nsRect r = GetNonSVGUserSpace(firstFrame); - nsPresContext* presContext = firstFrame->PresContext(); - return gfxRect(0, 0, presContext->AppUnitsToFloatCSSPixels(r.width), - presContext->AppUnitsToFloatCSSPixels(r.height)); -} - gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame) { @@ -368,12 +402,11 @@ nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame) "SVG frames should not get here"); nsIFrame* firstFrame = nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aNonSVGFrame); - nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame); - nsRect r = GetSVGBBox(firstFrame, nsnull, nsRect(), userSpaceRect); - gfxRect result(r.x, r.y, r.width, r.height); - nsPresContext* presContext = aNonSVGFrame->PresContext(); - result.ScaleInverse(presContext->AppUnitsPerCSSPixel()); - return result; + // 'r' is in "user space": + nsRect r = GetSVGBBox(firstFrame, nsnull, nsRect(), + GetOffsetToUserSpace(firstFrame)); + return nsLayoutUtils::RectToGfxRect(r, + aNonSVGFrame->PresContext()->AppUnitsPerCSSPixel()); } class PaintFrameCallback : public gfxDrawingCallback { @@ -423,10 +456,10 @@ PaintFrameCallback::operator()(gfxContext* aContext, // nsLayoutUtils::PaintFrame will anchor its painting at mFrame. But we want // to have it anchored at the top left corner of the bounding box of all of // mFrame's continuations. So we add a translation transform. - nsRect bbox = nsSVGIntegrationUtils::GetNonSVGUserSpace(mFrame); PRInt32 appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - gfxPoint offset = gfxPoint(bbox.x, bbox.y) / appUnitsPerDevPixel; - aContext->Multiply(gfxMatrix().Translate(-offset)); + nsPoint offset = nsSVGIntegrationUtils::GetOffsetToUserSpace(mFrame); + gfxPoint devPxOffset = gfxPoint(offset.x, offset.y) / appUnitsPerDevPixel; + aContext->Multiply(gfxMatrix().Translate(devPxOffset)); gfxSize paintServerSize = gfxSize(mPaintServerSize.width, mPaintServerSize.height) / @@ -440,7 +473,8 @@ PaintFrameCallback::operator()(gfxContext* aContext, aContext->Multiply(scaleMatrix); // Draw. - nsRect dirty(bbox.x, bbox.y, mPaintServerSize.width, mPaintServerSize.height); + nsRect dirty(-offset.x, -offset.y, + mPaintServerSize.width, mPaintServerSize.height); nsLayoutUtils::PaintFrame(&context, mFrame, dirty, NS_RGBA(0, 0, 0, 0), nsLayoutUtils::PAINT_IN_TRANSFORM | diff --git a/layout/svg/base/src/nsSVGIntegrationUtils.h b/layout/svg/base/src/nsSVGIntegrationUtils.h index f2f59e1ecc9..85d819789eb 100644 --- a/layout/svg/base/src/nsSVGIntegrationUtils.h +++ b/layout/svg/base/src/nsSVGIntegrationUtils.h @@ -19,8 +19,10 @@ class nsRenderingContext; struct nsPoint; struct nsSize; -/***** Integration of SVG effects with regular frame painting *****/ - +/** + * Integration of SVG effects (clipPath clipping, masking and filters) into + * regular display list based painting and hit-testing. + */ class nsSVGIntegrationUtils { public: @@ -31,11 +33,50 @@ public: UsingEffectsForFrame(const nsIFrame* aFrame); /** - * Get the union the frame border-box rects over all continuations, - * relative to aFirst. This defines "user space" for non-SVG frames. + * In SVG, an element's "user space" is simply the coordinate system in place + * at the time that it is drawn. For non-SVG frames, we want any SVG effects + * to be applied to the union of the border-box rects of all of a given + * frame's continuations. This means that, when we paint a non-SVG frame with + * effects, we want to offset the effects by the distance from the frame's + * origin (the top left of its border box) to the top left of the union of + * the border-box rects of all its continuations. In other words, we need to + * apply this offset as a suplimental translation to the current coordinate + * system in order to establish the correct user space before calling into + * the SVG effects code. For the purposes of the nsSVGIntegrationUtils code + * we somewhat misappropriate the term "user space" by using it to refer + * specifically to this adjusted coordinate system. + * + * For consistency with nsIFrame::GetOffsetTo, the offset this method returns + * is the offset you need to add to a point that's relative to aFrame's + * origin (the top left of its border box) to convert it to aFrame's user + * space. In other words the value returned is actually the offset from the + * origin of aFrame's user space to aFrame. + * + * Note: This method currently only accepts a frame's first continuation + * since none of our current callers need to be able to pass in other + * continuations. */ - static nsRect - GetNonSVGUserSpace(nsIFrame* aFirst); + static nsPoint + GetOffsetToUserSpace(nsIFrame* aFrame); + + /** + * Returns the size of the union of the border-box rects of all of + * aNonSVGFrame's continuations. + */ + static nsSize + GetContinuationUnionSize(nsIFrame* aNonSVGFrame); + + /** + * When SVG effects need to resolve percentage, userSpaceOnUse lengths, they + * need a coordinate context to resolve them against. This method provides + * that coordinate context for non-SVG frames with SVG effects applied to + * them. The gfxSize returned is the size of the union of all of the given + * frame's continuations' border boxes, converted to SVG user units (equal to + * CSS px units), as required by the SVG code. + */ + static gfxSize + GetSVGCoordContextForNonSVGFrame(nsIFrame* aNonSVGFrame); + /** * Adjust overflow rect for effects. * XXX this is a problem. We really need to compute the effects rect for From 5b5084bf3e23d2ce3e2833c9d8b42b9bf512de4b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 19 Jun 2012 12:08:39 -0400 Subject: [PATCH 32/83] Bug 764420. Fix ArrayBufferView unwrapping to allow DataViews. r=khuey --- dom/bindings/Codegen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index e819c774012..5d4ec10acac 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1607,7 +1607,7 @@ for (uint32_t i = 0; i < length; ++i) { if type.isArrayBuffer(): jsname = "ArrayBufferObject" elif type.isArrayBufferView(): - jsname = "TypedArrayObject" + jsname = "ArrayBufferViewObject" else: jsname = type.name From e92190b4f82359fb6a844130bec7e3a51cd860b9 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 19 Jun 2012 12:09:37 -0400 Subject: [PATCH 33/83] Bug 763911. Add support for interface members of dictionaries. r=khuey --- dom/bindings/Codegen.py | 116 ++++++++++++++++++++------- dom/bindings/Configuration.py | 65 ++++++++++----- dom/bindings/parser/WebIDL.py | 5 ++ dom/bindings/test/TestCodeGen.webidl | 2 + 4 files changed, 137 insertions(+), 51 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 5d4ec10acac..53888c75379 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -8,6 +8,7 @@ import os import string from WebIDL import * +from Configuration import NoSuchDescriptorError AUTOGENERATED_WARNING_COMMENT = \ "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n" @@ -351,6 +352,12 @@ class CGHeaders(CGWrapper): attrs = [a for a in members if a.isAttr()] types.extend([a.type for a in attrs]) + for dictionary in dictionaries: + curDict = dictionary + while curDict: + types.extend([m.type for m in curDict.members]) + curDict = curDict.parent + for t in types: if t.unroll().isInterface(): if t.unroll().isSpiderMonkeyInterface(): @@ -1556,15 +1563,15 @@ for (uint32_t i = 0; i < length; ++i) { elif descriptor.workers: templateBody += "${declName} = &${val}.toObject();" else: - # Either external, or new-binding non-castable. We always have a - # holder for these, because we don't actually know whether we have - # to addref when unwrapping or not. So we just pass an - # getter_AddRefs(nsRefPtr) to XPConnect and if we'll need a release - # it'll put a non-null pointer in there. + # External interface. We always have a holder for these, + # because we don't actually know whether we have to addref + # when unwrapping or not. So we just pass an + # getter_AddRefs(nsRefPtr) to XPConnect and if we'll need + # a release it'll put a non-null pointer in there. if forceOwningType: # Don't return a holderType in this case; our declName # will just own stuff. - templateBody += "nsRefPtr<" + typeName + "> ${holderName};" + templateBody += "nsRefPtr<" + typeName + "> ${holderName};\n" else: holderType = "nsRefPtr<" + typeName + ">" templateBody += ( @@ -1756,11 +1763,13 @@ for (uint32_t i = 0; i < length; ++i) { raise TypeError("Can't handle dictionaries when failureCode is not None") if type.nullable(): - typeName = type.inner.inner.identifier.name + typeName = CGDictionary.makeDictionaryName(type.inner.inner, + descriptorProvider.workers) declType = CGGeneric("Nullable<%s>" % typeName) selfRef = "${declName}.Value()" else: - typeName = type.inner.identifier.name + typeName = CGDictionary.makeDictionaryName(type.inner, + descriptorProvider.workers) declType = CGGeneric(typeName) selfRef = "${declName}" # If we're optional or a member of something else, the const @@ -3490,24 +3499,37 @@ class CGNamespacedEnum(CGThing): assert False # Only for headers. class CGDictionary(CGThing): - def __init__(self, dictionary, workers): + def __init__(self, dictionary, descriptorProvider): self.dictionary = dictionary; - self.workers = workers - # Fake a descriptorProvider - # XXXbz this will fail for interface types! - for member in dictionary.members: - if member.type.unroll().isInterface(): - raise TypeError("No support for interface members of dictionaries: %s.%s" % - (dictionary.identifier.name, member.identifier.name)) - self.memberInfo = [ - (member, - getJSToNativeConversionTemplate(member.type, - { "workers": workers }, - isMember=True, - isOptional=(not member.defaultValue))) - for member in dictionary.members ] + self.workers = descriptorProvider.workers + if dictionary.parent: + parentCGThing = CGDictionary(dictionary.parent, descriptorProvider) + self.generatable = parentCGThing.generatable + if not self.generatable: + # Nothing else to do here + return + else: + self.generatable = True + # Getting a conversion template for interface types can fail + # if we don't have a relevant descriptor when self.workers is True. + # If that happens, just mark ourselves as not being + # generatable and move on. + try: + self.memberInfo = [ + (member, + getJSToNativeConversionTemplate(member.type, + descriptorProvider, + isMember=True, + isOptional=(not member.defaultValue))) + for member in dictionary.members ] + except NoSuchDescriptorError, err: + if not self.workers: + raise err + self.generatable = False def declare(self): + if not self.generatable: + return "" d = self.dictionary if d.parent: inheritance = ": public %s " % self.makeClassName(d.parent) @@ -3535,6 +3557,8 @@ class CGDictionary(CGThing): "inheritance": inheritance })) def define(self): + if not self.generatable: + return "" d = self.dictionary if d.parent: initParent = ("// Per spec, we init the parent's members first\n" @@ -3590,10 +3614,14 @@ class CGDictionary(CGThing): "idInit": CGIndenter(idinit).define() }) - def makeClassName(self, dictionary): - suffix = "Workers" if self.workers else "" + @staticmethod + def makeDictionaryName(dictionary, workers): + suffix = "Workers" if workers else "" return dictionary.identifier.name + suffix + def makeClassName(self, dictionary): + return self.makeDictionaryName(dictionary, self.workers) + def getMemberType(self, memberInfo): (member, (templateBody, declType, holderType, dealWithOptional)) = memberInfo @@ -3604,7 +3632,6 @@ class CGDictionary(CGThing): return declType.define() def getMemberConversion(self, memberInfo): - # Fake a descriptorProvider (member, (templateBody, declType, holderType, dealWithOptional)) = memberInfo replacements = { "val": "temp", @@ -3616,7 +3643,11 @@ class CGDictionary(CGThing): # the guts of init to a static method which is passed # an explicit reference to our dictionary object, so # we couldn't screw this up even if we wanted to.... - "declName": ("(this->%s)" % member.identifier.name) } + "declName": ("(this->%s)" % member.identifier.name), + # We need a holder name for external interfaces, but + # it's scoped down to the conversion so we can just use + # anything we want. + "holderName": "holder"} # We can't handle having a holderType here assert holderType is None if dealWithOptional: @@ -3696,7 +3727,30 @@ class CGBindingRoot(CGThing): forwardDeclares = [CGClassForwardDeclare('XPCWrappedNativeScope')] - for x in descriptors: + descriptorsForForwardDeclaration = list(descriptors) + for dictionary in dictionaries: + curDict = dictionary + ifacemembers = [] + while curDict: + ifacemembers.extend([m.type.unroll().inner for m + in curDict.members + if m.type.unroll().isInterface()]) + curDict = curDict.parent + # Put in all the non-worker descriptors + descriptorsForForwardDeclaration.extend( + [config.getDescriptor(iface.identifier.name, False) for + iface in ifacemembers]) + # And now the worker ones. But these may not exist, so we + # have to be more careful. + for iface in ifacemembers: + try: + descriptorsForForwardDeclaration.append( + config.getDescriptor(iface.identifier.name, True)) + except NoSuchDescriptorError: + # just move along + pass + + for x in descriptorsForForwardDeclaration: nativeType = x.nativeType components = x.nativeType.split('::') className = components[-1] @@ -3755,8 +3809,10 @@ class CGBindingRoot(CGThing): reSortedDictionaries.extend(toMove) dictionaries = reSortedDictionaries - cgthings.extend([CGDictionary(d, workers=True) for d in dictionaries]) - cgthings.extend([CGDictionary(d, workers=False) for d in dictionaries]) + cgthings.extend([CGDictionary(d, config.getDescriptorProvider(True)) + for d in dictionaries]) + cgthings.extend([CGDictionary(d, config.getDescriptorProvider(False)) + for d in dictionaries]) # Do codegen for all the descriptors cgthings.extend([CGDescriptor(x) for x in descriptors]) diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index 63c02bfb6cb..6d478bf3b3b 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -75,13 +75,55 @@ class Configuration: return filter(lambda e: e.filename() == webIDLFile, self.enums) def getDictionaries(self, webIDLFile): return filter(lambda d: d.filename() == webIDLFile, self.dictionaries) + def getDescriptor(self, interfaceName, workers): + """ + Gets the appropriate descriptor for the given interface name + and the given workers boolean. + """ + iface = self.getInterface(interfaceName) + descriptors = self.getDescriptors(interface=iface) -class Descriptor: + # The only filter we currently have is workers vs non-workers. + matches = filter(lambda x: x.workers is workers, descriptors) + + # After filtering, we should have exactly one result. + if len(matches) is not 1: + raise NoSuchDescriptorError("For " + interfaceName + " found " + + str(len(matches)) + " matches"); + return matches[0] + def getDescriptorProvider(self, workers): + """ + Gets a descriptor provider that can provide descriptors as needed, + for the given workers boolean + """ + return DescriptorProvider(self, workers) + +class NoSuchDescriptorError(TypeError): + def __init__(self, str): + TypeError.__init__(self, str) + +class DescriptorProvider: + """ + A way of getting descriptors for interface names + """ + def __init__(self, config, workers): + self.config = config + self.workers = workers + + def getDescriptor(self, interfaceName): + """ + Gets the appropriate descriptor for the given interface name given the + context of the current descriptor. This selects the appropriate + implementation for cases like workers. + """ + return self.config.getDescriptor(interfaceName, self.workers) + +class Descriptor(DescriptorProvider): """ Represents a single descriptor for an interface. See Bindings.conf. """ def __init__(self, config, interface, desc): - self.config = config + DescriptorProvider.__init__(self, config, desc.get('workers', False)) self.interface = interface # Read the desc, and fill in the relevant defaults. @@ -109,7 +151,6 @@ class Descriptor: self.prefable = desc.get('prefable', False) - self.workers = desc.get('workers', False) self.nativeIsISupports = not self.workers self.customTrace = desc.get('customTrace', self.workers) self.customFinalize = desc.get('customFinalize', self.workers) @@ -166,24 +207,6 @@ class Descriptor: return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject() - def getDescriptor(self, interfaceName): - """ - Gets the appropriate descriptor for the given interface name given the - context of the current descriptor. This selects the appropriate - implementation for cases like workers. - """ - iface = self.config.getInterface(interfaceName) - descriptors = self.config.getDescriptors(interface=iface) - - # The only filter we currently have is workers vs non-workers. - matches = filter(lambda x: x.workers is self.workers, descriptors) - - # After filtering, we should have exactly one result. - if len(matches) is not 1: - raise TypeError("For " + interfaceName + " found " + - str(len(matches)) + " matches"); - return matches[0] - def getExtendedAttributes(self, member, getter=False, setter=False): name = member.identifier.name if member.isMethod(): diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 649ebe52704..6f4b6b5c7d8 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -634,6 +634,11 @@ class IDLDictionary(IDLObjectWithScope): for member in self.members: member.resolve(self) + if not member.type.isComplete(): + type = member.type.complete(scope) + assert not isinstance(type, IDLUnresolvedType) + assert not isinstance(type.name, IDLUnresolvedIdentifier) + member.type = type # Members of a dictionary are sorted in lexicographic order self.members.sort(cmp=cmp, key=lambda x: x.identifier.name) diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index dd3a080c214..f1837543b99 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -304,4 +304,6 @@ dictionary Dict : ParentDict { dictionary ParentDict : GrandparentDict { long c = 5; + TestInterface someInterface; + TestExternalInterface someExternalInterface; }; From 373898d8dfabece9343f9d8b7d4eb2ab40f86711 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Tue, 19 Jun 2012 09:14:41 -0700 Subject: [PATCH 34/83] Bug 756264 - Reduce devicemanager chmod calls; r=jmaher --- build/mobile/devicemanager.py | 8 ++ build/mobile/devicemanagerADB.py | 18 ++-- build/mobile/devicemanagerSUT.py | 11 +++ build/mobile/sutagent/android/DoCommand.java | 86 +++++++++++++++----- testing/xpcshell/remotexpcshelltests.py | 2 + 5 files changed, 97 insertions(+), 28 deletions(-) diff --git a/build/mobile/devicemanager.py b/build/mobile/devicemanager.py index 3e65420bd58..24c323e7ef2 100755 --- a/build/mobile/devicemanager.py +++ b/build/mobile/devicemanager.py @@ -501,6 +501,14 @@ class DeviceManager: return str(buf.getvalue()[0:-1]).rstrip().split('\r') + @abstractmethod + def chmodDir(self, remoteDir): + """ + external function + returns: + success: True + failure: False + """ class NetworkTools: def __init__(self): diff --git a/build/mobile/devicemanagerADB.py b/build/mobile/devicemanagerADB.py index 6aa724c3864..1ae1a527aef 100644 --- a/build/mobile/devicemanagerADB.py +++ b/build/mobile/devicemanagerADB.py @@ -168,7 +168,6 @@ class DeviceManagerADB(DeviceManager): self.checkCmd(["push", os.path.realpath(localname), destname]) if (self.isDir(destname)): destname = destname + "/" + os.path.basename(localname) - self.chmodDir(destname) return True except: return False @@ -184,8 +183,6 @@ class DeviceManagerADB(DeviceManager): return None if 'file exists' in result.lower(): return name - - self.chmodDir(name) return name except: return None @@ -253,7 +250,6 @@ class DeviceManagerADB(DeviceManager): targetDir = targetDir + dir if (not self.dirExists(targetDir)): self.mkDir(targetDir) - self.checkCmdAs(["shell", "chmod", "777", remoteDir]) return remoteDir except: print "pushing " + localDir + " to " + remoteDir + " failed" @@ -752,20 +748,26 @@ class DeviceManagerADB(DeviceManager): args.insert(2, self.packageName) return self.checkCmd(args) + # external function + # returns: + # success: True + # failure: False def chmodDir(self, remoteDir): if (self.isDir(remoteDir)): files = self.listFiles(remoteDir.strip()) for f in files: - if (self.isDir(remoteDir.strip() + "/" + f.strip())): - self.chmodDir(remoteDir.strip() + "/" + f.strip()) + remoteEntry = remoteDir.strip() + "/" + f.strip() + if (self.isDir(remoteEntry)): + self.chmodDir(remoteEntry) else: - self.checkCmdAs(["shell", "chmod", "777", remoteDir.strip()]) - print "chmod " + remoteDir.strip() + self.checkCmdAs(["shell", "chmod", "777", remoteEntry]) + print "chmod " + remoteEntry self.checkCmdAs(["shell", "chmod", "777", remoteDir]) print "chmod " + remoteDir else: self.checkCmdAs(["shell", "chmod", "777", remoteDir.strip()]) print "chmod " + remoteDir.strip() + return True def verifyADB(self): # Check to see if adb itself can be executed. diff --git a/build/mobile/devicemanagerSUT.py b/build/mobile/devicemanagerSUT.py index 270e051c5c8..d92d9e15e4a 100644 --- a/build/mobile/devicemanagerSUT.py +++ b/build/mobile/devicemanagerSUT.py @@ -1182,6 +1182,17 @@ class DeviceManagerSUT(DeviceManager): return True + # external function + # returns: + # success: True + # failure: False + def chmodDir(self, remoteDir): + try: + self.runCmds(["chmod "+remoteDir]) + except AgentError: + return False + return True + gCallbackData = '' class myServer(SocketServer.TCPServer): diff --git a/build/mobile/sutagent/android/DoCommand.java b/build/mobile/sutagent/android/DoCommand.java index 322f846729e..ffb7842aeca 100755 --- a/build/mobile/sutagent/android/DoCommand.java +++ b/build/mobile/sutagent/android/DoCommand.java @@ -169,6 +169,7 @@ public class DoCommand { TZGET ("tzget"), TZSET ("tzset"), ADB ("adb"), + CHMOD ("chmod"), UNKNOWN ("unknown"); private final String theCmd; @@ -732,6 +733,13 @@ public class DoCommand { strReturn = Zip(Argv[1], (Argc == 3 ? Argv[2] : "")); break; + case CHMOD: + if (Argc == 2) + strReturn = ChmodDir(Argv[1]); + else + strReturn = sErrorPrefix + "Wrong number of arguments for chmod command!"; + break; + case HELP: strReturn = PrintUsage(); break; @@ -1910,14 +1918,6 @@ private void CancelNotification() if (dstFile != null) { dstFile.flush(); dstFile.close(); - // set the new file's permissions to rwxrwxrwx, if possible - Process pProc = Runtime.getRuntime().exec("chmod 777 "+sTmpFileName); - RedirOutputThread outThrd = new RedirOutputThread(pProc, null); - outThrd.start(); - try { - outThrd.join(5000); - } catch (InterruptedException e) { - } } if (lRead == lSize) { @@ -2258,18 +2258,6 @@ private void CancelNotification() File dir = new File(sTmpDir); if (dir.mkdirs()) { - // set the new dir's permissions to rwxrwxrwx, if possible - try { - Process pProc = Runtime.getRuntime().exec("chmod 777 "+sTmpDir); - RedirOutputThread outThrd = new RedirOutputThread(pProc, null); - outThrd.start(); - try { - outThrd.join(5000); - } catch (InterruptedException e) { - } - } catch (IOException e) { - e.printStackTrace(); - } sRet = sDir + " successfully created"; } } @@ -3672,6 +3660,63 @@ private void CancelNotification() return (sRet); } + public String ChmodDir(String sDir) + { + String sRet = ""; + int nFiles = 0; + String sSubDir = null; + String sTmpDir = fixFileName(sDir); + + File dir = new File(sTmpDir); + + if (dir.isDirectory()) { + sRet = "Changing permissions for " + sTmpDir; + + File [] files = dir.listFiles(); + if (files != null) { + if ((nFiles = files.length) > 0) { + for (int lcv = 0; lcv < nFiles; lcv++) { + if (files[lcv].isDirectory()) { + sSubDir = files[lcv].getAbsolutePath(); + sRet += "\n" + ChmodDir(sSubDir); + } + else { + // set the new file's permissions to rwxrwxrwx, if possible + try { + Process pProc = Runtime.getRuntime().exec("chmod 777 "+files[lcv]); + RedirOutputThread outThrd = new RedirOutputThread(pProc, null); + outThrd.start(); + outThrd.join(5000); + sRet += "\n\tchmod " + files[lcv].getName() + " ok"; + } catch (InterruptedException e) { + sRet += "\n\ttimeout waiting for chmod " + files[lcv].getName(); + } catch (IOException e) { + sRet += "\n\tunable to chmod " + files[lcv].getName(); + } + } + } + } + else + sRet += "\n\t"; + } + } + + // set the new directory's (or file's) permissions to rwxrwxrwx, if possible + try { + Process pProc = Runtime.getRuntime().exec("chmod 777 "+sTmpDir); + RedirOutputThread outThrd = new RedirOutputThread(pProc, null); + outThrd.start(); + outThrd.join(5000); + sRet += "\n\tchmod " + sTmpDir + " ok"; + } catch (InterruptedException e) { + sRet += "\n\ttimeout waiting for chmod " + sTmpDir; + } catch (IOException e) { + sRet += "\n\tunable to chmod " + sTmpDir; + } + + return(sRet); + } + private String PrintUsage() { String sRet = @@ -3706,6 +3751,7 @@ private void CancelNotification() "mkdr directory - create directory\n" + "dirw directory - tests whether the directory is writable\n" + "isdir directory - test whether the directory exists\n" + + "chmod directory|file - change permissions of directory and contents (or file) to 777\n" + "stat processid - stat process\n" + "dead processid - print whether the process is alive or hung\n" + "mems - dump memory stats\n" + diff --git a/testing/xpcshell/remotexpcshelltests.py b/testing/xpcshell/remotexpcshelltests.py index b75fef50cd9..f6b0ef64c3b 100644 --- a/testing/xpcshell/remotexpcshelltests.py +++ b/testing/xpcshell/remotexpcshelltests.py @@ -119,6 +119,8 @@ class XPCShellRemote(xpcshell.XPCShellTests, object): if (file.endswith(".so")): self.device.pushFile(os.path.join(root, file), self.remoteBinDir) + self.device.chmodDir(self.remoteBinDir) + def setupTestDir(self): xpcDir = os.path.join(self.options.objdir, "_tests/xpcshell") self.device.pushDir(xpcDir, self.remoteScriptsDir) From 10817edfddc51030ff650a76ef99f573b9b011ba Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Tue, 19 Jun 2012 17:35:42 +0100 Subject: [PATCH 35/83] Bug 758191 - correct licence of file sourced from narwhal.js. --- .../modules/lib/unload.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/lib/unload.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/lib/unload.js index b1f7a41996e..525472d8e2c 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/lib/unload.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/lib/unload.js @@ -1,6 +1,23 @@ -/* 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/. */ +// Copyright (c) 2009 Thomas Robinson +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation files +// (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This module was taken from narwhal: // From be75994dedbefe438677f6ab8d2fbec86f6bc902 Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Tue, 19 Jun 2012 17:49:47 +0100 Subject: [PATCH 36/83] Backout most of Bug 467498 - crashtest failure on windows --- content/base/src/nsGkAtomList.h | 1 - content/svg/content/src/nsSVGUseElement.cpp | 7 ------- layout/reftests/svg/reftest.list | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index c7fdb17be59..a1e9269bd58 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -1218,7 +1218,6 @@ GK_ATOM(matrix, "matrix") GK_ATOM(metadata, "metadata") GK_ATOM(missingGlyph, "missing-glyph") GK_ATOM(mm, "mm") -GK_ATOM(mozUseChangeDummyAttr, "_mozUseChangeDummyAttr") GK_ATOM(mpath, "mpath") GK_ATOM(noStitch, "noStitch") GK_ATOM(numOctaves, "numOctaves") diff --git a/content/svg/content/src/nsSVGUseElement.cpp b/content/svg/content/src/nsSVGUseElement.cpp index bc3faa7be5e..385e01c9505 100644 --- a/content/svg/content/src/nsSVGUseElement.cpp +++ b/content/svg/content/src/nsSVGUseElement.cpp @@ -9,7 +9,6 @@ #include "nsIDOMSVGGElement.h" #include "nsGkAtoms.h" #include "nsIDOMDocument.h" -#include "nsIDOMMutationEvent.h" #include "nsSVGSVGElement.h" #include "nsIDOMSVGSymbolElement.h" #include "nsIDocument.h" @@ -437,12 +436,6 @@ nsSVGUseElement::TriggerReclone() if (!presShell) return; presShell->PostRecreateFramesFor(this); - - // We may be the target of other use elements - // so we need to notify them that things have changed - nsNodeUtils::AttributeChanged(this, kNameSpaceID_None, - nsGkAtoms::mozUseChangeDummyAttr, - nsIDOMMutationEvent::MODIFICATION); } void diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 53bac72b38a..f548f7cc58f 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -110,8 +110,8 @@ random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dyna == dynamic-use-04.svg pass.svg == dynamic-use-05.svg pass.svg == dynamic-use-06.svg pass.svg -== dynamic-use-nested-01a.svg dynamic-use-nested-01-ref.svg -== dynamic-use-nested-01b.svg dynamic-use-nested-01-ref.svg +random == dynamic-use-nested-01a.svg dynamic-use-nested-01-ref.svg +random == dynamic-use-nested-01b.svg dynamic-use-nested-01-ref.svg == dynamic-use-remove-width.svg dynamic-use-remove-width-ref.svg == fragmentIdentifier-01.xhtml pass.svg == linked-filter-01.svg pass.svg From 4654f19c55237d63c974c9e6c78c38d2ed88f673 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Mon, 18 Jun 2012 16:05:23 +0200 Subject: [PATCH 37/83] Bug 752407 - Thumbnail cache should be created in the Local profile folder, not the Roaming ones; r=mak --HG-- extra : rebase_source : 960b6d4ea73b52450320ae7c00702f3c233f523d --- browser/components/thumbnails/PageThumbs.jsm | 47 +++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/browser/components/thumbnails/PageThumbs.jsm b/browser/components/thumbnails/PageThumbs.jsm index e32c11fb333..09d383ba9af 100644 --- a/browser/components/thumbnails/PageThumbs.jsm +++ b/browser/components/thumbnails/PageThumbs.jsm @@ -11,6 +11,8 @@ const Cc = Components.classes; const Ci = Components.interfaces; const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; +const PREF_STORAGE_VERSION = "browser.pagethumbnails.storage_version"; +const LATEST_STORAGE_VERSION = 1; /** * Name of the directory in the profile that contains the thumbnails. @@ -79,6 +81,9 @@ let PageThumbs = { if (!this._initialized) { this._initialized = true; PlacesUtils.history.addObserver(PageThumbsHistoryObserver, false); + + // Migrate the underlying storage, if needed. + PageThumbsStorageMigrator.migrate(); } }, @@ -248,7 +253,7 @@ let PageThumbsStorage = { getFileForURL: function Storage_getFileForURL(aURL, aOptions) { let hash = this._calculateMD5Hash(aURL); let parts = [THUMBNAIL_DIRECTORY, hash[0], hash[1]]; - let file = FileUtils.getDir("ProfD", parts, aOptions && aOptions.createPath); + let file = FileUtils.getDir("ProfLD", parts, aOptions && aOptions.createPath); file.append(hash.slice(2) + ".png"); return file; }, @@ -284,7 +289,7 @@ let PageThumbsStorage = { wipe: function Storage_wipe() { try { - FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY]).remove(true); + FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]).remove(true); } catch (e) { /* The file might not exist or we're not permitted to remove it. */ } @@ -308,6 +313,44 @@ let PageThumbsStorage = { }; +let PageThumbsStorageMigrator = { + get currentVersion() { + try { + return Services.prefs.getIntPref(PREF_STORAGE_VERSION); + } catch (e) { + // The pref doesn't exist, yet. Return version 0. + return 0; + } + }, + + set currentVersion(aVersion) { + Services.prefs.setIntPref(PREF_STORAGE_VERSION, aVersion); + }, + + migrate: function Migrator_migrate() { + let version = this.currentVersion; + + if (version < 1) + this.removeThumbnailsFromRoamingProfile(); + + this.currentVersion = LATEST_STORAGE_VERSION; + }, + + removeThumbnailsFromRoamingProfile: + function Migrator_removeThumbnailsFromRoamingProfile() { + let local = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]); + let roaming = FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY]); + + if (!roaming.equals(local) && roaming.exists()) { + try { + roaming.remove(true); + } catch (e) { + // The directory might not exist or we're not permitted to remove it. + } + } + } +}; + let PageThumbsHistoryObserver = { onDeleteURI: function Thumbnails_onDeleteURI(aURI, aGUID) { PageThumbsStorage.remove(aURI.spec); From 79bb22426fefa9e4588d2f4f4d979c22998f2690 Mon Sep 17 00:00:00 2001 From: Thaddee Tyl Date: Tue, 12 Jun 2012 13:43:00 +0300 Subject: [PATCH 38/83] Bug 724585 - We need a way to scroll a page to center an element if the element is not visible; r=rcampbell --HG-- extra : rebase_source : 1dd1770cc77eaeed188db07da8a8254475767296 --- browser/devtools/highlighter/InsideOutBox.jsm | 7 +- browser/devtools/shared/LayoutHelpers.jsm | 81 ++++++++++++++- browser/devtools/shared/test/Makefile.in | 3 + .../shared/test/browser_layoutHelpers.html | 25 +++++ .../shared/test/browser_layoutHelpers.js | 99 +++++++++++++++++++ .../test/browser_layoutHelpers_iframe.html | 19 ++++ 6 files changed, 231 insertions(+), 3 deletions(-) create mode 100644 browser/devtools/shared/test/browser_layoutHelpers.html create mode 100644 browser/devtools/shared/test/browser_layoutHelpers.js create mode 100644 browser/devtools/shared/test/browser_layoutHelpers_iframe.html diff --git a/browser/devtools/highlighter/InsideOutBox.jsm b/browser/devtools/highlighter/InsideOutBox.jsm index fd53647cef5..5b07e4b1053 100644 --- a/browser/devtools/highlighter/InsideOutBox.jsm +++ b/browser/devtools/highlighter/InsideOutBox.jsm @@ -128,6 +128,9 @@ InsideOutBoxView = { var EXPORTED_SYMBOLS = ["InsideOutBox"]; +const Cu = Components.utils; +Cu.import("resource:///modules/devtools/LayoutHelpers.jsm"); + function InsideOutBox(aView, aBox) { this.view = aView; @@ -212,7 +215,9 @@ InsideOutBox.prototype = if (makeBoxVisible) { this.openObjectBox(objectBox); if (scrollIntoView) { - objectBox.scrollIntoView(true); + // We want to center the label of the element, not the whole tag + // (which includes all of its children, and is vertically huge). + LayoutHelpers.scrollIntoViewIfNeeded(objectBox.firstElementChild); } } return objectBox; diff --git a/browser/devtools/shared/LayoutHelpers.jsm b/browser/devtools/shared/LayoutHelpers.jsm index 7486f08e1c8..1d21f80b4fb 100644 --- a/browser/devtools/shared/LayoutHelpers.jsm +++ b/browser/devtools/shared/LayoutHelpers.jsm @@ -186,8 +186,7 @@ LayoutHelpers = { * @param integer aY * @returns Node|null the element node found at the given coordinates. */ - getElementFromPoint: function LH_elementFromPoint(aDocument, aX, aY) - { + getElementFromPoint: function LH_elementFromPoint(aDocument, aX, aY) { let node = aDocument.elementFromPoint(aX, aY); if (node && node.contentDocument) { if (node instanceof Ci.nsIDOMHTMLIFrameElement) { @@ -214,4 +213,82 @@ LayoutHelpers = { } return node; }, + + /** + * Scroll the document so that the element "elem" appears in the viewport. + * + * @param Element elem the element that needs to appear in the viewport. + * @param bool centered true if you want it centered, false if you want it to + * appear on the top of the viewport. It is true by default, and that is + * usually what you want. + */ + scrollIntoViewIfNeeded: + function LH_scrollIntoViewIfNeeded(elem, centered) { + // We want to default to centering the element in the page, + // so as to keep the context of the element. + centered = centered === undefined? true: !!centered; + + let win = elem.ownerDocument.defaultView; + let clientRect = elem.getBoundingClientRect(); + + // The following are always from the {top, bottom, left, right} + // of the viewport, to the {top, …} of the box. + // Think of them as geometrical vectors, it helps. + // The origin is at the top left. + + let topToBottom = clientRect.bottom; + let bottomToTop = clientRect.top - win.innerHeight; + let leftToRight = clientRect.right; + let rightToLeft = clientRect.left - win.innerWidth; + let xAllowed = true; // We allow one translation on the x axis, + let yAllowed = true; // and one on the y axis. + + // Whatever `centered` is, the behavior is the same if the box is + // (even partially) visible. + + if ((topToBottom > 0 || !centered) && topToBottom <= elem.offsetHeight) { + win.scrollBy(0, topToBottom - elem.offsetHeight); + yAllowed = false; + } else + if ((bottomToTop < 0 || !centered) && bottomToTop >= -elem.offsetHeight) { + win.scrollBy(0, bottomToTop + elem.offsetHeight); + yAllowed = false; + } + + if ((leftToRight > 0 || !centered) && leftToRight <= elem.offsetWidth) { + if (xAllowed) { + win.scrollBy(leftToRight - elem.offsetWidth, 0); + xAllowed = false; + } + } else + if ((rightToLeft < 0 || !centered) && rightToLeft >= -elem.offsetWidth) { + if (xAllowed) { + win.scrollBy(rightToLeft + elem.offsetWidth, 0); + xAllowed = false; + } + } + + // If we want it centered, and the box is completely hidden, + // then we center it explicitly. + + if (centered) { + + if (yAllowed && (topToBottom <= 0 || bottomToTop >= 0)) { + win.scroll(win.scrollX, + win.scrollY + clientRect.top + - (win.innerHeight - elem.offsetHeight) / 2); + } + + if (xAllowed && (leftToRight <= 0 || rightToLeft <= 0)) { + win.scroll(win.scrollX + clientRect.left + - (win.innerWidth - elem.offsetWidth) / 2, + win.scrollY); + } + } + + if (win.parent !== win) { + // We are inside an iframe. + LH_scrollIntoViewIfNeeded(win.frameElement, centered); + } + }, }; diff --git a/browser/devtools/shared/test/Makefile.in b/browser/devtools/shared/test/Makefile.in index 603c6faba82..83ac312ea8f 100644 --- a/browser/devtools/shared/test/Makefile.in +++ b/browser/devtools/shared/test/Makefile.in @@ -20,6 +20,7 @@ _BROWSER_TEST_FILES = \ browser_toolbar_basic.js \ browser_toolbar_tooltip.js \ browser_toolbar_webconsole_errors_count.js \ + browser_layoutHelpers.js \ head.js \ $(NULL) @@ -27,6 +28,8 @@ _BROWSER_TEST_PAGES = \ browser_templater_basic.html \ browser_toolbar_basic.html \ browser_toolbar_webconsole_errors_count.html \ + browser_layoutHelpers.html \ + browser_layoutHelpers_iframe.html \ $(NULL) libs:: $(_BROWSER_TEST_FILES) diff --git a/browser/devtools/shared/test/browser_layoutHelpers.html b/browser/devtools/shared/test/browser_layoutHelpers.html new file mode 100644 index 00000000000..3b9a285b42b --- /dev/null +++ b/browser/devtools/shared/test/browser_layoutHelpers.html @@ -0,0 +1,25 @@ + + + Layout Helpers + + + +
+ diff --git a/browser/devtools/shared/test/browser_layoutHelpers.js b/browser/devtools/shared/test/browser_layoutHelpers.js new file mode 100644 index 00000000000..9747399a4a7 --- /dev/null +++ b/browser/devtools/shared/test/browser_layoutHelpers.js @@ -0,0 +1,99 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that scrollIntoViewIfNeeded works properly. + +let imported = {}; +Components.utils.import("resource:///modules/devtools/LayoutHelpers.jsm", + imported); +registerCleanupFunction(function () { + imported = {}; +}); + +let LayoutHelpers = imported.LayoutHelpers; + +const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/browser_layoutHelpers.html"; + +function test() { + addTab(TEST_URI, function(browser, tab) { + info("Starting browser_layoutHelpers.js"); + let doc = browser.contentDocument; + runTest(doc.defaultView, doc.getElementById('some')); + gBrowser.removeCurrentTab(); + finish(); + }); +} + +function runTest(win, some) { + some.style.top = win.innerHeight + 'px'; + some.style.left = win.innerWidth + 'px'; + // The tests start with a black 2x2 pixels square below bottom right. + // Do not resize the window during the tests. + + win.scroll(win.innerWidth / 2, win.innerHeight + 2); // Above the viewport. + LayoutHelpers.scrollIntoViewIfNeeded(some); + is(win.scrollY, Math.floor(win.innerHeight / 2) + 1, + 'Element completely hidden above should appear centered.'); + + win.scroll(win.innerWidth / 2, win.innerHeight + 1); // On the top edge. + LayoutHelpers.scrollIntoViewIfNeeded(some); + is(win.scrollY, win.innerHeight, + 'Element partially visible above should appear above.'); + + win.scroll(win.innerWidth / 2, 0); // Just below the viewport. + LayoutHelpers.scrollIntoViewIfNeeded(some); + is(win.scrollY, Math.floor(win.innerHeight / 2) + 1, + 'Element completely hidden below should appear centered.'); + + win.scroll(win.innerWidth / 2, 1); // On the bottom edge. + LayoutHelpers.scrollIntoViewIfNeeded(some); + is(win.scrollY, 2, + 'Element partially visible below should appear below.'); + + + win.scroll(win.innerWidth / 2, win.innerHeight + 2); // Above the viewport. + LayoutHelpers.scrollIntoViewIfNeeded(some, false); + is(win.scrollY, win.innerHeight, + 'Element completely hidden above should appear above ' + + 'if parameter is false.'); + + win.scroll(win.innerWidth / 2, win.innerHeight + 1); // On the top edge. + LayoutHelpers.scrollIntoViewIfNeeded(some, false); + is(win.scrollY, win.innerHeight, + 'Element partially visible above should appear above ' + + 'if parameter is false.'); + + win.scroll(win.innerWidth / 2, 0); // Below the viewport. + LayoutHelpers.scrollIntoViewIfNeeded(some, false); + is(win.scrollY, 2, + 'Element completely hidden below should appear below ' + + 'if parameter is false.'); + + win.scroll(win.innerWidth / 2, 1); // On the bottom edge. + LayoutHelpers.scrollIntoViewIfNeeded(some, false); + is(win.scrollY, 2, + 'Element partially visible below should appear below ' + + 'if parameter is false.'); + + // The case of iframes. + win.scroll(0, 0); + + let frame = win.document.getElementById('frame'); + let fwin = frame.contentWindow; + + frame.style.top = win.innerHeight + 'px'; + frame.style.left = win.innerWidth + 'px'; + + fwin.addEventListener('load', function frameLoad() { + let some = fwin.document.getElementById('some'); + LayoutHelpers.scrollIntoViewIfNeeded(some); + is(win.scrollX, Math.floor(win.innerWidth / 2) + 20, + 'Scrolling from an iframe should center the iframe vertically.'); + is(win.scrollY, Math.floor(win.innerHeight / 2) + 20, + 'Scrolling from an iframe should center the iframe horizontally.'); + is(fwin.scrollX, Math.floor(fwin.innerWidth / 2) + 1, + 'Scrolling from an iframe should center the element vertically.'); + is(fwin.scrollY, Math.floor(fwin.innerHeight / 2) + 1, + 'Scrolling from an iframe should center the element horizontally.'); + }, false); +} diff --git a/browser/devtools/shared/test/browser_layoutHelpers_iframe.html b/browser/devtools/shared/test/browser_layoutHelpers_iframe.html new file mode 100644 index 00000000000..66ef5b29370 --- /dev/null +++ b/browser/devtools/shared/test/browser_layoutHelpers_iframe.html @@ -0,0 +1,19 @@ + + + Layout Helpers + + + +
+ From f4519e1d7078ea37b3fb4944a101974e36600f18 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Fri, 15 Jun 2012 15:55:33 +0200 Subject: [PATCH 39/83] Bug 761023 - [devtb] Developer Toolbar should re-open automatically if browser closed with it open; r=jwalker --HG-- extra : rebase_source : 95852ec078fb49ba547bed20abb4b886efb1f5d8 --- browser/app/profile/firefox.js | 1 + browser/base/content/browser.js | 5 +++++ browser/devtools/shared/DeveloperToolbar.jsm | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index e9695d455c9..395ad229849 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1024,6 +1024,7 @@ pref("devtools.errorconsole.enabled", false); // Developer toolbar and GCLI preferences pref("devtools.toolbar.enabled", false); +pref("devtools.toolbar.visible", false); pref("devtools.gcli.allowSet", false); // Enable the Inspector diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ee756c71a76..66f7d375a24 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1397,6 +1397,11 @@ var gBrowserInit = { #ifdef MENUBAR_CAN_AUTOHIDE document.getElementById("appmenu_devToolbar").hidden = false; #endif + + // Show the toolbar if it was previously visible + if (gPrefService.getBoolPref("devtools.toolbar.visible")) { + this.DeveloperToolbar.show(); + } } // Enable Inspector? diff --git a/browser/devtools/shared/DeveloperToolbar.jsm b/browser/devtools/shared/DeveloperToolbar.jsm index 5ef740a4312..d4a5f4f5145 100644 --- a/browser/devtools/shared/DeveloperToolbar.jsm +++ b/browser/devtools/shared/DeveloperToolbar.jsm @@ -122,6 +122,8 @@ DeveloperToolbar.prototype.show = function DT_show(aCallback) return; } + Services.prefs.setBoolPref("devtools.toolbar.visible", true); + this._notify(NOTIFICATIONS.LOAD); this._pendingShowCallback = aCallback; this._pendingHide = false; @@ -281,6 +283,8 @@ DeveloperToolbar.prototype.hide = function DT_hide() this._element.hidden = true; + Services.prefs.setBoolPref("devtools.toolbar.visible", false); + this._doc.getElementById("Tools:DevToolbar").setAttribute("checked", "false"); this.destroy(); From d49e0abf6fe036c0945c9d27158a926761ae2568 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 19 Jun 2012 15:48:00 +0100 Subject: [PATCH 40/83] Bug 757794 - Constant "command timed out: 1200 seconds without output" in test_0200_app_launch_apply_update.js and others. Ensure that timeout loops will always abort eventually. r=ehsan --HG-- extra : rebase_source : d29af708ec3c8d26bb5bcc95c51e25b13f798072 --- .../unit/test_0200_app_launch_apply_update.js | 15 ++++++++-- .../unit/test_0201_app_launch_apply_update.js | 26 +++++++++++++--- .../unit/test_0203_app_launch_apply_update.js | 20 +++++++++++-- .../test_0200_app_launch_apply_update_svc.js | 10 ++++++- .../test_0201_app_launch_apply_update_svc.js | 26 +++++++++++++--- ...2_app_launch_apply_update_dirlocked_svc.js | 9 +++++- .../test_0203_app_launch_apply_update_svc.js | 30 +++++++++++++++---- 7 files changed, 115 insertions(+), 21 deletions(-) diff --git a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js b/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js index 2a9cd78a566..5d5dffd1738 100644 --- a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js +++ b/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js @@ -18,12 +18,16 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; let gAppTimer; let gProcess; +let gTimeoutRuns = 0; function run_test() { do_test_pending(); @@ -236,19 +240,26 @@ function getUpdateTestDir() { * the test. */ function checkUpdateFinished() { + gTimeoutRuns++; // Don't proceed until the update.log has been created. let log = getUpdatesDir(); log.append("0"); log.append(FILE_UPDATE_LOG); if (!log.exists()) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } // Don't proceed until the update status is no longer pending or applying. let status = readStatusFile(); if (status == STATE_PENDING || status == STATE_APPLYING) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates status to not be pending or applying"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } diff --git a/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js b/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js index 74b7a0a3c08..8b68250d08d 100644 --- a/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js +++ b/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js @@ -21,6 +21,9 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; @@ -28,6 +31,7 @@ const APP_TIMER_TIMEOUT = 15000; let gAppTimer; let gProcess; let gActiveUpdate; +let gTimeoutRuns = 0; // Override getUpdatesRootDir on Mac because we need to apply the update // inside the bundle directory. @@ -327,9 +331,13 @@ function getUpdateTestDir() { * Checks if the update has finished being applied in the background. */ function checkUpdateApplied() { + gTimeoutRuns++; // Don't proceed until the update has been applied. if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -459,11 +467,15 @@ function checkUpdateApplied() { * the test. */ function checkUpdateFinished() { + gTimeoutRuns++; // Don't proceed until the update status is no longer applied. try { let status = readStatusFile(); if (status != STATE_SUCCEEDED) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for succeeded state"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } } catch (e) { @@ -477,7 +489,10 @@ function checkUpdateFinished() { if (e.result == Components.results.NS_ERROR_FILE_IS_LOCKED) { // This might happen on Windows in case the callback application has not // finished its job yet. So, we'll wait some more. - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for file to be unlocked"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } else { do_throw("getAppConsoleLogPath threw: " + e); @@ -493,7 +508,10 @@ function checkUpdateFinished() { updatedDir.append(UPDATED_DIR_SUFFIX.replace("/", "")); logTestInfo("testing " + updatedDir.path + " shouldn't exist"); if (updatedDir.exists()) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for update dir to not exist"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } diff --git a/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js b/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js index 16f57d09775..43b18288a5e 100644 --- a/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js +++ b/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js @@ -27,6 +27,8 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; @@ -36,6 +38,7 @@ Components.utils.import("resource://gre/modules/ctypes.jsm"); let gAppTimer; let gProcess; let gActiveUpdate; +let gTimeoutRuns = 0; // Override getUpdatesRootDir on Mac because we need to apply the update // inside the bundle directory. @@ -356,9 +359,13 @@ function getUpdateTestDir() { * Checks if the update has finished being applied in the background. */ function checkUpdateApplied() { + gTimeoutRuns++; // Don't proceed until the update has been applied. if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for update to be applied"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -489,10 +496,14 @@ function checkUpdateApplied() { */ function checkUpdateFinished() { // Don't proceed until the update status is no longer applied. + gTimeoutRuns++; try { let status = readStatusFile(); if (status != STATE_SUCCEEDED) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for succeeded state"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } } catch (e) { @@ -506,7 +517,10 @@ function checkUpdateFinished() { if (e.result == Components.results.NS_ERROR_FILE_IS_LOCKED) { // This might happen on Windows in case the callback application has not // finished its job yet. So, we'll wait some more. - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for file to be unlocked"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } else { do_throw("getAppConsoleLogPath threw: " + e); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js b/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js index 1c9ffedb312..ab25c45f2b2 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js @@ -18,10 +18,15 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; +let gTimeoutRuns = 0; + function run_test() { if (!shouldRunServiceTest()) { return; @@ -198,7 +203,10 @@ function checkUpdateFinished() { log.append("0"); log.append(FILE_UPDATE_LOG); if (!log.exists()) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } diff --git a/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js b/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js index 73e9c04fc45..a44ba361098 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js @@ -21,6 +21,9 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; @@ -28,6 +31,7 @@ const APP_TIMER_TIMEOUT = 15000; let gAppTimer; let gProcess; let gActiveUpdate; +let gTimeoutRuns = 0; // Override getUpdatesRootDir on Mac because we need to apply the update // inside the bundle directory. @@ -335,9 +339,13 @@ function getUpdateTestDir() { * Checks if the update has finished being applied in the background. */ function checkUpdateApplied() { + gTimeoutRuns++; // Don't proceed until the update has been applied. if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to be applied to platform"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -352,7 +360,10 @@ function checkUpdateApplied() { let log = getUpdatesDir(); log.append(FILE_LAST_LOG); if (!log.exists()) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update log to be created"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -439,11 +450,15 @@ function checkUpdateApplied() { * the test. */ function checkUpdateFinished() { + gTimeoutRuns++; // Don't proceed until the update status is no longer applied. try { let status = readStatusFile(); if (status != STATE_SUCCEEDED) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for succeeded state"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } } catch (e) { @@ -457,7 +472,10 @@ function checkUpdateFinished() { if (e.result == Components.results.NS_ERROR_FILE_IS_LOCKED) { // This might happen on Windows in case the callback application has not // finished its job yet. So, we'll wait some more. - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded whilst waiting for file to be unlocked"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } else { do_throw("getAppConsoleLogPath threw: " + e); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js b/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js index 021533c10f5..7f58b9b2fa1 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js +++ b/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js @@ -27,11 +27,15 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; let gActiveUpdate; +let gTimeoutRuns = 0; // Override getUpdatesRootDir on Mac because we need to apply the update // inside the bundle directory. @@ -300,7 +304,10 @@ function getUpdateTestDir() { function checkUpdateApplied() { // Don't proceed until the update has failed, and reset to pending. if (gUpdateManager.activeUpdate.state != STATE_PENDING) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for pending state to finish"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } diff --git a/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js b/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js index 97e0a1c6aaa..a8d2735b805 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js @@ -27,6 +27,9 @@ const FILE_UPDATER_INI_BAK = "updater.ini.bak"; // Number of milliseconds for each do_timeout call. const CHECK_TIMEOUT_MILLI = 1000; +// How many of CHECK_TIMEOUT_MILLI to wait before we abort the test. +const MAX_TIMEOUT_RUNS = 300; + // Maximum number of milliseconds the process that is launched can run before // the test will try to kill it. const APP_TIMER_TIMEOUT = 15000; @@ -36,6 +39,7 @@ Components.utils.import("resource://gre/modules/ctypes.jsm"); let gAppTimer; let gProcess; let gActiveUpdate; +let gTimeoutRuns = 0; // Override getUpdatesRootDir on Mac because we need to apply the update // inside the bundle directory. @@ -364,9 +368,13 @@ function getUpdateTestDir() { * Checks if the update has finished being applied in the background. */ function checkUpdateApplied() { + gTimeoutRuns++; // Don't proceed until the update has been applied. if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for update to be applied to the platform"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -381,7 +389,10 @@ function checkUpdateApplied() { let log = getUpdatesDir(); log.append(FILE_LAST_LOG); if (!log.exists()) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for update log to be created"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied); return; } @@ -468,11 +479,15 @@ function checkUpdateApplied() { * the test. */ function checkUpdateFinished() { + gTimeoutRuns++; // Don't proceed until the update status is no longer applied. try { let status = readStatusFile(); if (status != STATE_SUCCEEDED) { - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for success status"); + else + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } } catch (e) { @@ -484,9 +499,12 @@ function checkUpdateFinished() { getAppConsoleLogPath(); } catch (e) { if (e.result == Components.results.NS_ERROR_FILE_IS_LOCKED) { - // This might happen on Windows in case the callback application has not - // finished its job yet. So, we'll wait some more. - do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); + if (gTimeoutRuns > MAX_TIMEOUT_RUNS) + do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for file to be unlocked"); + else + // This might happen on Windows in case the callback application has not + // finished its job yet. So, we'll wait some more. + do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished); return; } else { do_throw("getAppConsoleLogPath threw: " + e); From c15c4ed94553631a39d15dc1920179cda6a8b27d Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 8 Jun 2012 08:41:30 -0400 Subject: [PATCH 41/83] Bug 755724 Part C - Move ScopedAppData into the XPCOM glue, r=glandium --HG-- rename : toolkit/xre/nsAppData.cpp => toolkit/xre/CreateAppData.cpp rename : toolkit/xre/nsAppData.cpp => xpcom/glue/AppData.cpp extra : rebase_source : 6223397345e77b00f14d93a1f188c042fc5f89ea --- .../xre/{nsAppData.cpp => CreateAppData.cpp} | 83 +---------------- toolkit/xre/Makefile.in | 2 +- toolkit/xre/nsAppRunner.cpp | 1 + toolkit/xre/nsAppRunner.h | 40 --------- webapprt/mac/webapprt.mm | 16 +--- webapprt/win/webapprt.cpp | 16 +--- xpcom/glue/AppData.cpp | 90 +++++++++++++++++++ xpcom/glue/AppData.h | 57 ++++++++++++ xpcom/glue/Makefile.in | 1 + xpcom/glue/objs.mk | 1 + 10 files changed, 161 insertions(+), 146 deletions(-) rename toolkit/xre/{nsAppData.cpp => CreateAppData.cpp} (62%) create mode 100644 xpcom/glue/AppData.cpp create mode 100644 xpcom/glue/AppData.h diff --git a/toolkit/xre/nsAppData.cpp b/toolkit/xre/CreateAppData.cpp similarity index 62% rename from toolkit/xre/nsAppData.cpp rename to toolkit/xre/CreateAppData.cpp index 437079c8da8..93708c5e420 100644 --- a/toolkit/xre/nsAppData.cpp +++ b/toolkit/xre/CreateAppData.cpp @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 8; 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/. */ @@ -5,84 +6,10 @@ #include "nsXULAppAPI.h" #include "nsINIParser.h" #include "nsIFile.h" -#include "nsAppRunner.h" -#include "nsCRTGlue.h" #include "nsAutoPtr.h" +#include "mozilla/AppData.h" -void -SetAllocatedString(const char *&str, const char *newvalue) -{ - NS_Free(const_cast(str)); - if (newvalue) { - str = NS_strdup(newvalue); - } - else { - str = nsnull; - } -} - -void -SetAllocatedString(const char *&str, const nsACString &newvalue) -{ - NS_Free(const_cast(str)); - if (newvalue.IsEmpty()) { - str = nsnull; - } - else { - str = ToNewCString(newvalue); - } -} - -ScopedAppData::ScopedAppData(const nsXREAppData* aAppData) -{ - Zero(); - - this->size = aAppData->size; - - SetAllocatedString(this->vendor, aAppData->vendor); - SetAllocatedString(this->name, aAppData->name); - SetAllocatedString(this->version, aAppData->version); - SetAllocatedString(this->buildID, aAppData->buildID); - SetAllocatedString(this->ID, aAppData->ID); - SetAllocatedString(this->copyright, aAppData->copyright); - SetAllocatedString(this->profile, aAppData->profile); - SetStrongPtr(this->directory, aAppData->directory); - this->flags = aAppData->flags; - - if (aAppData->size > offsetof(nsXREAppData, xreDirectory)) { - SetStrongPtr(this->xreDirectory, aAppData->xreDirectory); - SetAllocatedString(this->minVersion, aAppData->minVersion); - SetAllocatedString(this->maxVersion, aAppData->maxVersion); - } - - if (aAppData->size > offsetof(nsXREAppData, crashReporterURL)) { - SetAllocatedString(this->crashReporterURL, aAppData->crashReporterURL); - } - - if (aAppData->size > offsetof(nsXREAppData, UAName)) { - SetAllocatedString(this->UAName, aAppData->UAName); - } -} - -ScopedAppData::~ScopedAppData() -{ - SetAllocatedString(this->vendor, nsnull); - SetAllocatedString(this->name, nsnull); - SetAllocatedString(this->version, nsnull); - SetAllocatedString(this->buildID, nsnull); - SetAllocatedString(this->ID, nsnull); - SetAllocatedString(this->copyright, nsnull); - SetAllocatedString(this->profile, nsnull); - - NS_IF_RELEASE(this->directory); - - SetStrongPtr(this->xreDirectory, (nsIFile*) nsnull); - SetAllocatedString(this->minVersion, nsnull); - SetAllocatedString(this->maxVersion, nsnull); - - SetAllocatedString(this->crashReporterURL, nsnull); - SetAllocatedString(this->UAName, nsnull); -} +using namespace mozilla; nsresult XRE_CreateAppData(nsIFile* aINIFile, nsXREAppData **aAppData) @@ -103,9 +30,7 @@ XRE_CreateAppData(nsIFile* aINIFile, nsXREAppData **aAppData) if (NS_FAILED(rv)) return rv; - rv = CallQueryInterface(appDir, &data->directory); - if (NS_FAILED(rv)) - return rv; + appDir.forget(&data->directory); } *aAppData = data.forget(); diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index f5b0c2a9714..da950662b75 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -33,7 +33,7 @@ CPPSRCS = \ nsConsoleWriter.cpp \ nsXREDirProvider.cpp \ nsNativeAppSupportBase.cpp \ - nsAppData.cpp \ + CreateAppData.cpp \ nsSigHandlers.cpp \ nsEmbedFunctions.cpp \ ProfileReset.cpp \ diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 48b3823f94c..a2863a55810 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -26,6 +26,7 @@ #include "mozilla/Util.h" #include "nsAppRunner.h" +#include "mozilla/AppData.h" #include "nsUpdateDriver.h" #include "ProfileReset.h" diff --git a/toolkit/xre/nsAppRunner.h b/toolkit/xre/nsAppRunner.h index a969da251a5..f7a94220ade 100644 --- a/toolkit/xre/nsAppRunner.h +++ b/toolkit/xre/nsAppRunner.h @@ -108,46 +108,6 @@ WriteStatusApplied(LPCWSTR updateDirPath); #define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1" -// Like nsXREAppData, but releases all strong refs/allocated memory -// in the destructor. -class ScopedAppData : public nsXREAppData -{ -public: - ScopedAppData() { Zero(); this->size = sizeof(*this); } - - ScopedAppData(const nsXREAppData* aAppData); - - void Zero() { memset(this, 0, sizeof(*this)); } - - ~ScopedAppData(); -}; - -/** - * Given "str" is holding a string allocated with NS_Alloc, or null: - * replace the value in "str" with a new value. - * - * @param newvalue Null is permitted. The string is cloned with - * NS_strdup - */ -void SetAllocatedString(const char *&str, const char *newvalue); - -/** - * Given "str" is holding a string allocated with NS_Alloc, or null: - * replace the value in "str" with a new value. - * - * @param newvalue If "newvalue" is the empty string, "str" will be set - * to null. - */ -void SetAllocatedString(const char *&str, const nsACString &newvalue); - -template -void SetStrongPtr(T *&ptr, T* newvalue) -{ - NS_IF_RELEASE(ptr); - ptr = newvalue; - NS_IF_ADDREF(ptr); -} - namespace mozilla { namespace startup { extern GeckoProcessType sChildProcessType; diff --git a/webapprt/mac/webapprt.mm b/webapprt/mac/webapprt.mm index b0387d4a75a..174fe8f4da8 100644 --- a/webapprt/mac/webapprt.mm +++ b/webapprt/mac/webapprt.mm @@ -28,6 +28,9 @@ #include "nsCOMPtr.h" #include "nsIFile.h" #include "nsStringGlue.h" +#include "mozilla/AppData.h" + +using namespace mozilla; const char WEBAPPRT_EXECUTABLE[] = "webapprt-stub"; const char FXAPPINI_NAME[] = "application.ini"; @@ -82,19 +85,6 @@ AttemptGRELoad(char *greDir) return rv; } -// Copied from toolkit/xre/nsAppData.cpp. -void -SetAllocatedString(const char *&str, const char *newvalue) -{ - NS_Free(const_cast(str)); - if (newvalue) { - str = NS_strdup(newvalue); - } else { - str = nsnull; - } -} - - int main(int argc, char **argv) { diff --git a/webapprt/win/webapprt.cpp b/webapprt/win/webapprt.cpp index e62b76f58b6..17537bef3f5 100644 --- a/webapprt/win/webapprt.cpp +++ b/webapprt/win/webapprt.cpp @@ -18,6 +18,9 @@ #include "nsXPCOMGlue.h" #include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL #include "nsXULAppAPI.h" +#include "mozilla/AppData.h" + +using namespace mozilla; XRE_GetFileFromPathType XRE_GetFileFromPath; XRE_CreateAppDataType XRE_CreateAppData; @@ -41,19 +44,6 @@ namespace { int* pargc; char*** pargv; - // Copied from toolkit/xre/nsAppData.cpp. - void - SetAllocatedString(const char *&str, const char *newvalue) - { - NS_Free(const_cast(str)); - if (newvalue) { - str = NS_strdup(newvalue); - } - else { - str = nsnull; - } - } - nsresult joinPath(char* const dest, char const* const dir, diff --git a/xpcom/glue/AppData.cpp b/xpcom/glue/AppData.cpp new file mode 100644 index 00000000000..8caa314fc1b --- /dev/null +++ b/xpcom/glue/AppData.cpp @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 8; 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 "mozilla/AppData.h" +#include "nsXULAppAPI.h" +#include "nsINIParser.h" +#include "nsIFile.h" +#include "nsCRTGlue.h" +#include "nsAutoPtr.h" + +namespace mozilla { + +void +SetAllocatedString(const char *&str, const char *newvalue) +{ + NS_Free(const_cast(str)); + if (newvalue) { + str = NS_strdup(newvalue); + } + else { + str = nsnull; + } +} + +void +SetAllocatedString(const char *&str, const nsACString &newvalue) +{ + NS_Free(const_cast(str)); + if (newvalue.IsEmpty()) { + str = nsnull; + } + else { + str = ToNewCString(newvalue); + } +} + +ScopedAppData::ScopedAppData(const nsXREAppData* aAppData) +{ + Zero(); + + this->size = aAppData->size; + + SetAllocatedString(this->vendor, aAppData->vendor); + SetAllocatedString(this->name, aAppData->name); + SetAllocatedString(this->version, aAppData->version); + SetAllocatedString(this->buildID, aAppData->buildID); + SetAllocatedString(this->ID, aAppData->ID); + SetAllocatedString(this->copyright, aAppData->copyright); + SetAllocatedString(this->profile, aAppData->profile); + SetStrongPtr(this->directory, aAppData->directory); + this->flags = aAppData->flags; + + if (aAppData->size > offsetof(nsXREAppData, xreDirectory)) { + SetStrongPtr(this->xreDirectory, aAppData->xreDirectory); + SetAllocatedString(this->minVersion, aAppData->minVersion); + SetAllocatedString(this->maxVersion, aAppData->maxVersion); + } + + if (aAppData->size > offsetof(nsXREAppData, crashReporterURL)) { + SetAllocatedString(this->crashReporterURL, aAppData->crashReporterURL); + } + + if (aAppData->size > offsetof(nsXREAppData, UAName)) { + SetAllocatedString(this->UAName, aAppData->UAName); + } +} + +ScopedAppData::~ScopedAppData() +{ + SetAllocatedString(this->vendor, nsnull); + SetAllocatedString(this->name, nsnull); + SetAllocatedString(this->version, nsnull); + SetAllocatedString(this->buildID, nsnull); + SetAllocatedString(this->ID, nsnull); + SetAllocatedString(this->copyright, nsnull); + SetAllocatedString(this->profile, nsnull); + + NS_IF_RELEASE(this->directory); + + SetStrongPtr(this->xreDirectory, (nsIFile*) nsnull); + SetAllocatedString(this->minVersion, nsnull); + SetAllocatedString(this->maxVersion, nsnull); + + SetAllocatedString(this->crashReporterURL, nsnull); + SetAllocatedString(this->UAName, nsnull); +} + +} // namespace mozilla diff --git a/xpcom/glue/AppData.h b/xpcom/glue/AppData.h new file mode 100644 index 00000000000..bb771815686 --- /dev/null +++ b/xpcom/glue/AppData.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 8; 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 mozilla_AppData_h +#define mozilla_AppData_h + +#include "nsXREAppData.h" +#include "nscore.h" +#include "nsStringGlue.h" + +namespace mozilla { + +// Like nsXREAppData, but releases all strong refs/allocated memory +// in the destructor. +class NS_COM_GLUE ScopedAppData : public nsXREAppData +{ +public: + ScopedAppData() { Zero(); this->size = sizeof(*this); } + + ScopedAppData(const nsXREAppData* aAppData); + + void Zero() { memset(this, 0, sizeof(*this)); } + + ~ScopedAppData(); +}; + +/** + * Given "str" is holding a string allocated with NS_Alloc, or null: + * replace the value in "str" with a new value. + * + * @param newvalue Null is permitted. The string is cloned with + * NS_strdup + */ +void SetAllocatedString(const char *&str, const char *newvalue); + +/** + * Given "str" is holding a string allocated with NS_Alloc, or null: + * replace the value in "str" with a new value. + * + * @param newvalue If "newvalue" is the empty string, "str" will be set + * to null. + */ +void SetAllocatedString(const char *&str, const nsACString &newvalue); + +template +void SetStrongPtr(T *&ptr, T* newvalue) +{ + NS_IF_RELEASE(ptr); + ptr = newvalue; + NS_IF_ADDREF(ptr); +} + +} // namespace mozilla + +#endif diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in index 19644b22a0b..cf0a23aeff8 100644 --- a/xpcom/glue/Makefile.in +++ b/xpcom/glue/Makefile.in @@ -91,6 +91,7 @@ EXPORTS = \ $(NULL) EXPORTS_mozilla = \ + AppData.h \ AutoRestore.h \ BlockingResourceBase.h \ CondVar.h \ diff --git a/xpcom/glue/objs.mk b/xpcom/glue/objs.mk index aa20ad87524..1cc93fe74d9 100644 --- a/xpcom/glue/objs.mk +++ b/xpcom/glue/objs.mk @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. XPCOM_GLUE_SRC_LCPPSRCS = \ + AppData.cpp \ nsArrayEnumerator.cpp \ nsArrayUtils.cpp \ nsCategoryCache.cpp \ From ed825e08a853b21a8cc2b482c4509a60510c98f4 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Tue, 19 Jun 2012 10:45:24 -0400 Subject: [PATCH 42/83] Bug 755724 part A - add makefile variable DIST_SUBDIR to ship code to a subdirectory of dist/bin, r=ted --HG-- extra : rebase_source : ef52dff3c4f42b99148e99335ee82d9a207faf46 --- config/config.mk | 7 ++++--- js/src/config/config.mk | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/config.mk b/config/config.mk index 0201ea3a179..cbec1f34224 100644 --- a/config/config.mk +++ b/config/config.mk @@ -62,9 +62,10 @@ LIBXUL_DIST ?= $(DIST) # FINAL_TARGET specifies the location into which we copy end-user-shipped # build products (typelibs, components, chrome). # -# It will usually be the well-loved $(DIST)/bin, today, but can also be an -# XPI-contents staging directory for ambitious and right-thinking extensions. -FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin) +# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME) +# If DIST_SUBDIR is set, the files will be shipped to $(DIST)/$(DIST_SUBDIR) +# Otherwise, the default $(DIST)/bin will be used. +FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(if $(DIST_SUBDIR),$(DIST)/bin/$(DIST_SUBDIR),$(DIST)/bin)) ifdef XPI_NAME DEFINES += -DXPI_NAME=$(XPI_NAME) diff --git a/js/src/config/config.mk b/js/src/config/config.mk index 0201ea3a179..cbec1f34224 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -62,9 +62,10 @@ LIBXUL_DIST ?= $(DIST) # FINAL_TARGET specifies the location into which we copy end-user-shipped # build products (typelibs, components, chrome). # -# It will usually be the well-loved $(DIST)/bin, today, but can also be an -# XPI-contents staging directory for ambitious and right-thinking extensions. -FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin) +# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME) +# If DIST_SUBDIR is set, the files will be shipped to $(DIST)/$(DIST_SUBDIR) +# Otherwise, the default $(DIST)/bin will be used. +FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(if $(DIST_SUBDIR),$(DIST)/bin/$(DIST_SUBDIR),$(DIST)/bin)) ifdef XPI_NAME DEFINES += -DXPI_NAME=$(XPI_NAME) From 01eddea82126d18a14e22bbe114fbe5f7417b714 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Tue, 19 Jun 2012 13:20:34 -0400 Subject: [PATCH 43/83] Bug 766173 - Hold a strong ref to nsScriptSecurityManager, instead of hoping that it won't get addref'ed or released. r=bsmedberg --HG-- rename : mobile/android/base/resources/drawable/tabs_button_contracted.xml => mobile/android/base/resources/drawable/tabs_button.xml extra : rebase_source : 8f861c2298fd053a0e1f6deb6f9945040ea8db90 --- caps/src/nsScriptSecurityManager.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 05e3bf4b106..71224abda46 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -59,6 +59,7 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/StandardInteger.h" +#include "mozilla/ClearOnShutdown.h" using namespace mozilla; using namespace mozilla::dom; @@ -3144,7 +3145,7 @@ nsresult nsScriptSecurityManager::Init() return NS_OK; } -static nsScriptSecurityManager *gScriptSecMan = nsnull; +static nsRefPtr gScriptSecMan; jsid nsScriptSecurityManager::sEnabledID = JSID_VOID; @@ -3156,7 +3157,6 @@ nsScriptSecurityManager::~nsScriptSecurityManager(void) if(mDefaultPolicy) mDefaultPolicy->Drop(); delete mCapabilities; - gScriptSecMan = nsnull; } void @@ -3180,14 +3180,12 @@ nsScriptSecurityManager::GetScriptSecurityManager() { if (!gScriptSecMan) { - nsScriptSecurityManager* ssManager = new nsScriptSecurityManager(); - if (!ssManager) - return nsnull; + nsRefPtr ssManager = new nsScriptSecurityManager(); + nsresult rv; rv = ssManager->Init(); NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to initialize nsScriptSecurityManager"); if (NS_FAILED(rv)) { - delete ssManager; return nsnull; } @@ -3195,10 +3193,10 @@ nsScriptSecurityManager::GetScriptSecurityManager() nsIXPCSecurityManager::HOOK_ALL); if (NS_FAILED(rv)) { NS_WARNING("Failed to install xpconnect security manager!"); - delete ssManager; return nsnull; } + ClearOnShutdown(&gScriptSecMan); gScriptSecMan = ssManager; } return gScriptSecMan; From 01e8b1d2b1b652165a5258223c9f85147579473e Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Tue, 19 Jun 2012 10:48:31 -0700 Subject: [PATCH 44/83] Bug 695173 - Add content.css and jar.mn changes that didn't make it into the first push --- mobile/android/chrome/jar.mn | 1 + mobile/android/themes/core/content.css | 32 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/mobile/android/chrome/jar.mn b/mobile/android/chrome/jar.mn index 4b5cbd3c31f..3ad91c4c4d5 100644 --- a/mobile/android/chrome/jar.mn +++ b/mobile/android/chrome/jar.mn @@ -26,6 +26,7 @@ chrome.jar: * content/browser.xul (content/browser.xul) * content/browser.js (content/browser.js) content/bindings/checkbox.xml (content/bindings/checkbox.xml) + content/bindings/content.xml (content/bindings/content.xml) content/bindings/menulist.xml (content/bindings/menulist.xml) content/bindings/settings.xml (content/bindings/settings.xml) content/cursor.css (content/cursor.css) diff --git a/mobile/android/themes/core/content.css b/mobile/android/themes/core/content.css index aaa19d55087..be22d470dd7 100644 --- a/mobile/android/themes/core/content.css +++ b/mobile/android/themes/core/content.css @@ -340,3 +340,35 @@ video { xul|menulist { -moz-binding: url("chrome://browser/content/bindings/menulist.xml#menulist"); } + +/* Text Selection Handles */ + +/*XXX bug 765076: Add the binding dynamically using style.MozBinding */ +:root { + -moz-binding: url("chrome://browser/content/bindings/content.xml#selection-handles"); +} + +.moz-fennec-selection-handle { + position: absolute; + z-index: 999999; + min-width: 35px; + min-height: 64px; + width: 35px; + height: 64px; + padding: 20px; /* Add padding to make touch target larger */ + margin: 0; + background-repeat: no-repeat; + background-position: center; +} + +.moz-fennec-selection-handle:not([showing]) { + display: none; +} + +.moz-fennec-selection-handle[anonid="selection-handle-start"] { + background-image: url("chrome://browser/skin/images/handle-start.png"); +} + +.moz-fennec-selection-handle[anonid="selection-handle-end"] { + background-image: url("chrome://browser/skin/images/handle-end.png"); +} From ce8ece9c9449e14cb6ff26a9181e556145d094d1 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Tue, 19 Jun 2012 10:35:06 -0700 Subject: [PATCH 45/83] Bug 765797 - Only log generated record string for incoming records if Logger.LOG_PERSONAL_INFORMATION is set. r=liuche --HG-- extra : rebase_source : 35d9924d94ca3093a02e6f820769131f96296afb --- .../android/AndroidBrowserRepositorySession.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java index 54d8eb71595..3eb032a8320 100644 --- a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java +++ b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java @@ -646,10 +646,14 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos return null; } - Logger.debug(LOG_TAG, "Searching with record string " + recordString); + if (Logger.LOG_PERSONAL_INFORMATION) { + Logger.pii(LOG_TAG, "Searching with record string " + recordString); + } else { + Logger.debug(LOG_TAG, "Searching with record string."); + } String guid = getGuidForString(recordString); if (guid == null) { - Logger.debug(LOG_TAG, "findExistingRecord failed to find one for " + record.guid); + Logger.debug(LOG_TAG, "Failed to find existing record for " + record.guid); return null; } From 54f0f5227bd917e391764ed1908278b18d89a478 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Tue, 19 Jun 2012 10:54:23 -0700 Subject: [PATCH 46/83] Bug 762627 - Ensure that CommandProcessor does not hold reference to last active GlobalSession. r=rnewman,liuche --HG-- extra : rebase_source : 246551a5ae19653409b20ac7dd5c235b54f3f712 --- .../android/base/sync/CommandProcessor.java | 42 ++++++++++++++++++- mobile/android/base/sync/CommandRunner.java | 2 +- mobile/android/base/sync/GlobalSession.java | 39 +++++++++++------ .../setup/activities/SendTabActivity.java | 8 ++-- .../sync/stage/SyncClientsEngineStage.java | 2 +- 5 files changed, 73 insertions(+), 20 deletions(-) diff --git a/mobile/android/base/sync/CommandProcessor.java b/mobile/android/base/sync/CommandProcessor.java index eb3f7e8b403..89dcc030be2 100644 --- a/mobile/android/base/sync/CommandProcessor.java +++ b/mobile/android/base/sync/CommandProcessor.java @@ -24,6 +24,20 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; +/** + * Process commands received from Sync clients. + *

+ * We need a command processor at two different times: + *

    + *
  1. We execute commands during the "clients" engine stage of a Sync. Each + * command takes a GlobalSession instance as a parameter.
  2. + *
  3. We queue commands to be executed or propagated to other Sync clients + * during an activity completely unrelated to a sync (such as + * SendTabActivity.)
  4. + *
+ * To provide a processor for both these time frames, we maintain a static + * long-lived singleton. + */ public class CommandProcessor { private static final String LOG_TAG = "Command"; private static AtomicInteger currentId = new AtomicInteger(); @@ -31,6 +45,11 @@ public class CommandProcessor { private final static CommandProcessor processor = new CommandProcessor(); + /** + * Get the global singleton command processor. + * + * @return the singleton processor. + */ public static CommandProcessor getProcessor() { return processor; } @@ -66,11 +85,30 @@ public class CommandProcessor { } } + /** + * Register a command. + *

+ * Any existing registration is overwritten. + * + * @param commandType + * the name of the command, i.e., "displayURI". + * @param command + * the CommandRunner instance that should handle the + * command. + */ public void registerCommand(String commandType, CommandRunner command) { commands.put(commandType, command); } - public void processCommand(ExtendedJSONObject unparsedCommand) { + /** + * Process a command in the context of the given global session. + * + * @param session + * the GlobalSession instance currently executing. + * @param unparsedCommand + * command as a ExtendedJSONObject instance. + */ + public void processCommand(final GlobalSession session, ExtendedJSONObject unparsedCommand) { Command command = parseCommand(unparsedCommand); if (command == null) { Logger.debug(LOG_TAG, "Invalid command: " + unparsedCommand + " will not be processed."); @@ -83,7 +121,7 @@ public class CommandProcessor { return; } - executableCommand.executeCommand(command.getArgsList()); + executableCommand.executeCommand(session, command.getArgsList()); } /** diff --git a/mobile/android/base/sync/CommandRunner.java b/mobile/android/base/sync/CommandRunner.java index 13c657f3aca..c7a0f176235 100644 --- a/mobile/android/base/sync/CommandRunner.java +++ b/mobile/android/base/sync/CommandRunner.java @@ -13,7 +13,7 @@ public abstract class CommandRunner { this.argCount = argCount; } - public abstract void executeCommand(List args); + public abstract void executeCommand(GlobalSession session, List args); public boolean argumentsAreValid(List args) { return args != null && diff --git a/mobile/android/base/sync/GlobalSession.java b/mobile/android/base/sync/GlobalSession.java index b3609add54c..7c850ca979a 100644 --- a/mobile/android/base/sync/GlobalSession.java +++ b/mobile/android/base/sync/GlobalSession.java @@ -166,45 +166,50 @@ public class GlobalSession implements CredentialsSource, PrefsSource, HttpRespon // TODO: data-driven plan for the sync, referring to prepareStages. } - protected void registerCommands() { + /** + * Register commands this global session knows how to process. + *

+ * Re-registering a command overwrites any existing registration. + */ + protected static void registerCommands() { final CommandProcessor processor = CommandProcessor.getProcessor(); processor.registerCommand("resetEngine", new CommandRunner(1) { @Override - public void executeCommand(List args) { + public void executeCommand(final GlobalSession session, List args) { HashSet names = new HashSet(); names.add(args.get(0)); - resetStagesByName(names); + session.resetStagesByName(names); } }); processor.registerCommand("resetAll", new CommandRunner(0) { @Override - public void executeCommand(List args) { - resetAllStages(); + public void executeCommand(final GlobalSession session, List args) { + session.resetAllStages(); } }); processor.registerCommand("wipeEngine", new CommandRunner(1) { @Override - public void executeCommand(List args) { + public void executeCommand(final GlobalSession session, List args) { HashSet names = new HashSet(); names.add(args.get(0)); - wipeStagesByName(names); + session.wipeStagesByName(names); } }); processor.registerCommand("wipeAll", new CommandRunner(0) { @Override - public void executeCommand(List args) { - wipeAllStages(); + public void executeCommand(final GlobalSession session, List args) { + session.wipeAllStages(); } }); processor.registerCommand("displayURI", new CommandRunner(3) { @Override - public void executeCommand(List args) { - CommandProcessor.displayURI(args, context); + public void executeCommand(final GlobalSession session, List args) { + CommandProcessor.displayURI(args, session.getContext()); } }); } @@ -357,8 +362,16 @@ public class GlobalSession implements CredentialsSource, PrefsSource, HttpRespon this.start(); } - public void completeSync() { + /** + * We're finished (aborted or succeeded): release resources. + */ + protected void cleanUp() { uninstallAsHttpResponseObserver(); + this.stages = null; + } + + public void completeSync() { + cleanUp(); this.currentState = GlobalSyncStage.Stage.idle; this.callback.handleSuccess(this); } @@ -461,7 +474,7 @@ public class GlobalSession implements CredentialsSource, PrefsSource, HttpRespon public void abort(Exception e, String reason) { Logger.warn(LOG_TAG, "Aborting sync: " + reason, e); - uninstallAsHttpResponseObserver(); + cleanUp(); long existingBackoff = largestBackoffObserved.get(); if (existingBackoff > 0) { callback.requestBackoff(existingBackoff); diff --git a/mobile/android/base/sync/setup/activities/SendTabActivity.java b/mobile/android/base/sync/setup/activities/SendTabActivity.java index c04f4f8538c..70618ed60a0 100644 --- a/mobile/android/base/sync/setup/activities/SendTabActivity.java +++ b/mobile/android/base/sync/setup/activities/SendTabActivity.java @@ -5,11 +5,13 @@ import java.util.List; import org.mozilla.gecko.R; import org.mozilla.gecko.sync.CommandProcessor; import org.mozilla.gecko.sync.CommandRunner; +import org.mozilla.gecko.sync.GlobalSession; import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.repositories.NullCursorException; import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor; import org.mozilla.gecko.sync.repositories.domain.ClientRecord; import org.mozilla.gecko.sync.setup.Constants; + import android.accounts.Account; import android.accounts.AccountManager; import android.app.Activity; @@ -54,12 +56,12 @@ public class SendTabActivity extends Activity { enableSend(false); } - private void registerDisplayURICommand() { + private static void registerDisplayURICommand() { final CommandProcessor processor = CommandProcessor.getProcessor(); processor.registerCommand("displayURI", new CommandRunner(3) { @Override - public void executeCommand(List args) { - CommandProcessor.displayURI(args, getApplicationContext()); + public void executeCommand(final GlobalSession session, List args) { + CommandProcessor.displayURI(args, session.getContext()); } }); } diff --git a/mobile/android/base/sync/stage/SyncClientsEngineStage.java b/mobile/android/base/sync/stage/SyncClientsEngineStage.java index 7d59e521036..bd62e0a1c2a 100644 --- a/mobile/android/base/sync/stage/SyncClientsEngineStage.java +++ b/mobile/android/base/sync/stage/SyncClientsEngineStage.java @@ -398,7 +398,7 @@ public class SyncClientsEngineStage implements GlobalSyncStage { CommandProcessor processor = CommandProcessor.getProcessor(); for (Object o : commands) { - processor.processCommand(new ExtendedJSONObject((JSONObject) o)); + processor.processCommand(session, new ExtendedJSONObject((JSONObject) o)); } } From c18a5e6f0bc8789b7962861f701b39c2d71c7009 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Tue, 19 Jun 2012 11:01:57 -0700 Subject: [PATCH 47/83] Bug 762064 - Close InputStream in SuggestClient. r=blassey --- mobile/android/base/SuggestClient.java | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/mobile/android/base/SuggestClient.java b/mobile/android/base/SuggestClient.java index 496a6d197da..6a45a7a9143 100644 --- a/mobile/android/base/SuggestClient.java +++ b/mobile/android/base/SuggestClient.java @@ -15,6 +15,7 @@ import android.util.Log; import java.io.BufferedInputStream; import java.io.InputStream; import java.io.InterruptedIOException; +import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; @@ -71,14 +72,24 @@ public class SuggestClient { URL url = new URL(suggestUri); String json = null; - HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); + HttpURLConnection urlConnection = null; + InputStream in = null; try { + urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setConnectTimeout(mTimeout); urlConnection.setRequestProperty("User-Agent", USER_AGENT); - InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + in = new BufferedInputStream(urlConnection.getInputStream()); json = convertStreamToString(in); } finally { - urlConnection.disconnect(); + if (urlConnection != null) + urlConnection.disconnect(); + if (in != null) { + try { + in.close(); + } catch (IOException e) { + Log.e(LOGTAG, "error", e); + } + } } if (json != null) { @@ -98,12 +109,10 @@ public class SuggestClient { } } } else { - Log.d(LOGTAG, "Suggestion query failed"); + Log.e(LOGTAG, "Suggestion query failed"); } - } catch (InterruptedIOException e) { - Log.d(LOGTAG, "Suggestion query interrupted"); } catch (Exception e) { - Log.w(LOGTAG, "Error", e); + Log.e(LOGTAG, "Error", e); } return suggestions; } From e33f6ca94b266ea923e233d73ad3bf9a5b4dab96 Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Tue, 19 Jun 2012 11:13:42 -0700 Subject: [PATCH 48/83] Bug 637014 - use the right global in MakeFinalizeObserver (r=luke) --- js/src/builtin/TestingFunctions.cpp | 8 ++++++-- js/src/jit-test/tests/basic/testBug637014.js | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 js/src/jit-test/tests/basic/testBug637014.js diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index afcaf5de8ec..3ebfe1c1986 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -482,10 +482,14 @@ static JSClass FinalizeCounterClass = { static JSBool MakeFinalizeObserver(JSContext *cx, unsigned argc, jsval *vp) { - JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, NULL, - JS_GetGlobalObject(cx)); + JSObject *scope = JS_GetGlobalForScopeChain(cx); + if (!scope) + return false; + + JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, NULL, scope); if (!obj) return false; + *vp = OBJECT_TO_JSVAL(obj); return true; } diff --git a/js/src/jit-test/tests/basic/testBug637014.js b/js/src/jit-test/tests/basic/testBug637014.js new file mode 100644 index 00000000000..b7874ff6f4f --- /dev/null +++ b/js/src/jit-test/tests/basic/testBug637014.js @@ -0,0 +1,2 @@ +var o = newGlobal('new-compartment'); +o.makeFinalizeObserver(); From e84af3afd0eb0271e570ddc6a3b6cf60aef155d4 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 19 Jun 2012 11:33:00 -0700 Subject: [PATCH 49/83] Bug 763776 - refactor nsXPConnect::Traverse. r=billm --- js/xpconnect/src/nsXPConnect.cpp | 145 ++++++++++++++++++------------- 1 file changed, 86 insertions(+), 59 deletions(-) diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index d6a31b4dcad..2469c913abd 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -742,7 +742,7 @@ xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS) } } -static JSBool +static bool WrapperIsNotMainThreadOnly(XPCWrappedNative *wrapper) { XPCWrappedNativeProto *proto = wrapper->GetProto(); @@ -750,59 +750,34 @@ WrapperIsNotMainThreadOnly(XPCWrappedNative *wrapper) return false; // If the native participates in cycle collection then we know it can only - // be used on the main thread, in that case we assume the wrapped native + // be used on the main thread. In that case we assume the wrapped native // can only be used on the main thread too. nsXPCOMCycleCollectionParticipant* participant; return NS_FAILED(CallQueryInterface(wrapper->Native(), &participant)); } -NS_IMETHODIMP -nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) +static inline void +DescribeGCThing(bool isMarked, void *p, JSGCTraceKind traceKind, + nsCycleCollectionTraversalCallback &cb) { - JSGCTraceKind traceKind = js_GetGCThingTraceKind(p); - JSObject *obj = nsnull; - js::Class *clazz = nsnull; - - // We do not want to add wrappers to the cycle collector if they're not - // explicitly marked as main thread only, because the cycle collector isn't - // able to deal with objects that might be used off of the main thread. We - // do want to explicitly mark them for cycle collection if the wrapper has - // an external reference, because the wrapper would mark the JS object if - // we did add the wrapper to the cycle collector. - JSBool dontTraverse = false; - JSBool markJSObject = false; - if (traceKind == JSTRACE_OBJECT) { - obj = static_cast(p); - clazz = js::GetObjectClass(obj); - - if (clazz == &XPC_WN_Tearoff_JSClass) { - XPCWrappedNative *wrapper = - (XPCWrappedNative*)xpc_GetJSPrivate(js::GetObjectParent(obj)); - dontTraverse = WrapperIsNotMainThreadOnly(wrapper); - } else if (IS_WRAPPER_CLASS(clazz) && IS_WN_WRAPPER_OBJECT(obj)) { - XPCWrappedNative *wrapper = (XPCWrappedNative*)xpc_GetJSPrivate(obj); - dontTraverse = WrapperIsNotMainThreadOnly(wrapper); - markJSObject = dontTraverse && wrapper->HasExternalReference(); - } - } - - bool isMarked = markJSObject || !xpc_IsGrayGCThing(p); - if (cb.WantDebugInfo()) { char name[72]; if (traceKind == JSTRACE_OBJECT) { - XPCNativeScriptableInfo* si = nsnull; - if (IS_PROTO_CLASS(clazz)) { - XPCWrappedNativeProto* p = - (XPCWrappedNativeProto*) xpc_GetJSPrivate(obj); + JSObject *obj = static_cast(p); + js::Class *clasp = js::GetObjectClass(obj); + XPCNativeScriptableInfo *si = nsnull; + + if (IS_PROTO_CLASS(clasp)) { + XPCWrappedNativeProto *p = + static_cast(xpc_GetJSPrivate(obj)); si = p->GetScriptableInfo(); } if (si) { JS_snprintf(name, sizeof(name), "JS Object (%s - %s)", - clazz->name, si->GetJSClass()->name); - } else if (clazz == &js::FunctionClass) { - JSFunction* fun = JS_GetObjectFunction(obj); - JSString* str = JS_GetFunctionId(fun); + clasp->name, si->GetJSClass()->name); + } else if (clasp == &js::FunctionClass) { + JSFunction *fun = JS_GetObjectFunction(obj); + JSString *str = JS_GetFunctionId(fun); if (str) { NS_ConvertUTF16toUTF8 fname(JS_GetInternedStringChars(str)); JS_snprintf(name, sizeof(name), @@ -812,7 +787,7 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) } } else { JS_snprintf(name, sizeof(name), "JS Object (%s)", - clazz->name); + clasp->name); } } else { static const char trace_types[][11] = { @@ -833,36 +808,38 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) } else { cb.DescribeGCedNode(isMarked, sizeof(js::shadow::Object), "JS Object"); } +} - // There's no need to trace objects that have already been marked by the JS - // GC. Any JS objects hanging from them will already be marked. Only do this - // if cb.WantAllTraces() is false, otherwise we do want to know about all JS - // objects to get better graphs and explanations. - if (!cb.WantAllTraces() && isMarked) - return NS_OK; - +static inline void +NoteGCThingJSChildren(JSRuntime *rt, void *p, JSGCTraceKind traceKind, + nsCycleCollectionTraversalCallback &cb) +{ TraversalTracer trc(cb); - - JS_TracerInit(&trc, GetRuntime()->GetJSRuntime(), NoteJSChild); + JS_TracerInit(&trc, rt, NoteJSChild); trc.eagerlyTraceWeakMaps = false; JS_TraceChildren(&trc, p, traceKind); +} - if (traceKind != JSTRACE_OBJECT || dontTraverse) - return NS_OK; +static inline void +NoteGCThingXPCOMChildren(js::Class *clasp, JSObject *obj, + nsCycleCollectionTraversalCallback &cb) +{ + MOZ_ASSERT(clasp); + MOZ_ASSERT(clasp == js::GetObjectClass(obj)); - if (clazz == &XPC_WN_Tearoff_JSClass) { + if (clasp == &XPC_WN_Tearoff_JSClass) { // A tearoff holds a strong reference to its native object // (see XPCWrappedNative::FlatJSObjectFinalized). Its XPCWrappedNative // will be held alive through the parent of the JSObject of the tearoff. XPCWrappedNativeTearOff *to = - (XPCWrappedNativeTearOff*) xpc_GetJSPrivate(obj); + static_cast(xpc_GetJSPrivate(obj)); NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "xpc_GetJSPrivate(obj)->mNative"); cb.NoteXPCOMChild(to->GetNative()); } // XXX This test does seem fragile, we should probably whitelist classes // that do hold a strong reference, but that might not be possible. - else if (clazz->flags & JSCLASS_HAS_PRIVATE && - clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) { + else if (clasp->flags & JSCLASS_HAS_PRIVATE && + clasp->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "xpc_GetJSPrivate(obj)"); cb.NoteXPCOMChild(static_cast(xpc_GetJSPrivate(obj))); } else if (binding::instanceIsProxy(obj)) { @@ -870,12 +847,62 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) nsISupports *identity = static_cast(js::GetProxyPrivate(obj).toPrivate()); cb.NoteXPCOMChild(identity); - } else if (IsDOMClass(clazz) && - DOMJSClass::FromJSClass(clazz)->mDOMObjectIsISupports) { + } else if (IsDOMClass(clasp) && + DOMJSClass::FromJSClass(clasp)->mDOMObjectIsISupports) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "UnwrapDOMObject(obj)"); nsISupports *identity = UnwrapDOMObject(obj); cb.NoteXPCOMChild(identity); } +} + +NS_IMETHODIMP +nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb) +{ + JSGCTraceKind traceKind = js_GetGCThingTraceKind(p); + JSObject *obj = nsnull; + js::Class *clasp = nsnull; + + // We do not want to add wrappers to the cycle collector if they're not + // explicitly marked as main thread only, because the cycle collector isn't + // able to deal with objects that might be used off of the main thread. We + // do want to explicitly mark them for cycle collection if the wrapper has + // an external reference, because the wrapper would mark the JS object if + // we did add the wrapper to the cycle collector. + bool dontTraverse = false; + bool markJSObject = false; + if (traceKind == JSTRACE_OBJECT) { + obj = static_cast(p); + clasp = js::GetObjectClass(obj); + + if (clasp == &XPC_WN_Tearoff_JSClass) { + XPCWrappedNative *wrapper = + static_cast(xpc_GetJSPrivate(js::GetObjectParent(obj))); + dontTraverse = WrapperIsNotMainThreadOnly(wrapper); + } else if (IS_WRAPPER_CLASS(clasp) && IS_WN_WRAPPER_OBJECT(obj)) { + XPCWrappedNative *wrapper = + static_cast(xpc_GetJSPrivate(obj)); + dontTraverse = WrapperIsNotMainThreadOnly(wrapper); + markJSObject = dontTraverse && wrapper->HasExternalReference(); + } + } + + bool isMarked = markJSObject || !xpc_IsGrayGCThing(p); + + DescribeGCThing(isMarked, p, traceKind, cb); + + // If this object is alive, then all of its children are alive. For JS objects, + // the black-gray invariant ensures the children are also marked black. For C++ + // objects, the ref count from this object will keep them alive. Thus we don't + // need to trace our children, unless we are debugging using WantAllTraces. + if (isMarked && !cb.WantAllTraces()) + return NS_OK; + + NoteGCThingJSChildren(GetRuntime()->GetJSRuntime(), p, traceKind, cb); + + if (traceKind != JSTRACE_OBJECT || dontTraverse) + return NS_OK; + + NoteGCThingXPCOMChildren(clasp, obj, cb); return NS_OK; } From aa807b4225a160442018e8f7700537e03b9c0c14 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 12:01:44 -0700 Subject: [PATCH 50/83] Bug 756474 - Harden the SimpleScaleGestureDectector against missed events [r=kats] --- mobile/android/base/gfx/TouchEventHandler.java | 11 +---------- .../android/base/ui/SimpleScaleGestureDetector.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/gfx/TouchEventHandler.java b/mobile/android/base/gfx/TouchEventHandler.java index 21e77765203..153d47d49de 100644 --- a/mobile/android/base/gfx/TouchEventHandler.java +++ b/mobile/android/base/gfx/TouchEventHandler.java @@ -251,16 +251,7 @@ public final class TouchEventHandler implements Tabs.OnTabsChangedListener { */ private void dispatchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)) { - // An up/cancel event should get passed to both detectors, in - // case it comes from a pointer the scale detector is tracking. - switch (event.getAction() & MotionEvent.ACTION_MASK) { - case MotionEvent.ACTION_POINTER_UP: - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - break; - default: - return; - } + return; } mScaleGestureDetector.onTouchEvent(event); if (mScaleGestureDetector.isInProgress()) { diff --git a/mobile/android/base/ui/SimpleScaleGestureDetector.java b/mobile/android/base/ui/SimpleScaleGestureDetector.java index fa4e7f1a8d9..5fbfcd7c27e 100644 --- a/mobile/android/base/ui/SimpleScaleGestureDetector.java +++ b/mobile/android/base/ui/SimpleScaleGestureDetector.java @@ -51,6 +51,12 @@ public class SimpleScaleGestureDetector { public void onTouchEvent(MotionEvent event) { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: + // If we get ACTION_DOWN while still tracking any pointers, + // something is wrong. Cancel the current gesture and start over. + if (getPointersDown() > 0) + onTouchEnd(event); + onTouchStart(event); + break; case MotionEvent.ACTION_POINTER_DOWN: onTouchStart(event); break; @@ -99,7 +105,10 @@ public class SimpleScaleGestureDetector { private void onTouchEnd(MotionEvent event) { mLastEventTime = event.getEventTime(); - boolean isCancel = (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_CANCEL; + int action = event.getAction() & MotionEvent.ACTION_MASK; + boolean isCancel = (action == MotionEvent.ACTION_CANCEL || + action == MotionEvent.ACTION_DOWN); + int id = event.getPointerId(getActionIndex(event)); ListIterator iterator = mPointerInfo.listIterator(); while (iterator.hasNext()) { From 44462c91634556ea63109b9f8f29a4e132bacaee Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 12:03:00 -0700 Subject: [PATCH 51/83] Bug 765941 - Thumbnail doesn't update after following a link to an HTTP redirect [r=bnicholson] --- mobile/android/base/GeckoApp.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 9699644fd4e..c1db92af540 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -987,7 +987,7 @@ abstract public class GeckoApp handleDocumentStart(tabId, showProgress, uri); } else if ((state & GeckoAppShell.WPL_STATE_STOP) != 0) { Log.i(LOGTAG, "Got a document stop"); - handleDocumentStop(tabId, success, uri); + handleDocumentStop(tabId, success); } } } else if (event.equals("Content:LoadError")) { @@ -1308,7 +1308,7 @@ abstract public class GeckoApp }); } - void handleDocumentStop(int tabId, boolean success, final String uri) { + void handleDocumentStop(int tabId, boolean success) { final Tab tab = Tabs.getInstance().getTab(tabId); if (tab == null) return; @@ -1320,9 +1320,11 @@ abstract public class GeckoApp Tabs.getInstance().notifyListeners(tab, Tabs.TabEvents.STOP); } }); + + final String oldURL = tab.getURL(); GeckoAppShell.getHandler().postDelayed(new Runnable() { public void run() { - if (!uri.equals(tab.getURL())) + if (!oldURL.equals(tab.getURL())) return; getAndProcessThumbnailForTab(tab); From 0e8e38a31ec488ab705a52f2b39a762d9c1c753b Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 19 Jun 2012 12:13:41 -0700 Subject: [PATCH 52/83] Bug 765831 - Part 1: Extract selection index juggling into a Span helper class. r=blassey --- mobile/android/base/GeckoInputConnection.java | 131 ++++++++++-------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/mobile/android/base/GeckoInputConnection.java b/mobile/android/base/GeckoInputConnection.java index 3fa548e3840..c082880400e 100644 --- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -176,10 +176,7 @@ public class GeckoInputConnection return false; String text = content.toString(); - - clampSelection(); - int a = Selection.getSelectionStart(content); - int b = Selection.getSelectionEnd(content); + Span selection = clampSelection(); switch (id) { case R.id.selectAll: @@ -189,7 +186,7 @@ public class GeckoInputConnection // Fill the clipboard GeckoAppShell.setClipboardText(text); // If selection is empty, we'll select everything - if (a >= b) + if (selection.length == 0) GeckoAppShell.sendEventToGecko( GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, 0, text.length())); GeckoAppShell.sendEventToGecko( @@ -199,11 +196,11 @@ public class GeckoInputConnection commitText(GeckoAppShell.getClipboardText(), 1); break; case R.id.copy: - // If there is no selection set, we must be doing "Copy All", - // otherwise get the selection - if (a < b) - text = text.substring(a, b); - GeckoAppShell.setClipboardText(text.substring(a, b)); + // Copy the current selection or the empty string if nothing is selected. + String copiedText = selection.length > 0 + ? text.substring(selection.start, selection.end) + : ""; + GeckoAppShell.setClipboardText(text); break; } return true; @@ -221,14 +218,14 @@ public class GeckoInputConnection if ((flags & GET_EXTRACTED_TEXT_MONITOR) != 0) mUpdateRequest = req; + Span selection = clampSelection(); + ExtractedText extract = new ExtractedText(); extract.flags = 0; extract.partialStartOffset = -1; extract.partialEndOffset = -1; - - clampSelection(); - extract.selectionStart = Selection.getSelectionStart(content); - extract.selectionEnd = Selection.getSelectionEnd(content); + extract.selectionStart = selection.start; + extract.selectionEnd = selection.end; extract.startOffset = 0; extract.text = content.toString(); @@ -283,41 +280,20 @@ public class GeckoInputConnection // Android's BaseInputConnection.java is vulnerable to IndexOutOfBoundsExceptions because it // does not adequately protect against stale indexes for selections exceeding the content length // when the Editable content changes. We must clamp the indexes to be safe. - private void clampSelection() { + private Span clampSelection() { Editable content = getEditable(); - if (content == null) { - return; + final int currentStart = Selection.getSelectionStart(content); + final int currentEnd = Selection.getSelectionEnd(content); + Span selection = Span.clamp(currentStart, currentEnd, content); + + if (selection.start != currentStart || selection.end != currentEnd) { + Log.e(LOGTAG, "CLAMPING BOGUS SELECTION (" + currentStart + ", " + currentEnd + + "] -> (" + selection.start + ", " + selection.end + "]", + new AssertionError()); + super.setSelection(selection.start, selection.end); } - final int selectionStart = Selection.getSelectionStart(content); - final int selectionEnd = Selection.getSelectionEnd(content); - - int a = clampContentIndex(content, selectionStart); - int b = clampContentIndex(content, selectionEnd); - - if (a > b) { - int tmp = a; - a = b; - b = tmp; - } - - if (a != selectionStart || b != selectionEnd) { - Log.e(LOGTAG, "CLAMPING BOGUS SELECTION (" + selectionStart + ", " + selectionEnd - + "] -> (" + a + ", " + b + "]", new AssertionError()); - setSelection(a, b); - } - } - - private static int clampContentIndex(Editable content, int index) { - if (index < 0) { - index = 0; - } else { - final int contentLength = content.length(); - if (index > contentLength) { - index = contentLength; - } - } - return index; + return selection; } private void replaceText(CharSequence text, int newCursorPosition, boolean composing) { @@ -351,9 +327,9 @@ public class GeckoInputConnection if (a != -1 && b != -1) { removeComposingSpans(content); } else { - clampSelection(); - a = Selection.getSelectionStart(content); - b = Selection.getSelectionEnd(content); + Span selection = clampSelection(); + a = selection.start; + b = selection.end; } if (composing) { @@ -506,12 +482,13 @@ public class GeckoInputConnection if (!mBatchMode) { final Editable content = getEditable(); - start = clampContentIndex(content, start); - end = clampContentIndex(content, end); + Span newSelection = Span.clamp(start, end, content); + start = newSelection.start; + end = newSelection.end; - clampSelection(); - int a = Selection.getSelectionStart(content); - int b = Selection.getSelectionEnd(content); + Span currentSelection = clampSelection(); + int a = currentSelection.start; + int b = currentSelection.end; if (start != a || end != b) { if (DEBUG) { @@ -929,12 +906,10 @@ public class GeckoInputConnection (event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0 || !keyListener.onKeyDown(view, mEditable, keyCode, event)) { // Make sure selection in Gecko is up-to-date - final Editable content = getEditable(); - int a = Selection.getSelectionStart(content); - int b = Selection.getSelectionEnd(content); - GeckoAppShell.sendEventToGecko( - GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, a, b - a)); - + Span selection = clampSelection(); + GeckoAppShell.sendEventToGecko(GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, + selection.start, + selection.length)); GeckoAppShell.sendEventToGecko(GeckoEvent.createKeyEvent(event)); } return true; @@ -1135,6 +1110,42 @@ public class GeckoInputConnection return mCompositionStart != NO_COMPOSITION_STRING; } + private static final class Span { + public final int start; + public final int end; + public final int length; + + public static Span clamp(int start, int end, Editable content) { + return new Span(start, end, content); + } + + private Span(int a, int b, Editable content) { + if (a > b) { + int tmp = a; + a = b; + b = tmp; + } + + final int contentLength = content.length(); + + if (a < 0) { + a = 0; + } else if (a > contentLength) { + a = contentLength; + } + + if (b < 0) { + b = 0; + } else if (b > contentLength) { + b = contentLength; + } + + start = a; + end = b; + length = end - start; + } + } + private static final class DebugGeckoInputConnection extends GeckoInputConnection { public DebugGeckoInputConnection(View targetView) { super(targetView); From fad3377b1a5b1a397b391a00ab16bc3d440da171 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 19 Jun 2012 12:13:48 -0700 Subject: [PATCH 53/83] Bug 765831 - Part 2: Clamp bogus selection indexes passed to setSelection(). r=blassey --- mobile/android/base/GeckoInputConnection.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mobile/android/base/GeckoInputConnection.java b/mobile/android/base/GeckoInputConnection.java index c082880400e..813dde2f2ba 100644 --- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -234,10 +234,12 @@ public class GeckoInputConnection @Override public boolean setSelection(int start, int end) { - GeckoAppShell.sendEventToGecko( - GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, start, end - start)); - - return super.setSelection(start, end); + // Some IMEs call setSelection() with negative or stale indexes, so clamp them. + Span newSelection = Span.clamp(start, end, getEditable()); + GeckoAppShell.sendEventToGecko(GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, + newSelection.start, + newSelection.length)); + return super.setSelection(newSelection.start, newSelection.end); } @Override From 899a4bbb58b436a39d31a83a9222b41601b37d29 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 19 Jun 2012 12:19:30 -0700 Subject: [PATCH 54/83] Bug 765831 - Part 3: Clamp bogus composing region indexes passed to setComposingRegion(). r=blassey --- mobile/android/base/GeckoInputConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/GeckoInputConnection.java b/mobile/android/base/GeckoInputConnection.java index 813dde2f2ba..f7d1c7e561c 100644 --- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -392,7 +392,8 @@ public class GeckoInputConnection endComposition(); } - return super.setComposingRegion(start, end); + Span newComposingRegion = Span.clamp(start, end, getEditable()); + return super.setComposingRegion(newComposingRegion.start, newComposingRegion.end); } public String getComposingText() { From 7ea36bae56a230d3b5cbe4050a04bd2bdae29fd5 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 19 Jun 2012 12:12:27 -0700 Subject: [PATCH 55/83] Bug 765831 - Part 4: Clamp string lengths passed to getTextBeforeCursor/getTextAfterCursor. r=blassey --- mobile/android/base/GeckoInputConnection.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/GeckoInputConnection.java b/mobile/android/base/GeckoInputConnection.java index f7d1c7e561c..fd4880d6075 100644 --- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -256,7 +256,16 @@ public class GeckoInputConnection @Override public CharSequence getTextBeforeCursor(int length, int flags) { - clampSelection(); + // Avoid underrunning text buffer. + Span selection = clampSelection(); + if (length > selection.start) { + length = selection.start; + } + + if (length < 1) { + return ""; + } + return super.getTextBeforeCursor(length, flags); } @@ -268,7 +277,17 @@ public class GeckoInputConnection @Override public CharSequence getTextAfterCursor(int length, int flags) { - clampSelection(); + // Avoid overrunning text buffer. + Span selection = clampSelection(); + int contentLength = getEditable().length(); + if (selection.end + length > contentLength) { + length = contentLength - selection.end; + } + + if (length < 1) { + return ""; + } + return super.getTextAfterCursor(length, flags); } From e568d929d7fbd47eb95cf7bbc0895d22fcd380c2 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 19 Jun 2012 12:17:20 -0700 Subject: [PATCH 56/83] Bug 765831 - Part 5: Clamp composing span indexes. r=blassey --- mobile/android/base/GeckoInputConnection.java | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/mobile/android/base/GeckoInputConnection.java b/mobile/android/base/GeckoInputConnection.java index fd4880d6075..9d6771147ad 100644 --- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -334,19 +334,15 @@ public class GeckoInputConnection beginBatchEdit(); // delete composing text set previously. - int a = getComposingSpanStart(content); - int b = getComposingSpanEnd(content); + int a; + int b; - if (DEBUG) Log.d(LOGTAG, "Composing span: " + a + " to " + b); - - if (b < a) { - int tmp = a; - a = b; - b = tmp; - } - - if (a != -1 && b != -1) { + Span composingSpan = getComposingSpan(); + if (composingSpan != null) { removeComposingSpans(content); + a = composingSpan.start; + b = composingSpan.end; + composingSpan = null; } else { Span selection = clampSelection(); a = selection.start; @@ -420,19 +416,13 @@ public class GeckoInputConnection if (content == null) { return null; } - int a = getComposingSpanStart(content); - int b = getComposingSpanEnd(content); - if (a < 0 || b < 0) - return null; - - if (b < a) { - int tmp = a; - a = b; - b = tmp; + Span composingSpan = getComposingSpan(); + if (composingSpan == null || composingSpan.length == 0) { + return ""; } - return TextUtils.substring(content, a, b); + return TextUtils.substring(content, composingSpan.start, composingSpan.end); } public boolean onKeyDel() { @@ -522,16 +512,14 @@ public class GeckoInputConnection super.setSelection(start, end); // Check if the selection is inside composing span - int ca = getComposingSpanStart(content); - int cb = getComposingSpanEnd(content); - if (cb < ca) { - int tmp = ca; - ca = cb; - cb = tmp; - } - if (start < ca || start > cb || end < ca || end > cb) { - if (DEBUG) Log.d(LOGTAG, ". . . notifySelectionChange: removeComposingSpans"); - removeComposingSpans(content); + Span composingSpan = getComposingSpan(); + if (composingSpan != null) { + int ca = composingSpan.start; + int cb = composingSpan.end; + if (start < ca || start > cb || end < ca || end > cb) { + if (DEBUG) Log.d(LOGTAG, ". . . notifySelectionChange: removeComposingSpans"); + removeComposingSpans(content); + } } } } @@ -1132,6 +1120,23 @@ public class GeckoInputConnection return mCompositionStart != NO_COMPOSITION_STRING; } + private Span getComposingSpan() { + Editable content = getEditable(); + int start = getComposingSpanStart(content); + int end = getComposingSpanEnd(content); + + // Does the editable have a composing span? + if (start < 0 || end < 0) { + if (start != -1 || end != -1) { + throw new IndexOutOfBoundsException("Bad composing span (" + start + "," + end + + "], contentLength=" + content.length()); + } + return null; + } + + return new Span(start, end, content); + } + private static final class Span { public final int start; public final int end; From 6ceac710b778d5de415c7da11e3e894542dc140d Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 13:37:57 -0700 Subject: [PATCH 57/83] Bug 765805 (1/3) - Don't hide the tab sidebar when switching tabs [r=sriram] --- mobile/android/base/BrowserApp.java | 8 ++++++++ mobile/android/base/BrowserToolbar.java | 2 +- mobile/android/base/GeckoApp.java | 12 ++++++++++-- mobile/android/base/RemoteTabs.java | 10 +++++----- mobile/android/base/TabsTray.java | 6 +++--- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index c528a145ea1..3ffecddf0b5 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -323,6 +323,14 @@ abstract public class BrowserApp extends GeckoApp mTabsPanel.hide(); } + public boolean autoHideTabs() { + if (!isTablet() && areTabsShown()) { + hideTabs(); + return true; + } + return false; + } + public boolean areTabsShown() { return mTabsPanel.isShown(); } diff --git a/mobile/android/base/BrowserToolbar.java b/mobile/android/base/BrowserToolbar.java index ebdb0b4f45f..225635eabce 100644 --- a/mobile/android/base/BrowserToolbar.java +++ b/mobile/android/base/BrowserToolbar.java @@ -108,7 +108,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, mAwesomeBar = (Button) mLayout.findViewById(R.id.awesome_bar); mAwesomeBar.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { - GeckoApp.mAppContext.hideTabs(); + GeckoApp.mAppContext.autoHideTabs(); onAwesomeBarSearch(); } }); diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index c1db92af540..882a44db6c9 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -893,6 +893,15 @@ abstract public class GeckoApp public void hideTabs() { } + /** + * Close the tab UI indirectly (not as the result of a direct user + * action). This does not force the UI to close; for example in Firefox + * tablet mode it will remain open unless the user explicitly closes it. + * + * @return True if the tab UI was hidden. + */ + public boolean autoHideTabs() { return false; } + public boolean areTabsShown() { return false; } public void handleMessage(String event, JSONObject message) { @@ -2689,8 +2698,7 @@ abstract public class GeckoApp @Override public void onBackPressed() { - if (mTabsPanel != null && mTabsPanel.isShown() && !isTablet()) { - mTabsPanel.hide(); + if (autoHideTabs()) { return; } diff --git a/mobile/android/base/RemoteTabs.java b/mobile/android/base/RemoteTabs.java index 148b018c747..d9f2ea7521e 100644 --- a/mobile/android/base/RemoteTabs.java +++ b/mobile/android/base/RemoteTabs.java @@ -65,8 +65,8 @@ public class RemoteTabs extends LinearLayout public void hide() { } - void hideTabs() { - GeckoApp.mAppContext.hideTabs(); + void autoHideTabs() { + GeckoApp.mAppContext.autoHideTabs(); } @Override @@ -79,7 +79,7 @@ public class RemoteTabs extends LinearLayout public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) { HashMap tab = mTabsList.get(groupPosition).get(childPosition); if (tab == null) { - hideTabs(); + autoHideTabs(); return true; } @@ -95,7 +95,7 @@ public class RemoteTabs extends LinearLayout Log.d(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add"); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString())); - hideTabs(); + autoHideTabs(); return true; } @@ -103,7 +103,7 @@ public class RemoteTabs extends LinearLayout public void onQueryTabsComplete(List remoteTabsList) { ArrayList remoteTabs = new ArrayList (remoteTabsList); if (remoteTabs == null || remoteTabs.size() == 0) { - hideTabs(); + autoHideTabs(); return; } diff --git a/mobile/android/base/TabsTray.java b/mobile/android/base/TabsTray.java index ca8802fcabb..920dc360967 100644 --- a/mobile/android/base/TabsTray.java +++ b/mobile/android/base/TabsTray.java @@ -143,8 +143,8 @@ public class TabsTray extends LinearLayout } } - void hideTabs() { - GeckoApp.mAppContext.hideTabs(); + void autoHideTabs() { + GeckoApp.mAppContext.autoHideTabs(); } // ViewHolder for a row in the list @@ -331,7 +331,7 @@ public class TabsTray extends LinearLayout TabRow tab = (TabRow)mView.getTag(); int tabId = tab.id; Tabs.getInstance().selectTab(tabId); - hideTabs(); + autoHideTabs(); } } From 333b2454e8b108dce6907a082495ff3f1e69c1cf Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 13:37:57 -0700 Subject: [PATCH 58/83] Bug 765805 (2/3) - Don't hide the tab sidebar when adding a new tab [r=sriram] --- mobile/android/base/TabsPanel.java | 2 +- mobile/android/base/TabsTray.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/TabsPanel.java b/mobile/android/base/TabsPanel.java index 50201857999..c036fc8e8e4 100644 --- a/mobile/android/base/TabsPanel.java +++ b/mobile/android/base/TabsPanel.java @@ -67,7 +67,7 @@ public class TabsPanel extends LinearLayout { addTab.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { GeckoApp.mAppContext.addTab(); - hide(); + GeckoApp.mAppContext.autoHideTabs(); } }); diff --git a/mobile/android/base/TabsTray.java b/mobile/android/base/TabsTray.java index 920dc360967..5f1cf109d5f 100644 --- a/mobile/android/base/TabsTray.java +++ b/mobile/android/base/TabsTray.java @@ -125,11 +125,18 @@ public class TabsTray extends LinearLayout return; } + int index = Tabs.getInstance().getIndexOf(tab); + if (msg == Tabs.TabEvents.ADDED) { + mTabsAdapter.addTab(index, tab); + mTabsAdapter.notifyDataSetChanged(); + return; + } + int position = mTabsAdapter.getPositionForTab(tab); if (position == -1) return; - if (Tabs.getInstance().getIndexOf(tab) == -1) { + if (index == -1) { mWaitingForClose = false; mTabsAdapter.removeTab(tab); mTabsAdapter.notifyDataSetChanged(); @@ -213,6 +220,10 @@ public class TabsTray extends LinearLayout return mTabs.indexOf(tab); } + public void addTab(int index, Tab tab) { + mTabs.add(index, tab); + } + public void removeTab(Tab tab) { mTabs.remove(tab); } From 8d9b2a0c33c534e110330db158c4b21b46b581f7 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 13:37:57 -0700 Subject: [PATCH 59/83] Bug 765805 (3/3) - Update thumbnails for tabs added while the sidebar is open [r=sriram] --- mobile/android/base/GeckoApp.java | 16 ++++++++++++++-- mobile/android/base/GeckoAppShell.java | 8 ++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 882a44db6c9..5c416ee0515 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -746,9 +746,17 @@ abstract public class GeckoApp GeckoAppShell.sendEventToGecko(GeckoEvent.createScreenshotEvent(tab.getId(), 0, 0, 0, 0, 0, 0, dw, dh, dw, dh, GeckoAppShell.SCREENSHOT_THUMBNAIL, tab.getThumbnailBuffer())); } } - + + void handleThumbnailData(Tab tab, ByteBuffer data) { + if (shouldUpdateThumbnail(tab)) { + Bitmap b = tab.getThumbnailBitmap(); + b.copyPixelsFromBuffer(data); + processThumbnail(tab, b, null); + } + } + void processThumbnail(Tab thumbnailTab, Bitmap bitmap, byte[] compressed) { - if (Tabs.getInstance().isSelectedTab(thumbnailTab)) { + if (shouldUpdateThumbnail(thumbnailTab)) { if (compressed == null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos); @@ -765,6 +773,10 @@ abstract public class GeckoApp } } + private boolean shouldUpdateThumbnail(Tab tab) { + return (Tabs.getInstance().isSelectedTab(tab) || mTabsPanel.isShown()); + } + void updatePopups(final Tab tab) { mDoorHangerPopup.updatePopup(); } diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 4d5cca76f93..30703cd490a 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -1589,7 +1589,7 @@ public class GeckoAppShell int x, int y, int w, int h, boolean isFullScreen) -{ + { ImmutableViewportMetrics pluginViewport; Log.i(LOGTAG, "addPluginView:" + view + " @ x:" + x + " y:" + y + " w:" + w + " h:" + h + " fullscreen: " + isFullScreen); @@ -2423,11 +2423,7 @@ class ScreenshotHandler { } case GeckoAppShell.SCREENSHOT_THUMBNAIL: { - if (Tabs.getInstance().isSelectedTab(tab)) { - Bitmap b = tab.getThumbnailBitmap(); - b.copyPixelsFromBuffer(data); - GeckoApp.mAppContext.processThumbnail(tab, b, null); - } + GeckoApp.mAppContext.handleThumbnailData(tab, data); break; } } From 8e6da4dc6b929d9fdf9977c1b31fc4cd115beba9 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Mon, 18 Jun 2012 14:57:09 -0700 Subject: [PATCH 60/83] Bug 765270 - Don't try to clean up in findClosed if this._findInProgress is false. r=mfinkle --- mobile/android/chrome/content/browser.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 99cd5cb0b62..c86487f3b09 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -3575,11 +3575,9 @@ var FindHelper = { }, findClosed: function() { - if (!this._findInProgress) { - // this should never happen - Cu.reportError("Warning: findClosed() called while _findInProgress is false!"); - // fall through and clean up anyway - } + // If there's no find in progress, there's nothing to clean up + if (!this._findInProgress) + return; this._find.collapseSelection(); this._find = null; From fc3761841a2afc11897ec316082f065e1f28878d Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 19 Jun 2012 16:47:27 -0400 Subject: [PATCH 61/83] Bug 765597 - Invalidate the thebes layer as well as the overflow area when moving frames; r=dbaron --- layout/base/nsCSSFrameConstructor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index ec6504a280f..001066c15c5 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -11964,7 +11964,7 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame) nsPoint(newOffsets.left, newOffsets.top)); // Invalidate the new rect - aFrame->InvalidateOverflowRect(); + aFrame->InvalidateFrameSubtree(); return true; } @@ -12038,7 +12038,7 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame) } // Invalidate the old rect - aFrame->InvalidateOverflowRect(); + aFrame->InvalidateFrameSubtree(); // Move the frame nsPoint pos(parentBorder.left + reflowState.mComputedOffsets.left + @@ -12048,7 +12048,7 @@ nsCSSFrameConstructor::RecomputePosition(nsIFrame* aFrame) aFrame->SetPosition(pos); // Invalidate the new rect - aFrame->InvalidateOverflowRect(); + aFrame->InvalidateFrameSubtree(); return true; } From 3dfee9380758b580cc955127fecaa4a56f58ec76 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 19 Jun 2012 14:10:42 -0700 Subject: [PATCH 62/83] Bug 763726 - Tap on content area while tabs menu is open should close it [r=mfinkle] --- mobile/android/base/GeckoApp.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 5c416ee0515..1d876ac90cf 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -3024,6 +3024,8 @@ abstract public class GeckoApp public boolean onTouch(View view, MotionEvent event) { if (event == null) return true; + if (autoHideTabs()) + return true; GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event)); return true; } From dba7dfff28a74a5fc3bda488fdd6059f3e5e171c Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Tue, 19 Jun 2012 14:11:23 -0700 Subject: [PATCH 63/83] Backed out changeset 0fa8e0eb40a7 (bug 760696) --- layout/style/html.css | 4 ++-- toolkit/content/widgets/videocontrols.xml | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/layout/style/html.css b/layout/style/html.css index f93277b7ce1..11a8296d438 100644 --- a/layout/style/html.css +++ b/layout/style/html.css @@ -702,13 +702,13 @@ iframe:-moz-full-screen { } /* media elements */ -:-moz-any(video, audio) > xul|videocontrols { +video > xul|videocontrols, audio > xul|videocontrols { display: -moz-box; -moz-box-orient: vertical; -moz-binding: url("chrome://global/content/bindings/videocontrols.xml#videoControls"); } -:-moz-any(video, audio):not([controls]):not(:-moz-full-screen) > xul|videocontrols { +:-moz-any(video,audio):not([controls]) > xul|videocontrols:not(.forceControls) { visibility: hidden; } diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index 63048fe3bcc..e6f7512b7ec 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -826,6 +826,13 @@ this.startFade(this.volumeStack, isMouseOver); }, + forceControls: function () { + if (document.mozFullScreenElement == this.video) + this.videocontrols.classList.add("forceControls"); + else + this.videocontrols.classList.remove("forceControls"); + }, + _controlsHiddenByTimeout : false, _showControlsTimeout : 0, SHOW_CONTROLS_TIMEOUT_MS: 500, @@ -1408,6 +1415,7 @@ addListener(this.videocontrols, "transitionend", this.onTransitionEnd); addListener(this.video.ownerDocument, "mozfullscreenchange", this.setFullscreenButtonState); + addListener(this.video.ownerDocument, "mozfullscreenchange", this.forceControls); // Make the

Normal From 79cf139ded37dcc10d9096c27315a2d3059d175a Mon Sep 17 00:00:00 2001 From: Andrew Quartey Date: Tue, 19 Jun 2012 19:01:10 -0400 Subject: [PATCH 69/83] Bug 762038 - Get rid of HyperTextAccessible CID. r=tbsaunde --- accessible/src/base/nsAccessiblePivot.cpp | 8 ++++++-- accessible/src/generic/HyperTextAccessible.cpp | 6 ------ accessible/src/generic/HyperTextAccessible.h | 12 ------------ accessible/src/html/HTMLFormControlAccessible.cpp | 5 ++--- accessible/src/mac/mozTextAccessible.mm | 4 ++-- .../src/xforms/nsXFormsFormControlsAccessible.cpp | 3 +-- accessible/src/xul/XULFormControlAccessible.cpp | 3 +-- 7 files changed, 12 insertions(+), 29 deletions(-) diff --git a/accessible/src/base/nsAccessiblePivot.cpp b/accessible/src/base/nsAccessiblePivot.cpp index 74fa2ef9b75..8cda77d5933 100644 --- a/accessible/src/base/nsAccessiblePivot.cpp +++ b/accessible/src/base/nsAccessiblePivot.cpp @@ -155,7 +155,11 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible, (aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)), NS_ERROR_INVALID_ARG); - nsRefPtr newPosition = do_QueryObject(aTextAccessible); + nsRefPtr acc(do_QueryObject(aTextAccessible)); + if (!acc) + return NS_ERROR_INVALID_ARG; + + HyperTextAccessible* newPosition = acc->AsHyperText(); if (!newPosition || !IsRootDescendant(newPosition)) return NS_ERROR_INVALID_ARG; @@ -170,7 +174,7 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible, mEndOffset = aEndOffset; nsRefPtr oldPosition = mPosition.forget(); - mPosition = newPosition.forget(); + mPosition = newPosition; NotifyOfPivotChange(oldPosition, oldStart, oldEnd); diff --git a/accessible/src/generic/HyperTextAccessible.cpp b/accessible/src/generic/HyperTextAccessible.cpp index 6325c52cdb6..064a20d39d3 100644 --- a/accessible/src/generic/HyperTextAccessible.cpp +++ b/accessible/src/generic/HyperTextAccessible.cpp @@ -55,12 +55,6 @@ HyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr) { *aInstancePtr = nsnull; - if (aIID.Equals(NS_GET_IID(HyperTextAccessible))) { - *aInstancePtr = static_cast(this); - NS_ADDREF_THIS(); - return NS_OK; - } - // ARIA roles that these interfaces are not appropriate for. if (!IsTextRole()) return Accessible::QueryInterface(aIID, aInstancePtr); diff --git a/accessible/src/generic/HyperTextAccessible.h b/accessible/src/generic/HyperTextAccessible.h index bf0a4b6c1c0..8dd9929d03a 100644 --- a/accessible/src/generic/HyperTextAccessible.h +++ b/accessible/src/generic/HyperTextAccessible.h @@ -24,14 +24,6 @@ const PRUnichar kEmbeddedObjectChar = 0xfffc; const PRUnichar kImaginaryEmbeddedObjectChar = ' '; const PRUnichar kForcedNewLineChar = '\n'; -#define NS_HYPERTEXTACCESSIBLE_IMPL_CID \ -{ /* 245f3bc9-224f-4839-a92e-95239705f30b */ \ - 0x245f3bc9, \ - 0x224f, \ - 0x4839, \ - { 0xa9, 0x2e, 0x95, 0x23, 0x97, 0x05, 0xf3, 0x0b } \ -} - /** * Special Accessible that knows how contain both text and embedded objects */ @@ -48,7 +40,6 @@ public: NS_DECL_NSIACCESSIBLETEXT NS_DECL_NSIACCESSIBLEHYPERTEXT NS_DECL_NSIACCESSIBLEEDITABLETEXT - NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID) // Accessible virtual PRInt32 GetLevelInternal(); @@ -410,9 +401,6 @@ private: nsTArray mOffsets; }; -NS_DEFINE_STATIC_IID_ACCESSOR(HyperTextAccessible, - NS_HYPERTEXTACCESSIBLE_IMPL_CID) - //////////////////////////////////////////////////////////////////////////////// // Accessible downcasting method diff --git a/accessible/src/html/HTMLFormControlAccessible.cpp b/accessible/src/html/HTMLFormControlAccessible.cpp index f51f0c37201..f5e69c5f551 100644 --- a/accessible/src/html/HTMLFormControlAccessible.cpp +++ b/accessible/src/html/HTMLFormControlAccessible.cpp @@ -324,9 +324,8 @@ HTMLTextFieldAccessible:: { } -NS_IMPL_ISUPPORTS_INHERITED3(HTMLTextFieldAccessible, - Accessible, - HyperTextAccessible, +NS_IMPL_ISUPPORTS_INHERITED2(HTMLTextFieldAccessible, + Accessible, nsIAccessibleText, nsIAccessibleEditableText) diff --git a/accessible/src/mac/mozTextAccessible.mm b/accessible/src/mac/mozTextAccessible.mm index 2bb478cc58d..8e6f5a45cc9 100644 --- a/accessible/src/mac/mozTextAccessible.mm +++ b/accessible/src/mac/mozTextAccessible.mm @@ -57,7 +57,7 @@ ToNSString(id aValue) NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; if ((self = [super initWithAccessible:accessible])) { - CallQueryInterface(accessible, &mGeckoTextAccessible); + mGeckoTextAccessible = accessible->AsHyperText(); CallQueryInterface(accessible, &mGeckoEditableTextAccessible); } return self; @@ -312,7 +312,7 @@ ToNSString(id aValue) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - NS_IF_RELEASE(mGeckoTextAccessible); + mGeckoTextAccessible = nsnull; NS_IF_RELEASE(mGeckoEditableTextAccessible); [super expire]; diff --git a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp index a355316e6f7..dc639888b4b 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp @@ -119,9 +119,8 @@ nsXFormsInputAccessible:: { } -NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsInputAccessible, Accessible, - HyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText) diff --git a/accessible/src/xul/XULFormControlAccessible.cpp b/accessible/src/xul/XULFormControlAccessible.cpp index 7d20236dbcc..275a7489fde 100644 --- a/accessible/src/xul/XULFormControlAccessible.cpp +++ b/accessible/src/xul/XULFormControlAccessible.cpp @@ -685,9 +685,8 @@ XULTextFieldAccessible:: { } -NS_IMPL_ISUPPORTS_INHERITED3(XULTextFieldAccessible, +NS_IMPL_ISUPPORTS_INHERITED2(XULTextFieldAccessible, Accessible, - HyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText) From d03805787b72f54f3788116bdfc86a2bade68351 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 19 Jun 2012 19:01:10 -0400 Subject: [PATCH 70/83] Bug 763842 - Fix uninitialised value use in dosprintf(SprintfStateStr*, char const*, std::__va_list). r=njn --- dom/workers/WorkerPrivate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index e6357e9b488..74018455011 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -166,7 +166,7 @@ public: // 64bit address plus '0x' plus null terminator. char address[21]; uint32_t addressSize = - JS_snprintf(address, sizeof(address), "0x%llx", aWorkerPrivate); + JS_snprintf(address, sizeof(address), "%p", aWorkerPrivate); if (addressSize != uint32_t(-1)) { mAddressString.Assign(address, addressSize); } From 0a16a56d7f6ead7c9b2dd6f366741469acc785fd Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Tue, 19 Jun 2012 19:01:10 -0400 Subject: [PATCH 71/83] Bug 764916 - Replace nsDOMClassInfo::ThrowJSException with xpc::Throw. r=mrbkap --- content/xbl/src/nsXBLBinding.cpp | 11 ++-- dom/base/nsDOMClassInfo.cpp | 88 +++---------------------- dom/base/nsDOMClassInfo.h | 2 - dom/base/nsDOMScriptObjectFactory.cpp | 24 ------- dom/base/nsJSEnvironment.cpp | 7 +- dom/base/test/Makefile.in | 1 + dom/base/test/test_nondomexception.html | 28 ++++++++ dom/indexedDB/IDBKeyRange.cpp | 5 +- dom/workers/WorkerPrivate.cpp | 5 +- js/xpconnect/src/XPCLocale.cpp | 9 +-- 10 files changed, 54 insertions(+), 126 deletions(-) create mode 100644 dom/base/test/test_nondomexception.html diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index cc41eeef2b8..047e8738dfd 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -55,7 +55,7 @@ #include "nsNodeUtils.h" // Nasty hack. Maybe we could move some of the classinfo utility methods -// (e.g. WrapNative and ThrowJSException) over to nsContentUtils? +// (e.g. WrapNative) over to nsContentUtils? #include "nsDOMClassInfo.h" #include "nsJSUtils.h" @@ -118,7 +118,7 @@ XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, if (~nodeClass->flags & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) { - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED); + xpc::Throw(cx, NS_ERROR_UNEXPECTED); return JS_FALSE; } @@ -135,7 +135,7 @@ XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, nsCOMPtr content = do_QueryWrappedNative(xpcWrapper); if (!content) { - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED); + xpc::Throw(cx, NS_ERROR_UNEXPECTED); return JS_FALSE; } @@ -160,10 +160,7 @@ XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, protoBinding->DocURI(), &didInstall); if (NS_FAILED(rv)) { - if (!::JS_IsExceptionPending(cx)) { - nsDOMClassInfo::ThrowJSException(cx, rv); - } - + xpc::Throw(cx, rv); return JS_FALSE; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 55fa98ce9bb..15bc0c3cd26 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2142,70 +2142,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx) return NS_OK; } -static nsresult -CreateExceptionFromResult(JSContext *cx, nsresult aResult) -{ - nsCOMPtr xs = - do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID); - if (!xs) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr xm; - nsresult rv = xs->GetCurrentExceptionManager(getter_AddRefs(xm)); - if (NS_FAILED(rv)) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr exception; - rv = xm->GetExceptionFromProvider(aResult, 0, getter_AddRefs(exception)); - if (NS_FAILED(rv) || !exception) { - return NS_ERROR_FAILURE; - } - - JS::Value jv; - nsCOMPtr holder; - rv = WrapNative(cx, ::JS_GetGlobalObject(cx), exception, - &NS_GET_IID(nsIException), false, &jv, - getter_AddRefs(holder)); - if (NS_FAILED(rv) || jv.isNull()) { - return NS_ERROR_FAILURE; - } - - JSAutoEnterCompartment ac; - - if (jv.isObject()) { - if (!ac.enter(cx, &jv.toObject())) { - return NS_ERROR_UNEXPECTED; - } - } - - JS_SetPendingException(cx, jv); - return NS_OK; -} - -// static -nsresult -nsDOMClassInfo::ThrowJSException(JSContext *cx, nsresult aResult) -{ - JSAutoRequest ar(cx); - - if (NS_SUCCEEDED(CreateExceptionFromResult(cx, aResult))) { - return NS_OK; - } - - // XXX This probably wants to be localized, but that can fail in ways that - // are hard to report correctly. - JSString *str = - JS_NewStringCopyZ(cx, "An error occurred throwing an exception"); - if (!str) { - // JS_NewStringCopyZ reported the error for us. - return NS_OK; - } - JS_SetPendingException(cx, STRING_TO_JSVAL(str)); - return NS_OK; -} - // static bool nsDOMClassInfo::ObjectIsNativeWrapper(JSContext* cx, JSObject* obj) @@ -7130,9 +7066,7 @@ LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, { nsresult rv = LocationSetterGuts(cx, obj, vp); if (NS_FAILED(rv)) { - if (!::JS_IsExceptionPending(cx)) { - nsDOMClassInfo::ThrowJSException(cx, rv); - } + xpc::Throw(cx, rv); return JS_FALSE; } @@ -7805,9 +7739,7 @@ GetterShim(JSContext *cx, JSHandleObject obj, JSHandleId /* unused */, jsval *vp { nsresult rv = (*func)(cx, obj, vp); if (NS_FAILED(rv)) { - if (!::JS_IsExceptionPending(cx)) { - nsDOMClassInfo::ThrowJSException(cx, rv); - } + xpc::Throw(cx, rv); return JS_FALSE; } @@ -8972,7 +8904,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JSObject *obj, } if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_FAILURE); + xpc::Throw(cx, NS_ERROR_FAILURE); return JS_FALSE; } @@ -9024,7 +8956,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_, rv = nodeList->GetLength(&length); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return JS_FALSE; } @@ -9040,7 +8972,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_, result = doc->GetDocumentAllResult(str, &cache, &rv); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return JS_FALSE; } @@ -9068,7 +9000,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_, if (result) { rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), result, cache, true, vp); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return JS_FALSE; } @@ -9160,7 +9092,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) // XXX: Should throw NS_ERROR_XPC_NOT_ENOUGH_ARGS for argc < 1, // and create a new NS_ERROR_XPC_TOO_MANY_ARGS for argc > 1? IE // accepts nothing other than one arg. - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_INVALID_ARG); + xpc::Throw(cx, NS_ERROR_INVALID_ARG); return JS_FALSE; } @@ -9254,7 +9186,7 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj nsresult rv; nsCOMPtr doc = do_QueryWrapper(cx, obj, &rv); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return JS_FALSE; } @@ -9332,7 +9264,7 @@ nsHTMLDocumentSH::DocumentAllTagsNewResolve(JSContext *cx, JSHandleObject obj, static_cast(tags), tags, true, &v, getter_AddRefs(holder)); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return JS_FALSE; } @@ -9432,7 +9364,7 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, // Insert the helper into our prototype chain. helper's prototype // is already obj's current prototype. if (!::JS_SetPrototype(cx, obj, helper)) { - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED); + xpc::Throw(cx, NS_ERROR_UNEXPECTED); return NS_ERROR_UNEXPECTED; } diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 53d6f15dc38..bef070ee408 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -122,8 +122,6 @@ public: return new nsDOMClassInfo(aData); } - static nsresult ThrowJSException(JSContext *cx, nsresult aResult); - /* * The following two functions exist because of the way that Xray wrappers * work. In order to allow scriptable helpers to define non-IDL defined but diff --git a/dom/base/nsDOMScriptObjectFactory.cpp b/dom/base/nsDOMScriptObjectFactory.cpp index a29bf5db80a..155f600ca0c 100644 --- a/dom/base/nsDOMScriptObjectFactory.cpp +++ b/dom/base/nsDOMScriptObjectFactory.cpp @@ -55,7 +55,6 @@ nsDOMScriptObjectFactory::nsDOMScriptObjectFactory() xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM); xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_SVG); xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_XPATH); - xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_XPCONNECT); xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_INDEXEDDB); xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_FILEHANDLE); } @@ -141,8 +140,6 @@ nsDOMScriptObjectFactory::Observe(nsISupports *aSubject, NS_ERROR_MODULE_SVG); xs->UnregisterExceptionProvider(gExceptionProvider, NS_ERROR_MODULE_DOM_XPATH); - xs->UnregisterExceptionProvider(gExceptionProvider, - NS_ERROR_MODULE_XPCONNECT); xs->UnregisterExceptionProvider(gExceptionProvider, NS_ERROR_MODULE_DOM_INDEXEDDB); xs->UnregisterExceptionProvider(gExceptionProvider, @@ -156,27 +153,6 @@ nsDOMScriptObjectFactory::Observe(nsISupports *aSubject, return NS_OK; } -static nsresult -CreateXPConnectException(nsresult aResult, nsIException *aDefaultException, - nsIException **_retval) -{ - // See whether we already have a useful XPConnect exception. If we - // do, let's not create one with _less_ information! - nsCOMPtr exception(do_QueryInterface(aDefaultException)); - if (!exception) { - nsresult rv = NS_OK; - exception = do_CreateInstance("@mozilla.org/js/xpc/Exception;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); - - rv = exception->Initialize(nsnull, aResult, nsnull, nsnull, nsnull, - nsnull); - NS_ENSURE_SUCCESS(rv, rv); - } - - exception.forget(_retval); - return NS_OK; -} - NS_IMETHODIMP nsDOMScriptObjectFactory::RegisterDOMClassInfo(const char *aName, nsDOMClassInfoExternalConstructorFnc aConstructorFptr, diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 94d893ea172..60fd53073cf 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -40,7 +40,6 @@ #include "nsXPCOMCIDInternal.h" #include "nsIXULRuntime.h" -#include "nsDOMClassInfo.h" #include "xpcpublic.h" #include "jsdbgapi.h" // for JS_ClearWatchPointsForObject @@ -3700,7 +3699,7 @@ NS_DOMReadStructuredClone(JSContext* cx, } // Don't know what this is. Bail. - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_DATA_CLONE_ERR); + xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR); return nsnull; } @@ -3734,7 +3733,7 @@ NS_DOMWriteStructuredClone(JSContext* cx, } // Don't know what this is. Bail. - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_DATA_CLONE_ERR); + xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR); return JS_FALSE; } @@ -3743,7 +3742,7 @@ NS_DOMStructuredCloneError(JSContext* cx, uint32_t errorid) { // We don't currently support any extensions to structured cloning. - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_DATA_CLONE_ERR); + xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR); } //static diff --git a/dom/base/test/Makefile.in b/dom/base/test/Makefile.in index 8372dd032bb..aa31dd533ff 100644 --- a/dom/base/test/Makefile.in +++ b/dom/base/test/Makefile.in @@ -15,6 +15,7 @@ TEST_FILES = \ test_domrequest.html \ test_gsp-standards.html \ test_gsp-quirks.html \ + test_nondomexception.html \ $(NULL) libs:: $(TEST_FILES) diff --git a/dom/base/test/test_nondomexception.html b/dom/base/test/test_nondomexception.html new file mode 100644 index 00000000000..558db04e7a2 --- /dev/null +++ b/dom/base/test/test_nondomexception.html @@ -0,0 +1,28 @@ + + + + Test for non-DOM module exceptions + + + + +

+ +
+
+
+ + diff --git a/dom/indexedDB/IDBKeyRange.cpp b/dom/indexedDB/IDBKeyRange.cpp index 7adf0328d2c..132837e4379 100644 --- a/dom/indexedDB/IDBKeyRange.cpp +++ b/dom/indexedDB/IDBKeyRange.cpp @@ -10,7 +10,6 @@ #include "nsIXPConnect.h" -#include "nsDOMClassInfo.h" #include "nsJSUtils.h" #include "nsThreadUtils.h" #include "nsContentUtils.h" @@ -90,9 +89,7 @@ ThrowException(JSContext* aCx, nsresult aErrorCode) { NS_ASSERTION(NS_FAILED(aErrorCode), "Not an error code!"); - if (!JS_IsExceptionPending(aCx)) { - nsDOMClassInfo::ThrowJSException(aCx, aErrorCode); - } + xpc::Throw(aCx, aErrorCode); } inline diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 74018455011..8ebb1a86e7e 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -31,7 +31,6 @@ #include "js/MemoryMetrics.h" #include "nsAlgorithm.h" #include "nsContentUtils.h" -#include "nsDOMClassInfo.h" #include "nsDOMJSUtils.h" #include "nsGUIEvent.h" #include "nsJSEnvironment.h" @@ -2479,7 +2478,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent, // First check to make sure the caller has permission to make a // ChromeWorker if they called the ChromeWorker constructor. if (aIsChromeWorker && !isChrome) { - nsDOMClassInfo::ThrowJSException(aCx, NS_ERROR_DOM_SECURITY_ERR); + xpc::Throw(aCx, NS_ERROR_DOM_SECURITY_ERR); return nsnull; } @@ -2508,7 +2507,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent, if (!window || (globalWindow != window && !nsContentUtils::CanCallerAccess(window))) { - nsDOMClassInfo::ThrowJSException(aCx, NS_ERROR_DOM_SECURITY_ERR); + xpc::Throw(aCx, NS_ERROR_DOM_SECURITY_ERR); return nsnull; } diff --git a/js/xpconnect/src/XPCLocale.cpp b/js/xpconnect/src/XPCLocale.cpp index 02c8c5b6a5d..69e2ac0138b 100644 --- a/js/xpconnect/src/XPCLocale.cpp +++ b/js/xpconnect/src/XPCLocale.cpp @@ -11,7 +11,6 @@ #include "jsapi.h" #include "nsCollationCID.h" -#include "nsDOMClassInfo.h" #include "nsJSUtils.h" #include "nsICharsetConverterManager.h" #include "nsIPlatformCharset.h" @@ -20,6 +19,8 @@ #include "nsIServiceManager.h" #include "nsUnicharUtils.h" +#include "xpcpublic.h" + /** * JS locale callbacks implemented by XPCOM modules. This * implementation is "safe" up to the following restrictions @@ -208,7 +209,7 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks } if (!str) { - nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_OUT_OF_MEMORY); + xpc::Throw(cx, NS_ERROR_OUT_OF_MEMORY); return false; } @@ -240,7 +241,7 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks } if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return false; } @@ -256,7 +257,7 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks depStr1, depStr2, &result); if (NS_FAILED(rv)) { - nsDOMClassInfo::ThrowJSException(cx, rv); + xpc::Throw(cx, rv); return false; } From 3c4dbae1e36020719ccfea1f1926d50f0cfbed7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=20Figui=C3=A8re?= Date: Tue, 19 Jun 2012 16:19:09 -0700 Subject: [PATCH 72/83] Bug 761763 - Re-enable a11y on Mac by default. (re-apply patch) r=tbsaunde --- configure.in | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 6cfa8346def..ac5f37b7fa4 100644 --- a/configure.in +++ b/configure.in @@ -4312,15 +4312,7 @@ MOZ_USE_NATIVE_POPUP_WINDOWS= MOZ_ANDROID_HISTORY= MOZ_WEBSMS_BACKEND= MOZ_GRAPHITE=1 - -case "${target}" in -*darwin*) - ACCESSIBILITY= - ;; -*) - ACCESSIBILITY=1 - ;; -esac +ACCESSIBILITY=1 case "$target_os" in mingw*) @@ -5269,10 +5261,9 @@ AC_DEFINE(IBMBIDI) dnl ======================================================== dnl accessibility support on by default on all platforms -dnl except OS X. dnl ======================================================== MOZ_ARG_DISABLE_BOOL(accessibility, -[ --disable-accessibility Disable accessibility support (off by default on OS X)], +[ --disable-accessibility Disable accessibility support], ACCESSIBILITY=, ACCESSIBILITY=1 ) if test "$ACCESSIBILITY"; then From cd89dee94c4483f6b769c325e85e27bd336cea9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=20Figui=C3=A8re?= Date: Tue, 19 Jun 2012 16:19:13 -0700 Subject: [PATCH 73/83] Bug 761589 - Refactor accessibility.force_disabled to work on Mac too and make it tri-state. r=tbsaunde --- .../src/base/nsAccessibilityService.cpp | 27 +++++++++++++++++-- accessible/src/base/nsAccessibilityService.h | 11 ++++++++ .../src/mac/ApplicationAccessibleWrap.mm | 4 ++- modules/libpref/src/init/all.js | 17 +++++++++--- widget/windows/nsWindow.cpp | 25 +++-------------- 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index f80fcc74a24..fd82e4e1161 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -63,6 +63,7 @@ #include "nsTextFragment.h" #include "mozilla/FunctionTimer.h" #include "mozilla/dom/Element.h" +#include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/Util.h" @@ -1819,8 +1820,30 @@ nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent, // Services //////////////////////////////////////////////////////////////////////////////// -mozilla::a11y::FocusManager* -mozilla::a11y::FocusMgr() +namespace mozilla { +namespace a11y { + +FocusManager* +FocusMgr() { return nsAccessibilityService::gAccessibilityService; } + +EPlatformDisabledState +PlatformDisabledState() +{ + static int disabledState = 0xff; + + if (disabledState == 0xff) { + disabledState = Preferences::GetInt("accessibility.force_disabled", 0); + if (disabledState < ePlatformIsForceEnabled) + disabledState = ePlatformIsForceEnabled; + else if (disabledState > ePlatformIsDisabled) + disabledState = ePlatformIsDisabled; + } + + return (EPlatformDisabledState)disabledState; +} + +} +} diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index 02066cdd1ea..922d9fe2f4d 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -26,6 +26,17 @@ namespace a11y { */ FocusManager* FocusMgr(); +enum EPlatformDisabledState { + ePlatformIsForceEnabled = -1, + ePlatformIsEnabled = 0, + ePlatformIsDisabled = 1 +}; + +/** + * Return the platform disabled state. + */ +EPlatformDisabledState PlatformDisabledState(); + #ifdef MOZ_ACCESSIBILITY_ATK /** * Perform initialization that should be done as soon as possible, in order diff --git a/accessible/src/mac/ApplicationAccessibleWrap.mm b/accessible/src/mac/ApplicationAccessibleWrap.mm index 67ac98b6b77..8f990d71ef9 100644 --- a/accessible/src/mac/ApplicationAccessibleWrap.mm +++ b/accessible/src/mac/ApplicationAccessibleWrap.mm @@ -13,12 +13,14 @@ namespace mozilla { namespace a11y { +// Mac a11y whitelisting static bool sA11yShouldBeEnabled = false; bool ShouldA11yBeEnabled() { - return sA11yShouldBeEnabled; + EPlatformDisabledState disabledState = PlatformDisabledState(); + return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled); } } diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 890e6848dfb..f8c334fa8f5 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -253,10 +253,6 @@ pref("accessibility.browsewithcaret_shortcut.enabled", true); pref("accessibility.tabfocus", 7); pref("accessibility.tabfocus_applies_to_xul", false); -// Forcibly disable a11y on win32, even if something attempts -// to enable it. -pref("accessibility.win32.force_disabled", false); - // On OS X, we follow the "Click in the scrollbar to:" system preference // unless this preference was set manually pref("ui.scrollToClick", 0); @@ -266,6 +262,19 @@ pref("ui.scrollToClick", 0); pref("accessibility.tabfocus_applies_to_xul", true); #endif +// We want the ability to forcibly disable platform a11y, because +// some non-a11y-related components attempt to bring it up. See bug +// 538530 for details about Windows; we have a pref here that allows it +// to be disabled for performance and testing resons. +// See bug 761589 for the crossplatform aspect. +// +// This pref is checked only once, and the browser needs a restart to +// pick up any changes. +// +// Values are -1 always on. 1 always off, 0 is auto as some platform perform +// further checks. +pref("accessibility.force_disabled", 0); + pref("focusmanager.testmode", false); pref("accessibility.usetexttospeech", ""); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 94d151d26d6..8258e8647ae 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -137,6 +137,7 @@ #if defined(ACCESSIBILITY) #include "oleidl.h" #include +#include "nsAccessibilityService.h" #include "nsIAccessibleDocument.h" #if !defined(WINABLEAPI) #include @@ -7337,27 +7338,9 @@ bool nsWindow::AssociateDefaultIMC(bool aAssociate) Accessible* nsWindow::GetRootAccessible() { - // We want the ability to forcibly disable a11y on windows, because - // some non-a11y-related components attempt to bring it up. See bug - // 538530 for details; we have a pref here that allows it to be disabled - // for performance and testing resons. - // - // This pref is checked only once, and the browser needs a restart to - // pick up any changes. - static int accForceDisable = -1; - - if (accForceDisable == -1) { - const char* kPrefName = "accessibility.win32.force_disabled"; - if (Preferences::GetBool(kPrefName, false)) { - accForceDisable = 1; - } else { - accForceDisable = 0; - } - } - - // If the pref was true, return null here, disabling a11y. - if (accForceDisable) - return nsnull; + // If the pref was ePlatformIsDisabled, return null here, disabling a11y. + if (a11y::PlatformDisabledState() == a11y::ePlatformIsDisabled) + return nsnull; if (mInDtor || mOnDestroyCalled || mWindowType == eWindowType_invisible) { return nsnull; From 7ff49f22ce7d2de84aabcd6076d87ae675c9b7f6 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Tue, 19 Jun 2012 17:05:28 -0400 Subject: [PATCH 74/83] bug 766304 - ScopedGfxFeatureReporter uses observer service off the main thread r=joe --- gfx/src/gfxCrashReporterUtils.cpp | 70 ++++++++++++++++++------------- gfx/src/gfxCrashReporterUtils.h | 2 + 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index 39bb241d0e1..9f851aadb54 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -17,6 +17,7 @@ #include "nsAutoPtr.h" #include "nsServiceManagerUtils.h" #include "mozilla/Services.h" +#include "nsThreadUtils.h" namespace mozilla { @@ -50,38 +51,51 @@ ObserverToDestroyFeaturesAlreadyReported::Observe(nsISupports* aSubject, return NS_OK; } +class ScopedGfxFeatureReporter::AppNoteWritingRunnable : public nsRunnable { +public: + AppNoteWritingRunnable(char aStatusChar, const char *aFeature) : + mStatusChar(aStatusChar), mFeature(aFeature) {} + virtual nsresult Run() { + // LeakLog made me do this. Basically, I just wanted gFeaturesAlreadyReported to be a static nsTArray, + // and LeakLog was complaining about leaks like this: + // leaked 1 instance of nsTArray_base with size 8 bytes + // leaked 7 instances of nsStringBuffer with size 8 bytes each (56 bytes total) + // So this is a work-around using a pointer, and using a nsIObserver to deallocate on xpcom shutdown. + // Yay for fighting bloat. + if (!gFeaturesAlreadyReported) { + nsCOMPtr observerService = mozilla::services::GetObserverService(); + if (!observerService) + return NS_OK; + nsRefPtr observer = new ObserverToDestroyFeaturesAlreadyReported; + nsresult rv = observerService->AddObserver(observer, "xpcom-shutdown", false); + if (NS_FAILED(rv)) { + observer = nsnull; + return NS_OK; + } + gFeaturesAlreadyReported = new nsTArray; + } + + nsCAutoString featureString; + featureString.AppendPrintf("%s%c ", + mFeature, + mStatusChar); + + if (!gFeaturesAlreadyReported->Contains(featureString)) { + gFeaturesAlreadyReported->AppendElement(featureString); + CrashReporter::AppendAppNotesToCrashReport(featureString); + } + return NS_OK; + } +private: + char mStatusChar; + const char *mFeature; +}; void ScopedGfxFeatureReporter::WriteAppNote(char statusChar) { - // LeakLog made me do this. Basically, I just wanted gFeaturesAlreadyReported to be a static nsTArray, - // and LeakLog was complaining about leaks like this: - // leaked 1 instance of nsTArray_base with size 8 bytes - // leaked 7 instances of nsStringBuffer with size 8 bytes each (56 bytes total) - // So this is a work-around using a pointer, and using a nsIObserver to deallocate on xpcom shutdown. - // Yay for fighting bloat. - if (!gFeaturesAlreadyReported) { - nsCOMPtr observerService = mozilla::services::GetObserverService(); - if (!observerService) - return; - nsRefPtr observer = new ObserverToDestroyFeaturesAlreadyReported; - nsresult rv = observerService->AddObserver(observer, "xpcom-shutdown", false); - if (NS_FAILED(rv)) { - observer = nsnull; - return; - } - gFeaturesAlreadyReported = new nsTArray; - } - - nsCAutoString featureString; - featureString.AppendPrintf("%s%c ", - mFeature, - statusChar); - - if (!gFeaturesAlreadyReported->Contains(featureString)) { - gFeaturesAlreadyReported->AppendElement(featureString); - CrashReporter::AppendAppNotesToCrashReport(featureString); - } + nsCOMPtr r = new AppNoteWritingRunnable(statusChar, mFeature); + NS_DispatchToMainThread(r.get(), NS_DISPATCH_NORMAL); } } // end namespace mozilla diff --git a/gfx/src/gfxCrashReporterUtils.h b/gfx/src/gfxCrashReporterUtils.h index fdb67b2d997..d40ed45f965 100644 --- a/gfx/src/gfxCrashReporterUtils.h +++ b/gfx/src/gfxCrashReporterUtils.h @@ -34,6 +34,8 @@ public: } void SetSuccessful() { mStatusChar = '+'; } + class AppNoteWritingRunnable; + protected: const char *mFeature; char mStatusChar; From 7a73ff8ad0631e4a079816f5404c250441350d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Tue, 19 Jun 2012 16:54:46 -0700 Subject: [PATCH 75/83] Bug 766378 - adds a createArrayIn() call to create JS arrays in a given scope [r=mrbkap] --- js/xpconnect/idl/xpccomponents.idl | 8 ++++++++ js/xpconnect/src/XPCComponents.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/js/xpconnect/idl/xpccomponents.idl b/js/xpconnect/idl/xpccomponents.idl index e1a39c4b946..523b9991ac0 100644 --- a/js/xpconnect/idl/xpccomponents.idl +++ b/js/xpconnect/idl/xpccomponents.idl @@ -285,6 +285,14 @@ interface nsIXPCComponents_Utils : nsISupports [implicit_jscontext] jsval createObjectIn(in jsval vobj); + /* + * To be called from JS only. + * + * Returns an array created in |vobj|'s compartment. + */ + [implicit_jscontext] + jsval createArrayIn(in jsval vobj); + /* * To be called from JS only. * diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 8dc925f15a4..1093607fdb7 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -4129,6 +4129,35 @@ nsXPCComponents_Utils::CreateObjectIn(const jsval &vobj, JSContext *cx, jsval *r return NS_OK; } +/* jsval createObjectIn(in jsval vobj); */ +NS_IMETHODIMP +nsXPCComponents_Utils::CreateArrayIn(const jsval &vobj, JSContext *cx, jsval *rval) +{ + if (!cx) + return NS_ERROR_FAILURE; + + // first argument must be an object + if (JSVAL_IS_PRIMITIVE(vobj)) + return NS_ERROR_XPC_BAD_CONVERT_JS; + + JSObject *scope = js::UnwrapObject(JSVAL_TO_OBJECT(vobj)); + JSObject *obj; + { + JSAutoEnterCompartment ac; + if (!ac.enter(cx, scope)) + return NS_ERROR_FAILURE; + + obj = JS_NewArrayObject(cx, 0, NULL); + if (!obj) + return NS_ERROR_FAILURE; + } + + if (!JS_WrapObject(cx, &obj)) + return NS_ERROR_FAILURE; + *rval = OBJECT_TO_JSVAL(obj); + return NS_OK; +} + JSBool FunctionWrapper(JSContext *cx, unsigned argc, jsval *vp) { From 2bfa703f32188403d2eb26e26b153f80af2786ed Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Tue, 19 Jun 2012 17:10:14 -0700 Subject: [PATCH 76/83] Bug 766341 - Fix debug warnings in nsDocShell.cpp r=smaug --- docshell/base/nsDocShell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 6950ce233bf..91649a2d126 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -786,7 +786,7 @@ nsDocShell::nsDocShell(): // We're counting the number of |nsDocShells| to help find leaks ++gNumberOfDocShells; if (!PR_GetEnv("MOZ_QUIET")) { - printf("++DOCSHELL %p == %ld [id = %ld]\n", (void*) this, + printf("++DOCSHELL %p == %ld [id = %llu]\n", (void*) this, gNumberOfDocShells, mHistoryID); } #endif @@ -815,7 +815,7 @@ nsDocShell::~nsDocShell() // We're counting the number of |nsDocShells| to help find leaks --gNumberOfDocShells; if (!PR_GetEnv("MOZ_QUIET")) { - printf("--DOCSHELL %p == %ld [id = %ld]\n", (void*) this, + printf("--DOCSHELL %p == %ld [id = %llu]\n", (void*) this, gNumberOfDocShells, mHistoryID); } #endif From 3fc3d78ba69f54665bf9be1f498d522a5643cb53 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Tue, 19 Jun 2012 17:11:38 -0700 Subject: [PATCH 77/83] bug 766304 - ScopedGfxFeatureReporter uses observer service off the main thread, follow up to fix windows builders r=bustage --- gfx/src/gfxCrashReporterUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index 9f851aadb54..20903dea652 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -55,7 +55,7 @@ class ScopedGfxFeatureReporter::AppNoteWritingRunnable : public nsRunnable { public: AppNoteWritingRunnable(char aStatusChar, const char *aFeature) : mStatusChar(aStatusChar), mFeature(aFeature) {} - virtual nsresult Run() { + NS_IMETHOD Run() { // LeakLog made me do this. Basically, I just wanted gFeaturesAlreadyReported to be a static nsTArray, // and LeakLog was complaining about leaks like this: // leaked 1 instance of nsTArray_base with size 8 bytes From 8fd90f055f9aa1f216701e62ed33469046bb43cf Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 18 Jun 2012 16:54:55 -0700 Subject: [PATCH 78/83] Bug 765976 - Simplify CompileFunctionBody's control flow. r=sfink. --HG-- extra : rebase_source : 4d5e88fdae064f5a68c0938ee5cbc6e619d02c85 --- js/src/frontend/BytecodeCompiler.cpp | 98 ++++++++++++++-------------- js/src/frontend/BytecodeCompiler.h | 12 ++-- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index ba086815212..ed8c3fb8446 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -241,10 +241,8 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF return script; } -/* - * Compile a JS function body, which might appear as the value of an event - * handler attribute in an HTML tag. - */ +// Compile a JS function body, which might appear as the value of an event +// handler attribute in an HTML tag, or in a Function() constructor. bool frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun, JSPrincipals *principals, JSPrincipals *originPrincipals, @@ -284,34 +282,32 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun, /* FIXME: make Function format the source for a function definition. */ ParseNode *fn = FunctionNode::create(PNK_NAME, &parser); - if (fn) { - fn->pn_body = NULL; - fn->pn_cookie.makeFree(); + if (!fn) + return false; - ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &parser); - if (!argsbody) + fn->pn_body = NULL; + fn->pn_cookie.makeFree(); + + ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &parser); + if (!argsbody) + return false; + argsbody->setOp(JSOP_NOP); + argsbody->makeEmpty(); + fn->pn_body = argsbody; + + unsigned nargs = fun->nargs; + if (nargs) { + /* + * NB: do not use AutoLocalNameArray because it will release space + * allocated from cx->tempLifoAlloc by DefineArg. + */ + BindingNames names(cx); + if (!funsc.bindings.getLocalNameArray(cx, &names)) return false; - argsbody->setOp(JSOP_NOP); - argsbody->makeEmpty(); - fn->pn_body = argsbody; - unsigned nargs = fun->nargs; - if (nargs) { - /* - * NB: do not use AutoLocalNameArray because it will release space - * allocated from cx->tempLifoAlloc by DefineArg. - */ - BindingNames names(cx); - if (!funsc.bindings.getLocalNameArray(cx, &names)) { - fn = NULL; - } else { - for (unsigned i = 0; i < nargs; i++) { - if (!DefineArg(fn, names[i].maybeAtom, i, &parser)) { - fn = NULL; - break; - } - } - } + for (unsigned i = 0; i < nargs; i++) { + if (!DefineArg(fn, names[i].maybeAtom, i, &parser)) + return false; } } @@ -320,28 +316,30 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun, * functions, and generate code for this function, including a stop opcode * at the end. */ - ParseNode *pn = fn ? parser.functionBody(Parser::StatementListBody) : NULL; - if (pn) { - if (!parser.tokenStream.matchToken(TOK_EOF)) { - parser.reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR); - pn = NULL; - } else if (!FoldConstants(cx, pn, &parser)) { - /* FoldConstants reported the error already. */ - pn = NULL; - } else if (!AnalyzeFunctions(&parser)) { - pn = NULL; - } else { - if (fn->pn_body) { - JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); - fn->pn_body->append(pn); - fn->pn_body->pn_pos = pn->pn_pos; - pn = fn->pn_body; - } + ParseNode *pn = parser.functionBody(Parser::StatementListBody); + if (!pn) + return false; - if (!EmitFunctionScript(cx, &funbce, pn)) - pn = NULL; - } + if (!parser.tokenStream.matchToken(TOK_EOF)) { + parser.reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR); + return false; } - return pn != NULL; + if (!FoldConstants(cx, pn, &parser)) + return false; + + if (!AnalyzeFunctions(&parser)) + return false; + + if (fn->pn_body) { + JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); + fn->pn_body->append(pn); + fn->pn_body->pn_pos = pn->pn_pos; + pn = fn->pn_body; + } + + if (!EmitFunctionScript(cx, &funbce, pn)) + return false; + + return true; } diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h index 305df947a0e..cff8914403d 100644 --- a/js/src/frontend/BytecodeCompiler.h +++ b/js/src/frontend/BytecodeCompiler.h @@ -13,12 +13,6 @@ namespace js { namespace frontend { -bool -CompileFunctionBody(JSContext *cx, JSFunction *fun, - JSPrincipals *principals, JSPrincipals *originPrincipals, - Bindings *bindings, const jschar *chars, size_t length, - const char *filename, unsigned lineno, JSVersion version); - JSScript * CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerFrame, JSPrincipals *principals, JSPrincipals *originPrincipals, @@ -27,6 +21,12 @@ CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerFrame, const char *filename, unsigned lineno, JSVersion version, JSString *source = NULL, unsigned staticLevel = 0); +bool +CompileFunctionBody(JSContext *cx, JSFunction *fun, + JSPrincipals *principals, JSPrincipals *originPrincipals, + Bindings *bindings, const jschar *chars, size_t length, + const char *filename, unsigned lineno, JSVersion version); + } /* namespace frontend */ } /* namespace js */ From a535638b4bfae0f4bc2e5feacca7dd5b8bd65fc7 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Tue, 19 Jun 2012 20:38:44 -0400 Subject: [PATCH 79/83] bug 764260 convert telemetry::SPDY_VERSION and DNS_LOOKUP_METHOD to be enumerations r=bsmith --- netwerk/dns/nsHostResolver.cpp | 16 ++++++++-------- netwerk/protocol/http/ASpdySession.cpp | 2 +- .../components/telemetry/TelemetryHistograms.h | 6 ++++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index a1470c4a552..6aa18041f3e 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -543,7 +543,7 @@ nsHostResolver::ResolveHost(const char *host, LOG(("using cached record\n")); // put reference to host record on stack... result = he->rec; - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, METHOD_HIT); + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_HIT); // For entries that are in the grace period, or all cached // negative entries, use the cache but start a new lookup in @@ -557,13 +557,13 @@ nsHostResolver::ResolveHost(const char *host, if (!he->rec->negative) { // negative entries are constantly being refreshed, only // track positive grace period induced renewals - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_RENEWAL); } } if (he->rec->negative) { - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_NEGATIVE_HIT); status = NS_ERROR_UNKNOWN_HOST; } @@ -571,7 +571,7 @@ nsHostResolver::ResolveHost(const char *host, // if the host name is an IP address literal and has been parsed, // go ahead and use it. else if (he->rec->addr) { - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_LITERAL); result = he->rec; } @@ -587,14 +587,14 @@ nsHostResolver::ResolveHost(const char *host, else memcpy(he->rec->addr, &tempAddr, sizeof(PRNetAddr)); // put reference to host record on stack... - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_LITERAL); result = he->rec; } else if (mPendingCount >= MAX_NON_PRIORITY_REQUESTS && !IsHighPriority(flags) && !he->rec->resolving) { - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_OVERFLOW); // This is a lower priority request and we are swamped, so refuse it. rv = NS_ERROR_DNS_LOOKUP_QUEUE_FULL; @@ -607,7 +607,7 @@ nsHostResolver::ResolveHost(const char *host, if (!he->rec->resolving) { he->rec->flags = flags; rv = IssueLookup(he->rec); - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_NETWORK_FIRST); if (NS_FAILED(rv)) PR_REMOVE_AND_INIT_LINK(callback); @@ -615,7 +615,7 @@ nsHostResolver::ResolveHost(const char *host, LOG(("dns lookup blocking pending getaddrinfo query")); } else if (he->rec->onQueue) { - Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD, + Telemetry::Accumulate(Telemetry::DNS_LOOKUP_METHOD2, METHOD_NETWORK_SHARED); // Consider the case where we are on a pending queue of diff --git a/netwerk/protocol/http/ASpdySession.cpp b/netwerk/protocol/http/ASpdySession.cpp index 2f211646d27..d5b03e3f256 100644 --- a/netwerk/protocol/http/ASpdySession.cpp +++ b/netwerk/protocol/http/ASpdySession.cpp @@ -33,7 +33,7 @@ ASpdySession::NewSpdySession(PRUint32 version, // from a list provided in the SERVER HELLO filtered by our acceptable // versions, so there is no risk of the server ignoring our prefs. - Telemetry::Accumulate(Telemetry::SPDY_VERSION, version); + Telemetry::Accumulate(Telemetry::SPDY_VERSION2, version); if (version == SpdyInformation::SPDY_VERSION_2) return new SpdySession2(aTransaction, aTransport, aPriority); diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index 9fb7c67da32..e5aeeb621b1 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -170,7 +170,8 @@ HISTOGRAM(HTTP_KBREAD_PER_CONN, 1, 3000, 50, EXPONENTIAL, "HTTP: KB read per con HTTP_HISTOGRAMS(PAGE, "page: ") HTTP_HISTOGRAMS(SUB, "subitem: ") -HISTOGRAM(SPDY_VERSION, 1, 16, 16, LINEAR, "SPDY: Protocol Version Used") +// SPDY_VERSION was renamed to SPDY_VERSION2 as the old version did not use enumerated values +HISTOGRAM_ENUMERATED_VALUES(SPDY_VERSION2, 48, "SPDY: Protocol Version Used") HISTOGRAM(SPDY_PARALLEL_STREAMS, 1, 1000, 50, EXPONENTIAL, "SPDY: Streams concurrent active per connection") HISTOGRAM(SPDY_REQUEST_PER_CONN, 1, 1000, 50, EXPONENTIAL, "SPDY: Streams created per connection") HISTOGRAM(SPDY_SERVER_INITIATED_STREAMS, 1, 100000, 250, EXPONENTIAL, "SPDY: Streams recevied per connection") @@ -210,7 +211,8 @@ HISTOGRAM(CACHE_LM_INCONSISTENT, 0, 1, 2, BOOLEAN, "Cache discovered inconsiste HISTOGRAM(CACHE_SERVICE_LOCK_WAIT, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock (ms)") HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock on the main thread (ms)") -HISTOGRAM(DNS_LOOKUP_METHOD, 1, 7, 7, LINEAR, "DNS Lookup Type (hit, renewal, negative-hit, literal, overflow, network-first, network-shared)") +// DNS_LOOKUP_METHOD was renamed to DNS_LOOKUP_METHOD2 as the old version did not use enumerated values +HISTOGRAM_ENUMERATED_VALUES(DNS_LOOKUP_METHOD2, 16, "DNS Lookup Type (hit, renewal, negative-hit, literal, overflow, network-first, network-shared)") HISTOGRAM(DNS_CLEANUP_AGE, 1, 1440, 50, EXPONENTIAL, "DNS Cache Entry Age at Removal Time (minutes)") HISTOGRAM(DNS_LOOKUP_TIME, 1, 60000, 50, EXPONENTIAL, "Time for a successful DNS OS resolution (msec)") HISTOGRAM(DNS_RENEWAL_TIME, 1, 60000, 50, EXPONENTIAL, "Time for a renewed DNS OS resolution (msec)") From bfa7cae37bcf53159df5166690480c7e6a90d12c Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Tue, 19 Jun 2012 18:50:39 -0700 Subject: [PATCH 80/83] Bug 765839 - 'Enable IndexedDB OOP test suite'. r=khuey. --HG-- extra : transplant_source : %3Bb4%A4%99fC%9Cg%86%9B%1F3%C6%0F%01T%1C%3C%AE --- dom/file/FileHandle.h | 1 + dom/indexedDB/DatabaseInfo.cpp | 11 + dom/indexedDB/DatabaseInfo.h | 1 + dom/indexedDB/FileInfo.cpp | 1 - dom/indexedDB/FileInfo.h | 2 + dom/indexedDB/IDBDatabase.cpp | 4 + dom/indexedDB/IDBFileHandle.cpp | 3 +- dom/indexedDB/IDBObjectStore.h | 1 + dom/indexedDB/IDBTransaction.cpp | 1 + dom/indexedDB/IndexedDatabaseManager.cpp | 399 ++++++++++-------- dom/indexedDB/IndexedDatabaseManager.h | 98 ++++- dom/indexedDB/OpenDatabaseHelper.cpp | 11 +- dom/indexedDB/ipc/IndexedDBChild.cpp | 111 +++-- dom/indexedDB/ipc/IndexedDBChild.h | 3 + dom/indexedDB/ipc/Makefile.in | 16 +- dom/indexedDB/ipc/test_ipc.html | 31 +- dom/indexedDB/test/Makefile.in | 1 - dom/indexedDB/test/helpers.js | 35 +- .../test/test_writer_starvation.html | 93 +++- dom/indexedDB/test/unit/Makefile.in | 2 - .../test/unit/test_deleteDatabase.js | 4 +- .../test/unit/test_setVersion_abort.js | 22 +- .../test/unit/test_setVersion_exclusion.js | 25 +- .../test/unit/test_writer_starvation.js | 90 ---- dom/indexedDB/test/unit/xpcshell.ini | 3 +- 25 files changed, 605 insertions(+), 364 deletions(-) delete mode 100644 dom/indexedDB/test/unit/test_writer_starvation.js diff --git a/dom/file/FileHandle.h b/dom/file/FileHandle.h index 7da45ef55aa..d32b85309a6 100644 --- a/dom/file/FileHandle.h +++ b/dom/file/FileHandle.h @@ -11,6 +11,7 @@ #include "nsIDOMFileHandle.h" #include "nsIFile.h" +#include "nsIFileStorage.h" #include "nsDOMEventTargetHelper.h" diff --git a/dom/indexedDB/DatabaseInfo.cpp b/dom/indexedDB/DatabaseInfo.cpp index 2a4d4f4f708..fcf522587a4 100644 --- a/dom/indexedDB/DatabaseInfo.cpp +++ b/dom/indexedDB/DatabaseInfo.cpp @@ -105,6 +105,16 @@ ObjectStoreInfo::~ObjectStoreInfo() } IndexUpdateInfo::IndexUpdateInfo() +: indexId(0), + indexUnique(false) +{ + MOZ_COUNT_CTOR(IndexUpdateInfo); +} + +IndexUpdateInfo::IndexUpdateInfo(const IndexUpdateInfo& aOther) +: indexId(aOther.indexId), + indexUnique(aOther.indexUnique), + value(aOther.value) { MOZ_COUNT_CTOR(IndexUpdateInfo); } @@ -113,6 +123,7 @@ IndexUpdateInfo::~IndexUpdateInfo() { MOZ_COUNT_DTOR(IndexUpdateInfo); } + #endif /* NS_BUILD_REFCNT_LOGGING */ // static diff --git a/dom/indexedDB/DatabaseInfo.h b/dom/indexedDB/DatabaseInfo.h index eac71e4b637..0735d1553de 100644 --- a/dom/indexedDB/DatabaseInfo.h +++ b/dom/indexedDB/DatabaseInfo.h @@ -173,6 +173,7 @@ struct IndexUpdateInfo { #ifdef NS_BUILD_REFCNT_LOGGING IndexUpdateInfo(); + IndexUpdateInfo(const IndexUpdateInfo& aOther); ~IndexUpdateInfo(); #endif diff --git a/dom/indexedDB/FileInfo.cpp b/dom/indexedDB/FileInfo.cpp index f329c184670..4791a79ed1a 100644 --- a/dom/indexedDB/FileInfo.cpp +++ b/dom/indexedDB/FileInfo.cpp @@ -4,7 +4,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 "IndexedDatabaseManager.h" #include "FileInfo.h" USING_INDEXEDDB_NAMESPACE diff --git a/dom/indexedDB/FileInfo.h b/dom/indexedDB/FileInfo.h index 380ddf85b75..4d05382fe5c 100644 --- a/dom/indexedDB/FileInfo.h +++ b/dom/indexedDB/FileInfo.h @@ -8,8 +8,10 @@ #define mozilla_dom_indexeddb_fileinfo_h__ #include "IndexedDatabase.h" + #include "nsAtomicRefcnt.h" #include "nsThreadUtils.h" + #include "FileManager.h" #include "IndexedDatabaseManager.h" diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index d0e7616d45e..028b53d428e 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -243,6 +243,10 @@ IDBDatabase::Invalidate() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); + if (IsInvalidated()) { + return; + } + // Make sure we're closed too. Close(); diff --git a/dom/indexedDB/IDBFileHandle.cpp b/dom/indexedDB/IDBFileHandle.cpp index 7638ebe4975..530d8e45b18 100644 --- a/dom/indexedDB/IDBFileHandle.cpp +++ b/dom/indexedDB/IDBFileHandle.cpp @@ -8,10 +8,11 @@ #include "nsIStandardFileStream.h" +#include "mozilla/dom/file/File.h" #include "nsDOMClassInfoID.h" #include "FileStream.h" -#include "mozilla/dom/file/File.h" +#include "IDBDatabase.h" USING_INDEXEDDB_NAMESPACE diff --git a/dom/indexedDB/IDBObjectStore.h b/dom/indexedDB/IDBObjectStore.h index e3e8a46eecf..5c9684d3f62 100644 --- a/dom/indexedDB/IDBObjectStore.h +++ b/dom/indexedDB/IDBObjectStore.h @@ -24,6 +24,7 @@ BEGIN_INDEXEDDB_NAMESPACE class AsyncConnectionHelper; class IDBCursor; class IDBKeyRange; +class IDBRequest; class IndexedDBObjectStoreChild; class IndexedDBObjectStoreParent; class Key; diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index f074b63725e..c6261030551 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -250,6 +250,7 @@ IDBTransaction::CommitOrRollback() NS_ASSERTION(mActorChild, "Must have an actor!"); mActorChild->SendAllRequestsFinished(); + return NS_OK; } diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 188344f8252..aa5ce8cea66 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -7,6 +7,7 @@ #include "IndexedDatabaseManager.h" #include "DatabaseInfo.h" +#include "nsIAtom.h" #include "nsIDOMScriptObjectFactory.h" #include "nsIFile.h" #include "nsIFileStorage.h" @@ -437,33 +438,25 @@ IndexedDatabaseManager::AllowNextSynchronizedOp(const nsACString& aOrigin, } nsresult -IndexedDatabaseManager::AcquireExclusiveAccess(const nsACString& aOrigin, - IDBDatabase* aDatabase, - AsyncConnectionHelper* aHelper, - WaitingOnDatabasesCallback aCallback, - void* aClosure) +IndexedDatabaseManager::AcquireExclusiveAccess( + const nsACString& aOrigin, + IDBDatabase* aDatabase, + AsyncConnectionHelper* aHelper, + nsIRunnable* aRunnable, + WaitingOnDatabasesCallback aCallback, + void* aClosure) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - NS_ASSERTION(aHelper, "Why are you talking to me?"); + NS_ASSERTION(!aDatabase || aHelper, "Need a helper with a database!"); + NS_ASSERTION(aDatabase || aRunnable, "Need a runnable without a database!"); // Find the right SynchronizedOp. - SynchronizedOp* op = nsnull; - PRUint32 count = mSynchronizedOps.Length(); - for (PRUint32 index = 0; index < count; index++) { - SynchronizedOp* currentop = mSynchronizedOps[index].get(); - if (currentop->mOrigin.Equals(aOrigin)) { - if (!currentop->mId || - (aDatabase && currentop->mId == aDatabase->Id())) { - // We've found the right one. - NS_ASSERTION(!currentop->mHelper, - "SynchronizedOp already has a helper?!?"); - op = currentop; - break; - } - } - } + SynchronizedOp* op = + FindSynchronizedOp(aOrigin, aDatabase ? aDatabase->Id() : nsnull); NS_ASSERTION(op, "We didn't find a SynchronizedOp?"); + NS_ASSERTION(!op->mHelper, "SynchronizedOp already has a helper?!?"); + NS_ASSERTION(!op->mRunnable, "SynchronizedOp already has a runnable?!?"); nsTArray* array; mLiveDatabases.Get(aOrigin, &array); @@ -474,33 +467,50 @@ IndexedDatabaseManager::AcquireExclusiveAccess(const nsACString& aOrigin, nsTArray > liveDatabases; if (array) { - PRUint32 count = array->Length(); - for (PRUint32 index = 0; index < count; index++) { - IDBDatabase*& database = array->ElementAt(index); - if (!database->IsClosed() && - (!aDatabase || - (aDatabase && + if (aDatabase) { + // Grab all databases that are not yet closed but whose database id match + // the one we're looking for. + for (PRUint32 index = 0; index < array->Length(); index++) { + IDBDatabase*& database = array->ElementAt(index); + if (!database->IsClosed() && database != aDatabase && - database->Id() == aDatabase->Id()))) { - liveDatabases.AppendElement(database); + database->Id() == aDatabase->Id()) { + liveDatabases.AppendElement(database); + } } } + else { + // We want *all* databases, even those that are closed, if we're going to + // clear the origin. + liveDatabases.AppendElements(*array); + } } - if (liveDatabases.IsEmpty()) { - IndexedDatabaseManager::DispatchHelper(aHelper); - return NS_OK; + op->mHelper = aHelper; + op->mRunnable = aRunnable; + + if (!liveDatabases.IsEmpty()) { + NS_ASSERTION(op->mDatabases.IsEmpty(), + "How do we already have databases here?"); + op->mDatabases.AppendElements(liveDatabases); + + // Give our callback the databases so it can decide what to do with them. + aCallback(liveDatabases, aClosure); + + NS_ASSERTION(liveDatabases.IsEmpty(), + "Should have done something with the array!"); + + if (aDatabase) { + // Wait for those databases to close. + return NS_OK; + } } - NS_ASSERTION(op->mDatabases.IsEmpty(), "How do we already have databases here?"); - op->mDatabases.AppendElements(liveDatabases); - op->mHelper = aHelper; + // If we're trying to open a database and nothing blocks it, or if we're + // clearing an origin, then go ahead and schedule the op. + nsresult rv = RunSynchronizedOp(aDatabase, op); + NS_ENSURE_SUCCESS(rv, rv); - // Give our callback the databases so it can decide what to do with them. - aCallback(liveDatabases, aClosure); - - NS_ASSERTION(liveDatabases.IsEmpty(), - "Should have done something with the array!"); return NS_OK; } @@ -585,59 +595,23 @@ IndexedDatabaseManager::OnDatabaseClosed(IDBDatabase* aDatabase) // Check through the list of SynchronizedOps to see if any are waiting for // this database to close before proceeding. - PRUint32 count = mSynchronizedOps.Length(); - for (PRUint32 index = 0; index < count; index++) { - nsAutoPtr& op = mSynchronizedOps[index]; - - if (op->mOrigin == aDatabase->Origin() && - (op->mId == aDatabase->Id() || !op->mId)) { - // This database is in the scope of this SynchronizedOp. Remove it - // from the list if necessary. - if (op->mDatabases.RemoveElement(aDatabase)) { - // Now set up the helper if there are no more live databases. - NS_ASSERTION(op->mHelper, "How did we get rid of the helper before " - "removing the last database?"); - if (op->mDatabases.IsEmpty()) { - // At this point, all databases are closed, so no new transactions - // can be started. There may, however, still be outstanding - // transactions that have not completed. We need to wait for those - // before we dispatch the helper. - - FileService* service = FileService::Get(); - TransactionThreadPool* pool = TransactionThreadPool::Get(); - - PRUint32 count = !!service + !!pool; - - nsRefPtr runnable = - new WaitForTransactionsToFinishRunnable(op, - NS_MAX(count, 1)); - - if (!count) { - runnable->Run(); - } - else { - // Use the WaitForTransactionsToxFinishRunnable as the callback. - - if (service) { - nsTArray > array; - array.AppendElement(aDatabase); - - if (!service->WaitForAllStoragesToComplete(array, runnable)) { - NS_WARNING("Failed to wait for storages to complete!"); - } - } - - if (pool) { - nsTArray > array; - array.AppendElement(aDatabase); - - if (!pool->WaitForAllDatabasesToComplete(array, runnable)) { - NS_WARNING("Failed to wait for databases to complete!"); - } - } - } + SynchronizedOp* op = FindSynchronizedOp(aDatabase->Origin(), aDatabase->Id()); + if (op) { + // This database is in the scope of this SynchronizedOp. Remove it + // from the list if necessary. + if (op->mDatabases.RemoveElement(aDatabase)) { + // Now set up the helper if there are no more live databases. + NS_ASSERTION(op->mHelper || op->mRunnable, + "How did we get rid of the helper/runnable before " + "removing the last database?"); + if (op->mDatabases.IsEmpty()) { + // At this point, all databases are closed, so no new transactions + // can be started. There may, however, still be outstanding + // transactions that have not completed. We need to wait for those + // before we dispatch the helper. + if (NS_FAILED(RunSynchronizedOp(aDatabase, op))) { + NS_WARNING("Failed to run synchronized op!"); } - break; } } } @@ -1101,41 +1075,62 @@ IndexedDatabaseManager::AsyncDeleteFile(FileManager* aFileManager, // static nsresult -IndexedDatabaseManager::DispatchHelper(AsyncConnectionHelper* aHelper) +IndexedDatabaseManager::RunSynchronizedOp(IDBDatabase* aDatabase, + SynchronizedOp* aOp) { - nsresult rv = NS_OK; + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); + NS_ASSERTION(aOp, "Null pointer!"); + NS_ASSERTION(!aDatabase || aOp->mHelper, "No helper on this op!"); + NS_ASSERTION(aDatabase || aOp->mRunnable, "No runnable on this op!"); + NS_ASSERTION(!aDatabase || aOp->mDatabases.IsEmpty(), + "This op isn't ready to run!"); - // If the helper has a transaction, dispatch it to the transaction - // threadpool. - if (aHelper->HasTransaction()) { - rv = aHelper->DispatchToTransactionPool(); + FileService* service = FileService::Get(); + TransactionThreadPool* pool = TransactionThreadPool::Get(); + + nsTArray > databases; + if (aDatabase) { + if (service || pool) { + databases.AppendElement(aDatabase); + } } else { - // Otherwise, dispatch it to the IO thread. - IndexedDatabaseManager* manager = IndexedDatabaseManager::Get(); - NS_ASSERTION(manager, "We should definitely have a manager here"); - - rv = aHelper->Dispatch(manager->IOThread()); + aOp->mDatabases.SwapElements(databases); } - NS_ENSURE_SUCCESS(rv, rv); - return rv; -} + PRUint32 waitCount = service && pool && !databases.IsEmpty() ? 2 : 1; -bool -IndexedDatabaseManager::IsClearOriginPending(const nsACString& origin) -{ - // Iterate through our SynchronizedOps to see if we have an entry that matches - // this origin and has no id. - PRUint32 count = mSynchronizedOps.Length(); - for (PRUint32 index = 0; index < count; index++) { - nsAutoPtr& op = mSynchronizedOps[index]; - if (op->mOrigin.Equals(origin) && !op->mId) { - return true; + nsRefPtr runnable = + new WaitForTransactionsToFinishRunnable(aOp, waitCount); + + // There's no point in delaying if we don't yet have a transaction thread pool + // or a file service. Also, if we're not waiting on any databases then we can + // also run immediately. + if (!(service || pool) || databases.IsEmpty()) { + nsresult rv = runnable->Run(); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; + } + + // Ask each service to call us back when they're done with this database. + if (service) { + // Have to copy here in case the pool needs a list too. + nsTArray > array; + array.AppendElements(databases); + + if (!service->WaitForAllStoragesToComplete(array, runnable)) { + NS_WARNING("Failed to wait for storages to complete!"); + return NS_ERROR_FAILURE; } } - return false; + if (pool && !pool->WaitForAllDatabasesToComplete(databases, runnable)) { + NS_WARNING("Failed to wait for databases to complete!"); + return NS_ERROR_FAILURE; + } + + return NS_OK; } NS_IMPL_ISUPPORTS2(IndexedDatabaseManager, nsIIndexedDatabaseManager, @@ -1237,33 +1232,31 @@ IndexedDatabaseManager::ClearDatabasesForURI(nsIURI* aURI) } // Queue up the origin clear runnable. - nsRefPtr runnable = - new OriginClearRunnable(origin, mIOThread); + nsRefPtr runnable = new OriginClearRunnable(origin); rv = WaitForOpenAllowed(origin, nsnull, runnable); NS_ENSURE_SUCCESS(rv, rv); - // Give the runnable some help by invalidating any databases in the way. - // We need to grab references to any live databases here to prevent them from + runnable->AdvanceState(); + + // Give the runnable some help by invalidating any databases in the way. We + // need to grab references to any live databases here to prevent them from // dying while we invalidate them. nsTArray > liveDatabases; - // Grab all live databases for this origin. nsTArray* array; if (mLiveDatabases.Get(origin, &array)) { liveDatabases.AppendElements(*array); } - // Invalidate all the live databases first. for (PRUint32 index = 0; index < liveDatabases.Length(); index++) { liveDatabases[index]->Invalidate(); } - + DatabaseInfo::RemoveAllForOrigin(origin); // After everything has been invalidated the helper should be dispatched to // the end of the event queue. - return NS_OK; } @@ -1374,60 +1367,105 @@ IndexedDatabaseManager::Observe(nsISupports* aSubject, NS_IMPL_THREADSAFE_ISUPPORTS1(IndexedDatabaseManager::OriginClearRunnable, nsIRunnable) +// static +void +IndexedDatabaseManager:: +OriginClearRunnable::InvalidateOpenedDatabases( + nsTArray >& aDatabases, + void* aClosure) +{ + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); + + OriginClearRunnable* self = static_cast(aClosure); + + nsTArray > databases; + databases.SwapElements(aDatabases); + + for (PRUint32 index = 0; index < databases.Length(); index++) { + databases[index]->Invalidate(); + } + + DatabaseInfo::RemoveAllForOrigin(self->mOrigin); +} + NS_IMETHODIMP IndexedDatabaseManager::OriginClearRunnable::Run() { IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get(); NS_ASSERTION(mgr, "This should never fail!"); - if (NS_IsMainThread()) { - // On the first time on the main thread we dispatch to the IO thread. - if (mFirstCallback) { - NS_ASSERTION(mThread, "Should have a thread here!"); + switch (mCallbackState) { + case Pending: { + NS_NOTREACHED("Should never get here without being dispatched!"); + return NS_ERROR_UNEXPECTED; + } - mFirstCallback = false; + case OpenAllowed: { + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - nsCOMPtr thread; - mThread.swap(thread); + AdvanceState(); - // Dispatch to the IO thread. - if (NS_FAILED(thread->Dispatch(this, NS_DISPATCH_NORMAL))) { - NS_WARNING("Failed to dispatch to IO thread!"); + // Now we have to wait until the thread pool is done with all of the + // databases we care about. + nsresult rv = + mgr->AcquireExclusiveAccess(mOrigin, this, InvalidateOpenedDatabases, + this); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; + } + + case IO: { + NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!"); + + AdvanceState(); + + // Remove the directory that contains all our databases. + nsCOMPtr directory; + nsresult rv = + mgr->GetDirectoryForOrigin(mOrigin, getter_AddRefs(directory)); + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get directory to remove!"); + + if (NS_SUCCEEDED(rv)) { + bool exists; + rv = directory->Exists(&exists); + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), + "Failed to check that the directory exists!"); + + if (NS_SUCCEEDED(rv) && exists && NS_FAILED(directory->Remove(true))) { + // This should never fail if we've closed all database connections + // correctly... + NS_ERROR("Failed to remove directory!"); + } + } + + // Now dispatch back to the main thread. + if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) { + NS_WARNING("Failed to dispatch to main thread!"); return NS_ERROR_FAILURE; } return NS_OK; } - NS_ASSERTION(!mThread, "Should have been cleared already!"); + case Complete: { + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - mgr->InvalidateFileManagersForOrigin(mOrigin); + mgr->InvalidateFileManagersForOrigin(mOrigin); - // Tell the IndexedDatabaseManager that we're done. - mgr->AllowNextSynchronizedOp(mOrigin, nsnull); + // Tell the IndexedDatabaseManager that we're done. + mgr->AllowNextSynchronizedOp(mOrigin, nsnull); - return NS_OK; - } - - NS_ASSERTION(!mThread, "Should have been cleared already!"); - - // Remove the directory that contains all our databases. - nsCOMPtr directory; - nsresult rv = mgr->GetDirectoryForOrigin(mOrigin, getter_AddRefs(directory)); - if (NS_SUCCEEDED(rv)) { - bool exists; - rv = directory->Exists(&exists); - if (NS_SUCCEEDED(rv) && exists) { - rv = directory->Remove(true); + return NS_OK; } + + default: + NS_ERROR("Unknown state value!"); + return NS_ERROR_UNEXPECTED; } - NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to remove directory!"); - // Switch back to the main thread to complete the sequence. - rv = NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL); - NS_ENSURE_SUCCESS(rv, rv); - - return NS_OK; + NS_NOTREACHED("Should never get here!"); + return NS_ERROR_UNEXPECTED; } IndexedDatabaseManager::AsyncUsageRunnable::AsyncUsageRunnable( @@ -1591,14 +1629,16 @@ IndexedDatabaseManager::AsyncUsageRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(IndexedDatabaseManager::WaitForTransactionsToFinishRunnable, - nsIRunnable) +NS_IMPL_THREADSAFE_ISUPPORTS1( + IndexedDatabaseManager::WaitForTransactionsToFinishRunnable, + nsIRunnable) NS_IMETHODIMP IndexedDatabaseManager::WaitForTransactionsToFinishRunnable::Run() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - NS_ASSERTION(mOp && mOp->mHelper, "What?"); + NS_ASSERTION(mOp, "Null op!"); + NS_ASSERTION(mOp->mHelper || mOp->mRunnable, "Nothing to run!"); NS_ASSERTION(mCountdown, "Wrong countdown!"); if (--mCountdown) { @@ -1609,18 +1649,40 @@ IndexedDatabaseManager::WaitForTransactionsToFinishRunnable::Run() nsRefPtr helper; helper.swap(mOp->mHelper); + nsCOMPtr runnable; + runnable.swap(mOp->mRunnable); + mOp = nsnull; - IndexedDatabaseManager::DispatchHelper(helper); + nsresult rv; - // The helper is responsible for calling + if (helper && helper->HasTransaction()) { + // If the helper has a transaction, dispatch it to the transaction + // threadpool. + rv = helper->DispatchToTransactionPool(); + NS_ENSURE_SUCCESS(rv, rv); + } + else { + // Otherwise, dispatch it to the IO thread. + IndexedDatabaseManager* manager = IndexedDatabaseManager::Get(); + NS_ASSERTION(manager, "We should definitely have a manager here"); + + nsIEventTarget* target = manager->IOThread(); + + rv = helper ? + helper->Dispatch(target) : + target->Dispatch(runnable, NS_DISPATCH_NORMAL); + NS_ENSURE_SUCCESS(rv, rv); + } + + // The helper or runnable is responsible for calling // IndexedDatabaseManager::AllowNextSynchronizedOp. - return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(IndexedDatabaseManager::WaitForLockedFilesToFinishRunnable, - nsIRunnable) +NS_IMPL_THREADSAFE_ISUPPORTS1( + IndexedDatabaseManager::WaitForLockedFilesToFinishRunnable, + nsIRunnable) NS_IMETHODIMP IndexedDatabaseManager::WaitForLockedFilesToFinishRunnable::Run() @@ -1632,8 +1694,9 @@ IndexedDatabaseManager::WaitForLockedFilesToFinishRunnable::Run() return NS_OK; } -IndexedDatabaseManager::SynchronizedOp::SynchronizedOp(const nsACString& aOrigin, - nsIAtom* aId) +IndexedDatabaseManager:: +SynchronizedOp::SynchronizedOp(const nsACString& aOrigin, + nsIAtom* aId) : mOrigin(aOrigin), mId(aId) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h index 38b4b75eb7e..c839093fb49 100644 --- a/dom/indexedDB/IndexedDatabaseManager.h +++ b/dom/indexedDB/IndexedDatabaseManager.h @@ -7,10 +7,7 @@ #ifndef mozilla_dom_indexeddb_indexeddatabasemanager_h__ #define mozilla_dom_indexeddb_indexeddatabasemanager_h__ -#include "mozilla/dom/indexedDB/FileManager.h" #include "mozilla/dom/indexedDB/IndexedDatabase.h" -#include "mozilla/dom/indexedDB/IDBDatabase.h" -#include "mozilla/dom/indexedDB/IDBRequest.h" #include "mozilla/Mutex.h" @@ -27,14 +24,17 @@ #define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1" class mozIStorageQuotaCallback; +class nsIAtom; class nsIFile; class nsITimer; +class nsPIDOMWindow; BEGIN_INDEXEDDB_NAMESPACE class AsyncConnectionHelper; - class CheckQuotaHelper; +class FileManager; +class IDBDatabase; class IndexedDatabaseManager MOZ_FINAL : public nsIIndexedDatabaseManager, public nsIObserver @@ -74,26 +74,29 @@ public: static bool IsClosed(); - typedef void (*WaitingOnDatabasesCallback)(nsTArray >&, void*); + typedef void + (*WaitingOnDatabasesCallback)(nsTArray >&, void*); // Acquire exclusive access to the database given (waits for all others to // close). If databases need to close first, the callback will be invoked // with an array of said databases. nsresult AcquireExclusiveAccess(IDBDatabase* aDatabase, + const nsACString& aOrigin, AsyncConnectionHelper* aHelper, WaitingOnDatabasesCallback aCallback, void* aClosure) { NS_ASSERTION(aDatabase, "Need a DB here!"); - return AcquireExclusiveAccess(aDatabase->Origin(), aDatabase, aHelper, + return AcquireExclusiveAccess(aOrigin, aDatabase, aHelper, nsnull, aCallback, aClosure); } - nsresult AcquireExclusiveAccess(const nsACString& aOrigin, - AsyncConnectionHelper* aHelper, + + nsresult AcquireExclusiveAccess(const nsACString& aOrigin, + nsIRunnable* aRunnable, WaitingOnDatabasesCallback aCallback, void* aClosure) { - return AcquireExclusiveAccess(aOrigin, nsnull, aHelper, aCallback, + return AcquireExclusiveAccess(aOrigin, nsnull, nsnull, aRunnable, aCallback, aClosure); } @@ -197,9 +200,10 @@ private: IndexedDatabaseManager(); ~IndexedDatabaseManager(); - nsresult AcquireExclusiveAccess(const nsACString& aOrigin, + nsresult AcquireExclusiveAccess(const nsACString& aOrigin, IDBDatabase* aDatabase, AsyncConnectionHelper* aHelper, + nsIRunnable* aRunnable, WaitingOnDatabasesCallback aCallback, void* aClosure); @@ -226,23 +230,54 @@ private: // IndexedDatabaseManager that the job has been completed. class OriginClearRunnable MOZ_FINAL : public nsIRunnable { + enum CallbackState { + // Not yet run. + Pending = 0, + + // Running on the main thread in the callback for OpenAllowed. + OpenAllowed, + + // Running on the IO thread. + IO, + + // Running on the main thread after all work is done. + Complete + }; + public: NS_DECL_ISUPPORTS NS_DECL_NSIRUNNABLE - OriginClearRunnable(const nsACString& aOrigin, - nsIThread* aThread) + OriginClearRunnable(const nsACString& aOrigin) : mOrigin(aOrigin), - mThread(aThread), - mFirstCallback(true) + mCallbackState(Pending) { } - nsCString mOrigin; - nsCOMPtr mThread; - bool mFirstCallback; - }; + void AdvanceState() + { + switch (mCallbackState) { + case Pending: + mCallbackState = OpenAllowed; + return; + case OpenAllowed: + mCallbackState = IO; + return; + case IO: + mCallbackState = Complete; + return; + default: + NS_NOTREACHED("Can't advance past Complete!"); + } + } - bool IsClearOriginPending(const nsACString& origin); + static void InvalidateOpenedDatabases( + nsTArray >& aDatabases, + void* aClosure); + + private: + nsCString mOrigin; + CallbackState mCallbackState; + }; // Responsible for calculating the amount of space taken up by databases of a // certain origin. Created when nsIIDBIndexedDatabaseManager::GetUsageForURI @@ -301,6 +336,7 @@ private: const nsCString mOrigin; nsCOMPtr mId; nsRefPtr mHelper; + nsCOMPtr mRunnable; nsTArray > mDelayedRunnables; nsTArray > mDatabases; }; @@ -316,7 +352,8 @@ private: { NS_ASSERTION(mOp, "Why don't we have a runnable?"); NS_ASSERTION(mOp->mDatabases.IsEmpty(), "We're here too early!"); - NS_ASSERTION(mOp->mHelper, "What are we supposed to do when we're done?"); + NS_ASSERTION(mOp->mHelper || mOp->mRunnable, + "What are we supposed to do when we're done?"); NS_ASSERTION(mCountdown, "Wrong countdown!"); } @@ -361,7 +398,26 @@ private: nsString mFilePath; }; - static nsresult DispatchHelper(AsyncConnectionHelper* aHelper); + static nsresult RunSynchronizedOp(IDBDatabase* aDatabase, + SynchronizedOp* aOp); + + SynchronizedOp* FindSynchronizedOp(const nsACString& aOrigin, + nsIAtom* aId) + { + for (PRUint32 index = 0; index < mSynchronizedOps.Length(); index++) { + const nsAutoPtr& currentOp = mSynchronizedOps[index]; + if (currentOp->mOrigin == aOrigin && + (!currentOp->mId || currentOp->mId == aId)) { + return currentOp; + } + } + return nsnull; + } + + bool IsClearOriginPending(const nsACString& aOrigin) + { + return !!FindSynchronizedOp(aOrigin, nsnull); + } // Maintains a list of live databases per origin. nsClassHashtable > mLiveDatabases; diff --git a/dom/indexedDB/OpenDatabaseHelper.cpp b/dom/indexedDB/OpenDatabaseHelper.cpp index 8dca92eaac2..7adfa83e000 100644 --- a/dom/indexedDB/OpenDatabaseHelper.cpp +++ b/dom/indexedDB/OpenDatabaseHelper.cpp @@ -1880,15 +1880,14 @@ OpenDatabaseHelper::StartSetVersion() IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get(); NS_ASSERTION(mgr, "This should never be null!"); - rv = mgr->AcquireExclusiveAccess(mDatabase, helper, - &VersionChangeEventsRunnable::QueueVersionChange, + rv = mgr->AcquireExclusiveAccess(mDatabase, mDatabase->Origin(), helper, + &VersionChangeEventsRunnable::QueueVersionChange, helper); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); // The SetVersionHelper is responsible for dispatching us back to the // main thread again and changing the state to eSetVersionCompleted. mState = eSetVersionPending; - return NS_OK; } @@ -1910,8 +1909,8 @@ OpenDatabaseHelper::StartDelete() IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get(); NS_ASSERTION(mgr, "This should never be null!"); - rv = mgr->AcquireExclusiveAccess(mDatabase, helper, - &VersionChangeEventsRunnable::QueueVersionChange, + rv = mgr->AcquireExclusiveAccess(mDatabase, mDatabase->Origin(), helper, + &VersionChangeEventsRunnable::QueueVersionChange, helper); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); @@ -2136,7 +2135,7 @@ OpenDatabaseHelper::NotifySetVersionFinished() NS_ASSERTION(mState = eSetVersionPending, "How did we get here?"); mState = eSetVersionCompleted; - + // Dispatch ourself back to the main thread return NS_DispatchToCurrentThread(this); } diff --git a/dom/indexedDB/ipc/IndexedDBChild.cpp b/dom/indexedDB/ipc/IndexedDBChild.cpp index 10beb6618b9..117e91b34ce 100644 --- a/dom/indexedDB/ipc/IndexedDBChild.cpp +++ b/dom/indexedDB/ipc/IndexedDBChild.cpp @@ -104,6 +104,38 @@ public: DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE; }; +class VersionChangeRunnable : public nsRunnable +{ + nsRefPtr mDatabase; + uint64_t mOldVersion; + uint64_t mNewVersion; + +public: + VersionChangeRunnable(IDBDatabase* aDatabase, const uint64_t& aOldVersion, + const uint64_t& aNewVersion) + : mDatabase(aDatabase), mOldVersion(aOldVersion), mNewVersion(aNewVersion) + { + MOZ_ASSERT(aDatabase); + } + + NS_IMETHOD Run() MOZ_OVERRIDE + { + if (mDatabase->IsClosed()) { + return NS_OK; + } + + nsRefPtr event = + IDBVersionChangeEvent::Create(mOldVersion, mNewVersion); + MOZ_ASSERT(event); + + bool dummy; + nsresult rv = mDatabase->DispatchEvent(event, &dummy); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; + } +}; + } // anonymous namespace /******************************************************************************* @@ -362,12 +394,13 @@ IndexedDBDatabaseChild::RecvBlocked(const uint64_t& aOldVersion) MOZ_ASSERT(mRequest); MOZ_ASSERT(!mDatabase); - nsRefPtr event = - IDBVersionChangeEvent::CreateBlocked(aOldVersion, mVersion); + nsCOMPtr runnable = + IDBVersionChangeEvent::CreateBlockedRunnable(aOldVersion, mVersion, + mRequest); - bool dummy; - if (NS_FAILED(mRequest->DispatchEvent(event, &dummy))) { - NS_WARNING("Failed to dispatch blocked event!"); + MainThreadEventTarget target; + if (NS_FAILED(target.Dispatch(runnable, NS_DISPATCH_NORMAL))) { + NS_WARNING("Dispatch of blocked event failed!"); } return true; @@ -379,16 +412,12 @@ IndexedDBDatabaseChild::RecvVersionChange(const uint64_t& aOldVersion, { MOZ_ASSERT(mDatabase); - if (mDatabase->IsClosed()) { - return true; - } + nsCOMPtr runnable = + new VersionChangeRunnable(mDatabase, aOldVersion, aNewVersion); - nsRefPtr event = - IDBVersionChangeEvent::Create(aOldVersion, aNewVersion); - - bool dummy; - if (NS_FAILED(mDatabase->DispatchEvent(event, &dummy))) { - NS_WARNING("Failed to dispatch blocked event!"); + MainThreadEventTarget target; + if (NS_FAILED(target.Dispatch(runnable, NS_DISPATCH_NORMAL))) { + NS_WARNING("Dispatch of versionchange event failed!"); } return true; @@ -503,18 +532,7 @@ IndexedDBTransactionChild::SetTransaction(IDBTransaction* aTransaction) } void -IndexedDBTransactionChild::ActorDestroy(ActorDestroyReason aWhy) -{ - if (mTransaction) { - mTransaction->SetActor(static_cast(NULL)); -#ifdef DEBUG - mTransaction = NULL; -#endif - } -} - -bool -IndexedDBTransactionChild::RecvComplete(const nsresult& aRv) +IndexedDBTransactionChild::FireCompleteEvent(nsresult aRv) { MOZ_ASSERT(mTransaction); MOZ_ASSERT(mStrongTransaction); @@ -530,10 +548,36 @@ IndexedDBTransactionChild::RecvComplete(const nsresult& aRv) // } nsRefPtr helper = new CommitHelper(transaction, aRv); - if (NS_FAILED(helper->Run())) { - NS_WARNING("CommitHelper failed!"); + + MainThreadEventTarget target; + if (NS_FAILED(target.Dispatch(helper, NS_DISPATCH_NORMAL))) { + NS_WARNING("Dispatch of CommitHelper failed!"); + } +} + +void +IndexedDBTransactionChild::ActorDestroy(ActorDestroyReason aWhy) +{ + if (mStrongTransaction) { + // We're being torn down before we received a complete event from the parent + // so fake one here. + FireCompleteEvent(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + + MOZ_ASSERT(!mStrongTransaction); } + if (mTransaction) { + mTransaction->SetActor(static_cast(NULL)); +#ifdef DEBUG + mTransaction = NULL; +#endif + } +} + +bool +IndexedDBTransactionChild::RecvComplete(const nsresult& aRv) +{ + FireCompleteEvent(aRv); return true; } @@ -1059,12 +1103,13 @@ IndexedDBDeleteDatabaseRequestChild::RecvBlocked( { MOZ_ASSERT(mOpenRequest); - nsRefPtr event = - IDBVersionChangeEvent::CreateBlocked(aCurrentVersion, 0); + nsCOMPtr runnable = + IDBVersionChangeEvent::CreateBlockedRunnable(aCurrentVersion, 0, + mOpenRequest); - bool dummy; - if (NS_FAILED(mOpenRequest->DispatchEvent(event, &dummy))) { - NS_WARNING("Failed to dispatch blocked event!"); + MainThreadEventTarget target; + if (NS_FAILED(target.Dispatch(runnable, NS_DISPATCH_NORMAL))) { + NS_WARNING("Dispatch of blocked event failed!"); } return true; diff --git a/dom/indexedDB/ipc/IndexedDBChild.h b/dom/indexedDB/ipc/IndexedDBChild.h index a500c7ecf95..e53d934acb9 100644 --- a/dom/indexedDB/ipc/IndexedDBChild.h +++ b/dom/indexedDB/ipc/IndexedDBChild.h @@ -155,6 +155,9 @@ public: } protected: + void + FireCompleteEvent(nsresult aRv); + virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; diff --git a/dom/indexedDB/ipc/Makefile.in b/dom/indexedDB/ipc/Makefile.in index f4ef0a2af6b..fc35d9d8afd 100644 --- a/dom/indexedDB/ipc/Makefile.in +++ b/dom/indexedDB/ipc/Makefile.in @@ -31,18 +31,14 @@ LOCAL_INCLUDES += \ DEFINES += -D_IMPL_NS_LAYOUT -# Test is disabled for the moment to investigate OS X 10.7 crash. -# -#TEST_FILES = \ -# test_ipc.html \ -# $(NULL) +TEST_FILES = \ + test_ipc.html \ + $(NULL) include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -# Test is disabled for the moment to investigate OS X 10.7 crash. -# -#libs:: $(TEST_FILES) -# $(INSTALL) $(foreach f,$^,"$f") \ -# $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) +libs:: $(TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") \ + $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/dom/indexedDB/ipc/test_ipc.html b/dom/indexedDB/ipc/test_ipc.html index 2e8d2a72d5b..6a60a9c6554 100644 --- a/dom/indexedDB/ipc/test_ipc.html +++ b/dom/indexedDB/ipc/test_ipc.html @@ -12,7 +12,17 @@ SimpleTest.waitForExplicitFinish(); + // This isn't a single test, really... It runs the entirety of the IndexedDB + // tests. Each of those has a normal timeout handler, so there's no point in + // having a timeout here. I'm setting this really high just to avoid getting + // killed. + SimpleTest.requestLongerTimeout(100); + function iframeScriptFirst() { + // Disable this functionality, it breaks later tests. + SpecialPowers.prototype.registerProcessCrashObservers = function() { }; + SpecialPowers.prototype.unregisterProcessCrashObservers = function() { }; + content.wrappedJSObject.RunSet.reloadAndRunAll({ preventDefault: function() { } }); @@ -41,7 +51,11 @@ } } - let regex = /^(TEST-PASS|TEST-UNEXPECTED-PASS|TEST-KNOWN-FAIL|TEST-UNEXPECTED-FAIL|TEST-DEBUG-INFO) \| ([^\|]+) \|(.*)/; + let regexString = + "^(TEST-PASS|TEST-UNEXPECTED-PASS|TEST-KNOWN-FAIL|TEST-UNEXPECTED-FAIL" + + "|TEST-DEBUG-INFO) \\| ([^\\|]+) \\|(.*)"; + + let regex = new RegExp(regexString); function onTestMessage(data) { let message = data.json.msg; @@ -69,19 +83,8 @@ } function onTestComplete() { - let comp = SpecialPowers.wrap(Components); - - let idbManager = - comp.classes["@mozilla.org/dom/indexeddb/manager;1"] - .getService(comp.interfaces.nsIIndexedDatabaseManager); - - let uri = SpecialPowers.getDocumentURIObject(document); - idbManager.clearDatabasesForURI(uri); - - idbManager.getUsageForURI(uri, function(uri, usage, fileUsage) { - is(usage, 0, "Cleared ipc databases properly"); - SimpleTest.executeSoon(function () { SimpleTest.finish(); }); - }); + ok(true, "Got test complete message"); + SimpleTest.executeSoon(function () { SimpleTest.finish(); }); } function runTests() { diff --git a/dom/indexedDB/test/Makefile.in b/dom/indexedDB/test/Makefile.in index fea6b59fe60..0e93a5d69a0 100644 --- a/dom/indexedDB/test/Makefile.in +++ b/dom/indexedDB/test/Makefile.in @@ -15,7 +15,6 @@ XPCSHELL_TESTS = unit include $(topsrcdir)/config/rules.mk - TEST_FILES = \ bfcache_iframe1.html \ bfcache_iframe2.html \ diff --git a/dom/indexedDB/test/helpers.js b/dom/indexedDB/test/helpers.js index 1272583ae36..9aee167eda6 100644 --- a/dom/indexedDB/test/helpers.js +++ b/dom/indexedDB/test/helpers.js @@ -10,9 +10,39 @@ function executeSoon(aFun) SimpleTest.executeSoon(aFun); } +function clearAllDatabases(callback) { + function runCallback() { + SimpleTest.executeSoon(function () { callback(); }); + } + + if (!SpecialPowers.isMainProcess()) { + runCallback(); + return; + } + + let comp = SpecialPowers.wrap(Components); + + let idbManager = + comp.classes["@mozilla.org/dom/indexeddb/manager;1"] + .getService(comp.interfaces.nsIIndexedDatabaseManager); + + let uri = SpecialPowers.getDocumentURIObject(document); + + idbManager.clearDatabasesForURI(uri); + idbManager.getUsageForURI(uri, function(uri, usage, fileUsage) { + if (usage) { + throw new Error("getUsageForURI returned non-zero usage after " + + "clearing all databases!"); + } + runCallback(); + }); +} + if (!window.runTest) { window.runTest = function(limitedQuota) { + SimpleTest.waitForExplicitFinish(); + allowIndexedDB(); if (limitedQuota) { denyUnlimitedQuota(); @@ -21,8 +51,7 @@ if (!window.runTest) { allowUnlimitedQuota(); } - SimpleTest.waitForExplicitFinish(); - testGenerator.next(); + clearAllDatabases(function () { testGenerator.next(); }); } } @@ -33,7 +62,7 @@ function finishTest() SimpleTest.executeSoon(function() { testGenerator.close(); - SimpleTest.finish(); + clearAllDatabases(function() { SimpleTest.finish(); }); }); } diff --git a/dom/indexedDB/test/test_writer_starvation.html b/dom/indexedDB/test/test_writer_starvation.html index 85772174730..037eff0f8c1 100644 --- a/dom/indexedDB/test/test_writer_starvation.html +++ b/dom/indexedDB/test/test_writer_starvation.html @@ -9,7 +9,98 @@ - + diff --git a/dom/indexedDB/test/unit/Makefile.in b/dom/indexedDB/test/unit/Makefile.in index 355952c1ac5..ece2ba8285a 100644 --- a/dom/indexedDB/test/unit/Makefile.in +++ b/dom/indexedDB/test/unit/Makefile.in @@ -62,10 +62,8 @@ TEST_FILES = \ test_transaction_lifetimes.js \ test_transaction_lifetimes_nested.js \ test_transaction_ordering.js \ - test_writer_starvation.js \ $(NULL) - libs:: $(TEST_FILES) $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/dom/indexedDB/test/unit/test_deleteDatabase.js b/dom/indexedDB/test/unit/test_deleteDatabase.js index a696d5cfe69..5c7df137eae 100644 --- a/dom/indexedDB/test/unit/test_deleteDatabase.js +++ b/dom/indexedDB/test/unit/test_deleteDatabase.js @@ -57,8 +57,8 @@ function testSteps() ok(!(event.newVersion === 0), "newVersion should be null"); db.close(); db2.close(); - db.onversionchange = errorHandler; - db2.onversionchange = errorHandler; + db.onversionchange = unexpectedSuccessHandler; + db2.onversionchange = unexpectedSuccessHandler; }; // The IDB spec doesn't guarantee the order that onversionchange will fire diff --git a/dom/indexedDB/test/unit/test_setVersion_abort.js b/dom/indexedDB/test/unit/test_setVersion_abort.js index 1cee3e27e5d..af588cdfb94 100644 --- a/dom/indexedDB/test/unit/test_setVersion_abort.js +++ b/dom/indexedDB/test/unit/test_setVersion_abort.js @@ -11,7 +11,7 @@ function testSteps() const description = "My Test Database"; let request = mozIndexedDB.open(name, 1, description); - request.onerror = grabEventAndContinueHandler; + request.onerror = errorHandler; request.onsuccess = unexpectedSuccessHandler; request.onupgradeneeded = grabEventAndContinueHandler; let event = yield; @@ -38,7 +38,11 @@ function testSteps() is(db.version, 1, "Correct version"); is(db.objectStoreNames.length, 1, "Correct objectStoreNames length"); + request.onerror = grabEventAndContinueHandler; + request.onupgradeneeded = unexpectedSuccessHandler; + event = yield; + is(event.type, "error", "Got request error event"); is(event.target, request, "Right target"); is(event.target.transaction, null, "No transaction"); @@ -46,19 +50,27 @@ function testSteps() event.preventDefault(); request = mozIndexedDB.open(name, 1, description); - request.onerror = grabEventAndContinueHandler; + request.onerror = errorHandler; request.onsuccess = unexpectedSuccessHandler; request.onupgradeneeded = grabEventAndContinueHandler; - let event = yield; + event = yield; + + is(event.type, "upgradeneeded", "Got upgradeneeded event"); let db2 = event.target.result; - + isnot(db, db2, "Should give a different db instance"); is(db2.version, 1, "Correct version"); is(db2.objectStoreNames.length, 0, "Correct objectStoreNames length"); request.onsuccess = grabEventAndContinueHandler; - yield; + request.onupgradeneeded = unexpectedSuccessHandler; + event = yield; + + is(event.target.result, db2, "Correct target"); + is(event.type, "success", "Got success event"); + is(db2.version, 1, "Correct version"); + is(db2.objectStoreNames.length, 0, "Correct objectStoreNames length"); finishTest(); yield; diff --git a/dom/indexedDB/test/unit/test_setVersion_exclusion.js b/dom/indexedDB/test/unit/test_setVersion_exclusion.js index 6bc4f3fd4dc..08d5a791b46 100644 --- a/dom/indexedDB/test/unit/test_setVersion_exclusion.js +++ b/dom/indexedDB/test/unit/test_setVersion_exclusion.js @@ -17,6 +17,7 @@ function testSteps() let request2 = mozIndexedDB.open(name, 2); request2.onerror = errorHandler; request2.onupgradeneeded = unexpectedSuccessHandler; + request2.onsuccess = unexpectedSuccessHandler; let event = yield; is(event.type, "upgradeneeded", "Expect an upgradeneeded event"); @@ -41,9 +42,11 @@ function testSteps() is(e.code, DOMException.INVALID_STATE_ERR, "Expect an INVALID_STATE_ERR"); } + request.onupgradeneeded = unexpectedSuccessHandler; request.transaction.oncomplete = grabEventAndContinueHandler; - yield; + event = yield; + is(event.type, "complete", "Got complete event"); // The database is still not fully open here. try { @@ -57,7 +60,9 @@ function testSteps() request.onsuccess = grabEventAndContinueHandler; - yield; + event = yield; + is(event.type, "success", "Expect a success event"); + is(event.target.result, db, "Same database"); db.onversionchange = function() { ok(true, "next setVersion was unblocked appropriately"); @@ -71,10 +76,22 @@ function testSteps() ok(false, "Transactions should be allowed now!"); } - request2.onupgradeneeded = null; + request.onsuccess = unexpectedSuccessHandler; + request2.onupgradeneeded = grabEventAndContinueHandler; + + event = yield; + is(event.type, "upgradeneeded", "Expect an upgradeneeded event"); + + db = event.target.result; + is(db.version, 2, "Database has correct version"); + + request2.onupgradeneeded = unexpectedSuccessHandler; request2.onsuccess = grabEventAndContinueHandler; - yield; + event = yield; + is(event.type, "success", "Expect a success event"); + is(event.target.result, db, "Same database"); + is(db.version, 2, "Database has correct version"); finishTest(); yield; diff --git a/dom/indexedDB/test/unit/test_writer_starvation.js b/dom/indexedDB/test/unit/test_writer_starvation.js deleted file mode 100644 index da2e7491531..00000000000 --- a/dom/indexedDB/test/unit/test_writer_starvation.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var testGenerator = testSteps(); - -function testSteps() -{ - const name = this.window ? window.location.pathname : "Splendid Test"; - const description = "My Test Database"; - - let request = mozIndexedDB.open(name, 1, description); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield; - - let db = event.target.result; - - is(event.target.transaction.mode, "versionchange", "Correct mode"); - - let objectStore = db.createObjectStore("foo", { autoIncrement: true }); - - request = objectStore.add({}); - request.onerror = errorHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield; - - let key = event.target.result; - ok(key, "Got a key"); - - yield; - - let continueReading = true; - let readerCount = 0; - let callbackCount = 0; - let finalCallbackCount = 0; - - // Generate a bunch of reads right away without returning to the event - // loop. - for (let i = 0; i < 20; i++) { - readerCount++; - request = db.transaction("foo").objectStore("foo").get(key); - request.onerror = errorHandler; - request.onsuccess = function(event) { - callbackCount++; - }; - } - - while (continueReading) { - readerCount++; - request = db.transaction("foo").objectStore("foo").get(key); - request.onerror = errorHandler; - request.onsuccess = function(event) { - is(event.target.transaction.mode, "readonly", "Correct mode"); - callbackCount++; - if (callbackCount == 100) { - request = db.transaction("foo", "readwrite") - .objectStore("foo") - .add({}, readerCount); - request.onerror = errorHandler; - request.onsuccess = function(event) { - continueReading = false; - finalCallbackCount = callbackCount; - is(event.target.result, callbackCount, - "write callback came before later reads"); - } - } - }; - - executeSoon(function() { testGenerator.next(); }); - yield; - } - - while (callbackCount < readerCount) { - executeSoon(function() { testGenerator.next(); }); - yield; - } - - is(callbackCount, readerCount, "All requests accounted for"); - ok(callbackCount > finalCallbackCount, "More readers after writer"); - - finishTest(); - yield; -} - -if (this.window) - SimpleTest.requestLongerTimeout(5); // see bug 580875 - diff --git a/dom/indexedDB/test/unit/xpcshell.ini b/dom/indexedDB/test/unit/xpcshell.ini index 3d75a6a154d..8f679dc89dd 100644 --- a/dom/indexedDB/test/unit/xpcshell.ini +++ b/dom/indexedDB/test/unit/xpcshell.ini @@ -51,5 +51,4 @@ tail = [test_transaction_abort.js] [test_transaction_lifetimes.js] [test_transaction_lifetimes_nested.js] -[test_transaction_ordering.js] -[test_writer_starvation.js] \ No newline at end of file +[test_transaction_ordering.js] \ No newline at end of file From 540d4de6c631afd950bf77d08fe39128f5e37d82 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 19 Jun 2012 18:05:43 -0700 Subject: [PATCH 81/83] Bug 766004 - Remove LookupCompileTimeConstant(). r=bhackett. --HG-- extra : rebase_source : 27e505a79158eb87fd38adf700bc21a666415733 --- js/src/frontend/BytecodeEmitter.cpp | 141 +--------------------------- 1 file changed, 3 insertions(+), 138 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 2fe44d2c2a0..208967f7077 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -646,70 +646,6 @@ frontend::DefineCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom return JS_TRUE; } -/* - * The function sets vp to NO_CONSTANT when the atom does not corresponds to a - * name defining a constant. - */ -static JSBool -LookupCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom *atom, Value *constp) -{ - /* - * Chase down the bce stack, but only until we reach the outermost bce. - * This enables propagating consts from top-level into switch cases in a - * function compiled along with the top-level script. - */ - constp->setMagic(JS_NO_CONSTANT); - do { - if (bce->sc->inFunction() || bce->script->compileAndGo) { - /* XXX this will need revising if 'const' becomes block-scoped. */ - StmtInfo *stmt = LexicalLookup(bce->sc, atom, NULL); - if (stmt) - return JS_TRUE; - - if (BytecodeEmitter::ConstMap::Ptr p = bce->constMap.lookup(atom)) { - JS_ASSERT(!p->value.isMagic(JS_NO_CONSTANT)); - *constp = p->value; - return JS_TRUE; - } - - /* - * Try looking in the variable object for a direct property that - * is readonly and permanent. We know such a property can't be - * shadowed by another property on obj's prototype chain, or a - * with object or catch variable; nor can prop's value be changed, - * nor can prop be deleted. - */ - if (bce->sc->inFunction()) { - if (bce->sc->bindings.hasBinding(cx, atom)) - break; - } else { - JS_ASSERT(bce->script->compileAndGo); - JSObject *obj = bce->sc->scopeChain(); - - const Shape *shape = obj->nativeLookup(cx, AtomToId(atom)); - if (shape) { - /* - * We're compiling code that will be executed immediately, - * not re-executed against a different scope chain and/or - * variable object. Therefore we can get constant values - * from our variable object here. - */ - if (!shape->writable() && !shape->configurable() && - shape->hasDefaultGetter() && shape->hasSlot()) { - *constp = obj->nativeGetSlot(shape->slot()); - } - } - - if (shape) - break; - } - } - bce = bce->parent; - } while (bce); - - return JS_TRUE; -} - static bool EmitIndex32(JSContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) { @@ -2122,7 +2058,7 @@ MOZ_NEVER_INLINE static JSBool EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) { JSOp switchOp; - JSBool ok, hasDefault, constPropagated; + JSBool ok, hasDefault; ptrdiff_t top, off, defaultOffset; ParseNode *pn2, *pn3, *pn4; uint32_t caseCount, tableLength; @@ -2130,13 +2066,13 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) int32_t i, low, high; int noteIndex; size_t switchSize, tableSize; - jsbytecode *pc, *savepc; + jsbytecode *pc; StmtInfo stmtInfo(cx); /* Try for most optimal, fall back if not dense ints, and per ECMAv2. */ switchOp = JSOP_TABLESWITCH; ok = JS_TRUE; - hasDefault = constPropagated = JS_FALSE; + hasDefault = JS_FALSE; defaultOffset = -1; pn2 = pn->pn_right; @@ -2239,32 +2175,6 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) constVal.setNull(); break; case PNK_NAME: - if (!pn4->maybeExpr()) { - ok = LookupCompileTimeConstant(cx, bce, pn4->pn_atom, &constVal); - if (!ok) - goto release; - if (!constVal.isMagic(JS_NO_CONSTANT)) { - if (constVal.isObject()) { - /* - * XXX JSOP_LOOKUPSWITCH does not support const- - * propagated object values, see bug 407186. - */ - switchOp = JSOP_CONDSWITCH; - continue; - } - if (constVal.isString()) { - JSAtom *atom = js_AtomizeString(cx, constVal.toString()); - if (!atom) { - ok = JS_FALSE; - goto release; - } - constVal.setString(atom); - } - constPropagated = JS_TRUE; - break; - } - } - /* FALL THROUGH */ default: switchOp = JSOP_CONDSWITCH; continue; @@ -2486,51 +2396,6 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) * simple, all switchOp cases exit that way. */ MUST_FLOW_THROUGH("out"); - - if (constPropagated) { - /* - * Skip switchOp, as we are not setting jump offsets in the two - * for loops below. We'll restore bce->next() from savepc after, - * unless there was an error. - */ - savepc = bce->next(); - bce->current->next = pc + 1; - if (switchOp == JSOP_TABLESWITCH) { - for (i = 0; i < (int)tableLength; i++) { - pn3 = table[i]; - if (pn3 && - (pn4 = pn3->pn_left) != NULL && - pn4->isKind(PNK_NAME)) - { - /* Note a propagated constant with the const's name. */ - JS_ASSERT(!pn4->maybeExpr()); - jsatomid index; - if (!bce->makeAtomIndex(pn4->pn_atom, &index)) - goto bad; - bce->current->next = pc; - if (NewSrcNote2(cx, bce, SRC_LABEL, ptrdiff_t(index)) < 0) - goto bad; - } - pc += JUMP_OFFSET_LEN; - } - } else { - for (pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) { - pn4 = pn3->pn_left; - if (pn4 && pn4->isKind(PNK_NAME)) { - /* Note a propagated constant with the const's name. */ - JS_ASSERT(!pn4->maybeExpr()); - jsatomid index; - if (!bce->makeAtomIndex(pn4->pn_atom, &index)) - goto bad; - bce->current->next = pc; - if (NewSrcNote2(cx, bce, SRC_LABEL, ptrdiff_t(index)) < 0) - goto bad; - } - pc += UINT32_INDEX_LEN + JUMP_OFFSET_LEN; - } - } - bce->current->next = savepc; - } } /* Emit code for each case's statements, copying pn_offset up to pn3. */ From 8d5747b8cbd9f9b8a35b71f11e2e4a6ce367d346 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 19 Jun 2012 23:28:45 -0400 Subject: [PATCH 82/83] Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (more widget parts); r=roc --- widget/tests/TestAppShellSteadyState.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widget/tests/TestAppShellSteadyState.cpp b/widget/tests/TestAppShellSteadyState.cpp index a382686b936..d293262a45a 100644 --- a/widget/tests/TestAppShellSteadyState.cpp +++ b/widget/tests/TestAppShellSteadyState.cpp @@ -23,6 +23,7 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsNetUtil.h" #include "nsThreadUtils.h" +#include "mozilla/Attributes.h" #ifdef XP_WIN #include @@ -158,7 +159,7 @@ public: } }; -class EventListener : public nsIDOMEventListener +class EventListener MOZ_FINAL : public nsIDOMEventListener { nsCOMPtr mAppShell; From fc968e2de7389f733b9fb96a734e261b322fab3d Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Tue, 19 Jun 2012 21:04:06 -0700 Subject: [PATCH 83/83] Bug 766446 - 'nsEvent needs a copy constructor that calls MOZ_COUNT_CTOR'. r=bz. --- widget/nsGUIEvent.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index 8b65626913e..1bd67b5fdca 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -566,6 +566,7 @@ protected: nsEvent() { + MOZ_COUNT_CTOR(nsEvent); } public: @@ -586,6 +587,12 @@ public: MOZ_COUNT_DTOR(nsEvent); } + nsEvent(const nsEvent& aOther) + { + MOZ_COUNT_CTOR(nsEvent); + *this = aOther; + } + // See event struct types PRUint8 eventStructType; // See GUI MESSAGES,