From 32c037745976235b63fb312ab5c53056dddeb05e Mon Sep 17 00:00:00 2001 From: Mark Capella Date: Thu, 5 Apr 2012 23:27:37 +0900 Subject: [PATCH 001/152] Bug 739889 - densify nsOuterDocAccessible, r=surkov, tbsaunde --HG-- rename : accessible/src/base/nsOuterDocAccessible.cpp => accessible/src/generic/OuterDocAccessible.cpp rename : accessible/src/base/nsOuterDocAccessible.h => accessible/src/generic/OuterDocAccessible.h rename : accessible/tests/mochitest/test_nsOuterDocAccessible.html => accessible/tests/mochitest/test_OuterDocAccessible.html --- accessible/build/Makefile.in | 1 + accessible/src/Makefile.in | 1 + accessible/src/base/Makefile.in | 1 - accessible/src/base/nsAccDocManager.cpp | 1 - .../src/base/nsAccessibilityService.cpp | 10 ++-- accessible/src/base/nsAccessible.cpp | 2 +- accessible/src/generic/Makefile.in | 31 +++++++++++++ .../OuterDocAccessible.cpp} | 46 +++++++++++-------- .../OuterDocAccessible.h} | 17 +++++-- accessible/tests/mochitest/Makefile.in | 2 +- ...ible.html => test_OuterDocAccessible.html} | 0 11 files changed, 78 insertions(+), 34 deletions(-) create mode 100644 accessible/src/generic/Makefile.in rename accessible/src/{base/nsOuterDocAccessible.cpp => generic/OuterDocAccessible.cpp} (85%) rename accessible/src/{base/nsOuterDocAccessible.h => generic/OuterDocAccessible.h} (88%) rename accessible/tests/mochitest/{test_nsOuterDocAccessible.html => test_OuterDocAccessible.html} (100%) diff --git a/accessible/build/Makefile.in b/accessible/build/Makefile.in index a6ac8ab8f016..87f9856aade3 100644 --- a/accessible/build/Makefile.in +++ b/accessible/build/Makefile.in @@ -58,6 +58,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../src SHARED_LIBRARY_LIBS = \ ../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \ + ../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \ ../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \ ../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \ ../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \ diff --git a/accessible/src/Makefile.in b/accessible/src/Makefile.in index b937e4cfd13d..bb55d0ecb251 100644 --- a/accessible/src/Makefile.in +++ b/accessible/src/Makefile.in @@ -61,6 +61,7 @@ DIRS += $(PLATFORM_DIR) DIRS += \ base \ + generic \ html \ xpcom \ xforms \ diff --git a/accessible/src/base/Makefile.in b/accessible/src/base/Makefile.in index b71efb0c1ba7..c7d865cfe7f0 100644 --- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -60,7 +60,6 @@ CPPSRCS = \ nsARIAGridAccessible.cpp \ nsARIAMap.cpp \ nsDocAccessible.cpp \ - nsOuterDocAccessible.cpp \ nsCoreUtils.cpp \ nsAccUtils.cpp \ nsAccessibilityService.cpp \ diff --git a/accessible/src/base/nsAccDocManager.cpp b/accessible/src/base/nsAccDocManager.cpp index 0f1cbe49746f..494400d7be44 100644 --- a/accessible/src/base/nsAccDocManager.cpp +++ b/accessible/src/base/nsAccDocManager.cpp @@ -41,7 +41,6 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "nsApplicationAccessible.h" -#include "nsOuterDocAccessible.h" #include "nsRootAccessibleWrap.h" #include "States.h" diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 1537e966e481..e0b0dbbce08f 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -79,7 +79,6 @@ #include "nsNPAPIPluginInstance.h" #include "nsISupportsUtils.h" #include "nsObjectFrame.h" -#include "nsOuterDocAccessible.h" #include "nsRootAccessibleWrap.h" #include "nsTextFragment.h" #include "mozilla/Services.h" @@ -110,6 +109,7 @@ #include "nsXFormsFormControlsAccessible.h" #include "nsXFormsWidgetsAccessible.h" +#include "OuterDocAccessible.h" #include "mozilla/FunctionTimer.h" #include "mozilla/dom/Element.h" @@ -210,9 +210,9 @@ already_AddRefed nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsOuterDocAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); + nsAccessible* accessible = + new OuterDocAccessible(aContent, + nsAccUtils::GetDocAccessibleFor(aPresShell)); NS_ADDREF(accessible); return accessible; } @@ -1356,7 +1356,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, return nsnull; if (type == nsIAccessibleProvider::OuterDoc) { - nsAccessible* accessible = new nsOuterDocAccessible(aContent, aDoc); + nsAccessible* accessible = new OuterDocAccessible(aContent, aDoc); NS_IF_ADDREF(accessible); return accessible; } diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index c53225070281..733b52d2ec7c 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -821,7 +821,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, // point. Skip offscreen or invisible accessibles. This takes care of cases // where layout won't walk into things for us, such as image map areas and // sub documents (XXX: subdocuments should be handled by methods of - // nsOuterDocAccessibles). + // OuterDocAccessibles). PRInt32 childCount = GetChildCount(); for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) { nsAccessible *child = GetChildAt(childIdx); diff --git a/accessible/src/generic/Makefile.in b/accessible/src/generic/Makefile.in new file mode 100644 index 000000000000..ad8ebe1648cd --- /dev/null +++ b/accessible/src/generic/Makefile.in @@ -0,0 +1,31 @@ +# 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/. + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = accessibility +LIBRARY_NAME = accessibility_generic_s +LIBXUL_LIBRARY = 1 + + +CPPSRCS = \ + OuterDocAccessible.cpp \ + $(NULL) + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +LOCAL_INCLUDES = \ + -I$(srcdir)/../xpcom \ + -I$(srcdir)/../base \ + -I$(srcdir)/../../../layout/generic \ + -I$(srcdir)/../../../layout/xul/base/src \ + $(NULL) diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/generic/OuterDocAccessible.cpp similarity index 85% rename from accessible/src/base/nsOuterDocAccessible.cpp rename to accessible/src/generic/OuterDocAccessible.cpp index cf5ad424f0e1..22094e589657 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/generic/OuterDocAccessible.cpp @@ -36,43 +36,48 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsOuterDocAccessible.h" +#include "OuterDocAccessible.h" #include "nsAccUtils.h" #include "nsDocAccessible.h" #include "Role.h" #include "States.h" +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsOuterDocAccessible +// OuterDocAccessible //////////////////////////////////////////////////////////////////////////////// -nsOuterDocAccessible:: - nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : +OuterDocAccessible:: + OuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : nsAccessibleWrap(aContent, aDoc) { } +OuterDocAccessible::~OuterDocAccessible() +{ +} + //////////////////////////////////////////////////////////////////////////////// // nsISupports -NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible, +NS_IMPL_ISUPPORTS_INHERITED0(OuterDocAccessible, nsAccessible) //////////////////////////////////////////////////////////////////////////////// // nsAccessible public (DON'T add methods here) role -nsOuterDocAccessible::NativeRole() +OuterDocAccessible::NativeRole() { return roles::INTERNAL_FRAME; } nsAccessible* -nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, - EWhichChildAtPoint aWhichChild) +OuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, + EWhichChildAtPoint aWhichChild) { PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0; nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight); @@ -92,7 +97,7 @@ nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, } nsresult -nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes) +OuterDocAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes) { nsAutoString tag; aAttributes->GetStringProperty(NS_LITERAL_CSTRING("tag"), tag); @@ -108,14 +113,14 @@ nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes // nsIAccessible PRUint8 -nsOuterDocAccessible::ActionCount() +OuterDocAccessible::ActionCount() { // Internal frame, which is the doc's parent, should not have a click action. return 0; } NS_IMETHODIMP -nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) +OuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) { aName.Truncate(); @@ -123,7 +128,8 @@ nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName) } NS_IMETHODIMP -nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescription) +OuterDocAccessible::GetActionDescription(PRUint8 aIndex, + nsAString& aDescription) { aDescription.Truncate(); @@ -131,7 +137,7 @@ nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescripti } NS_IMETHODIMP -nsOuterDocAccessible::DoAction(PRUint8 aIndex) +OuterDocAccessible::DoAction(PRUint8 aIndex) { return NS_ERROR_INVALID_ARG; } @@ -140,7 +146,7 @@ nsOuterDocAccessible::DoAction(PRUint8 aIndex) // nsAccessNode public void -nsOuterDocAccessible::Shutdown() +OuterDocAccessible::Shutdown() { // XXX: sometimes outerdoc accessible is shutdown because of layout style // change however the presshell of underlying document isn't destroyed and @@ -149,7 +155,7 @@ nsOuterDocAccessible::Shutdown() NS_LOG_ACCDOCDESTROY_MSG("A11y outerdoc shutdown") NS_LOG_ACCDOCDESTROY_ACCADDRESS("outerdoc", this) - nsAccessible *childAcc = mChildren.SafeElementAt(0, nsnull); + nsAccessible* childAcc = mChildren.SafeElementAt(0, nsnull); if (childAcc) { NS_LOG_ACCDOCDESTROY("outerdoc's child document shutdown", childAcc->GetDocumentNode()) @@ -163,7 +169,7 @@ nsOuterDocAccessible::Shutdown() // nsAccessible public void -nsOuterDocAccessible::InvalidateChildren() +OuterDocAccessible::InvalidateChildren() { // Do not invalidate children because nsAccDocManager is responsible for // document accessible lifetime when DOM document is created or destroyed. If @@ -178,7 +184,7 @@ nsOuterDocAccessible::InvalidateChildren() } bool -nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible) +OuterDocAccessible::AppendChild(nsAccessible* aAccessible) { // We keep showing the old document for a bit after creating the new one, // and while building the new DOM and frame tree. That's done on purpose @@ -199,9 +205,9 @@ nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible) } bool -nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible) +OuterDocAccessible::RemoveChild(nsAccessible* aAccessible) { - nsAccessible *child = mChildren.SafeElementAt(0, nsnull); + nsAccessible* child = mChildren.SafeElementAt(0, nsnull); if (child != aAccessible) { NS_ERROR("Wrong child to remove!"); return false; @@ -224,7 +230,7 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible) // nsAccessible protected void -nsOuterDocAccessible::CacheChildren() +OuterDocAccessible::CacheChildren() { // Request document accessible for the content document to make sure it's // created. It will appended to outerdoc accessible children asynchronously. diff --git a/accessible/src/base/nsOuterDocAccessible.h b/accessible/src/generic/OuterDocAccessible.h similarity index 88% rename from accessible/src/base/nsOuterDocAccessible.h rename to accessible/src/generic/OuterDocAccessible.h index 9a19f1e5232d..9d6fb98b31d4 100644 --- a/accessible/src/base/nsOuterDocAccessible.h +++ b/accessible/src/generic/OuterDocAccessible.h @@ -36,24 +36,28 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef _nsOuterDocAccessible_H_ -#define _nsOuterDocAccessible_H_ +#ifndef MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_ +#define MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_ #include "nsAccessibleWrap.h" +namespace mozilla { +namespace a11y { + /** * Used for , , + + + diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index 1b9269b29017..4ef78ba644ef 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -223,6 +223,8 @@ bool Base64Decode(JSContext *cx, JS::Value val, JS::Value *out); bool StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval); bool NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval); +nsIPrincipal *GetCompartmentPrincipal(JSCompartment *compartment); + #ifdef DEBUG void DumpJSHeap(FILE* file); #endif diff --git a/js/xpconnect/wrappers/AccessCheck.h b/js/xpconnect/wrappers/AccessCheck.h index 43e8d3f5c7ca..aec1bee51abb 100644 --- a/js/xpconnect/wrappers/AccessCheck.h +++ b/js/xpconnect/wrappers/AccessCheck.h @@ -45,9 +45,6 @@ class nsIPrincipal; namespace xpc { -nsIPrincipal * -GetCompartmentPrincipal(JSCompartment *compartment); - class AccessCheck { public: static bool isSameOrigin(JSCompartment *a, JSCompartment *b); From 6984e9f6931f7ef6cdac11a5303c6e25301a14b6 Mon Sep 17 00:00:00 2001 From: Joey Armstrong Date: Thu, 5 Apr 2012 18:33:21 -0400 Subject: [PATCH 085/152] Bug 740452 - Move check-sync-dirs test to a named target so it can be run independent of configure. r=ted --- client.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client.mk b/client.mk index 8b036c49d203..8ce623015d32 100644 --- a/client.mk +++ b/client.mk @@ -368,8 +368,7 @@ endif #################################### # Build it -realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status - @$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/config $(TOPSRCDIR)/config +realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status check-sync-dirs-config $(MOZ_MAKE) #################################### @@ -427,6 +426,12 @@ cleansrcdir: build/autoconf/clean-config.sh; \ fi; +## Sanity check $X and js/src/$X are in sync +.PHONY: check-sync-dirs +check-sync-dirs: check-sync-dirs-build check-sync-dirs-config +check-sync-dirs-%: + @$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/$* $(TOPSRCDIR)/$* + echo-variable-%: @echo $($*) From c23bdb7e3d85ea21435675b6bd712dbdaf243a62 Mon Sep 17 00:00:00 2001 From: Steven Michaud Date: Thu, 5 Apr 2012 17:36:40 -0500 Subject: [PATCH 086/152] Bug 738076 - Missing "return NS_ERROR_FAILURE" after malloc failure. r=bgigard --- gfx/thebes/nsCoreAnimationSupport.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/thebes/nsCoreAnimationSupport.mm b/gfx/thebes/nsCoreAnimationSupport.mm index f9343f373f02..ad9e2416fac5 100644 --- a/gfx/thebes/nsCoreAnimationSupport.mm +++ b/gfx/thebes/nsCoreAnimationSupport.mm @@ -531,6 +531,7 @@ nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight, mUnsupportedWidth = aWidth; mUnsupportedHeight = aHeight; Destroy(); + return NS_ERROR_FAILURE; } memset(mCGData, 0, aWidth*aHeight*4); From 8c7a832ca8042897b239c1be6c18ffc740103f8b Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Thu, 5 Apr 2012 18:37:57 -0400 Subject: [PATCH 087/152] bug 742827 - fix problem with landing of bug 671591 r=honzab --- netwerk/protocol/http/nsHttpTransaction.cpp | 73 +++++++++++++-------- netwerk/protocol/http/nsHttpTransaction.h | 26 +++++--- 2 files changed, 65 insertions(+), 34 deletions(-) diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 44c04d9128b0..ee7e73f34656 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -138,11 +138,10 @@ nsHttpTransaction::nsHttpTransaction() , mSSLConnectFailed(false) , mHttpResponseMatched(false) , mPreserveStream(false) - , mToReadBeforeRestart(0) , mReportedStart(false) , mReportedResponseHeader(false) , mForTakeResponseHead(nsnull) - , mTakenResponseHeader(false) + , mResponseHeadTaken(false) { LOG(("Creating nsHttpTransaction @%x\n", this)); gHttpHandler->GetMaxPipelineObjectSize(mMaxPipelineObjectSize); @@ -360,12 +359,12 @@ nsHttpTransaction::Connection() nsHttpResponseHead * nsHttpTransaction::TakeResponseHead() { - NS_ABORT_IF_FALSE(!mTakenResponseHeader, "TakeResponseHead called 2x"); + NS_ABORT_IF_FALSE(!mResponseHeadTaken, "TakeResponseHead called 2x"); // Lock RestartInProgress() and TakeResponseHead() against main thread MutexAutoLock lock(*nsHttp::GetLock()); - mTakenResponseHeader = true; + mResponseHeadTaken = true; // Prefer mForTakeResponseHead over mResponseHead. It is always a complete // set of headers. @@ -470,7 +469,7 @@ nsHttpTransaction::OnTransportStatus(nsITransport* transport, PR_Now(), LL_ZERO, EmptyCString()); // report the status and progress - if (!mRestartInProgressVerifier.Active()) + if (!mRestartInProgressVerifier.IsDiscardingContent()) mActivityDistributor->ObserveActivity( mChannel, NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT, @@ -841,30 +840,40 @@ nsHttpTransaction::RestartInProgress() { NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + if ((mRestartCount + 1) >= gHttpHandler->MaxRequestAttempts()) { + LOG(("nsHttpTransaction::RestartInProgress() " + "reached max request attempts, failing transaction %p\n", this)); + return NS_ERROR_NET_RESET; + } + // Lock RestartInProgress() and TakeResponseHead() against main thread MutexAutoLock lock(*nsHttp::GetLock()); + // Don't try and RestartInProgress() things that haven't gotten a response + // header yet. Those should be handled under the normal restart() path if + // they are eligible. + if (!mHaveAllHeaders) + return NS_ERROR_NET_RESET; + // don't try and restart 0.9 or non 200/Get HTTP/1 - if (mHaveAllHeaders && !mRestartInProgressVerifier.IsSetup()) + if (!mRestartInProgressVerifier.IsSetup()) return NS_ERROR_NET_RESET; LOG(("Will restart transaction %p and skip first %lld bytes, " "old Content-Length %lld", this, mContentRead, mContentLength)); - if (mHaveAllHeaders) { - mRestartInProgressVerifier.SetAlreadyProcessed( - PR_MAX(mRestartInProgressVerifier.AlreadyProcessed(), mContentRead)); - mToReadBeforeRestart = mRestartInProgressVerifier.AlreadyProcessed(); - mRestartInProgressVerifier.SetActive(true); + mRestartInProgressVerifier.SetAlreadyProcessed( + PR_MAX(mRestartInProgressVerifier.AlreadyProcessed(), mContentRead)); - if (!mTakenResponseHeader && !mForTakeResponseHead) { - // TakeResponseHeader() has not been called yet and this - // is the first restart. Store the resp headers exclusively - // for TakeResponseHeader() - mForTakeResponseHead = mResponseHead; - mResponseHead = nsnull; - } + if (!mResponseHeadTaken && !mForTakeResponseHead) { + // TakeResponseHeader() has not been called yet and this + // is the first restart. Store the resp headers exclusively + // for TakeResponseHead() which is called from the main thread and + // could happen at any time - so we can't continue to modify those + // headers (which restarting will effectively do) + mForTakeResponseHead = mResponseHead; + mResponseHead = nsnull; } if (mResponseHead) { @@ -1253,7 +1262,7 @@ nsHttpTransaction::HandleContentStart() LOG(("waiting for the server to close the connection.\n")); #endif } - if (mRestartInProgressVerifier.Active() && + if (mRestartInProgressVerifier.IsSetup() && !mRestartInProgressVerifier.Verify(mContentLength, mResponseHead)) { LOG(("Restart in progress subsequent transaction failed to match")); return NS_ERROR_ABORT; @@ -1261,8 +1270,12 @@ nsHttpTransaction::HandleContentStart() } mDidContentStart = true; + + // The verifier only initializes itself once (from the first iteration of + // a transaction that gets far enough to have response headers) if (mRequestHead->Method() == nsHttp::Get) mRestartInProgressVerifier.Set(mContentLength, mResponseHead); + return NS_OK; } @@ -1322,17 +1335,19 @@ nsHttpTransaction::HandleContent(char *buf, *contentRead = count; } - if (mRestartInProgressVerifier.Active() && - mToReadBeforeRestart && *contentRead) { - PRUint32 ignore = PR_MIN(*contentRead, PRUint32(mToReadBeforeRestart)); + PRInt64 toReadBeforeRestart = + mRestartInProgressVerifier.ToReadBeforeRestart(); + + if (toReadBeforeRestart && *contentRead) { + PRUint32 ignore = + PR_MIN(toReadBeforeRestart, PR_UINT32_MAX); + ignore = PR_MIN(*contentRead, ignore); LOG(("Due To Restart ignoring %d of remaining %ld", - ignore, mToReadBeforeRestart)); + ignore, toReadBeforeRestart)); *contentRead -= ignore; mContentRead += ignore; - mToReadBeforeRestart -= ignore; + mRestartInProgressVerifier.HaveReadBeforeRestart(ignore); memmove(buf, buf + ignore, *contentRead + *contentRemaining); - if (!mToReadBeforeRestart) - mRestartInProgressVerifier.SetActive(false); } if (*contentRead) { @@ -1647,6 +1662,12 @@ nsHttpTransaction::RestartVerifier::Set(PRInt64 contentLength, val = head->PeekHeader(nsHttp::Transfer_Encoding); if (val) mTransferEncoding.Assign(val); + + // We can only restart with any confidence if we have a stored etag or + // last-modified header + if (mETag.IsEmpty() && mLastModified.IsEmpty()) + return; + mSetup = true; } } diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index cbb7f04acd5a..addf1b2976a6 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -231,13 +231,12 @@ private: // mResponseComplete := transaction ran to completion // For Restart-In-Progress Functionality - PRInt64 mToReadBeforeRestart; bool mReportedStart; bool mReportedResponseHeader; // protected by nsHttp::GetLock() nsHttpResponseHead *mForTakeResponseHead; - bool mTakenResponseHeader; + bool mResponseHeadTaken; class RestartVerifier { @@ -254,18 +253,27 @@ private: RestartVerifier() : mContentLength(-1) , mAlreadyProcessed(0) - , mActive(false) + , mToReadBeforeRestart(0) , mSetup(false) {} ~RestartVerifier() {} void Set(PRInt64 contentLength, nsHttpResponseHead *head); bool Verify(PRInt64 contentLength, nsHttpResponseHead *head); - bool Active() { return mActive; } - void SetActive(bool val) { mActive = val; } + bool IsDiscardingContent() { return mToReadBeforeRestart != 0; } bool IsSetup() { return mSetup; } PRInt64 AlreadyProcessed() { return mAlreadyProcessed; } - void SetAlreadyProcessed(PRInt64 val) { mAlreadyProcessed = val; } + void SetAlreadyProcessed(PRInt64 val) { + mAlreadyProcessed = val; + mToReadBeforeRestart = val; + } + PRInt64 ToReadBeforeRestart() { return mToReadBeforeRestart; } + void HaveReadBeforeRestart(PRUint32 amt) + { + NS_ABORT_IF_FALSE(amt <= mToReadBeforeRestart, + "too large of a HaveReadBeforeRestart deduction"); + mToReadBeforeRestart -= amt; + } private: // This is the data from the first complete response header @@ -283,8 +291,10 @@ private: // be skipped in the new one. PRInt64 mAlreadyProcessed; - // true when iteration > 0 has started - bool mActive; + // The amount of data that must be discarded in the current iteration + // (where iteration > 0) to reach the mAlreadyProcessed high water + // mark. + PRInt64 mToReadBeforeRestart; // true when ::Set has been called with a response header bool mSetup; From 5865ef3df30728125cdf33605132dcbf79306ebc Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Thu, 5 Apr 2012 15:45:31 -0700 Subject: [PATCH 088/152] Bug 741135: Update NSS to NSS_3_13_4_BETA2. Includes fixes for bug 741481 and bug 715073. --- security/coreconf/coreconf.dep | 1 + security/nss/TAG-INFO | 2 +- security/nss/TAG-INFO-CKBI | 2 +- security/nss/lib/certdb/certdb.c | 3 +- security/nss/lib/softoken/legacydb/keydb.c | 31 ++++++++++++++++++- security/nss/lib/softoken/legacydb/lowkey.c | 18 +++++++++++ security/nss/lib/softoken/legacydb/lowkeyti.h | 1 + security/nss/lib/util/quickder.c | 2 +- 8 files changed, 55 insertions(+), 5 deletions(-) diff --git a/security/coreconf/coreconf.dep b/security/coreconf/coreconf.dep index b75161110bb5..b536cfc01b91 100644 --- a/security/coreconf/coreconf.dep +++ b/security/coreconf/coreconf.dep @@ -42,3 +42,4 @@ */ #error "Do not include this header file." + diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO index 6a64c4a94b9d..faedfe40da6f 100644 --- a/security/nss/TAG-INFO +++ b/security/nss/TAG-INFO @@ -1 +1 @@ -NSS_3_13_4_BETA1 +NSS_3_13_4_BETA2 diff --git a/security/nss/TAG-INFO-CKBI b/security/nss/TAG-INFO-CKBI index 6a64c4a94b9d..faedfe40da6f 100644 --- a/security/nss/TAG-INFO-CKBI +++ b/security/nss/TAG-INFO-CKBI @@ -1 +1 @@ -NSS_3_13_4_BETA1 +NSS_3_13_4_BETA2 diff --git a/security/nss/lib/certdb/certdb.c b/security/nss/lib/certdb/certdb.c index 2172f7acfeab..15f111fba1ec 100644 --- a/security/nss/lib/certdb/certdb.c +++ b/security/nss/lib/certdb/certdb.c @@ -39,7 +39,7 @@ /* * Certificate handling code * - * $Id: certdb.c,v 1.121 2012/03/23 03:25:57 wtc%google.com Exp $ + * $Id: certdb.c,v 1.121.2.1 2012/04/03 00:38:19 wtc%google.com Exp $ */ #include "nssilock.h" @@ -2955,6 +2955,7 @@ cert_InitLocks(void) PORT_Assert(certTrustLock != NULL); if (!certTrustLock) { PZ_DestroyLock(certRefCountLock); + certRefCountLock = NULL; return SECFailure; } } diff --git a/security/nss/lib/softoken/legacydb/keydb.c b/security/nss/lib/softoken/legacydb/keydb.c index f94f65064e6b..2f60a9e55dca 100644 --- a/security/nss/lib/softoken/legacydb/keydb.c +++ b/security/nss/lib/softoken/legacydb/keydb.c @@ -34,7 +34,7 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -/* $Id: keydb.c,v 1.12 2010/07/20 01:26:04 wtc%google.com Exp $ */ +/* $Id: keydb.c,v 1.12.2.1 2012/04/05 21:14:22 wtc%google.com Exp $ */ #include "lowkeyi.h" #include "secasn1.h" @@ -1790,6 +1790,35 @@ seckey_decrypt_private_key(SECItem*epki, rv = SEC_QuickDERDecodeItem(permarena, pk, lg_nsslowkey_RSAPrivateKeyTemplate, &newPrivateKey); + if (rv == SECSuccess) { + break; + } + /* Try decoding with the alternative template, but only allow + * a zero-length modulus for a secret key object. + * See bug 715073. + */ + rv = SEC_QuickDERDecodeItem(permarena, pk, + lg_nsslowkey_RSAPrivateKeyTemplate2, + &newPrivateKey); + /* A publicExponent of 0 is the defining property of a secret + * key disguised as an RSA key. When decoding with the + * alternative template, only accept a secret key with an + * improperly encoded modulus and a publicExponent of 0. + */ + if (rv == SECSuccess) { + if (pk->u.rsa.modulus.len == 2 && + pk->u.rsa.modulus.data[0] == SEC_ASN1_INTEGER && + pk->u.rsa.modulus.data[1] == 0 && + pk->u.rsa.publicExponent.len == 1 && + pk->u.rsa.publicExponent.data[0] == 0) { + /* Fix the zero-length integer by setting it to 0. */ + pk->u.rsa.modulus.data = pk->u.rsa.publicExponent.data; + pk->u.rsa.modulus.len = pk->u.rsa.publicExponent.len; + } else { + PORT_SetError(SEC_ERROR_BAD_DER); + rv = SECFailure; + } + } break; case SEC_OID_ANSIX9_DSA_SIGNATURE: pk->keyType = NSSLOWKEYDSAKey; diff --git a/security/nss/lib/softoken/legacydb/lowkey.c b/security/nss/lib/softoken/legacydb/lowkey.c index 28a7ac94cc69..ca8a4907c39b 100644 --- a/security/nss/lib/softoken/legacydb/lowkey.c +++ b/security/nss/lib/softoken/legacydb/lowkey.c @@ -97,6 +97,24 @@ const SEC_ASN1Template lg_nsslowkey_RSAPrivateKeyTemplate[] = { { 0 } }; +/* + * Allows u.rsa.modulus to be zero length for secret keys with an empty + * CKA_ID incorrectly generated in NSS 3.13.3 or earlier. Only used for + * decoding. See bug 715073. + */ +const SEC_ASN1Template lg_nsslowkey_RSAPrivateKeyTemplate2[] = { + { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(NSSLOWKEYPrivateKey) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.version) }, + { SEC_ASN1_ANY, offsetof(NSSLOWKEYPrivateKey,u.rsa.modulus) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.publicExponent) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.privateExponent) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.prime1) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.prime2) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.exponent1) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.exponent2) }, + { SEC_ASN1_INTEGER, offsetof(NSSLOWKEYPrivateKey,u.rsa.coefficient) }, + { 0 } +}; const SEC_ASN1Template lg_nsslowkey_DSAPrivateKeyTemplate[] = { { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(NSSLOWKEYPrivateKey) }, diff --git a/security/nss/lib/softoken/legacydb/lowkeyti.h b/security/nss/lib/softoken/legacydb/lowkeyti.h index 2e2cdf0c967f..27dff2033e64 100644 --- a/security/nss/lib/softoken/legacydb/lowkeyti.h +++ b/security/nss/lib/softoken/legacydb/lowkeyti.h @@ -72,6 +72,7 @@ typedef struct NSSLOWKEYDBHandleStr NSSLOWKEYDBHandle; */ extern const SEC_ASN1Template lg_nsslowkey_PQGParamsTemplate[]; extern const SEC_ASN1Template lg_nsslowkey_RSAPrivateKeyTemplate[]; +extern const SEC_ASN1Template lg_nsslowkey_RSAPrivateKeyTemplate2[]; extern const SEC_ASN1Template lg_nsslowkey_DSAPrivateKeyTemplate[]; extern const SEC_ASN1Template lg_nsslowkey_DHPrivateKeyTemplate[]; extern const SEC_ASN1Template lg_nsslowkey_DHPrivateKeyExportTemplate[]; diff --git a/security/nss/lib/util/quickder.c b/security/nss/lib/util/quickder.c index b1956af62786..95475a7d35ce 100644 --- a/security/nss/lib/util/quickder.c +++ b/security/nss/lib/util/quickder.c @@ -858,7 +858,7 @@ static SECStatus DecodeItem(void* dest, /* change the length in the SECItem to be the number of bits */ temp.len = (temp.len-1)*8 - (temp.data[0] & 0x7); - temp.data += 1; + temp.data++; break; } From a3d5f1de5403007b5d2ae5b18fea75c1d9a6fd7a Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 5 Apr 2012 00:14:35 -0700 Subject: [PATCH 089/152] Bug 742610 - Remove opportunistic caching support from nsHttpChannel, r=honzab --HG-- extra : source : 8b98023b89ddef6e7b0bbed25463c68142877d8e --- netwerk/protocol/http/nsHttpChannel.cpp | 34 +++---------------------- netwerk/protocol/http/nsHttpChannel.h | 3 --- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 4bd8890c572a..ce785c8d1437 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -135,7 +135,6 @@ nsHttpChannel::nsHttpChannel() , mResuming(false) , mInitedCacheEntry(false) , mCacheForOfflineUse(false) - , mCachingOpportunistically(false) , mFallbackChannel(false) , mCustomConditionalRequest(false) , mFallingBack(false) @@ -2073,8 +2072,8 @@ nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback) NS_ASSERTION(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK, "Fallback entry not marked correctly!"); - // Kill any opportunistic cache entry, and disable opportunistic - // caching for the fallback. + // Kill any offline cache entry, and disable offline caching for the + // fallback. if (mOfflineCacheEntry) { mOfflineCacheEntry->Doom(); mOfflineCacheEntry = 0; @@ -2082,7 +2081,6 @@ nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback) } mCacheForOfflineUse = false; - mCachingOpportunistically = false; mOfflineCacheClientID.Truncate(); mOfflineCacheEntry = 0; mOfflineCacheAccess = 0; @@ -2335,12 +2333,10 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry, NS_FAILED(namespaceEntry->GetItemType(&namespaceType)) || (namespaceType & (nsIApplicationCacheNamespace::NAMESPACE_FALLBACK | - nsIApplicationCacheNamespace::NAMESPACE_OPPORTUNISTIC | nsIApplicationCacheNamespace::NAMESPACE_BYPASS)) == 0) { // When loading from an application cache, only items // on the whitelist or matching a - // fallback/opportunistic namespace should hit the - // network... + // fallback namespace should hit the network... mLoadFlags |= LOAD_ONLY_FROM_CACHE; // ... and if there were an application cache entry, @@ -2353,19 +2349,6 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry, rv = namespaceEntry->GetData(mFallbackKey); NS_ENSURE_SUCCESS(rv, rv); } - - if ((namespaceType & - nsIApplicationCacheNamespace::NAMESPACE_OPPORTUNISTIC) && - mLoadFlags & LOAD_DOCUMENT_URI) { - // Document loads for items in an opportunistic namespace - // should be placed in the offline cache. - nsCString clientID; - mApplicationCache->GetClientID(clientID); - - mCacheForOfflineUse = !clientID.IsEmpty(); - SetOfflineCacheClientID(clientID); - mCachingOpportunistically = true; - } } return OpenNormalCacheEntry(); @@ -3105,17 +3088,6 @@ nsHttpChannel::CloseOfflineCacheEntry() mOfflineCacheEntry = 0; mOfflineCacheAccess = 0; - - if (mCachingOpportunistically) { - nsCOMPtr appCacheService = - do_GetService(NS_APPLICATIONCACHESERVICE_CONTRACTID); - if (appCacheService) { - nsCAutoString cacheKey; - GenerateCacheKey(mPostID, cacheKey); - appCacheService->CacheOpportunistically(mApplicationCache, - cacheKey); - } - } } diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index e3f10002964b..c3935f5bfc2c 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -337,9 +337,6 @@ private: PRUint32 mResuming : 1; PRUint32 mInitedCacheEntry : 1; PRUint32 mCacheForOfflineUse : 1; - // True if mCacheForOfflineUse was set because we were caching - // opportunistically. - PRUint32 mCachingOpportunistically : 1; // True if we are loading a fallback cache entry from the // application cache. PRUint32 mFallbackChannel : 1; From 944d8aa687b982d17a4423531c71e55a747ba09a Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Thu, 5 Apr 2012 16:31:26 -0700 Subject: [PATCH 090/152] no bug: Warning fix at predeclaration of AutoCompartment; r=jorendorff --- js/src/jsapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 70d61a734990..0d7cc8a8940e 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2736,7 +2736,7 @@ js_TransplantObjectWithWrapper(JSContext *cx, JS_END_EXTERN_C namespace js { -struct AutoCompartment; +class AutoCompartment; } class JS_PUBLIC_API(JSAutoEnterCompartment) From 47a4fb0311dc812eb73dbfb4d84dbfabf13c0ae2 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Thu, 5 Apr 2012 16:50:40 -0700 Subject: [PATCH 091/152] Bug 739899 - Fix orange --- js/src/jsgc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index a233c28adc6d..b3f6536fd075 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -4335,11 +4335,13 @@ EndVerifyBarriers(JSContext *cx) if (!trc) return; + bool compartmentCreated = false; + /* We need to disable barriers before tracing, which may invoke barriers. */ for (CompartmentsIter c(rt); !c.done(); c.next()) { - /* Don't verify if a new compartment was created. */ if (!c->needsBarrier_) - return; + compartmentCreated = true; + c->needsBarrier_ = false; } @@ -4360,7 +4362,7 @@ EndVerifyBarriers(JSContext *cx) AutoGCRooter::traceAll(trc); - if (IsIncrementalGCSafe(rt)) { + if (!compartmentCreated && IsIncrementalGCSafe(rt)) { /* * Verify that all the current roots were reachable previously, or else * are marked. From 7ac37189bb2bc8e24da4e3b0f799f00f48d3ffcb Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Thu, 5 Apr 2012 17:05:34 -0700 Subject: [PATCH 092/152] Bug 739899 - Fix clang warning (rs=terrence) --- js/src/gc/Statistics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 2bf1e4244d7d..383aae9a2c1e 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -512,8 +512,8 @@ Statistics::endGC() void Statistics::beginSlice(int collectedCount, int compartmentCount, gcreason::Reason reason) { - collectedCount = collectedCount; - compartmentCount = compartmentCount; + this->collectedCount = collectedCount; + this->compartmentCount = compartmentCount; bool first = runtime->gcIncrementalState == gc::NO_INCREMENTAL; if (first) From ef32c48bf1efaeab4f90267b3cfbc98a5bc270eb Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 5 Apr 2012 17:10:44 -0700 Subject: [PATCH 093/152] Bug 733461: Implement the 'query' parameter of Debugger.prototype.findScripts. r=jorendorff --- js/src/jit-test/jit_test.py | 6 +- .../tests/debug/Debugger-findScripts-07.js | 31 ++ .../debug/Debugger-findScripts-08-script2 | 3 + .../tests/debug/Debugger-findScripts-08.js | 78 ++++ .../tests/debug/Debugger-findScripts-09.js | 44 ++ .../tests/debug/Debugger-findScripts-10.js | 13 + .../debug/Debugger-findScripts-11-script2 | 18 + .../tests/debug/Debugger-findScripts-11.js | 35 ++ .../debug/Debugger-findScripts-12-script1 | 19 + .../debug/Debugger-findScripts-12-script2 | 19 + .../tests/debug/Debugger-findScripts-12.js | 127 ++++++ .../tests/debug/Debugger-findScripts-14.js | 29 ++ .../debug/Debugger-findScripts-14.script1 | 12 + js/src/js.msg | 2 + js/src/jsatom.tbl | 2 + js/src/vm/Debugger.cpp | 378 +++++++++++++++--- js/src/vm/Debugger.h | 1 + 17 files changed, 770 insertions(+), 47 deletions(-) create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-07.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-08-script2 create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-08.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-09.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-10.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-11-script2 create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-11.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-12-script1 create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-12-script2 create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-12.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-14.js create mode 100644 js/src/jit-test/tests/debug/Debugger-findScripts-14.script1 diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py index 60e50ef95386..1501bed53118 100755 --- a/js/src/jit-test/jit_test.py +++ b/js/src/jit-test/jit_test.py @@ -132,7 +132,11 @@ def get_test_cmd(path, jitflags, lib_dir, shell_args): libdir_var = lib_dir if not libdir_var.endswith('/'): libdir_var += '/' - expr = "const platform=%r; const libdir=%r;"%(sys.platform, libdir_var) + scriptdir_var = os.path.dirname(path); + if not scriptdir_var.endswith('/'): + scriptdir_var += '/' + expr = ("const platform=%r; const libdir=%r; const scriptdir=%r" + % (sys.platform, libdir_var, scriptdir_var)) # We may have specified '-a' or '-d' twice: once via --jitflags, once # via the "|jit-test|" line. Remove dups because they are toggles. return ([ JS ] + list(set(jitflags)) + shell_args + diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-07.js b/js/src/jit-test/tests/debug/Debugger-findScripts-07.js new file mode 100644 index 000000000000..e2df9aaf0665 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-07.js @@ -0,0 +1,31 @@ +// findScripts can filter scripts by global. +var g1 = newGlobal('new-compartment'); +var g2 = newGlobal('new-compartment'); +var g3 = newGlobal('new-compartment'); + +var dbg = new Debugger(g1, g2); + +g1.eval('function f() {}'); +g2.eval('function g() {}'); +g2.eval('function h() {}'); +var g1fw = dbg.addDebuggee(g1.f); +var g2gw = dbg.addDebuggee(g2.g); + +var scripts; + +scripts = dbg.findScripts({}); +assertEq(scripts.indexOf(g1fw.script) != -1, true); +assertEq(scripts.indexOf(g2gw.script) != -1, true); + +scripts = dbg.findScripts({global: g1}); +assertEq(scripts.indexOf(g1fw.script) != -1, true); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({global: g2}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, true); + +scripts = dbg.findScripts({global: g3}); +// findScripts should only return debuggee scripts, and g3 isn't a +// debuggee, so this should be completely empty. +assertEq(scripts.length, 0); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-08-script2 b/js/src/jit-test/tests/debug/Debugger-findScripts-08-script2 new file mode 100644 index 000000000000..40b3aafff5bf --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-08-script2 @@ -0,0 +1,3 @@ +// -*- mode: js2 -*- +g1.eval('function g1g() {}'); +g2.eval('function g2g() {}'); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-08.js b/js/src/jit-test/tests/debug/Debugger-findScripts-08.js new file mode 100644 index 000000000000..13867361be0b --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-08.js @@ -0,0 +1,78 @@ +// Debugger.prototype.findScripts can filter scripts by URL. +var g1 = newGlobal('new-compartment'); +var g2 = newGlobal('new-compartment'); +var g3 = newGlobal('new-compartment'); + +// Define some functions whose url will be this test file. +g1.eval('function g1f() {}'); +g2.eval('function g2f() {}'); + +// Define some functions whose url will be a different file. +url2 = scriptdir + "Debugger-findScripts-08-script2"; +load(url2); + +var dbg = new Debugger(g1, g2, g3); + +var g1fw = dbg.addDebuggee(g1.g1f); +var g1gw = dbg.addDebuggee(g1.g1g); +var g2fw = dbg.addDebuggee(g2.g2f); +var g2gw = dbg.addDebuggee(g2.g2g); + +// Find the url of this file. +url = g1fw.script.url; + +var scripts; + +scripts = dbg.findScripts({}); +assertEq(scripts.indexOf(g1fw.script) != -1, true); +assertEq(scripts.indexOf(g1gw.script) != -1, true); +assertEq(scripts.indexOf(g2fw.script) != -1, true); +assertEq(scripts.indexOf(g2gw.script) != -1, true); + +scripts = dbg.findScripts({url:url}); +assertEq(scripts.indexOf(g1fw.script) != -1, true); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, true); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({url:url2}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, true); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, true); + +scripts = dbg.findScripts({url:url, global:g1}); +assertEq(scripts.indexOf(g1fw.script) != -1, true); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({url:url2, global:g1}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, true); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({url:url, global:g2}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, true); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({url:url2, global:g2}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, true); + +scripts = dbg.findScripts({url:"xlerb"}); // "XLERB"??? +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, false); + +scripts = dbg.findScripts({url:url, global:g3}); +assertEq(scripts.indexOf(g1fw.script) != -1, false); +assertEq(scripts.indexOf(g1gw.script) != -1, false); +assertEq(scripts.indexOf(g2fw.script) != -1, false); +assertEq(scripts.indexOf(g2gw.script) != -1, false); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-09.js b/js/src/jit-test/tests/debug/Debugger-findScripts-09.js new file mode 100644 index 000000000000..0b359681b1f2 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-09.js @@ -0,0 +1,44 @@ +// Passing bad query properties to Debugger.prototype.findScripts throws. +load(libdir + 'asserts.js'); + +var dbg = new Debugger(); +assertEq(dbg.findScripts().length, 0); +assertEq(dbg.findScripts({}).length, 0); + +assertEq(dbg.findScripts({global:{}}).length, 0); +assertThrowsInstanceOf(function () { dbg.findScripts({global:null}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({global:true}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({global:4}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({global:"I must have fruit!"}); }, TypeError); + +assertEq(dbg.findScripts({url:""}).length, 0); +assertThrowsInstanceOf(function () { dbg.findScripts({url:null}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:true}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:4}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:{}}); }, TypeError); + +assertEq(dbg.findScripts({url:"", line:1}).length, 0); +assertEq(dbg.findScripts({url:"", line:Math.sqrt(4)}).length, 0); + +// A 'line' property without a 'url' property is verboten. +assertThrowsInstanceOf(function () { dbg.findScripts({line:1}); }, TypeError); + +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:null}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:{}}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:true}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:""}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:0}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:-1}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:1.5}); }, TypeError); + +// Values of any type for 'innermost' are accepted. +assertEq(dbg.findScripts({url:"", line:1, innermost:true}).length, 0); +assertEq(dbg.findScripts({url:"", line:1, innermost:1}).length, 0); +assertEq(dbg.findScripts({url:"", line:1, innermost:"yes"}).length, 0); +assertEq(dbg.findScripts({url:"", line:1, innermost:{}}).length, 0); +assertEq(dbg.findScripts({url:"", line:1, innermost:[]}).length, 0); + +// An 'innermost' property without 'url' and 'line' properties is verboten. +assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true, line:1}); }, TypeError); +assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true, url:"foo"}); }, TypeError); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-10.js b/js/src/jit-test/tests/debug/Debugger-findScripts-10.js new file mode 100644 index 000000000000..0fa6b0fae706 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-10.js @@ -0,0 +1,13 @@ +// Specifying a non-debuggee global in a Debugger.prototype.findScripts query should +// cause the query to return no scripts. + +var g1 = newGlobal('new-compartment'); +g1.eval('function f(){}'); + +var g2 = newGlobal('new-compartment'); +g2.eval('function g(){}'); + +var dbg = new Debugger(g1); +assertEq(dbg.findScripts({global:g1}).length > 0, true); +assertEq(dbg.findScripts({global:g2}).length, 0); +assertEq(dbg.findScripts({global:this}).length, 0); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-11-script2 b/js/src/jit-test/tests/debug/Debugger-findScripts-11-script2 new file mode 100644 index 000000000000..7a170645e82c --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-11-script2 @@ -0,0 +1,18 @@ +// -*- mode: js2 -*- +// Line numbers in this file are checked in Debugger-findScripts-11.js. + +// line 3 + +var x = ""; +function f() { + x += "the map"; // line 8 + return function g() { + return "to me what you have stolen"; // line 10 + }; +} + +function h(x, y) { + if (x == 0) return y+1; // line 15 + if (y == 0) return h(x-1, 1); + return h(x-1, h(x, y-1)); +} diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-11.js b/js/src/jit-test/tests/debug/Debugger-findScripts-11.js new file mode 100644 index 000000000000..4dfc96a3fbf9 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-11.js @@ -0,0 +1,35 @@ +// Debugger.prototype.findScripts can filter scripts by line number. +var g = newGlobal('new-compartment'); +var dbg = new Debugger(g); + +var scriptname = scriptdir + 'Debugger-findScripts-11-script2'; +g.load(scriptname); + +var gfw = dbg.addDebuggee(g.f); +var ggw = dbg.addDebuggee(g.f()); +var ghw = dbg.addDebuggee(g.h); + +// Specifying a line outside of all functions screens out all function scripts. +assertEq(dbg.findScripts({url:scriptname, line:3}).indexOf(gfw.script) != -1, false); +assertEq(dbg.findScripts({url:scriptname, line:3}).indexOf(ggw.script) != -1, false); +assertEq(dbg.findScripts({url:scriptname, line:3}).indexOf(ghw.script) != -1, false); + +// Specifying a different url screens out scripts, even when global and line match. +assertEq(dbg.findScripts({url:"xlerb", line:8}).indexOf(gfw.script) != -1, false); +assertEq(dbg.findScripts({url:"xlerb", line:8}).indexOf(ggw.script) != -1, false); +assertEq(dbg.findScripts({url:"xlerb", line:8}).indexOf(ghw.script) != -1, false); + +// A line number within a function selects that function's script. +assertEq(dbg.findScripts({url:scriptname, line:8}).indexOf(gfw.script) != -1, true); +assertEq(dbg.findScripts({url:scriptname, line:8}).indexOf(ggw.script) != -1, false); +assertEq(dbg.findScripts({url:scriptname, line:8}).indexOf(ghw.script) != -1, false); + +// A line number within a nested function selects all enclosing functions' scripts. +assertEq(dbg.findScripts({url:scriptname, line:10}).indexOf(gfw.script) != -1, true); +assertEq(dbg.findScripts({url:scriptname, line:10}).indexOf(ggw.script) != -1, true); +assertEq(dbg.findScripts({url:scriptname, line:10}).indexOf(ghw.script) != -1, false); + +// A line number in a non-nested function selects that function. +assertEq(dbg.findScripts({url:scriptname, line:15}).indexOf(gfw.script) != -1, false); +assertEq(dbg.findScripts({url:scriptname, line:15}).indexOf(ggw.script) != -1, false); +assertEq(dbg.findScripts({url:scriptname, line:15}).indexOf(ghw.script) != -1, true); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-12-script1 b/js/src/jit-test/tests/debug/Debugger-findScripts-12-script1 new file mode 100644 index 000000000000..f9f484e9707e --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-12-script1 @@ -0,0 +1,19 @@ +// -*- mode: js2 -*- +// Script for Debugger-findScripts-12.js to load. +// Line numbers in this script are cited in the test. + +function f() { + // line 6 + function ff() { + return "my wuv, I want you always beside me"; // line 8 + }; + ff.global = this; + return ff; +}; + +function g() { + return "to Oz"; // line 15 +} + +f.global = this; +g.global = this; diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-12-script2 b/js/src/jit-test/tests/debug/Debugger-findScripts-12-script2 new file mode 100644 index 000000000000..3350c8ed294a --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-12-script2 @@ -0,0 +1,19 @@ +// -*- mode: js2 -*- +// Script for Debugger-findScripts-12.js to load. +// Line numbers in this script are cited in the test, and must align with ...-script1. + +function h() { + // line 6 + function hh() { + return "on investment"; // line 8 + }; + hh.global = this; + return hh; +}; + +function i() { + return "to innocence"; // line 15 +} + +h.global = this; +i.global = this; diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-12.js b/js/src/jit-test/tests/debug/Debugger-findScripts-12.js new file mode 100644 index 000000000000..93e0aaafe03e --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-12.js @@ -0,0 +1,127 @@ +// Debugger.prototype.findScripts can filter by global, url, and line number. + +// Two scripts, with different functions at the same line numbers. +var url1 = scriptdir + 'Debugger-findScripts-12-script1'; +var url2 = scriptdir + 'Debugger-findScripts-12-script2'; + +// Three globals: two with code, one with nothing. +var g1 = newGlobal('new-compartment'); +g1.toSource = function () "[global g1]"; +g1.load(url1); +g1.load(url2); +var g2 = newGlobal('new-compartment'); +g2.toSource = function () "[global g2]"; +g2.load(url1); +g2.load(url2); +var g3 = newGlobal('new-compartment'); + +var dbg = new Debugger(g1, g2, g3); + +function script(func) { + var script = dbg.addDebuggee(func).script; + script.toString = function () + "[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]"; + return script; +} + +// The function scripts we know of. There may be random eval scripts involved, but +// we don't care about those. +var allScripts = ([g1.f, g1.f(), g1.g, g1.h, g1.h(), g1.i, + g2.f, g2.f(), g2.g, g2.h, g2.h(), g2.i].map(script)); + +// Search for scripts using |query|, expecting no members of allScripts +// except those given in |expected| in the result. If |expected| is +// omitted, expect no members of allScripts at all. +function queryExpectOnly(query, expected) { + print(); + print("queryExpectOnly(" + uneval(query) + ")"); + var scripts = dbg.findScripts(query); + var present = allScripts.filter(function (s) { return scripts.indexOf(s) != -1; }); + if (expected) { + expected = expected.map(script); + expected.forEach(function (s) { + if (present.indexOf(s) == -1) + assertEq(s + " not present", "is present"); + }); + present.forEach(function (s) { + if (expected.indexOf(s) == -1) + assertEq(s + " is present", "not present"); + }); + } else { + assertEq(present.length, 0); + } +} + +// We have twelve functions: two globals, each with two urls, each +// defining three functions. Show that all the different combinations of +// query parameters select what they should. + +// There are gaps in the pattern: +// - You can only filter by line if you're also filtering by url. +// - You can't ask for only the innermost scripts unless you're filtering by line. + +// Filtering by global, url, and line produces one function, or two +// where they are nested. +queryExpectOnly({ global:g1, url:url1, line: 6 }, [g1.f ]); +queryExpectOnly({ global:g1, url:url1, line: 8 }, [g1.f, g1.f()]); +queryExpectOnly({ global:g1, url:url1, line: 15 }, [g1.g ]); +queryExpectOnly({ global:g1, url:url2, line: 6 }, [g1.h ]); +queryExpectOnly({ global:g1, url:url2, line: 8 }, [g1.h, g1.h()]); +queryExpectOnly({ global:g1, url:url2, line: 15 }, [g1.i ]); +queryExpectOnly({ global:g2, url:url1, line: 6 }, [g2.f ]); +queryExpectOnly({ global:g2, url:url1, line: 8 }, [g2.f, g2.f()]); +queryExpectOnly({ global:g2, url:url1, line: 15 }, [g2.g ]); +queryExpectOnly({ global:g2, url:url2, line: 6 }, [g2.h ]); +queryExpectOnly({ global:g2, url:url2, line: 8 }, [g2.h, g2.h()]); +queryExpectOnly({ global:g2, url:url2, line: 15 }, [g2.i ]); + +// Filtering by global, url, and line, and requesting only the innermost +// function at each point, should produce only one function. +queryExpectOnly({ global:g1, url:url1, line: 6, innermost: true }, [g1.f ]); +queryExpectOnly({ global:g1, url:url1, line: 8, innermost: true }, [g1.f()]); +queryExpectOnly({ global:g1, url:url1, line: 15, innermost: true }, [g1.g ]); +queryExpectOnly({ global:g1, url:url2, line: 6, innermost: true }, [g1.h ]); +queryExpectOnly({ global:g1, url:url2, line: 8, innermost: true }, [g1.h()]); +queryExpectOnly({ global:g1, url:url2, line: 15, innermost: true }, [g1.i ]); +queryExpectOnly({ global:g2, url:url1, line: 6, innermost: true }, [g2.f ]); +queryExpectOnly({ global:g2, url:url1, line: 8, innermost: true }, [g2.f()]); +queryExpectOnly({ global:g2, url:url1, line: 15, innermost: true }, [g2.g ]); +queryExpectOnly({ global:g2, url:url2, line: 6, innermost: true }, [g2.h ]); +queryExpectOnly({ global:g2, url:url2, line: 8, innermost: true }, [g2.h()]); +queryExpectOnly({ global:g2, url:url2, line: 15, innermost: true }, [g2.i ]); + +// Filtering by url and global should produce sets of three scripts. +queryExpectOnly({ global:g1, url:url1 }, [g1.f, g1.f(), g1.g]); +queryExpectOnly({ global:g1, url:url2 }, [g1.h, g1.h(), g1.i]); +queryExpectOnly({ global:g2, url:url1 }, [g2.f, g2.f(), g2.g]); +queryExpectOnly({ global:g2, url:url2 }, [g2.h, g2.h(), g2.i]); + +// Filtering by url and line, innermost-only, should produce sets of two scripts, +// or four where there are nested functions. +queryExpectOnly({ url:url1, line: 6 }, [g1.f, g2.f ]); +queryExpectOnly({ url:url1, line: 8 }, [g1.f, g1.f(), g2.f, g2.f()]); +queryExpectOnly({ url:url1, line:15 }, [g1.g, g2.g ]); +queryExpectOnly({ url:url2, line: 6 }, [g1.h, g2.h ]); +queryExpectOnly({ url:url2, line: 8 }, [g1.h, g1.h(), g2.h, g2.h()]); +queryExpectOnly({ url:url2, line:15 }, [g1.i, g2.i ]); + +// Filtering by url and line, and requesting only the innermost scripts, +// should always produce pairs of scripts. +queryExpectOnly({ url:url1, line: 6, innermost: true }, [g1.f, g2.f ]); +queryExpectOnly({ url:url1, line: 8, innermost: true }, [g1.f(), g2.f()]); +queryExpectOnly({ url:url1, line:15, innermost: true }, [g1.g, g2.g ]); +queryExpectOnly({ url:url2, line: 6, innermost: true }, [g1.h, g2.h ]); +queryExpectOnly({ url:url2, line: 8, innermost: true }, [g1.h(), g2.h()]); +queryExpectOnly({ url:url2, line:15, innermost: true }, [g1.i, g2.i ]); + +// Filtering by global only should produce sets of six scripts. +queryExpectOnly({ global:g1 }, [g1.f, g1.f(), g1.g, g1.h, g1.h(), g1.i]); +queryExpectOnly({ global:g2 }, [g2.f, g2.f(), g2.g, g2.h, g2.h(), g2.i]); + +// Filtering by url should produce sets of six scripts. +queryExpectOnly({ url:url1 }, [g1.f, g1.f(), g1.g, g2.f, g2.f(), g2.g]); +queryExpectOnly({ url:url2 }, [g1.h, g1.h(), g1.i, g2.h, g2.h(), g2.i]); + +// Filtering by no axes should produce all twelve scripts. +queryExpectOnly({}, [g1.f, g1.f(), g1.g, g1.h, g1.h(), g1.i, + g2.f, g2.f(), g2.g, g2.h, g2.h(), g2.i]); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-14.js b/js/src/jit-test/tests/debug/Debugger-findScripts-14.js new file mode 100644 index 000000000000..f99045033fe1 --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-14.js @@ -0,0 +1,29 @@ +// Debugger.prototype.findScripts can find the innermost script at a given +// source location. +var g = newGlobal('new-compartment'); +var dbg = new Debugger(g); + +function script(f) { + return dbg.addDebuggee(f).script; +} + +function arrayIsOnly(array, element) { + return array.length == 1 && array[0] === element; +} + +url = scriptdir + 'Debugger-findScripts-14.script1'; +g.load(url); + +var scripts; + +// When we're doing 'innermost' queries, we don't have to worry about finding +// random eval scripts: we should get exactly one script, for the function +// covering that line. +scripts = dbg.findScripts({url:url, line:4, innermost:true}); +assertEq(arrayIsOnly(scripts, script(g.f)), true); + +scripts = dbg.findScripts({url:url, line:6, innermost:true}); +assertEq(arrayIsOnly(scripts, script(g.f())), true); + +scripts = dbg.findScripts({url:url, line:8, innermost:true}); +assertEq(arrayIsOnly(scripts, script(g.f()())), true); diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-14.script1 b/js/src/jit-test/tests/debug/Debugger-findScripts-14.script1 new file mode 100644 index 000000000000..00da459fc14c --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-14.script1 @@ -0,0 +1,12 @@ +// -*- mode:js2 -*- + +function f() { + var x = 1; // line 4 + return function g() { + var y = 2; // line 6 + return function h() { + var z = 3; // line 8 + return x+y+z; + }; + }; +} diff --git a/js/src/js.msg b/js/src/js.msg index 6690ac8bda11..cead265e494f 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -375,3 +375,5 @@ MSG_DEF(JSMSG_CSP_BLOCKED_EVAL, 288, 0, JSEXN_ERR, "call to eval() blocked MSG_DEF(JSMSG_DEBUG_NO_SCOPE_OBJECT, 289, 0, JSEXN_TYPEERR, "declarative Environments don't have binding objects") MSG_DEF(JSMSG_EMPTY_CONSEQUENT, 290, 0, JSEXN_SYNTAXERR, "mistyped ; after conditional?") MSG_DEF(JSMSG_NOT_ITERABLE, 291, 1, JSEXN_TYPEERR, "{0} is not iterable") +MSG_DEF(JSMSG_QUERY_LINE_WITHOUT_URL, 292, 0, JSEXN_TYPEERR, "findScripts query object has 'line' property, but no 'url' property") +MSG_DEF(JSMSG_QUERY_INNERMOST_WITHOUT_LINE_URL, 293, 0, JSEXN_TYPEERR, "findScripts query object has 'innermost' property without both 'url' and 'line' properties") diff --git a/js/src/jsatom.tbl b/js/src/jsatom.tbl index 35cddbb076dc..e2c6f3ba7394 100644 --- a/js/src/jsatom.tbl +++ b/js/src/jsatom.tbl @@ -121,3 +121,5 @@ DEFINE_PROTOTYPE_ATOM(WeakMap) DEFINE_ATOM(byteLength, "byteLength") DEFINE_KEYWORD_ATOM(return) DEFINE_KEYWORD_ATOM(throw) +DEFINE_ATOM(url, "url") +DEFINE_ATOM(innermost, "innermost") diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 605ab21a66c2..2c324ba418ad 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1972,27 +1972,345 @@ Debugger::removeDebuggeeGlobal(FreeOp *fop, GlobalObject *global, debuggees.remove(global); } -/* A set of JSCompartment pointers. */ -typedef HashSet, RuntimeAllocPolicy> CompartmentSet; +/* + * A class for parsing 'findScripts' query arguments and searching for + * scripts that match the criteria they represent. + */ +class Debugger::ScriptQuery { + public: + /* Construct a ScriptQuery to use matching scripts for |dbg|. */ + ScriptQuery(JSContext *cx, Debugger *dbg): + cx(cx), debugger(dbg), compartments(cx), innermostForGlobal(cx) {} + + /* + * Initialize this ScriptQuery. Raise an error and return false if we + * haven't enough memory. + */ + bool init() { + if (!globals.init() || + !compartments.init() || + !innermostForGlobal.init()) + { + js_ReportOutOfMemory(cx); + return false; + } + + return true; + } + + /* + * Parse the query object |query|, and prepare to match only the scripts + * it specifies. + */ + bool parseQuery(JSObject *query) { + /* + * Check for a 'global' property, which limits the results to those + * scripts scoped to a particular global object. + */ + Value global; + if (!query->getProperty(cx, cx->runtime->atomState.globalAtom, &global)) + return false; + if (global.isUndefined()) { + matchAllDebuggeeGlobals(); + } else { + JSObject *referent = debugger->unwrapDebuggeeArgument(cx, global); + if (!referent) + return false; + GlobalObject *globalObject = &referent->global(); + + /* + * If the given global isn't a debuggee, just leave the set of + * acceptable globals empty; we'll return no scripts. + */ + if (debugger->debuggees.has(globalObject)) { + if (!matchSingleGlobal(globalObject)) + return false; + } + } + + /* Check for a 'url' property. */ + if (!query->getProperty(cx, cx->runtime->atomState.urlAtom, &url)) + return false; + if (!url.isUndefined() && !url.isString()) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE, + "query object's 'url' property", "neither undefined nor a string"); + return false; + } + + /* Check for a 'line' property. */ + Value lineProperty; + if (!query->getProperty(cx, cx->runtime->atomState.lineAtom, &lineProperty)) + return false; + if (lineProperty.isUndefined()) { + hasLine = false; + } else if (lineProperty.isNumber()) { + if (url.isUndefined()) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_QUERY_LINE_WITHOUT_URL); + return false; + } + double doubleLine = lineProperty.toNumber(); + if (doubleLine <= 0 || (unsigned int) doubleLine != doubleLine) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEBUG_BAD_LINE); + return false; + } + hasLine = true; + line = doubleLine; + } else { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE, + "query object's 'line' property", + "neither undefined nor an integer"); + return false; + } + + /* Check for an 'innermost' property. */ + Value innermostProperty; + if (!query->getProperty(cx, cx->runtime->atomState.innermostAtom, &innermostProperty)) + return false; + innermost = js_ValueToBoolean(innermostProperty); + if (innermost) { + /* Technically, we need only check hasLine, but this is clearer. */ + if (url.isUndefined() || !hasLine) { + JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, + JSMSG_QUERY_INNERMOST_WITHOUT_LINE_URL); + return false; + } + } + + return true; + } + + /* Set up this ScriptQuery appropriately for a missing query argument. */ + bool omittedQuery() { + url.setUndefined(); + hasLine = false; + innermost = false; + return matchAllDebuggeeGlobals(); + } + + /* + * Search all relevant compartments and the stack for scripts matching + * this query, and append the matching scripts to |vector|. + */ + bool findScripts(AutoScriptVector *vector) { + if (!prepareQuery()) + return false; + + /* Search each compartment for debuggee scripts. */ + for (CompartmentSet::Range r = compartments.all(); !r.empty(); r.popFront()) { + for (gc::CellIter i(r.front(), gc::FINALIZE_SCRIPT); !i.done(); i.next()) { + JSScript *script = i.get(); + GlobalObject *global = script->getGlobalObjectOrNull(); + if (global && !consider(script, global, vector)) + return false; + } + } + + /* + * Since eval scripts have no global, we need to find them via the call + * stack, where frame's scope tells us the global in use. + */ + for (FrameRegsIter fri(cx); !fri.done(); ++fri) { + if (fri.fp()->isEvalFrame()) { + JSScript *script = fri.fp()->script(); + + /* + * If eval scripts never have global objects set, then we don't need + * to check the existing script vector for duplicates, since we only + * include scripts with globals above. + */ + JS_ASSERT(!script->getGlobalObjectOrNull()); + + GlobalObject *global = &fri.fp()->scopeChain().global(); + if (!consider(script, global, vector)) + return false; + } + } + + /* + * For most queries, we just accumulate results in 'vector' as we find + * them. But if this is an 'innermost' query, then we've accumulated the + * results in the 'innermostForGlobal' map. In that case, we now need to + * walk that map and populate 'vector'. + */ + if (innermost) { + for (GlobalToScriptMap::Range r = innermostForGlobal.all(); !r.empty(); r.popFront()) { + if (!vector->append(r.front().value)) { + js_ReportOutOfMemory(cx); + return false; + } + } + } + + return true; + } + + private: + /* The context in which we should do our work. */ + JSContext *cx; + + /* The debugger for which we conduct queries. */ + Debugger *debugger; + + /* A script must run in one of these globals to match the query. */ + GlobalObjectSet globals; + + typedef HashSet, RuntimeAllocPolicy> + CompartmentSet; + + /* The smallest set of compartments that contains all globals in globals. */ + CompartmentSet compartments; + + /* If this is a string, matching scripts have urls equal to it. */ + Value url; + + /* url as a C string. */ + JSAutoByteString urlCString; + + /* True if the query contained a 'line' property. */ + bool hasLine; + + /* The line matching scripts must cover. */ + unsigned int line; + + /* True if the query has an 'innermost' property whose value is true. */ + bool innermost; + + typedef HashMap, RuntimeAllocPolicy> + GlobalToScriptMap; + + /* + * For 'innermost' queries, a map from global objects to the innermost + * script we've seen so far in that global. (Instantiation code size + * explosion ho!) + */ + GlobalToScriptMap innermostForGlobal; + + /* Arrange for this ScriptQuery to match only scripts that run in |global|. */ + bool matchSingleGlobal(GlobalObject *global) { + JS_ASSERT(globals.count() == 0); + if (!globals.put(global)) { + js_ReportOutOfMemory(cx); + return false; + } + return true; + } + + /* + * Arrange for this ScriptQuery to match all scripts running in debuggee + * globals. + */ + bool matchAllDebuggeeGlobals() { + JS_ASSERT(globals.count() == 0); + /* Copy the debugger's set of debuggee globals to our global set. */ + for (GlobalObjectSet::Range r = debugger->debuggees.all(); !r.empty(); r.popFront()) { + if (!globals.put(r.front())) { + js_ReportOutOfMemory(cx); + return false; + } + } + return true; + } + + /* + * Given that parseQuery or omittedQuery has been called, prepare to + * match scripts. Set urlCString as appropriate. + */ + bool prepareQuery() { + /* + * Compute the proper value for |compartments|, given the present + * value of |globals|. + */ + for (GlobalObjectSet::Range r = globals.all(); !r.empty(); r.popFront()) { + if (!compartments.put(r.front()->compartment())) { + js_ReportOutOfMemory(cx); + return false; + } + } + + /* Compute urlCString, if a url was given. */ + if (url.isString()) { + if (!urlCString.encode(cx, url.toString())) + return false; + } + + return true; + } + + /* + * If |script|, a script in |global|, matches this query, append it to + * |vector| or place it in |innermostForGlobal|, as appropriate. Return true + * if no error occurs, false if an error occurs. + */ + bool consider(JSScript *script, GlobalObject *global, AutoScriptVector *vector) { + if (!globals.has(global)) + return true; + if (urlCString.ptr()) { + if (!script->filename || strcmp(script->filename, urlCString.ptr()) != 0) + return true; + } + if (hasLine) { + if (line < script->lineno || script->lineno + js_GetScriptLineExtent(script) < line) + return true; + } + + if (innermost) { + /* + * For 'innermost' queries, we don't place scripts in |vector| right + * away; we may later find another script that is nested inside this + * one. Instead, we record the innermost script we've found so far + * for each global in innermostForGlobal, and only populate |vector| + * at the bottom of findScripts, when we've traversed all the + * scripts. + * + * So: check this script against the innermost one we've found so + * far (if any), as recorded in innermostForGlobal, and replace that + * if it's better. + */ + GlobalToScriptMap::AddPtr p = innermostForGlobal.lookupForAdd(global); + if (p) { + /* Is our newly found script deeper than the last one we found? */ + JSScript *incumbent = p->value; + if (script->staticLevel > incumbent->staticLevel) + p->value = script; + } else { + /* + * This is the first matching script we've encountered for this + * global, so it is thus the innermost such script. + */ + if (!innermostForGlobal.add(p, global, script)) { + js_ReportOutOfMemory(cx); + return false; + } + } + } else { + /* Record this matching script in the results vector. */ + if (!vector->append(script)) { + js_ReportOutOfMemory(cx); + return false; + } + } + + return true; + } +}; JSBool Debugger::findScripts(JSContext *cx, unsigned argc, Value *vp) { THIS_DEBUGGER(cx, argc, vp, "findScripts", args, dbg); - CompartmentSet compartments(cx); - if (!compartments.init()) { - js_ReportOutOfMemory(cx); + ScriptQuery query(cx, dbg); + if (!query.init()) return false; - } - /* Assemble the set of debuggee compartments. */ - for (GlobalObjectSet::Range r = dbg->debuggees.all(); !r.empty(); r.popFront()) { - if (!compartments.put(r.front()->compartment())) { - js_ReportOutOfMemory(cx); + if (argc >= 1) { + JSObject *queryObject = NonNullObject(cx, args[0]); + if (!queryObject || !query.parseQuery(queryObject)) return false; - } - } + } else { + if (!query.omittedQuery()) + return false; + } /* * Accumulate the scripts in an AutoScriptVector, instead of creating @@ -2001,40 +2319,8 @@ Debugger::findScripts(JSContext *cx, unsigned argc, Value *vp) */ AutoScriptVector scripts(cx); - /* Search each compartment for debuggee scripts. */ - for (CompartmentSet::Range r = compartments.all(); !r.empty(); r.popFront()) { - for (gc::CellIter i(r.front(), gc::FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); - GlobalObject *global = script->getGlobalObjectOrNull(); - if (global && dbg->debuggees.has(global)) { - if (!scripts.append(script)) { - js_ReportOutOfMemory(cx); - return false; - } - } - } - } - - /* - * Since eval scripts have no global, we need to find them via the call - * stack, where frame's scope tells us the global in use. - */ - for (FrameRegsIter fri(cx); !fri.done(); ++fri) { - if (fri.fp()->isEvalFrame() && dbg->debuggees.has(&fri.fp()->scopeChain().global())) { - JSScript *script = fri.fp()->script(); - - /* - * If eval scripts never have global objects set, then we don't need - * to check the existing script vector for duplicates, since we only - * include scripts with globals above. - */ - JS_ASSERT(!script->getGlobalObjectOrNull()); - if (!scripts.append(script)) { - js_ReportOutOfMemory(cx); - return false; - } - } - } + if (!query.findScripts(&scripts)) + return false; JSObject *result = NewDenseAllocatedArray(cx, scripts.length(), NULL); if (!result) diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 5824c06a5c8d..0a9eea33060a 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -120,6 +120,7 @@ class Debugger { ObjectWeakMap environments; class FrameRange; + class ScriptQuery; bool addDebuggeeGlobal(JSContext *cx, GlobalObject *obj); void removeDebuggeeGlobal(FreeOp *fop, GlobalObject *global, From 00830bb88b1ec773dff69d64c60a1d7f05976d1a Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Fri, 6 Apr 2012 10:31:47 +1000 Subject: [PATCH 094/152] Bug 737245 followup: backout chunk of pymake that slipped in with this bug's patch. DONTBUILD --- build/pymake/pymake/process.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build/pymake/pymake/process.py b/build/pymake/pymake/process.py index 427f6c63ee9f..0fdd68bdbca8 100644 --- a/build/pymake/pymake/process.py +++ b/build/pymake/pymake/process.py @@ -210,11 +210,7 @@ class PythonJob(Job): if self.method not in m.__dict__: print >>sys.stderr, "No method named '%s' in module %s" % (method, module) return -127 - try: - m.__dict__[self.method](self.argv) - except TypeError: - print >> sys.stderr, "FAILED calling %r in %r" % (self.method, m) - raise + m.__dict__[self.method](self.argv) except PythonException, e: print >>sys.stderr, e return e.exitcode From 6cbec49cd2b856f01608d978042c01dd71c4ad9c Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Thu, 5 Apr 2012 17:56:53 -0700 Subject: [PATCH 095/152] Bug 730452 - Trigger post barriers on moveDenseArrayElements; r=billm We cannot do this per-element because it is too slow. Instead we have a special storebuffer entry for this case so we can do all work at gc time. --HG-- extra : rebase_source : 7e48184d38b442b2bdba38553cf93f9d629debf1 --- js/src/gc/Barrier.h | 11 +++++++++++ js/src/jsobjinlines.h | 1 + 2 files changed, 12 insertions(+) diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index 77d2791b22b3..7a9a7e1bbb49 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -395,6 +395,17 @@ class HeapSlot : public EncapsulatedValue inline void post(JSCompartment *comp, JSObject *owner, uint32_t slot); }; +/* + * NOTE: This is a placeholder for bug 619558. + * + * Run a post write barrier that encompasses multiple contiguous slots in a + * single step. + */ +static inline void +SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count) +{ +} + static inline const Value * Valueify(const EncapsulatedValue *array) { diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 4bd2b17637d0..477d914d7ef1 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -511,6 +511,7 @@ JSObject::moveDenseArrayElements(unsigned dstStart, unsigned srcStart, unsigned } } else { memmove(elements + dstStart, elements + srcStart, count * sizeof(js::HeapSlot)); + SlotRangeWriteBarrierPost(comp, this, dstStart, count); } } From 61a15be5dee3f228da1815065c497b5b95dc0d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=20Figui=C3=A8re?= Date: Thu, 5 Apr 2012 18:49:43 -0700 Subject: [PATCH 096/152] Bug 743114 - Regression: Autocomplete role should be ignored on Mac. r=tbsaunde --- accessible/src/mac/nsRoleMap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accessible/src/mac/nsRoleMap.h b/accessible/src/mac/nsRoleMap.h index 4bdac03f9d78..99413f5110c8 100644 --- a/accessible/src/mac/nsRoleMap.h +++ b/accessible/src/mac/nsRoleMap.h @@ -142,7 +142,7 @@ static const NSString* AXRoles [] = { NSAccessibilityGroupRole, // roles::FOOTER 97 NSAccessibilityGroupRole, // roles::PARAGRAPH 98 @"AXRuler", // roles::RULER 99 10.4+ only, so we re-define the constant. - NSAccessibilityComboBoxRole, // roles::AUTOCOMPLETE 100 + NSAccessibilityUnknownRole, // roles::AUTOCOMPLETE 100 NSAccessibilityTextFieldRole, // roles::EDITBAR 101 NSAccessibilityTextFieldRole, // roles::ENTRY 102 NSAccessibilityStaticTextRole, // roles::CAPTION 103 From ee79d7d84b16306c8210409f822699fb54c835f5 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 5 Apr 2012 22:24:42 -0400 Subject: [PATCH 097/152] Bug 742549. Add a .crossOrigin IDL property. r=sicking Note that the content attribute is crossorigin (lowercase) in SVG, hence the need to have different content and IDL property names in the test. --- content/base/src/nsGenericElement.h | 19 +++++++++ .../html/content/src/nsGenericHTMLElement.cpp | 7 ---- .../html/content/src/nsGenericHTMLElement.h | 29 -------------- .../html/content/src/nsHTMLScriptElement.cpp | 1 + content/html/content/test/Makefile.in | 1 + content/html/content/test/test_bug742549.html | 40 +++++++++++++++++++ .../svg/content/src/nsSVGScriptElement.cpp | 15 ++----- .../html/nsIDOMHTMLScriptElement.idl | 3 +- dom/interfaces/svg/nsIDOMSVGScriptElement.idl | 3 +- 9 files changed, 68 insertions(+), 50 deletions(-) create mode 100644 content/html/content/test/test_bug742549.html diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 9ef8a236c24c..b8b3adcae136 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -1047,6 +1047,25 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \ NS_GetDOMClassInfoInstance(eDOMClassInfo_##_interface##_id)); \ } +/** + * A macro to implement the getter and setter for a given string + * valued content property. The method uses the generic GetAttr and + * SetAttr methods. We use the 5-argument form of SetAttr, because + * some consumers only implement that one, hiding superclass + * 4-argument forms. + */ +#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \ + NS_IMETHODIMP \ + _class::Get##_method(nsAString& aValue) \ + { \ + return GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \ + } \ + NS_IMETHODIMP \ + _class::Set##_method(const nsAString& aValue) \ + { \ + return SetAttr(kNameSpaceID_None, nsGkAtoms::_atom, nsnull, aValue, true); \ + } + /** * Tearoff class to implement nsITouchEventReceiver */ diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 665b64f29b21..a65fb85b6e58 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2263,13 +2263,6 @@ nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttri //---------------------------------------------------------------------- -nsresult -nsGenericHTMLElement::GetAttrHelper(nsIAtom* aAttr, nsAString& aValue) -{ - GetAttr(kNameSpaceID_None, aAttr, aValue); - return NS_OK; -} - nsresult nsGenericHTMLElement::SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue) { diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 452c8f61b191..f7dc45aaeb91 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -607,18 +607,6 @@ protected: virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const; - /** - * Helper method for NS_IMPL_STRING_ATTR macro. - * Gets the value of an attribute, returns empty string if - * attribute isn't set. Only works for attributes in null namespace. - * - * @param aAttr name of attribute. - * @param aDefault default-value to return if attribute isn't set. - * @param aResult result value [out] - * @result always NS_OK - */ - NS_HIDDEN_(nsresult) GetAttrHelper(nsIAtom* aAttr, nsAString& aValue); - /** * Helper method for NS_IMPL_STRING_ATTR macro. * Sets the value of an attribute, returns specified default value if the @@ -1006,23 +994,6 @@ PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32); //---------------------------------------------------------------------- -/** - * A macro to implement the getter and setter for a given string - * valued content property. The method uses the generic GetAttr and - * SetAttr methods. - */ -#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \ - NS_IMETHODIMP \ - _class::Get##_method(nsAString& aValue) \ - { \ - return GetAttrHelper(nsGkAtoms::_atom, aValue); \ - } \ - NS_IMETHODIMP \ - _class::Set##_method(const nsAString& aValue) \ - { \ - return SetAttrHelper(nsGkAtoms::_atom, aValue); \ - } - /** * This macro is similar to NS_IMPL_STRING_ATTR except that the getter method * falls back to an alternative method if the content attribute isn't set. diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index 88a25dffaf5d..97a70be56c5e 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -243,6 +243,7 @@ NS_IMPL_URI_ATTR(nsHTMLScriptElement, Src, src) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, HtmlFor, _for) NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Event, event) +NS_IMPL_STRING_ATTR(nsHTMLScriptElement, CrossOrigin, crossorigin) nsresult nsHTMLScriptElement::GetAsync(bool* aValue) diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index ee109008baa4..0cc068fa296e 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -300,6 +300,7 @@ _TEST_FILES = \ test_bug694503.html \ test_object_plugin_nav.html \ test_bug742030.html \ + test_bug742549.html \ $(NULL) _BROWSER_TEST_FILES = \ diff --git a/content/html/content/test/test_bug742549.html b/content/html/content/test/test_bug742549.html new file mode 100644 index 000000000000..72ecfba98892 --- /dev/null +++ b/content/html/content/test/test_bug742549.html @@ -0,0 +1,40 @@ + + + + + + Test for Bug 742549 + + + + + +Mozilla Bug 742549 +

+ +
+
+
+ + diff --git a/content/svg/content/src/nsSVGScriptElement.cpp b/content/svg/content/src/nsSVGScriptElement.cpp index 1ec932912949..37e9cfd22a59 100644 --- a/content/svg/content/src/nsSVGScriptElement.cpp +++ b/content/svg/content/src/nsSVGScriptElement.cpp @@ -177,18 +177,9 @@ nsSVGScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const // nsIDOMSVGScriptElement methods /* attribute DOMString type; */ -NS_IMETHODIMP -nsSVGScriptElement::GetType(nsAString & aType) -{ - GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType); - - return NS_OK; -} -NS_IMETHODIMP -nsSVGScriptElement::SetType(const nsAString & aType) -{ - return SetAttr(kNameSpaceID_None, nsGkAtoms::type, aType, true); -} +NS_IMPL_STRING_ATTR(nsSVGScriptElement, Type, type) +/* attribute DOMString crossOrigin */ +NS_IMPL_STRING_ATTR(nsSVGScriptElement, CrossOrigin, crossorigin) //---------------------------------------------------------------------- // nsIDOMSVGURIReference methods diff --git a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl index 80705bd7af27..ec7ba7969abf 100644 --- a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl @@ -50,7 +50,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(aa028093-b990-4b57-b0d4-e82d80ca85b1)] +[scriptable, uuid(2a9a1a1b-d4cf-4594-a71c-f47ebd790f0d)] interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement { attribute DOMString src; @@ -62,4 +62,5 @@ interface nsIDOMHTMLScriptElement : nsIDOMHTMLElement attribute DOMString htmlFor; attribute DOMString event; + attribute DOMString crossOrigin; }; diff --git a/dom/interfaces/svg/nsIDOMSVGScriptElement.idl b/dom/interfaces/svg/nsIDOMSVGScriptElement.idl index 023d84b3adf5..21e73b1ddf79 100644 --- a/dom/interfaces/svg/nsIDOMSVGScriptElement.idl +++ b/dom/interfaces/svg/nsIDOMSVGScriptElement.idl @@ -38,7 +38,7 @@ #include "nsIDOMSVGElement.idl" -[scriptable, uuid(2a837684-cf83-4fea-af06-fd1f351f901b)] +[scriptable, uuid(5f7314ba-d7b9-457b-a299-cb57658464ee)] interface nsIDOMSVGScriptElement : nsIDOMSVGElement /* @@ -55,4 +55,5 @@ interface nsIDOMSVGScriptElement { attribute DOMString type; // raises DOMException on setting + attribute DOMString crossOrigin; }; From 90145577f2e25b5dab4529989984bc10191a5bf1 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 5 Apr 2012 19:25:34 -0700 Subject: [PATCH 098/152] Bug 735083 - batch inserts into Fennec history provider. r=rnewman --- .../AndroidBrowserHistoryDataAccessor.java | 89 +++++++++++++++++ .../AndroidBrowserHistoryDataExtender.java | 68 ++++++------- ...ndroidBrowserHistoryRepositorySession.java | 98 ++++++++++++++++++- .../AndroidBrowserRepositoryDataAccessor.java | 2 +- 4 files changed, 216 insertions(+), 41 deletions(-) diff --git a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java index c5b14893b7c2..85b903881ca1 100644 --- a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java +++ b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java @@ -4,15 +4,21 @@ package org.mozilla.gecko.sync.repositories.android; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.mozilla.gecko.db.BrowserContract; import org.mozilla.gecko.sync.Logger; +import org.mozilla.gecko.sync.repositories.NullCursorException; import org.mozilla.gecko.sync.repositories.domain.HistoryRecord; import org.mozilla.gecko.sync.repositories.domain.Record; import android.content.ContentValues; import android.content.Context; +import android.database.Cursor; import android.net.Uri; public class AndroidBrowserHistoryDataAccessor extends @@ -93,4 +99,87 @@ public class AndroidBrowserHistoryDataAccessor extends public void closeExtender() { dataExtender.close(); } + + public static String[] GUID_AND_ID = new String[] { BrowserContract.History.GUID, BrowserContract.History._ID }; + + /** + * Insert records. + *

+ * This inserts all the records (using ContentProvider.bulkInsert), + * then inserts all the visit information (using the data extender's + * bulkInsert, which internally uses a single database + * transaction), and then optionally updates the androidID of + * each record. + * + * @param records + * The records to insert. + * @param fetchFreshAndroidIDs + * true to update the androidID of each + * record; false to invalidate them all. + * @throws NullCursorException + */ + public void bulkInsert(ArrayList records, boolean fetchFreshAndroidIDs) throws NullCursorException { + if (records.isEmpty()) { + Logger.debug(LOG_TAG, "No records to insert, returning."); + } + + int size = records.size(); + ContentValues[] cvs = new ContentValues[size]; + String[] guids = new String[size]; + Map guidToRecord = new HashMap(); + int index = 0; + for (Record record : records) { + if (record.guid == null) { + throw new IllegalArgumentException("Record with null GUID passed in to bulkInsert."); + } + cvs[index] = getContentValues(record); + guids[index] = record.guid; + guidToRecord.put(record.guid, record); + index += 1; + } + + // First update the history records. + int inserted = context.getContentResolver().bulkInsert(getUri(), cvs); + if (inserted == size) { + Logger.debug(LOG_TAG, "Inserted " + inserted + " records, as expected."); + } else { + Logger.debug(LOG_TAG, "Inserted " + + inserted + " records but expected " + + size + " records; continuing to update visits."); + } + // Then update the history visits. + dataExtender.bulkInsert(records); + + // And finally patch up the androidIDs. + if (!fetchFreshAndroidIDs) { + return; + } + + // We do this here to save a few loops. + String guidIn = RepoUtils.computeSQLInClause(guids.length, BrowserContract.History.GUID); + Cursor cursor = queryHelper.safeQuery("", GUID_AND_ID, guidIn, guids, null); + int guidIndex = cursor.getColumnIndexOrThrow(BrowserContract.History.GUID); + int androidIDIndex = cursor.getColumnIndexOrThrow(BrowserContract.History._ID); + + try { + cursor.moveToFirst(); + while (!cursor.isAfterLast()) { + String guid = cursor.getString(guidIndex); + int androidID = cursor.getInt(androidIDIndex); + cursor.moveToNext(); + + Record record = guidToRecord.get(guid); + if (record == null) { + // Should never happen! + Logger.warn(LOG_TAG, "Failed to update androidID for record with guid " + guid + "."); + continue; + } + record.androidID = androidID; + } + } finally { + if (cursor != null) { + cursor.close(); + } + } + } } diff --git a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataExtender.java b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataExtender.java index b84a248363fa..41f2f8fb735e 100644 --- a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataExtender.java +++ b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataExtender.java @@ -1,50 +1,20 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Android Sync Client. - * - * The Initial Developer of the Original Code is - * the Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2011 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Jason Voll - * Richard Newman - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ +/* 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/. */ package org.mozilla.gecko.sync.repositories.android; +import java.util.ArrayList; + import org.json.simple.JSONArray; import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.repositories.NullCursorException; +import org.mozilla.gecko.sync.repositories.domain.HistoryRecord; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; +import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; public class AndroidBrowserHistoryDataExtender extends CachedSQLiteOpenHelper { @@ -119,6 +89,30 @@ public class AndroidBrowserHistoryDataExtender extends CachedSQLiteOpenHelper { } } + public void bulkInsert(ArrayList records) { + SQLiteDatabase db = this.getCachedWritableDatabase(); + try { + db.beginTransaction(); + + for (HistoryRecord record : records) { + ContentValues cv = new ContentValues(); + cv.put(COL_GUID, record.guid); + if (record.visits == null) { + cv.put(COL_VISITS, "[]"); + } else { + cv.put(COL_VISITS, record.visits.toJSONString()); + } + db.insert(TBL_HISTORY_EXT, null, cv); + } + + db.setTransactionSuccessful(); + } catch (SQLException e) { + Logger.error(LOG_TAG, "Caught exception in bulkInsert new history visits.", e); + } finally { + db.endTransaction(); + } + } + /** * Fetch a row. * diff --git a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryRepositorySession.java b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryRepositorySession.java index c1433068ba8e..66b7e53bc69c 100644 --- a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryRepositorySession.java +++ b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryRepositorySession.java @@ -4,12 +4,17 @@ package org.mozilla.gecko.sync.repositories.android; +import java.util.ArrayList; + import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.mozilla.gecko.db.BrowserContract; +import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.repositories.InactiveSessionException; import org.mozilla.gecko.sync.repositories.InvalidSessionTransitionException; +import org.mozilla.gecko.sync.repositories.NoGuidForIdException; import org.mozilla.gecko.sync.repositories.NullCursorException; +import org.mozilla.gecko.sync.repositories.ParentNotFoundException; import org.mozilla.gecko.sync.repositories.Repository; import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionBeginDelegate; import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFinishDelegate; @@ -21,11 +26,17 @@ import android.database.Cursor; import android.util.Log; public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserRepositorySession { - + public static final String LOG_TAG = "ABHistoryRepoSess"; + public static final String KEY_DATE = "date"; public static final String KEY_TYPE = "type"; public static final long DEFAULT_VISIT_TYPE = 1; + /** + * The number of records to queue for insertion before writing to databases. + */ + public static int INSERT_RECORD_THRESHOLD = 50; + public AndroidBrowserHistoryRepositorySession(Repository repository, Context context) { super(repository); dbHelper = new AndroidBrowserHistoryDataAccessor(context); @@ -113,7 +124,7 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi protected Record prepareRecord(Record record) { return record; } - + @Override public void abort() { ((AndroidBrowserHistoryDataAccessor) dbHelper).closeExtender(); @@ -125,4 +136,85 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi ((AndroidBrowserHistoryDataAccessor) dbHelper).closeExtender(); super.finish(delegate); } -} + + protected Object recordsBufferMonitor = new Object(); + protected ArrayList recordsBuffer = new ArrayList(); + + /** + * Queue record for insertion, possibly flushing the queue. + *

+ * Must be called on storeWorkQueue thread! But this is only + * called from store, which is called on the queue thread. + * + * @param record + * A Record with a GUID that is not present locally. + * @return The Record to be inserted. Warning: the + * androidID is not valid! It will be set after the + * records are flushed to the database. + */ + @Override + protected Record insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException { + HistoryRecord toStore = (HistoryRecord) prepareRecord(record); + toStore.androidID = -111; // Hopefully this special value will make it easy to catch future errors. + updateBookkeeping(toStore); // Does not use androidID -- just GUID -> String map. + enqueueNewRecord(toStore); + return toStore; + } + + /** + * Batch incoming records until some reasonable threshold is hit or storeDone + * is received. + *

+ * Must be called on storeWorkQueue thread! + * + * @param record A Record with a GUID that is not present locally. + * @throws NullCursorException + */ + protected void enqueueNewRecord(HistoryRecord record) throws NullCursorException { + synchronized (recordsBufferMonitor) { + if (recordsBuffer.size() >= INSERT_RECORD_THRESHOLD) { + flushNewRecords(); + } + Logger.debug(LOG_TAG, "Enqueuing new record with GUID " + record.guid); + recordsBuffer.add(record); + } + } + + /** + * Flush queue of incoming records to database. + *

+ * Must be called on storeWorkQueue thread! + *

+ * Must be locked by recordsBufferMonitor! + * @throws NullCursorException + */ + protected void flushNewRecords() throws NullCursorException { + if (recordsBuffer.size() < 1) { + Logger.debug(LOG_TAG, "No records to flush, returning."); + return; + } + + final ArrayList outgoing = recordsBuffer; + recordsBuffer = new ArrayList(); + Logger.debug(LOG_TAG, "Flushing " + outgoing.size() + " records to database."); + // TODO: move bulkInsert to AndroidBrowserDataAccessor? + ((AndroidBrowserHistoryDataAccessor) dbHelper).bulkInsert(outgoing, false); // Don't need to update any androidIDs. + } + + @Override + public void storeDone() { + storeWorkQueue.execute(new Runnable() { + @Override + public void run() { + synchronized (recordsBufferMonitor) { + try { + flushNewRecords(); + } catch (NullCursorException e) { + Logger.warn(LOG_TAG, "Error flushing records to database.", e); + } + } + storeDone(System.currentTimeMillis()); + } + }); + } +} \ No newline at end of file diff --git a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositoryDataAccessor.java b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositoryDataAccessor.java index ef9550e29995..dfce61855ae5 100644 --- a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositoryDataAccessor.java +++ b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositoryDataAccessor.java @@ -19,7 +19,7 @@ public abstract class AndroidBrowserRepositoryDataAccessor { private static final String[] GUID_COLUMNS = new String[] { BrowserContract.SyncColumns.GUID }; protected Context context; protected static String LOG_TAG = "BrowserDataAccessor"; - private final RepoUtils.QueryHelper queryHelper; + protected final RepoUtils.QueryHelper queryHelper; public AndroidBrowserRepositoryDataAccessor(Context context) { this.context = context; From 8ca6e187d8c9544719737fda3f018f14af48aa11 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Thu, 5 Apr 2012 19:25:34 -0700 Subject: [PATCH 099/152] Bug 736348 - Child positioning hits sqlite limits. r=lucasr --- .../android/base/db/BrowserProvider.java.in | 76 +++++++++++--- .../base/tests/ContentProviderTest.java.in | 6 +- .../base/tests/testBrowserProvider.java.in | 99 +++++++++++++++++++ 3 files changed, 167 insertions(+), 14 deletions(-) diff --git a/mobile/android/base/db/BrowserProvider.java.in b/mobile/android/base/db/BrowserProvider.java.in index 58bf16e3b87c..1d93811f2423 100644 --- a/mobile/android/base/db/BrowserProvider.java.in +++ b/mobile/android/base/db/BrowserProvider.java.in @@ -74,6 +74,12 @@ public class BrowserProvider extends ContentProvider { // Number of records marked as deleted to be removed static final long DELETED_RECORDS_PURGE_LIMIT = 7; + // How many records to reposition in a single query. + // This should be less than the SQLite maximum number of query variables + // (currently 999) divided by the number of variables used per positioning + // query (currently 3). + static final int MAX_POSITION_UPDATES_PER_QUERY = 100; + static final String TABLE_BOOKMARKS = "bookmarks"; static final String TABLE_HISTORY = "history"; static final String TABLE_IMAGES = "images"; @@ -1660,11 +1666,9 @@ public class BrowserProvider extends ContentProvider { } /** - * Construct an update expression that will modify the positions of - * records in-place. + * Update the positions of bookmarks in batches. * - * The provided selectionArgs is expected to be an implicit mapping from - * GUID to new position. + * @see #updateBookmarkPositionsInTransaction(SQLiteDatabase, String[], int, int) */ int updateBookmarkPositions(Uri uri, String[] guids) { if (guids == null) @@ -1674,16 +1678,61 @@ public class BrowserProvider extends ContentProvider { if (guidsCount == 0) return 0; + final SQLiteDatabase db = getWritableDatabase(uri); + int offset = 0; + int updated = 0; + + db.beginTransaction(); + + while (offset < guidsCount) { + try { + updated += updateBookmarkPositionsInTransaction(db, guids, offset, + MAX_POSITION_UPDATES_PER_QUERY); + } catch (SQLException e) { + Log.e(LOGTAG, "Got SQLite exception updating bookmark positions at offset " + offset, e); + + // Need to restart the transaction. + // The only way a caller knows that anything failed is that the + // returned update count will be smaller than the requested + // number of records. + db.setTransactionSuccessful(); + db.endTransaction(); + + db.beginTransaction(); + } + + offset += MAX_POSITION_UPDATES_PER_QUERY; + } + + db.setTransactionSuccessful(); + db.endTransaction(); + + return updated; + } + + /** + * Construct and execute an update expression that will modify the positions + * of records in-place. + */ + int updateBookmarkPositionsInTransaction(final SQLiteDatabase db, final String[] guids, + final int offset, final int max) { + int guidsCount = guids.length; + int processCount = Math.min(max, guidsCount - offset); + // Each must appear twice: once in a CASE, and once in the IN clause. - String[] args = new String[guidsCount * 2]; - System.arraycopy(guids, 0, args, 0, guidsCount); - System.arraycopy(guids, 0, args, guidsCount, guidsCount); + String[] args = new String[processCount * 2]; + System.arraycopy(guids, offset, args, 0, processCount); + System.arraycopy(guids, offset, args, processCount, processCount); StringBuilder b = new StringBuilder("UPDATE " + TABLE_BOOKMARKS + - " SET " + Bookmarks.POSITION + " = CASE guid"); + " SET " + Bookmarks.POSITION + + " = CASE guid"); - int i = 0; - for (; i < guids.length; ++i) { + // Build the CASE statement body for GUID/index pairs from offset up to + // the computed limit. + final int end = offset + processCount; + int i = offset; + for (; i < end; ++i) { if (guids[i] == null) { // We don't want to issue the query if not every GUID is specified. debug("updateBookmarkPositions called with null GUID at index " + i); @@ -1691,16 +1740,17 @@ public class BrowserProvider extends ContentProvider { } b.append(" WHEN ? THEN " + i); } + b.append(" END WHERE " + Bookmarks.GUID + " IN ("); i = 1; - while (i++ < guidsCount) { + while (i++ < processCount) { b.append("?, "); } b.append("?)"); - getWritableDatabase(uri).execSQL(b.toString(), args); + db.execSQL(b.toString(), args); // We can't easily get a modified count without calling something like changes(). - return guidsCount; + return processCount; } /** diff --git a/mobile/android/base/tests/ContentProviderTest.java.in b/mobile/android/base/tests/ContentProviderTest.java.in index 00d9591d432b..56811cd5df6d 100644 --- a/mobile/android/base/tests/ContentProviderTest.java.in +++ b/mobile/android/base/tests/ContentProviderTest.java.in @@ -160,8 +160,12 @@ abstract class ContentProviderTest extends AndroidTestCase { } public Uri getContentUri(String className) throws Exception { + return getUriColumn(className, "CONTENT_URI"); + } + + public Uri getUriColumn(String className, String columnId) throws Exception { Class aClass = mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract$" + className); - return (Uri) aClass.getField("CONTENT_URI").get(null); + return (Uri) aClass.getField(columnId).get(null); } public String getStringColumn(String className, String columnId) throws Exception { diff --git a/mobile/android/base/tests/testBrowserProvider.java.in b/mobile/android/base/tests/testBrowserProvider.java.in index c520e1985928..fc29c365f066 100644 --- a/mobile/android/base/tests/testBrowserProvider.java.in +++ b/mobile/android/base/tests/testBrowserProvider.java.in @@ -13,6 +13,7 @@ import android.util.Log; import java.io.File; import java.lang.reflect.Method; +import java.util.Random; /* * This test is meant to exercise all operations exposed by Fennec's @@ -29,6 +30,7 @@ public class testBrowserProvider extends ContentProviderTest { private String UNFILED_FOLDER_GUID; private Uri mBookmarksUri; + private Uri mBookmarksPositionUri; private Uri mHistoryUri; private Uri mImagesUri; private Uri mCombinedUri; @@ -84,6 +86,8 @@ public class testBrowserProvider extends ContentProviderTest { mImagesUri = getContentUri("Images"); mCombinedUri = getContentUri("Combined"); + mBookmarksPositionUri = getUriColumn("Bookmarks", "POSITIONS_CONTENT_URI"); + PLACES_FOLDER_GUID = getStringColumn("Bookmarks", "PLACES_FOLDER_GUID"); MOBILE_FOLDER_GUID = getStringColumn("Bookmarks", "MOBILE_FOLDER_GUID"); MENU_FOLDER_GUID = getStringColumn("Bookmarks", "MENU_FOLDER_GUID"); @@ -196,6 +200,14 @@ public class testBrowserProvider extends ContentProviderTest { mBookmarksTypeBookmark, 0, "tags", "description", "keyword"); } + private Cursor getBookmarksByParent(long parent) throws Exception { + // Order by position. + return mProvider.query(mBookmarksUri, null, + mBookmarksParentCol + " = ?", + new String[] { String.valueOf(parent) }, + mBookmarksPositionCol); + } + private Cursor getBookmarkByGuid(String guid) throws Exception { return mProvider.query(mBookmarksUri, null, mBookmarksGuidCol + " = ?", @@ -275,6 +287,7 @@ public class testBrowserProvider extends ContentProviderTest { mTests.add(new TestDeleteBookmarksImages()); mTests.add(new TestUpdateBookmarks()); mTests.add(new TestUpdateBookmarksImages()); + mTests.add(new TestPositionBookmarks()); mTests.add(new TestInsertHistory()); mTests.add(new TestInsertHistoryImages()); @@ -661,6 +674,92 @@ public class testBrowserProvider extends ContentProviderTest { } } + /** + * Create a folder of one thousand and one bookmarks, then impose an order + * on them. + * + * Verify that the reordering worked by querying. + */ + class TestPositionBookmarks extends Test { + + public String makeGUID(final long in) { + String part = String.valueOf(in); + return "aaaaaaaaaaaa".substring(0, (12 - part.length())) + part; + } + + public void compareCursorToItems(final Cursor c, final String[] items, final int count) { + mAsserter.is(c.moveToFirst(), true, "Folder has children."); + + int posColumn = c.getColumnIndex(mBookmarksPositionCol); + int guidColumn = c.getColumnIndex(mBookmarksGuidCol); + int i = 0; + + while (!c.isAfterLast()) { + String guid = c.getString(guidColumn); + long pos = c.getLong(posColumn); + mAsserter.is(pos, (long) i, "Position matches sequence."); + mAsserter.is(guid, items[i], "GUID matches sequence."); + ++i; + c.moveToNext(); + } + + mAsserter.is(i, count, "Folder has the right number of children."); + } + + public static final int NUMBER_OF_CHILDREN = 1001; + public void test() throws Exception { + // Create the containing folder. + ContentValues folder = createBookmark("FolderFolder", "", mMobileFolderId, + mBookmarksTypeFolder, 0, "", + "description", "keyword"); + folder.put(mBookmarksGuidCol, "folderfolder"); + long folderId = ContentUris.parseId(mProvider.insert(mBookmarksUri, folder)); + + // Create the children. + String[] items = new String[NUMBER_OF_CHILDREN]; + + // Reuse the same ContentValues. + ContentValues item = createBookmark("Test Bookmark", "http://example.com", folderId, + mBookmarksTypeFolder, 0, "", + "description", "keyword"); + + for (int i = 0; i < NUMBER_OF_CHILDREN; ++i) { + String guid = makeGUID(i); + items[i] = guid; + item.put(mBookmarksGuidCol, guid); + item.put(mBookmarksPositionCol, i); + item.put(mBookmarksUrlCol, "http://example.com/" + guid); + item.put(mBookmarksTitleCol, "Test Bookmark " + guid); + mProvider.insert(mBookmarksUri, item); + } + + Cursor c; + + // Verify insertion. + c = getBookmarksByParent(folderId); + compareCursorToItems(c, items, NUMBER_OF_CHILDREN); + c.close(); + + // Now permute the items array. + Random rand = new Random(); + for (int i = 0; i < NUMBER_OF_CHILDREN; ++i) { + final int newPosition = rand.nextInt(NUMBER_OF_CHILDREN); + final String switched = items[newPosition]; + items[newPosition] = items[i]; + items[i] = switched; + } + + // Impose the positions. + long updated = mProvider.update(mBookmarksPositionUri, null, null, items); + mAsserter.is(updated, (long) NUMBER_OF_CHILDREN, "Updated " + NUMBER_OF_CHILDREN + " positions."); + + // Verify that the database was updated. + c = getBookmarksByParent(folderId); + compareCursorToItems(c, items, NUMBER_OF_CHILDREN); + c.close(); + } + } + class TestInsertHistory extends Test { private long insertWithNullCol(String colName) throws Exception { ContentValues h = createOneHistoryEntry(); From f6f94ebc7927cd0f996bf429cf64146d3d7f40d9 Mon Sep 17 00:00:00 2001 From: Chenxia Liu Date: Thu, 5 Apr 2012 19:25:34 -0700 Subject: [PATCH 100/152] Bug 742700 - Null URI crash in canceling J-PAKE. r=rnewman --- .../android/base/sync/jpake/JPakeClient.java | 21 ++++++++++++------- .../base/sync/jpake/stage/DeleteChannel.java | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/mobile/android/base/sync/jpake/JPakeClient.java b/mobile/android/base/sync/jpake/JPakeClient.java index 51b7e7e8e421..dad624c0b343 100644 --- a/mobile/android/base/sync/jpake/JPakeClient.java +++ b/mobile/android/base/sync/jpake/JPakeClient.java @@ -72,7 +72,7 @@ public class JPakeClient { public int jpakePollInterval; public int jpakeMaxTries; public String channel; - public String channelUrl; + public volatile String channelUrl; // J-PAKE session data. public KeyBundle myKeyBundle; @@ -219,28 +219,33 @@ public class JPakeClient { Logger.debug(LOG_TAG, "All stages complete."); return; } - JPakeStage nextStage = null; + JPakeStage currentStage = null; try{ - nextStage = stages.remove(); - Logger.debug(LOG_TAG, "starting stage " + nextStage.toString()); - nextStage.execute(this); + currentStage = stages.remove(); + Logger.debug(LOG_TAG, "starting stage " + currentStage.toString()); + currentStage.execute(this); } catch (Exception e) { - Logger.error(LOG_TAG, "Exception in stage " + nextStage, e); + Logger.error(LOG_TAG, "Exception in stage " + currentStage, e); abort("Stage exception."); } } /** - * Abort J-PAKE. + * Abort J-PAKE. This can propagate an error from the stages, or result from + * UI abort (onPause, user abort) * * @param reason * Reason for abort. */ public void abort(String reason) { finished = true; + // We do not need to clean up the channel in the following cases: if (Constants.JPAKE_ERROR_CHANNEL.equals(reason) || Constants.JPAKE_ERROR_NETWORK.equals(reason) || - Constants.JPAKE_ERROR_NODATA.equals(reason)) { + Constants.JPAKE_ERROR_NODATA.equals(reason) || + channelUrl == null) { + // We may leak a channel if the activity aborts sync while requesting the channel. + // The server, however, will delete the channel anyways after a certain time has passed. displayAbort(reason); } else { // Delete channel, then call controller's displayAbort in callback. diff --git a/mobile/android/base/sync/jpake/stage/DeleteChannel.java b/mobile/android/base/sync/jpake/stage/DeleteChannel.java index 012c3ec620a7..71cd4bb53a58 100644 --- a/mobile/android/base/sync/jpake/stage/DeleteChannel.java +++ b/mobile/android/base/sync/jpake/stage/DeleteChannel.java @@ -85,7 +85,7 @@ public class DeleteChannel { } }; - jClient.runOnThread(new Runnable() { + JPakeClient.runOnThread(new Runnable() { @Override public void run() { httpResource.delete(); From 48061f5c96ea3816b9e2f5dd1680968c6f604222 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Fri, 6 Apr 2012 11:36:24 +0900 Subject: [PATCH 101/152] Bug 716354 - freetype2 detection doesn't consider cross-compiling. r=glandium --- aclocal.m4 | 1 - build/autoconf/freetype2.m4 | 137 ------------------------------------ configure.in | 2 +- 3 files changed, 1 insertion(+), 139 deletions(-) delete mode 100644 build/autoconf/freetype2.m4 diff --git a/aclocal.m4 b/aclocal.m4 index 18c9b7da381a..6a5c2a0962ff 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -7,7 +7,6 @@ builtin(include, build/autoconf/glib.m4)dnl builtin(include, build/autoconf/nspr.m4)dnl builtin(include, build/autoconf/nss.m4)dnl builtin(include, build/autoconf/pkg.m4)dnl -builtin(include, build/autoconf/freetype2.m4)dnl builtin(include, build/autoconf/codeset.m4)dnl builtin(include, build/autoconf/altoptions.m4)dnl builtin(include, build/autoconf/mozprog.m4)dnl diff --git a/build/autoconf/freetype2.m4 b/build/autoconf/freetype2.m4 deleted file mode 100644 index 52b88bf1756b..000000000000 --- a/build/autoconf/freetype2.m4 +++ /dev/null @@ -1,137 +0,0 @@ -# Configure paths for FreeType2 -# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor - -dnl AM_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS -dnl -AC_DEFUN([AC_CHECK_FT2], -[dnl -dnl Get the cflags and libraries from the freetype-config script -dnl -AC_ARG_WITH(freetype-prefix, -[ --with-ft-prefix=PFX Prefix where FreeType is installed (optional)], - ft_config_prefix="$withval", ft_config_prefix="") -AC_ARG_WITH(freetype-exec-prefix, -[ --with-ft-exec-prefix=PFX - Exec prefix where FreeType is installed (optional)], - ft_config_exec_prefix="$withval", ft_config_exec_prefix="") -AC_ARG_ENABLE(freetypetest, -[ --disable-freetypetest - Do not try to compile and run a test FreeType program], - [], enable_fttest=yes) - -if test x$ft_config_exec_prefix != x ; then - ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" - if test x${FT2_CONFIG+set} != xset ; then - FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config - fi -fi -if test x$ft_config_prefix != x ; then - ft_config_args="$ft_config_args --prefix=$ft_config_prefix" - if test x${FT2_CONFIG+set} != xset ; then - FT2_CONFIG=$ft_config_prefix/bin/freetype-config - fi -fi -AC_PATH_PROG(FT2_CONFIG, freetype-config, no) - -min_ft_version=ifelse([$1], ,6.1.0,$1) -AC_MSG_CHECKING(for FreeType - version >= $min_ft_version) -no_ft="" -if test "$FT2_CONFIG" = "no" ; then - no_ft=yes -else - FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` - FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` - ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - ft_min_major_version=`echo $min_ft_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - ft_min_minor_version=`echo $min_ft_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - ft_min_micro_version=`echo $min_ft_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_fttest" = "xyes" ; then - ft_config_is_lt=no - if test $ft_config_major_version -lt $ft_min_major_version ; then - ft_config_is_lt=yes - else - if test $ft_config_major_version -eq $ft_min_major_version ; then - if test $ft_config_minor_version -lt $ft_min_minor_version ; then - ft_config_is_lt=yes - else - if test $ft_config_minor_version -eq $ft_min_minor_version ; then - if test $ft_config_micro_version -lt $ft_min_micro_version ; then - ft_config_is_lt=yes - fi - fi - fi - fi - fi - if test "x$ft_config_is_lt" = "xyes" ; then - ifelse([$3], , :, [$3]) - AC_MSG_RESULT(no) - else - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $FT2_CFLAGS" - LIBS="$FT2_LIBS $LIBS" -dnl -dnl Sanity checks for the results of freetype-config to some extent -dnl - AC_TRY_RUN([ -#include -#include FT_FREETYPE_H -#include -#include - -int -main() -{ - FT_Library library; - FT_Error error; - - error = FT_Init_FreeType(&library); - - if (error) - return 1; - else - { - FT_Done_FreeType(library); - return 0; - } -} -],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi # test $ft_config_version -lt $ft_min_version - fi # test "x$enable_fttest" = "xyes" -fi # test "$FT2_CONFIG" = "no" -if test "x$ft_config_is_lt" != "xyes" ; then - if test "x$no_ft" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$FT2_CONFIG" = "no" ; then - echo "*** The freetype-config script installed by FreeType 2 could not be found." - echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the FT2_CONFIG environment variable to the" - echo "*** full path to freetype-config." - else - echo "*** The FreeType test program failed to run. If your system uses" - echo "*** shared libraries and they are installed outside the normal" - echo "*** system library path, make sure the variable LD_LIBRARY_PATH" - echo "*** (or whatever is appropiate for your system) is correctly set." - fi - FT2_CFLAGS="" - FT2_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(FT2_CFLAGS) - AC_SUBST(FT2_LIBS) -fi -]) diff --git a/configure.in b/configure.in index fcdb8c8a39a9..cb8107ace381 100644 --- a/configure.in +++ b/configure.in @@ -3380,7 +3380,7 @@ else dnl ======================================================== dnl = Check for freetype2 and its functionality dnl ======================================================== - AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=]) + PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=) if test "$_HAVE_FREETYPE2"; then _SAVE_LIBS="$LIBS" From f947c86002f663d33618405d2d1d5ac6d13a94f1 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 4 Apr 2012 13:47:36 +0300 Subject: [PATCH 102/152] Bug 316447 - execCommand("insertHorizontalRule") should not set height/width; r=ehsan --- editor/libeditor/html/nsHTMLEditor.cpp | 11 +---------- editor/libeditor/html/tests/Makefile.in | 1 + editor/libeditor/html/tests/test_bug316447.html | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 editor/libeditor/html/tests/test_bug316447.html diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 2af5076821ec..1f9e4924c88b 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -2937,16 +2937,7 @@ nsHTMLEditor::CreateElementWithDefaults(const nsAString& aTagName, nsIDOMElement newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), EmptyString()); // Set default values for new elements - if (TagName.EqualsLiteral("hr")) - { - // Note that we read the user's attributes for these from prefs (in InsertHLine JS) - res = SetAttributeOrEquivalent(newElement, NS_LITERAL_STRING("width"), - NS_LITERAL_STRING("100%"), true); - NS_ENSURE_SUCCESS(res, res); - res = SetAttributeOrEquivalent(newElement, NS_LITERAL_STRING("size"), - NS_LITERAL_STRING("2"), true); - } else if (TagName.EqualsLiteral("table")) - { + if (TagName.EqualsLiteral("table")) { res = newElement->SetAttribute(NS_LITERAL_STRING("cellpadding"),NS_LITERAL_STRING("2")); NS_ENSURE_SUCCESS(res, res); res = newElement->SetAttribute(NS_LITERAL_STRING("cellspacing"),NS_LITERAL_STRING("2")); diff --git a/editor/libeditor/html/tests/Makefile.in b/editor/libeditor/html/tests/Makefile.in index dfda3328cb60..eddb77092493 100644 --- a/editor/libeditor/html/tests/Makefile.in +++ b/editor/libeditor/html/tests/Makefile.in @@ -48,6 +48,7 @@ _TEST_FILES = \ green.png \ test_bug290026.html \ test_bug291780.html \ + test_bug316447.html \ test_bug332636.html \ test_bug332636.html^headers^ \ test_bug372345.html \ diff --git a/editor/libeditor/html/tests/test_bug316447.html b/editor/libeditor/html/tests/test_bug316447.html new file mode 100644 index 000000000000..76d123815b86 --- /dev/null +++ b/editor/libeditor/html/tests/test_bug316447.html @@ -0,0 +1,16 @@ + + +Test for Bug 316447 + + +Mozilla Bug 316447 +


+ From ef2365e614e67c53c922e845ff89caaa12356fcd Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 4 Apr 2012 14:46:04 +0300 Subject: [PATCH 103/152] Bug 317093 part 1 - Avoid spurious UNEXPECTED-FAILs in test_richtext2 when fixing expected fails; r=ehsan --- .../libeditor/html/tests/browserscope/test_richtext2.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/libeditor/html/tests/browserscope/test_richtext2.html b/editor/libeditor/html/tests/browserscope/test_richtext2.html index 421ef4a4190c..386de569e8e6 100644 --- a/editor/libeditor/html/tests/browserscope/test_richtext2.html +++ b/editor/libeditor/html/tests/browserscope/test_richtext2.html @@ -216,7 +216,8 @@ http://code.google.com/p/browserscope/source/browse/trunk/categories/richtext2/u // unexpected pass todo_is(row.valscore, 1, testName + " used to fail, but it just started passing"); // debugging information - is(row.output, expected.output, "HTML test result comparison"); + info("HTML test result comparison - got " + + row.output + ", expected " + expected.output); } else if (row.valscore == 0 && expected.valscore == 0) { // known failure todo_is(row.valscore, 1, testName + " is known to fail"); @@ -236,7 +237,8 @@ http://code.google.com/p/browserscope/source/browse/trunk/categories/richtext2/u // unexpected pass todo_is(row.selscore, 1, testName + " used to fail, but it just started passing"); // debugging information - is(row.output, expected.output, "HTML test result comparison"); + info("HTML test result comparison - got " + + row.output + ", expected " + expected.output); } else if (row.selscore == 0 && expected.selscore == 0) { // known failure todo_is(row.selscore, 1, testName + " is known to fail"); From 342965bb6e7a8fca1b05c8a49d5fd3ec6a928872 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 4 Apr 2012 14:47:13 +0300 Subject: [PATCH 104/152] Bug 317093 part 2 - execCommand() should remove , , and as well as , , ; r=ehsan --- editor/composer/src/nsComposerCommands.cpp | 17 +- .../lib/richtext/currentStatus.js | 3 - .../lib/richtext2/currentStatus.js | 713 +++++++++--------- 3 files changed, 370 insertions(+), 363 deletions(-) diff --git a/editor/composer/src/nsComposerCommands.cpp b/editor/composer/src/nsComposerCommands.cpp index 47fb6a59f0b9..adc47d0caf65 100644 --- a/editor/composer/src/nsComposerCommands.cpp +++ b/editor/composer/src/nsComposerCommands.cpp @@ -261,10 +261,21 @@ nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor, const char* aTagName) NS_ENSURE_SUCCESS(rv, rv); } - if (doTagRemoval) + if (doTagRemoval) { + // Also remove equivalent properties (bug 317093) + if (tagName.EqualsLiteral("b")) { + rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("strong").get(), nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } else if (tagName.EqualsLiteral("i")) { + rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("em").get(), nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } else if (tagName.EqualsLiteral("strike")) { + rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("s").get(), nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } + rv = RemoveTextProperty(aEditor, tagName.get(), nsnull); - else - { + } else { // Superscript and Subscript styles are mutually exclusive nsAutoString removeName; aEditor->BeginTransaction(); diff --git a/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js b/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js index 15cd7ab9d241..c3326e154633 100644 --- a/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js +++ b/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js @@ -27,11 +27,8 @@ var knownFailures = { 'superscript-1' : true, }, 'u': { - 'bold-1' : true, - 'italic-1' : true, 'removeformat-1' : true, 'removeformat-2' : true, - 'strikethrough-1' : true, 'strikethrough-2' : true, 'subscript-1' : true, 'superscript-1' : true, diff --git a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js b/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js index f735fbc035d5..ac8db10c0ade 100644 --- a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js +++ b/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js @@ -4542,11 +4542,11 @@ const TEST_RESULTS = { "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`foo[bar]baz´", + "output": "`foo[bar]baz´", "innerHTML": "`foo[bar]baz´", - "outerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", "bodyInnerHTML": "`foo[bar]baz´", - "bodyOuterHTML": "`foo[bar]baz´" + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { "valscore": 0, @@ -5915,11 +5915,11 @@ const TEST_RESULTS = { "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`[foobarbaz]´", + "output": "`[foobarbaz]´", "innerHTML": "`[foobarbaz]´", - "outerHTML": "`[foobarbaz]´", + "outerHTML": "`[foobarbaz]´", "bodyInnerHTML": "`[foobarbaz]´", - "bodyOuterHTML": "`[foobarbaz]´" + "bodyOuterHTML": "`[foobarbaz]´" }, "div": { "valscore": 0, @@ -5950,11 +5950,11 @@ const TEST_RESULTS = { "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`[foobarbaz]´", + "output": "`[foobarbaz]´", "innerHTML": "`[foobarbaz]´", - "outerHTML": "`[foobarbaz]´", + "outerHTML": "`[foobarbaz]´", "bodyInnerHTML": "`[foobarbaz]´", - "bodyOuterHTML": "`[foobarbaz]´" + "bodyOuterHTML": "`[foobarbaz]´" }, "div": { "valscore": 0, @@ -5985,11 +5985,11 @@ const TEST_RESULTS = { "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`[foobarbaz]´", + "output": "`[foobarbaz]´", "innerHTML": "`[foobarbaz]´", - "outerHTML": "`[foobarbaz]´", + "outerHTML": "`[foobarbaz]´", "bodyInnerHTML": "`[foobarbaz]´", - "bodyOuterHTML": "`[foobarbaz]´" + "bodyOuterHTML": "`[foobarbaz]´" }, "div": { "valscore": 0, @@ -8994,22 +8994,22 @@ const TEST_RESULTS = { "selscore": 1, "valresult": 8, "selresult": 5, - "output": "`foo[bar]baz´", - "innerHTML": "`foo[bar]baz´", - "outerHTML": "`foo[bar]baz´", - "bodyInnerHTML": "`foo[bar]baz´", - "bodyOuterHTML": "`foo[bar]baz´" + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "`foo´`[bar]´`baz´", + "bodyInnerHTML": "`foo´`[bar]´`baz´", + "bodyOuterHTML": "`foo´`[bar]´`baz´" }, "body": { "valscore": 1, "selscore": 1, "valresult": 8, "selresult": 5, - "output": "`foo[bar]baz´", - "innerHTML": "`foo[bar]baz´", - "outerHTML": "`foo[bar]baz´", - "bodyInnerHTML": "`foo[bar]baz´", - "bodyOuterHTML": "`foo[bar]baz´" + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "`foo´`[bar]´`baz´", + "bodyInnerHTML": "`foo´`[bar]´`baz´", + "bodyOuterHTML": "`foo´`[bar]´`baz´" }, "div": { "valscore": 1, @@ -9379,22 +9379,22 @@ const TEST_RESULTS = { "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "`foo´`[bar]´`baz´", + "bodyInnerHTML": "`foo´`[bar]´`baz´", + "bodyOuterHTML": "`foo´`[bar]´`baz´" }, "body": { "valscore": 0, "selscore": 0, "valresult": 6, "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "`foo´`[bar]´`baz´", + "bodyInnerHTML": "`foo´`[bar]´`baz´", + "bodyOuterHTML": "`foo´`[bar]´`baz´" }, "div": { "valscore": 0, @@ -10744,142 +10744,142 @@ const TEST_RESULTS = { }, "B_STRONG-1_SW": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "
`foo´`[bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "
`foo´`[bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" } }, "B_STRONG-1_SO": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "
`foo[´`bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar´`]baz´", + "innerHTML": "`foo[´`bar´`]baz´", + "outerHTML": "
`foo[´`bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" } }, "B_STRONG-1_SL": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "
`foo[´`bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar]´`baz´", + "innerHTML": "`foo[´`bar]´`baz´", + "outerHTML": "
`foo[´`bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" } }, "B_STRONG-1_SR": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "
`foo´`[bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar´`]baz´", + "innerHTML": "`foo´`[bar´`]baz´", + "outerHTML": "
`foo´`[bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" } }, "B_SPANs:fw:b-1_SW": { @@ -11164,142 +11164,142 @@ const TEST_RESULTS = { }, "I_EM-1_SW": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "
`foo´`[bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "
`foo´`[bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" } }, "I_EM-1_SO": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "
`foo[´`bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar´`]baz´", + "innerHTML": "`foo[´`bar´`]baz´", + "outerHTML": "
`foo[´`bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" } }, "I_EM-1_SL": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "
`foo[´`bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar]´`baz´", + "innerHTML": "`foo[´`bar]´`baz´", + "outerHTML": "
`foo[´`bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" } }, "I_EM-1_SR": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "
`foo´`[bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar´`]baz´", + "innerHTML": "`foo´`[bar´`]baz´", + "outerHTML": "
`foo´`[bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" } }, "I_SPANs:fs:i-1_SW": { @@ -11724,142 +11724,142 @@ const TEST_RESULTS = { }, "S_S-1_SW": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "`foo´`[bar]´`baz´", - "bodyInnerHTML": "`foo´`[bar]´`baz´", - "bodyOuterHTML": "`foo´`[bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar]´`baz´", - "innerHTML": "`foo´`[bar]´`baz´", - "outerHTML": "
`foo´`[bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar]´`baz´", + "innerHTML": "`foo´`[bar]´`baz´", + "outerHTML": "
`foo´`[bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar]´`baz´
CAN
ARY" } }, "S_S-1_SO": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "`foo[´`bar´`]baz´", - "bodyInnerHTML": "`foo[´`bar´`]baz´", - "bodyOuterHTML": "`foo[´`bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar´`]baz´", - "innerHTML": "`foo[´`bar´`]baz´", - "outerHTML": "
`foo[´`bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar´`]baz´", + "innerHTML": "`foo[´`bar´`]baz´", + "outerHTML": "
`foo[´`bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar´`]baz´
CAN
ARY" } }, "S_S-1_SL": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "`foo[´`bar]´`baz´", - "bodyInnerHTML": "`foo[´`bar]´`baz´", - "bodyOuterHTML": "`foo[´`bar]´`baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo[´`bar]´`baz´", - "innerHTML": "`foo[´`bar]´`baz´", - "outerHTML": "
`foo[´`bar]´`baz´
", - "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[´`bar]´`baz´", + "innerHTML": "`foo[´`bar]´`baz´", + "outerHTML": "
`foo[´`bar]´`baz´
", + "bodyInnerHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo[´`bar]´`baz´
CAN
ARY" } }, "S_S-1_SR": { "dM": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "body": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "`foo´`[bar´`]baz´", - "bodyInnerHTML": "`foo´`[bar´`]baz´", - "bodyOuterHTML": "`foo´`[bar´`]baz´" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo[bar]baz´", + "innerHTML": "`foo[bar]baz´", + "outerHTML": "`foo[bar]baz´", + "bodyInnerHTML": "`foo[bar]baz´", + "bodyOuterHTML": "`foo[bar]baz´" }, "div": { - "valscore": 0, - "selscore": 0, - "valresult": 6, - "selresult": 3, - "output": "`foo´`[bar´`]baz´", - "innerHTML": "`foo´`[bar´`]baz´", - "outerHTML": "
`foo´`[bar´`]baz´
", - "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", - "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" + "valscore": 1, + "selscore": 1, + "valresult": 8, + "selresult": 5, + "output": "`foo´`[bar´`]baz´", + "innerHTML": "`foo´`[bar´`]baz´", + "outerHTML": "
`foo´`[bar´`]baz´
", + "bodyInnerHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY", + "bodyOuterHTML": "CAN
ARY
`foo´`[bar´`]baz´
CAN
ARY" } }, "S_STRIKE-1_SW": { @@ -23830,4 +23830,3 @@ const TEST_RESULTS = { } } } - From 58500691c788d958c9738a58d99d2e85a88d53f4 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 4 Apr 2012 15:30:33 +0300 Subject: [PATCH 105/152] Bug 742261 - Remove useless queryCommandText/execCommandShowHelp methods; r=ehsan --- content/html/document/src/nsHTMLDocument.cpp | 30 ------------------- content/html/document/test/Makefile.in | 1 + .../html/document/test/test_bug742261.html | 14 +++++++++ dom/interfaces/html/nsIDOMHTMLDocument.idl | 8 +---- 4 files changed, 16 insertions(+), 37 deletions(-) create mode 100644 content/html/document/test/test_bug742261.html diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 94129e5016a4..ad80d55fc86f 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -3124,22 +3124,6 @@ nsHTMLDocument::ExecCommand(const nsAString & commandID, return rv; } -/* TODO: don't let this call do anything if the page is not done loading */ -/* boolean execCommandShowHelp(in DOMString commandID); */ -NS_IMETHODIMP -nsHTMLDocument::ExecCommandShowHelp(const nsAString & commandID, - bool *_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - *_retval = false; - - // if editing is not on, bail - if (!IsEditingOnAfterFlush()) - return NS_ERROR_FAILURE; - - return NS_ERROR_NOT_IMPLEMENTED; -} - /* boolean queryCommandEnabled(in DOMString commandID); */ NS_IMETHODIMP nsHTMLDocument::QueryCommandEnabled(const nsAString & commandID, @@ -3306,20 +3290,6 @@ nsHTMLDocument::QueryCommandSupported(const nsAString & commandID, return NS_OK; } -/* DOMString queryCommandText(in DOMString commandID); */ -NS_IMETHODIMP -nsHTMLDocument::QueryCommandText(const nsAString & commandID, - nsAString & _retval) -{ - _retval.SetLength(0); - - // if editing is not on, bail - if (!IsEditingOnAfterFlush()) - return NS_ERROR_FAILURE; - - return NS_ERROR_NOT_IMPLEMENTED; -} - /* DOMString queryCommandValue(in DOMString commandID); */ NS_IMETHODIMP nsHTMLDocument::QueryCommandValue(const nsAString & commandID, diff --git a/content/html/document/test/Makefile.in b/content/html/document/test/Makefile.in index b56204270072..6bbebcb674ad 100644 --- a/content/html/document/test/Makefile.in +++ b/content/html/document/test/Makefile.in @@ -106,6 +106,7 @@ _TEST_FILES = test_bug1682.html \ test_bug571981.html \ test_bug677495.html \ test_bug677495-1.html \ + test_bug742261.html \ $(NULL) ifneq (mobile,$(MOZ_BUILD_APP)) diff --git a/content/html/document/test/test_bug742261.html b/content/html/document/test/test_bug742261.html new file mode 100644 index 000000000000..9ad41dd52bc7 --- /dev/null +++ b/content/html/document/test/test_bug742261.html @@ -0,0 +1,14 @@ + + +Test for Bug 742261 + + + + diff --git a/dom/interfaces/html/nsIDOMHTMLDocument.idl b/dom/interfaces/html/nsIDOMHTMLDocument.idl index ba29af6ae326..72fa405d63cf 100644 --- a/dom/interfaces/html/nsIDOMHTMLDocument.idl +++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl @@ -47,7 +47,7 @@ */ interface nsISelection; -[scriptable, uuid(0d59c4f0-2272-4a72-8197-da6f86353ec1)] +[scriptable, uuid(3dae5807-3615-4567-913f-c3956a2aa251)] interface nsIDOMHTMLDocument : nsIDOMDocument { readonly attribute DOMString URL; @@ -94,9 +94,6 @@ interface nsIDOMHTMLDocument : nsIDOMDocument [optional] in boolean doShowUI, [optional] in DOMString value); - // returns true if the help is being shown for command (false if not) - boolean execCommandShowHelp(in DOMString commandID); - // returns true if the command is enabled (false otherwise) boolean queryCommandEnabled(in DOMString commandID); @@ -109,9 +106,6 @@ interface nsIDOMHTMLDocument : nsIDOMDocument // returns true if the command is supported on the current range boolean queryCommandSupported(in DOMString commandID); - // - DOMString queryCommandText(in DOMString commandID); - // returns the current value of the document or current selection for command DOMString queryCommandValue(in DOMString commandID); From f72bc2550596aee44ba1f37e9f87912da93f787f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 6 Apr 2012 10:16:25 +0200 Subject: [PATCH 106/152] Bug 741287 - Make expandlibs_gen.py error out when given a missing file. r=ted --- config/expandlibs_gen.py | 13 +++++++++---- config/tests/unit-expandlibs.py | 3 +++ js/src/config/expandlibs_gen.py | 13 +++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py index f6d26d3c3d1c..0a19c5013d10 100644 --- a/config/expandlibs_gen.py +++ b/config/expandlibs_gen.py @@ -47,10 +47,15 @@ def generate(args): desc = LibDescriptor() for arg in args: if isObject(arg): - desc['OBJS'].append(os.path.abspath(arg)) - elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \ - (os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)): - desc['LIBS'].append(os.path.abspath(arg)) + if os.path.exists(arg): + desc['OBJS'].append(os.path.abspath(arg)) + else: + raise Exception("File not found: %s" % arg) + elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX: + if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX): + desc['LIBS'].append(os.path.abspath(arg)) + else: + raise Exception("File not found: %s" % arg) return desc if __name__ == '__main__': diff --git a/config/tests/unit-expandlibs.py b/config/tests/unit-expandlibs.py index 491c95448b1f..a7ab6d1c23e3 100644 --- a/config/tests/unit-expandlibs.py +++ b/config/tests/unit-expandlibs.py @@ -145,6 +145,9 @@ class TestExpandLibsGen(TestCaseWithTmpDir): self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']]) self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']]) + self.assertRaises(Exception, generate, files + [self.tmpfile(Obj('z'))]) + self.assertRaises(Exception, generate, files + [self.tmpfile(Lib('y'))]) + class TestExpandInit(TestCaseWithTmpDir): def init(self): ''' Initializes test environment for library expansion tests''' diff --git a/js/src/config/expandlibs_gen.py b/js/src/config/expandlibs_gen.py index f6d26d3c3d1c..0a19c5013d10 100644 --- a/js/src/config/expandlibs_gen.py +++ b/js/src/config/expandlibs_gen.py @@ -47,10 +47,15 @@ def generate(args): desc = LibDescriptor() for arg in args: if isObject(arg): - desc['OBJS'].append(os.path.abspath(arg)) - elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \ - (os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)): - desc['LIBS'].append(os.path.abspath(arg)) + if os.path.exists(arg): + desc['OBJS'].append(os.path.abspath(arg)) + else: + raise Exception("File not found: %s" % arg) + elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX: + if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX): + desc['LIBS'].append(os.path.abspath(arg)) + else: + raise Exception("File not found: %s" % arg) return desc if __name__ == '__main__': From ca56e22619bf5498bf0a1cd3ed447f17352175fa Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 6 Apr 2012 10:17:47 +0200 Subject: [PATCH 107/152] Bug 741287 part 2 - Fix layout/build/Makefile.in for missing libraries. r=ted --- layout/build/Makefile.in | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index 491706ded550..badb2e0050fb 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -106,7 +106,6 @@ SHARED_LIBRARY_LIBS = \ $(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/src/notification/$(LIB_PREFIX)jsdomnotification_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/system/$(LIB_PREFIX)domsystem_s.$(LIB_SUFFIX) \ - $(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/workers/$(LIB_PREFIX)domworkers_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/indexedDB/$(LIB_PREFIX)dom_indexeddb_s.$(LIB_SUFFIX) \ $(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \ @@ -132,13 +131,6 @@ SHARED_LIBRARY_LIBS += \ LOCAL_INCLUDES += \ -I$(topsrcdir)/dom/system/windows \ $(NULL) -else ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT))) -SHARED_LIBRARY_LIBS += \ - $(DEPTH)/dom/system/cocoa/$(LIB_PREFIX)domsystemcocoa_s.$(LIB_SUFFIX) \ - $(NULL) -LOCAL_INCLUDES += \ - -I$(topsrcdir)/dom/system/cocoa \ - $(NULL) else ifneq (,$(filter android,$(MOZ_WIDGET_TOOLKIT))) SHARED_LIBRARY_LIBS += \ $(DEPTH)/dom/system/android/$(LIB_PREFIX)domsystemandroid_s.$(LIB_SUFFIX) \ @@ -155,7 +147,10 @@ SHARED_LIBRARY_LIBS += $(DEPTH)/dom/bluetooth/$(LIB_PREFIX)dombluetooth_s.$(LIB_ endif #} ifdef MOZ_B2G_RIL #{ -SHARED_LIBRARY_LIBS += $(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) +SHARED_LIBRARY_LIBS += \ + $(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) \ + $(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \ + $(NULL) endif #} ifdef MOZ_MEDIA From 6c18cf386083e8db626320805328fc4932e4ac7b Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 31 Mar 2012 09:24:39 +0200 Subject: [PATCH 108/152] Bug 644608 - Implement full dependencies for expandlibs. r=ted --- config/config.mk | 2 +- config/expandlibs_deps.py | 83 ++++++++++++++++++++++++++++++++ config/rules.mk | 20 ++++++-- config/tests/unit-expandlibs.py | 25 ++++++++++ js/src/config/config.mk | 2 +- js/src/config/expandlibs_deps.py | 83 ++++++++++++++++++++++++++++++++ js/src/config/rules.mk | 20 ++++++-- 7 files changed, 225 insertions(+), 10 deletions(-) create mode 100644 config/expandlibs_deps.py create mode 100644 js/src/config/expandlibs_deps.py diff --git a/config/config.mk b/config/config.mk index f9fd8b273d36..066f91a4379a 100644 --- a/config/config.mk +++ b/config/config.mk @@ -783,7 +783,7 @@ OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizeja CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py) -EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py +EXPAND_LIBS_DEPS = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_deps.py EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR) diff --git a/config/expandlibs_deps.py b/config/expandlibs_deps.py new file mode 100644 index 000000000000..022b6e23524c --- /dev/null +++ b/config/expandlibs_deps.py @@ -0,0 +1,83 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is a build helper for libraries +# +# The Initial Developer of the Original Code is +# the Mozilla Foundation +# Portions created by the Initial Developer are Copyright (C) 2011 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Mike Hommey +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +'''expandlibs_deps.py takes a list of key/value pairs and prints, for each +key, a list of all dependencies corresponding to the corresponding value. +Libraries are thus expanded, and their descriptor is also made part of this +list. +The list of key/value is passed on the command line in the form +"var1 = value , var2 = value ..." +''' +import sys +import os +from expandlibs import ExpandArgs, relativize +import expandlibs_config as conf + +class ExpandLibsDeps(ExpandArgs): + def _expand_desc(self, arg): + objs = super(ExpandLibsDeps, self)._expand_desc(arg) + if os.path.exists(arg + conf.LIBS_DESC_SUFFIX): + objs += [relativize(arg + conf.LIBS_DESC_SUFFIX)] + return objs + +def split_args(args): + '''Transforms a list in the form + ['var1', '=', 'value', ',', 'var2', '=', 'other', 'value', ',' ...] + into a corresponding dict + { 'var1': ['value'], + 'var2': ['other', 'value'], ... }''' + + result = {} + while args: + try: + i = args.index(',') + l = args[:i] + args[:i + 1] = [] + except: + l = args + args = [] + if l[1] != '=': + raise RuntimeError('Expected "var = value" format') + result[l[0]] = l[2:] + return result + +if __name__ == '__main__': + for key, value in split_args(sys.argv[1:]).iteritems(): + expanded = ExpandLibsDeps(value) + if os.sep == '\\': + expanded = [o.replace(os.sep, '/') for o in expanded] + print "%s = %s" % (key, " ".join(expanded)) diff --git a/config/rules.mk b/config/rules.mk index 5eae4ccc24c1..4ba20576fdf6 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -746,11 +746,23 @@ $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only) endif # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries -DO_EXPAND_LIBS = $(foreach f,$(1),$(if $(filter %.$(LIB_SUFFIX),$(f)),$(if $(wildcard $(f).$(LIBS_DESC_SUFFIX)),$(f).$(LIBS_DESC_SUFFIX),$(if $(wildcard $(f)),$(f))))) -LIBS_DEPS = $(call DO_EXPAND_LIBS,$(filter %.$(LIB_SUFFIX),$(LIBS) $(if $(PROGRAM)$(SIMPLE_PROGRAMS),$(MOZ_GLUE_PROGRAM_LDFLAGS)))) -SHARED_LIBRARY_LIBS_DEPS = $(call DO_EXPAND_LIBS,$(SHARED_LIBRARY_LIBS)) +ifneq (,$(strip $(filter %.$(LIB_SUFFIX),$(LIBS) $(EXTRA_DSO_LDOPTS)) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LIBS))) +$(MDDEPDIR)/libs: Makefile.in + @mkdir -p $(MDDEPDIR) + @$(EXPAND_LIBS_DEPS) LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(LIBS)) , \ + SHARED_LIBRARY_LIBS_DEPS = $(SHARED_LIBRARY_LIBS) , \ + DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)) > $@ + +ifneq (,$(wildcard $(MDDEPDIR)/libs)) +include $(MDDEPDIR)/libs +endif + +$(MDDEPDIR)/libs: $(wildcard $(filter %.$(LIBS_DESC_SUFFIX),$(LIBS_DEPS) $(SHARED_LIBRARY_LIBS_DEPS) $(DSO_LDOPTS_DEPS))) + +EXTRA_DEPS += $(MDDEPDIR)/libs +endif + HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS)) -DSO_LDOPTS_DEPS = $(call DO_EXPAND_LIBS,$(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))) # Dependencies which, if modified, should cause everything to rebuild GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk diff --git a/config/tests/unit-expandlibs.py b/config/tests/unit-expandlibs.py index a7ab6d1c23e3..f7154c67fc53 100644 --- a/config/tests/unit-expandlibs.py +++ b/config/tests/unit-expandlibs.py @@ -37,6 +37,7 @@ config_unix = { config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config') from expandlibs import LibDescriptor, ExpandArgs, relativize +from expandlibs_deps import ExpandLibsDeps, split_args from expandlibs_gen import generate from expandlibs_exec import ExpandArgsMore, SectionFinder @@ -194,6 +195,30 @@ class TestExpandArgs(TestExpandInit): args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))]) +class TestExpandLibsDeps(TestExpandInit): + def test_expandlibsdeps(self): + '''Test library expansion for dependencies''' + # Dependency list for a library with a descriptor is equivalent to + # the arguments expansion, to which we add each descriptor + args = self.arg_files + [self.tmpfile('liby', Lib('y'))] + self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args) + [self.tmpfile('libx', Lib('x') + config.LIBS_DESC_SUFFIX), self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX)]) + + # When a library exists at the same time as a descriptor, the + # descriptor is not a dependency + self.touch([self.tmpfile('libx', Lib('x'))]) + args = self.arg_files + [self.tmpfile('liby', Lib('y'))] + self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args) + [self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX)]) + + self.touch([self.tmpfile('liby', Lib('y'))]) + args = self.arg_files + [self.tmpfile('liby', Lib('y'))] + self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args)) + +class TestSplitArgs(unittest.TestCase): + def test_split_args(self): + self.assertEqual(split_args(['a', '=', 'b', 'c']), {'a': ['b', 'c']}) + self.assertEqual(split_args(['a', '=', 'b', 'c', ',', 'd', '=', 'e', 'f', 'g', ',', 'h', '=', 'i']), + {'a': ['b', 'c'], 'd': ['e', 'f', 'g'], 'h': ['i']}) + class TestExpandArgsMore(TestExpandInit): def test_makelist(self): '''Test grouping object files in lists''' diff --git a/js/src/config/config.mk b/js/src/config/config.mk index f9fd8b273d36..066f91a4379a 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -783,7 +783,7 @@ OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizeja CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py) -EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py +EXPAND_LIBS_DEPS = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_deps.py EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR) diff --git a/js/src/config/expandlibs_deps.py b/js/src/config/expandlibs_deps.py new file mode 100644 index 000000000000..022b6e23524c --- /dev/null +++ b/js/src/config/expandlibs_deps.py @@ -0,0 +1,83 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is a build helper for libraries +# +# The Initial Developer of the Original Code is +# the Mozilla Foundation +# Portions created by the Initial Developer are Copyright (C) 2011 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Mike Hommey +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +'''expandlibs_deps.py takes a list of key/value pairs and prints, for each +key, a list of all dependencies corresponding to the corresponding value. +Libraries are thus expanded, and their descriptor is also made part of this +list. +The list of key/value is passed on the command line in the form +"var1 = value , var2 = value ..." +''' +import sys +import os +from expandlibs import ExpandArgs, relativize +import expandlibs_config as conf + +class ExpandLibsDeps(ExpandArgs): + def _expand_desc(self, arg): + objs = super(ExpandLibsDeps, self)._expand_desc(arg) + if os.path.exists(arg + conf.LIBS_DESC_SUFFIX): + objs += [relativize(arg + conf.LIBS_DESC_SUFFIX)] + return objs + +def split_args(args): + '''Transforms a list in the form + ['var1', '=', 'value', ',', 'var2', '=', 'other', 'value', ',' ...] + into a corresponding dict + { 'var1': ['value'], + 'var2': ['other', 'value'], ... }''' + + result = {} + while args: + try: + i = args.index(',') + l = args[:i] + args[:i + 1] = [] + except: + l = args + args = [] + if l[1] != '=': + raise RuntimeError('Expected "var = value" format') + result[l[0]] = l[2:] + return result + +if __name__ == '__main__': + for key, value in split_args(sys.argv[1:]).iteritems(): + expanded = ExpandLibsDeps(value) + if os.sep == '\\': + expanded = [o.replace(os.sep, '/') for o in expanded] + print "%s = %s" % (key, " ".join(expanded)) diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 5eae4ccc24c1..4ba20576fdf6 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -746,11 +746,23 @@ $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only) endif # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries -DO_EXPAND_LIBS = $(foreach f,$(1),$(if $(filter %.$(LIB_SUFFIX),$(f)),$(if $(wildcard $(f).$(LIBS_DESC_SUFFIX)),$(f).$(LIBS_DESC_SUFFIX),$(if $(wildcard $(f)),$(f))))) -LIBS_DEPS = $(call DO_EXPAND_LIBS,$(filter %.$(LIB_SUFFIX),$(LIBS) $(if $(PROGRAM)$(SIMPLE_PROGRAMS),$(MOZ_GLUE_PROGRAM_LDFLAGS)))) -SHARED_LIBRARY_LIBS_DEPS = $(call DO_EXPAND_LIBS,$(SHARED_LIBRARY_LIBS)) +ifneq (,$(strip $(filter %.$(LIB_SUFFIX),$(LIBS) $(EXTRA_DSO_LDOPTS)) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LIBS))) +$(MDDEPDIR)/libs: Makefile.in + @mkdir -p $(MDDEPDIR) + @$(EXPAND_LIBS_DEPS) LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(LIBS)) , \ + SHARED_LIBRARY_LIBS_DEPS = $(SHARED_LIBRARY_LIBS) , \ + DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)) > $@ + +ifneq (,$(wildcard $(MDDEPDIR)/libs)) +include $(MDDEPDIR)/libs +endif + +$(MDDEPDIR)/libs: $(wildcard $(filter %.$(LIBS_DESC_SUFFIX),$(LIBS_DEPS) $(SHARED_LIBRARY_LIBS_DEPS) $(DSO_LDOPTS_DEPS))) + +EXTRA_DEPS += $(MDDEPDIR)/libs +endif + HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS)) -DSO_LDOPTS_DEPS = $(call DO_EXPAND_LIBS,$(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))) # Dependencies which, if modified, should cause everything to rebuild GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk From bcc36a72c412962dc769597aea2bf27f444432e7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 6 Apr 2012 11:12:59 +0200 Subject: [PATCH 109/152] Bug 742357 - Use macros to declare nsIMutationObserver functions in nsMutationReceiver r=smaug --- content/base/src/nsDOMMutationObserver.cpp | 6 ++++ content/base/src/nsDOMMutationObserver.h | 34 ++++------------------ 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/content/base/src/nsDOMMutationObserver.cpp b/content/base/src/nsDOMMutationObserver.cpp index 5e30390d4734..6ad99fcb8d89 100644 --- a/content/base/src/nsDOMMutationObserver.cpp +++ b/content/base/src/nsDOMMutationObserver.cpp @@ -385,6 +385,12 @@ nsMutationReceiver::ContentRemoved(nsIDocument* aDocument, Observer()->ScheduleForRun(); } +void nsMutationReceiver::NodeWillBeDestroyed(const nsINode *aNode) +{ + NS_ASSERTION(!mParent, "Shouldn't have mParent here!"); + Disconnect(true); +} + // Observer NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMutationObserver) diff --git a/content/base/src/nsDOMMutationObserver.h b/content/base/src/nsDOMMutationObserver.h index 93c2c34074b7..18e97bd527e5 100644 --- a/content/base/src/nsDOMMutationObserver.h +++ b/content/base/src/nsDOMMutationObserver.h @@ -265,34 +265,12 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(nsMutationReceiver) - virtual void AttributeWillChange(nsIDocument* aDocument, - mozilla::dom::Element* aElement, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType); - virtual void CharacterDataWillChange(nsIDocument *aDocument, - nsIContent* aContent, - CharacterDataChangeInfo* aInfo); - virtual void ContentAppended(nsIDocument *aDocument, - nsIContent* aContainer, - nsIContent* aFirstNewContent, - PRInt32 aNewIndexInContainer); - virtual void ContentInserted(nsIDocument *aDocument, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer); - virtual void ContentRemoved(nsIDocument *aDocument, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer, - nsIContent* aPreviousSibling); - - virtual void NodeWillBeDestroyed(const nsINode *aNode) - { - NS_ASSERTION(!mParent, "Shouldn't have mParent here!"); - Disconnect(true); - } - + NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE + NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE + NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED + NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED }; NS_DEFINE_STATIC_IID_ACCESSOR(nsMutationReceiver, NS_MUTATION_OBSERVER_IID) From c7a0b43a8114711155969ae92c493ce9c4d681c6 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 6 Apr 2012 11:13:28 +0200 Subject: [PATCH 110/152] Bug 742281 - Append instead of assigning OS_LIBS in xpcom/tests/windows/Makefile.in r=glandium --- xpcom/tests/windows/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpcom/tests/windows/Makefile.in b/xpcom/tests/windows/Makefile.in index 86f5dc43f851..95889b7df350 100644 --- a/xpcom/tests/windows/Makefile.in +++ b/xpcom/tests/windows/Makefile.in @@ -54,4 +54,4 @@ CPP_UNIT_TESTS = \ include $(topsrcdir)/config/rules.mk -OS_LIBS = $(call EXPAND_LIBNAME,rpcrt4 uuid advapi32) +OS_LIBS += $(call EXPAND_LIBNAME,rpcrt4 uuid) From 9ee4c9833547e5b3e796d5c63bb5aa42fa1f242a Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Fri, 6 Apr 2012 03:01:07 -0700 Subject: [PATCH 111/152] Bug 741038 - Dumb down mt touchscreen detection, r=cjones --- widget/gonk/libui/EventHub.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/widget/gonk/libui/EventHub.cpp b/widget/gonk/libui/EventHub.cpp index 448de29e6bf5..eccbf3dc715d 100644 --- a/widget/gonk/libui/EventHub.cpp +++ b/widget/gonk/libui/EventHub.cpp @@ -970,9 +970,10 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { // Some joysticks such as the PS3 controller report axes that conflict // with the ABS_MT range. Try to confirm that the device really is // a touch screen. - if (test_bit(BTN_TOUCH, device->keyBitmask) || !haveGamepadButtons) { + // Mozilla Bug 741038 - support GB touchscreen drivers + //if (test_bit(BTN_TOUCH, device->keyBitmask) || !haveGamepadButtons) { device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT; - } + //} // Is this an old style single-touch driver? } else if (test_bit(BTN_TOUCH, device->keyBitmask) && test_bit(ABS_X, device->absBitmask) From d435106df9b2cf139466c18289dda88f29a81da1 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 112/152] Bug 742805 - Do not dump ril socket failures on a desktop build with --enable-b2g-ril. r=philikon --- dom/system/gonk/ril_worker.js | 10 ++++++---- ipc/ril/Ril.cpp | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 6481d360f7d4..b8f19ee38176 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -1923,7 +1923,7 @@ RIL[REQUEST_VOICE_REGISTRATION_STATE] = function REQUEST_VOICE_REGISTRATION_STAT } let state = Buf.readStringList(); -debug("voice registration state: " + state); + if (DEBUG) debug("voice registration state: " + state); this._processVoiceRegistrationState(state); }; RIL[REQUEST_DATA_REGISTRATION_STATE] = function REQUEST_DATA_REGISTRATION_STATE(length, options) { @@ -2047,9 +2047,11 @@ RIL[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) { if (sw1 != ICC_STATUS_NORMAL_ENDING) { // See GSM11.11, TS 51.011 clause 9.4, and ISO 7816-4 for the error // description. - debug("ICC I/O Error EF id = " + options.fileid.toString(16) + - " command = " + options.command.toString(16) + - "(" + sw1.toString(16) + "/" + sw2.toString(16) + ")"); + if (DEBUG) { + debug("ICC I/O Error EF id = " + options.fileid.toString(16) + + " command = " + options.command.toString(16) + + "(" + sw1.toString(16) + "/" + sw2.toString(16) + ")"); + } return; } diff --git a/ipc/ril/Ril.cpp b/ipc/ril/Ril.cpp index c6407c13d922..113e23e23ac9 100644 --- a/ipc/ril/Ril.cpp +++ b/ipc/ril/Ril.cpp @@ -229,7 +229,9 @@ RilClient::OpenSocket() } if (connect(mSocket.mFd, (struct sockaddr *) &addr, alen) < 0) { +#if defined(MOZ_WIDGET_GONK) LOG("Cannot open socket for RIL!\n"); +#endif close(mSocket.mFd); return false; } From f3b5badf835d4f9c4cfead1a6164c67afc42efe2 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 113/152] Bug 742778 - Turn off the debug mode by default for dom/wifi. r=mrbkap --- dom/wifi/DOMWifiManager.js | 2 +- dom/wifi/WifiWorker.js | 2 +- dom/wifi/wifi_worker.js | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js index e272034defac..24e71f463b7f 100644 --- a/dom/wifi/DOMWifiManager.js +++ b/dom/wifi/DOMWifiManager.js @@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/DOMRequestHelper.jsm"); -const DEBUG = true; // set to false to suppress debug messages +const DEBUG = false; // set to false to suppress debug messages const DOMWIFIMANAGER_CONTRACTID = "@mozilla.org/wifimanager;1"; const DOMWIFIMANAGER_CID = Components.ID("{2cf775a7-1837-410c-9e26-323c42e076da}"); diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index 4ac0424bf31c..d439db323e21 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -44,7 +44,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -const DEBUG = true; // set to false to suppress debug messages +const DEBUG = false; // set to false to suppress debug messages const WIFIWORKER_CONTRACTID = "@mozilla.org/wifi/worker;1"; const WIFIWORKER_CID = Components.ID("{a14e8977-d259-433a-a88d-58dd44657e5b}"); diff --git a/dom/wifi/wifi_worker.js b/dom/wifi/wifi_worker.js index b8311f483eeb..89ece68b49bc 100644 --- a/dom/wifi/wifi_worker.js +++ b/dom/wifi/wifi_worker.js @@ -13,6 +13,17 @@ var hwaddr = ctypes.uint8_t.array(6)(); var len = ctypes.size_t(); var ints = ctypes.int.array(8)(); +const DEBUG = false; + +let debug; +if (DEBUG) { + debug = function (s) { + dump("-*- WifiWorker component: " + s + "\n"); + }; +} else { + debug = function (s) {}; +} + // TODO: consolidate with implementation in systemlibs.js let libcutils = (function () { let library = ctypes.open("libcutils.so"); @@ -67,7 +78,7 @@ self.onmessage = function(e) { postMessage({ id: id, status: ret }); break; case "ifc_configure": - dump("WIFI: data: " + uneval(data) + "\n"); + debug("WIFI: data: " + uneval(data) + "\n"); var ret = libnetutils.ifc_configure(data.ifname, data.ipaddr, data.mask, data.gateway, data.dns1, data.dns2); postMessage({ id: id, status: ret }); break; @@ -93,7 +104,7 @@ self.onmessage = function(e) { default: var f = libhardware_legacy[cmd] || libnetutils[cmd]; var ret = f(); - dump("WIFI: " + cmd + " returned: " + ret); + debug("WIFI: " + cmd + " returned: " + ret); postMessage({ id: id, status: ret }); break; } From 5bc7aae6bcf526319ab955f10ae6d32dba67bfb0 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 114/152] Bug 742775 - Turn off the debug mode by default on SmsDatabaseService.js. r=philikon --- dom/sms/src/ril/SmsDatabaseService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/sms/src/ril/SmsDatabaseService.js b/dom/sms/src/ril/SmsDatabaseService.js index 39dab2116b6c..04b71c7f5695 100644 --- a/dom/sms/src/ril/SmsDatabaseService.js +++ b/dom/sms/src/ril/SmsDatabaseService.js @@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); const RIL_SMSDATABASESERVICE_CONTRACTID = "@mozilla.org/sms/rilsmsdatabaseservice;1"; const RIL_SMSDATABASESERVICE_CID = Components.ID("{a1fa610c-eb6c-4ac2-878f-b005d5e89249}"); -const DEBUG = true; +const DEBUG = false; const DB_NAME = "sms"; const DB_VERSION = 1; const STORE_NAME = "sms"; From 6f5f3f6e701fef346fd989b74bff12a9f13084ec Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 115/152] Bug 740974 - toolbar currentSet setter needs to return 'val' when returning early. r=dao --- toolkit/content/widgets/toolbar.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index 36576eac6539..976563dededd 100644 --- a/toolkit/content/widgets/toolbar.xml +++ b/toolkit/content/widgets/toolbar.xml @@ -225,7 +225,7 @@ Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 116/152] Bug 742765 - this._indexedDB is undefined in SettingsManager.js. r=gwagner --- dom/settings/SettingsManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/settings/SettingsManager.js b/dom/settings/SettingsManager.js index c5f1909d7a5b..53e23e1e3413 100644 --- a/dom/settings/SettingsManager.js +++ b/dom/settings/SettingsManager.js @@ -64,7 +64,7 @@ SettingsDB.prototype = { } let self = this; - debug("try to open database:" + DB_NAME + " " + DB_VERSION + " " + this._indexedDB); + debug("try to open database:" + DB_NAME + " " + DB_VERSION + " " + this.db); let req = aGlobal.mozIndexedDB.open(DB_NAME, DB_VERSION); req.onsuccess = function (event) { debug("Opened database:", DB_NAME, DB_VERSION); From 88ce490e485abdecf7f2866fd149eb0847b246b2 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Fri, 6 Apr 2012 03:12:18 -0700 Subject: [PATCH 117/152] Bug 742761 - Remove some warnings in b2g/. r=fabrice --- b2g/chrome/content/shell.js | 22 +++++++++++++++++----- b2g/chrome/content/shell.xul | 5 +---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 0825cdd3bd4e..34aa8e805200 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -30,8 +30,14 @@ XPCOMUtils.defineLazyGetter(Services, 'idle', function() { }); XPCOMUtils.defineLazyGetter(Services, 'audioManager', function() { +#ifdef MOZ_WIDGET_GONK return Cc['@mozilla.org/telephony/audiomanager;1'] .getService(Ci.nsIAudioManager); +#else + return { + "masterVolume": 0 + }; +#endif }); XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function() { @@ -79,11 +85,12 @@ var shell = { return Services.prefs.getCharPref('browser.homescreenURL'); }, - start: function shell_init() { + start: function shell_start() { let homeURL = this.homeURL; if (!homeURL) { let msg = 'Fatal error during startup: No homescreen found: try setting B2G_HOMESCREEN'; - return alert(msg); + alert(msg); + return; } ['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) { @@ -100,9 +107,7 @@ var shell = { // a specific value when the device starts. This way the front-end // can display a notification when the volume change and show a volume // level modified from this point. - try { - Services.audioManager.masterVolume = 0.5; - } catch(e) {} + Services.audioManager.masterVolume = 0.5; let domains = ""; try { @@ -297,6 +302,7 @@ var shell = { } } } + let wakeLockHandler = function wakeLockHandler(topic, state) { // Turn off the screen when no one needs the it or all of them are // invisible, otherwise turn the screen on. Note that the CPU @@ -313,7 +319,11 @@ var shell = { } } } + let idleTimeout = Services.prefs.getIntPref("power.screen.timeout"); + if (!('mozSettings' in navigator)) + return; + let request = navigator.mozSettings.getLock().get("power.screen.timeout"); request.onsuccess = function onSuccess() { idleTimeout = request.result["power.screen.timeout"] || idleTimeout; @@ -322,12 +332,14 @@ var shell = { power.addWakeLockListener(wakeLockHandler); } } + request.onerror = function onError() { if (idleTimeout) { Services.idle.addIdleObserver(idleHandler, idleTimeout); power.addWakeLockListener(wakeLockHandler); } } + // XXX We may override other's callback here, but this is the only // user of mozSettings in shell.js at this moment. navigator.mozSettings.onsettingchange = function onSettingChange(e) { diff --git a/b2g/chrome/content/shell.xul b/b2g/chrome/content/shell.xul index d4e623a565e0..222a8172e7a9 100644 --- a/b2g/chrome/content/shell.xul +++ b/b2g/chrome/content/shell.xul @@ -19,14 +19,11 @@ #ifndef MOZ_TOUCH