aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/waterfox/Makefile6
-rw-r--r--www/waterfox/distinfo6
-rw-r--r--www/waterfox/files/patch-bug1387427499
-rw-r--r--www/waterfox/files/patch-bug1389561758
-rw-r--r--www/waterfox/files/patch-bug139550835
-rw-r--r--www/waterfox/files/patch-bug1398581125
-rw-r--r--www/waterfox/files/patch-bug139940039
-rw-r--r--www/waterfox/files/patch-bug140145936
-rw-r--r--www/waterfox/files/patch-bug1409449161
-rw-r--r--www/waterfox/files/patch-bug1412646162
-rw-r--r--www/waterfox/files/patch-bug1413143306
-rw-r--r--www/waterfox/files/patch-bug141529152
-rw-r--r--www/waterfox/files/patch-bug141588344
-rw-r--r--www/waterfox/files/patch-bug141766137
-rw-r--r--www/waterfox/files/patch-bug141844726
-rw-r--r--www/waterfox/files/patch-bug1418894244
-rw-r--r--www/waterfox/files/patch-bug1418966232
-rw-r--r--www/waterfox/files/patch-bug141936332
-rw-r--r--www/waterfox/files/patch-bug142050732
-rw-r--r--www/waterfox/files/patch-bug1423086222
-rw-r--r--www/waterfox/files/patch-bug142315969
-rw-r--r--www/waterfox/files/patch-bug142377044
-rw-r--r--www/waterfox/files/patch-bug1425000139
-rw-r--r--www/waterfox/files/patch-bug142526755
-rw-r--r--www/waterfox/files/patch-bug730495545
25 files changed, 1458 insertions, 2448 deletions
diff --git a/www/waterfox/Makefile b/www/waterfox/Makefile
index e795914d085c..0ec1e39405b4 100644
--- a/www/waterfox/Makefile
+++ b/www/waterfox/Makefile
@@ -1,15 +1,15 @@
# $FreeBSD$
PORTNAME= waterfox
-DISTVERSION= 56.0.3
-PORTREVISION= 4
+DISTVERSION= 56.0.3-63
+DISTVERSIONSUFFIX= -g3c6467364007
CATEGORIES= www ipv6
MAINTAINER= jbeich@FreeBSD.org
COMMENT= Distilled fork of Firefox
DEPRECATED= Temporary experiment
-EXPIRATION_DATE=2018-01-30
+EXPIRATION_DATE=2018-03-20
BUILD_DEPENDS= nspr>=4.16:devel/nspr \
nss>=3.32.1:security/nss \
diff --git a/www/waterfox/distinfo b/www/waterfox/distinfo
index b0652dc4098f..65a99923b4e8 100644
--- a/www/waterfox/distinfo
+++ b/www/waterfox/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1515710085
-SHA256 (MrAlex94-Waterfox-56.0.3_GH0.tar.gz) = 80d4bba90b2d8aac7223aa81302ea56e0dc226e29d01c206e2cbf375d471a9fa
-SIZE (MrAlex94-Waterfox-56.0.3_GH0.tar.gz) = 394227402
+TIMESTAMP = 1517018506
+SHA256 (MrAlex94-Waterfox-56.0.3-63-g3c6467364007_GH0.tar.gz) = b9cfff8a10e7783cf17086b1cd19b1d17e3ad2d5fe89fb5d2b9a4502486e08e5
+SIZE (MrAlex94-Waterfox-56.0.3-63-g3c6467364007_GH0.tar.gz) = 394217223
diff --git a/www/waterfox/files/patch-bug1387427 b/www/waterfox/files/patch-bug1387427
deleted file mode 100644
index 06139cd2d8f9..000000000000
--- a/www/waterfox/files/patch-bug1387427
+++ /dev/null
@@ -1,499 +0,0 @@
-commit ecb753bbae79
-Author: Peter Van der Beken <peterv@propagandism.org>
-Date: Fri Nov 3 16:58:59 2017 +0100
-
- Bug 1387427 - Don't insert source content into the document for XSLT transforms. r=smaug, a=gchang
-
- --HG--
- extra : source : b069f99a8ca9989f277645bbadc2116dcabd8ad0
----
- dom/xml/nsXMLContentSink.cpp | 93 +++++++++++++++++---------------
- dom/xml/nsXMLContentSink.h | 8 ++-
- dom/xslt/base/txURIUtils.cpp | 11 +---
- dom/xslt/base/txURIUtils.h | 4 +-
- dom/xslt/nsIDocumentTransformer.h | 6 ++-
- dom/xslt/xslt/txExecutionState.cpp | 15 ++++--
- dom/xslt/xslt/txExecutionState.h | 7 ++-
- dom/xslt/xslt/txMozillaTextOutput.cpp | 2 +-
- dom/xslt/xslt/txMozillaXMLOutput.cpp | 2 +-
- dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 37 +++++++------
- dom/xslt/xslt/txMozillaXSLTProcessor.h | 7 +--
- 11 files changed, 107 insertions(+), 85 deletions(-)
-
-diff --git dom/xml/nsXMLContentSink.cpp dom/xml/nsXMLContentSink.cpp
-index 637939261be7..3d973f2bcf97 100644
---- dom/xml/nsXMLContentSink.cpp
-+++ dom/xml/nsXMLContentSink.cpp
-@@ -152,6 +152,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLContentSink,
- const StackNode& node = tmp->mContentStack.ElementAt(i);
- cb.NoteXPCOMChild(node.mContent);
- }
-+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentChildren)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
- // nsIContentSink
-@@ -293,8 +294,7 @@ nsXMLContentSink::DidBuildModel(bool aTerminated)
- }
- }
-
-- nsCOMPtr<nsIDOMDocument> currentDOMDoc(do_QueryInterface(mDocument));
-- mXSLTProcessor->SetSourceContentModel(currentDOMDoc);
-+ mXSLTProcessor->SetSourceContentModel(mDocument, mDocumentChildren);
- // Since the processor now holds a reference to us we drop our reference
- // to it to avoid owning cycles
- mXSLTProcessor = nullptr;
-@@ -358,8 +358,9 @@ NS_IMETHODIMP
- nsXMLContentSink::OnTransformDone(nsresult aResult,
- nsIDocument* aResultDocument)
- {
-- NS_ASSERTION(NS_FAILED(aResult) || aResultDocument,
-- "Don't notify about transform success without a document.");
-+ MOZ_ASSERT(aResultDocument, "Don't notify about transform end without a document.");
-+
-+ mDocumentChildren.Clear();
-
- nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aResultDocument);
-
-@@ -368,28 +369,17 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
-
- if (NS_FAILED(aResult) && contentViewer) {
- // Transform failed.
-- if (domDoc) {
-- aResultDocument->SetMayStartLayout(false);
-- // We have an error document.
-- contentViewer->SetDOMDocument(domDoc);
-- }
-- else {
-- // We don't have an error document, display the
-- // untransformed source document.
-- nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
-- contentViewer->SetDOMDocument(document);
-- }
-+ aResultDocument->SetMayStartLayout(false);
-+ // We have an error document.
-+ contentViewer->SetDOMDocument(domDoc);
- }
-
- nsCOMPtr<nsIDocument> originalDocument = mDocument;
-- if (NS_SUCCEEDED(aResult) || aResultDocument) {
-- // Transform succeeded or it failed and we have an error
-- // document to display.
-- mDocument = aResultDocument;
-- nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
-- if (htmlDoc) {
-- htmlDoc->SetDocWriteDisabled(false);
-- }
-+ // Transform succeeded, or it failed and we have an error document to display.
-+ mDocument = aResultDocument;
-+ nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
-+ if (htmlDoc) {
-+ htmlDoc->SetDocWriteDisabled(false);
- }
-
- // Notify document observers that all the content has been stuck
-@@ -617,12 +607,17 @@ nsXMLContentSink::AddContentAsLeaf(nsIContent *aContent)
- {
- nsresult result = NS_OK;
-
-- if ((eXMLContentSinkState_InProlog == mState) ||
-- (eXMLContentSinkState_InEpilog == mState)) {
-- NS_ASSERTION(mDocument, "Fragments have no prolog or epilog");
-- mDocument->AppendChildTo(aContent, false);
-- }
-- else {
-+ if (mState == eXMLContentSinkState_InProlog) {
-+ NS_ASSERTION(mDocument, "Fragments have no prolog");
-+ mDocumentChildren.AppendElement(aContent);
-+ } else if (mState == eXMLContentSinkState_InEpilog) {
-+ NS_ASSERTION(mDocument, "Fragments have no epilog");
-+ if (mXSLTProcessor) {
-+ mDocumentChildren.AppendElement(aContent);
-+ } else {
-+ mDocument->AppendChildTo(aContent, false);
-+ }
-+ } else {
- nsCOMPtr<nsIContent> parent = GetCurrentContent();
-
- if (parent) {
-@@ -875,6 +870,20 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
- if (mDocElement)
- return false;
-
-+ mDocElement = aContent;
-+
-+ if (mXSLTProcessor) {
-+ mDocumentChildren.AppendElement(aContent);
-+ return true;
-+ }
-+
-+ if (!mDocumentChildren.IsEmpty()) {
-+ for (nsIContent* child : mDocumentChildren) {
-+ mDocument->AppendChildTo(child, false);
-+ }
-+ mDocumentChildren.Clear();
-+ }
-+
- // check for root elements that needs special handling for
- // prettyprinting
- if ((aNameSpaceID == kNameSpaceID_XBL &&
-@@ -893,7 +902,6 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
- }
- }
-
-- mDocElement = aContent;
- nsresult rv = mDocument->AppendChildTo(mDocElement, NotifyForDocElement());
- if (NS_FAILED(rv)) {
- // If we return false here, the caller will bail out because it won't
-@@ -1001,17 +1009,17 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
- mInMonolithicContainer++;
- }
-
-- if (content != mDocElement && !mCurrentHead) {
-- // This isn't the root and we're not inside an XHTML <head>.
-- // Might need to start layout
-- MaybeStartLayout(false);
-- }
--
-- if (content == mDocElement) {
-- NotifyDocElementCreated(mDocument);
-+ if (!mXSLTProcessor) {
-+ if (content == mDocElement) {
-+ NotifyDocElementCreated(mDocument);
-
-- if (aInterruptable && NS_SUCCEEDED(result) && mParser && !mParser->IsParserEnabled()) {
-- return NS_ERROR_HTMLPARSER_BLOCK;
-+ if (aInterruptable && NS_SUCCEEDED(result) && mParser && !mParser->IsParserEnabled()) {
-+ return NS_ERROR_HTMLPARSER_BLOCK;
-+ }
-+ } else if (!mCurrentHead) {
-+ // This isn't the root and we're not inside an XHTML <head>.
-+ // Might need to start layout
-+ MaybeStartLayout(false);
- }
- }
-
-@@ -1171,9 +1179,9 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
- nsCOMPtr<nsIContent> content = do_QueryInterface(docType);
- NS_ASSERTION(content, "doctype isn't content?");
-
-- rv = mDocument->AppendChildTo(content, false);
-+ mDocumentChildren.AppendElement(content);
- DidAddContent();
-- return NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv;
-+ return DidProcessATokenImpl();
- }
-
- NS_IMETHODIMP
-@@ -1321,6 +1329,7 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
- mIsDocumentObserver = false;
-
- // Clear the current content
-+ mDocumentChildren.Clear();
- nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mDocument));
- if (node) {
- for (;;) {
-diff --git dom/xml/nsXMLContentSink.h dom/xml/nsXMLContentSink.h
-index a1a7fc8814e9..17ac940caa07 100644
---- dom/xml/nsXMLContentSink.h
-+++ dom/xml/nsXMLContentSink.h
-@@ -139,7 +139,7 @@ protected:
-
- void DidAddContent()
- {
-- if (IsTimeToNotify()) {
-+ if (!mXSLTProcessor && IsTimeToNotify()) {
- FlushTags();
- }
- }
-@@ -190,6 +190,12 @@ protected:
-
- nsCOMPtr<nsIDocumentTransformer> mXSLTProcessor;
-
-+ // Holds the children in the prolog until the root element is added, after which they're
-+ // inserted in the document. However, if we're doing an XSLT transform this will
-+ // actually hold all the children of the source document, until the transform is
-+ // finished. After the transform is finished we'll just discard the children.
-+ nsTArray<nsCOMPtr<nsIContent>> mDocumentChildren;
-+
- static const int NS_ACCUMULATION_BUFFER_SIZE = 4096;
- // Our currently accumulated text that we have not flushed to a textnode yet.
- char16_t mText[NS_ACCUMULATION_BUFFER_SIZE];
-diff --git dom/xslt/base/txURIUtils.cpp dom/xslt/base/txURIUtils.cpp
-index 2c0dec942b80..3f3556f80110 100644
---- dom/xslt/base/txURIUtils.cpp
-+++ dom/xslt/base/txURIUtils.cpp
-@@ -43,16 +43,9 @@ void URIUtils::resolveHref(const nsAString& href, const nsAString& base,
-
- // static
- void
--URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
-+URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsINode *aSourceNode)
- {
-- nsCOMPtr<nsINode> node = do_QueryInterface(aSourceNode);
-- if (!node) {
-- // XXXbz passing nullptr as the first arg to Reset is illegal
-- aNewDoc->Reset(nullptr, nullptr);
-- return;
-- }
--
-- nsCOMPtr<nsIDocument> sourceDoc = node->OwnerDoc();
-+ nsCOMPtr<nsIDocument> sourceDoc = aSourceNode->OwnerDoc();
- nsIPrincipal* sourcePrincipal = sourceDoc->NodePrincipal();
-
- // Copy the channel and loadgroup from the source document.
-diff --git dom/xslt/base/txURIUtils.h dom/xslt/base/txURIUtils.h
-index ca38538a8b82..ad182a00a795 100644
---- dom/xslt/base/txURIUtils.h
-+++ dom/xslt/base/txURIUtils.h
-@@ -9,7 +9,7 @@
- #include "txCore.h"
-
- class nsIDocument;
--class nsIDOMNode;
-+class nsINode;
-
- /**
- * A utility class for URI handling
-@@ -22,7 +22,7 @@ public:
- /**
- * Reset the given document with the document of the source node
- */
-- static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode);
-+ static void ResetWithSource(nsIDocument *aNewDoc, nsINode *aSourceNode);
-
- /**
- * Resolves the given href argument, using the given documentBase
-diff --git dom/xslt/nsIDocumentTransformer.h dom/xslt/nsIDocumentTransformer.h
-index a5df807ffe8c..34343e8e1a15 100644
---- dom/xslt/nsIDocumentTransformer.h
-+++ dom/xslt/nsIDocumentTransformer.h
-@@ -7,10 +7,13 @@
-
- #include "nsISupports.h"
-
-+template<class> class nsCOMPtr;
-+class nsIContent;
- class nsIDocument;
- class nsIDOMNode;
- class nsIURI;
- class nsString;
-+template<class> class nsTArray;
-
- #define NS_ITRANSFORMOBSERVER_IID \
- { 0x04b2d17c, 0xe98d, 0x45f5, \
-@@ -43,7 +46,8 @@ public:
-
- NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) = 0;
- NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsIDocument* aLoaderDocument) = 0;
-- NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) = 0;
-+ NS_IMETHOD SetSourceContentModel(nsIDocument* aDocument,
-+ const nsTArray<nsCOMPtr<nsIContent>>& aSource) = 0;
- NS_IMETHOD CancelLoads() = 0;
-
- NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
-diff --git dom/xslt/xslt/txExecutionState.cpp dom/xslt/xslt/txExecutionState.cpp
-index e1d714189ce7..2fc84971d2d3 100644
---- dom/xslt/xslt/txExecutionState.cpp
-+++ dom/xslt/xslt/txExecutionState.cpp
-@@ -17,9 +17,9 @@
- const int32_t txExecutionState::kMaxRecursionDepth = 20000;
-
- nsresult
--txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
-+txLoadedDocumentsHash::init(const txXPathNode& aSource)
- {
-- mSourceDocument = aSourceDocument;
-+ mSourceDocument = txXPathNodeUtils::getOwnerDocument(aSource);
-
- nsAutoString baseURI;
- nsresult rv = txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);
-@@ -27,7 +27,14 @@ txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
- return rv;
- }
-
-- PutEntry(baseURI)->mDocument = mSourceDocument;
-+ // Technically the hash holds documents, but we allow any node that we're transforming
-+ // from. In particular, the document() function uses this hash and it can return the
-+ // source document, but if we're transforming from a document fragment (through
-+ // txMozillaXSLTProcessor::SetSourceContentModel/txMozillaXSLTProcessor::DoTransform)
-+ // or from another type of node (through txMozillaXSLTProcessor::TransformToDocument
-+ // or txMozillaXSLTProcessor::TransformToFragment) it makes more sense to return the
-+ // real root of the source tree, which is the node where the transform started.
-+ PutEntry(baseURI)->mDocument = txXPathNativeNode::createXPathNode(txXPathNativeNode::getNode(aSource));
- return NS_OK;
- }
-
-@@ -121,7 +128,7 @@ txExecutionState::init(const txXPathNode& aNode,
- mOutputHandler->startDocument();
-
- // Set up loaded-documents-hash
-- rv = mLoadedDocuments.init(txXPathNodeUtils::getOwnerDocument(aNode));
-+ rv = mLoadedDocuments.init(aNode);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Init members
-diff --git dom/xslt/xslt/txExecutionState.h dom/xslt/xslt/txExecutionState.h
-index 44f1918c86b0..300bcfed07e4 100644
---- dom/xslt/xslt/txExecutionState.h
-+++ dom/xslt/xslt/txExecutionState.h
-@@ -56,16 +56,15 @@ class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry>
- {
- public:
- txLoadedDocumentsHash()
-- : nsTHashtable<txLoadedDocumentEntry>(4),
-- mSourceDocument(nullptr)
-+ : nsTHashtable<txLoadedDocumentEntry>(4)
- {
- }
- ~txLoadedDocumentsHash();
-- MOZ_MUST_USE nsresult init(txXPathNode* aSourceDocument);
-+ MOZ_MUST_USE nsresult init(const txXPathNode& aSource);
-
- private:
- friend class txExecutionState;
-- txXPathNode* mSourceDocument;
-+ nsAutoPtr<txXPathNode> mSourceDocument;
- };
-
-
-diff --git dom/xslt/xslt/txMozillaTextOutput.cpp dom/xslt/xslt/txMozillaTextOutput.cpp
-index 9056bd8f2608..c2c6ba8757be 100644
---- dom/xslt/xslt/txMozillaTextOutput.cpp
-+++ dom/xslt/xslt/txMozillaTextOutput.cpp
-@@ -153,7 +153,7 @@ txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
- NS_ASSERTION(mDocument, "Need document");
-
- // Reset and set up document
-- URIUtils::ResetWithSource(mDocument, aSourceDocument);
-+ URIUtils::ResetWithSource(mDocument, source);
- // Only do this after resetting the document to ensure we have the
- // correct principal.
- mDocument->SetScriptHandlingObject(sgo);
-diff --git dom/xslt/xslt/txMozillaXMLOutput.cpp dom/xslt/xslt/txMozillaXMLOutput.cpp
-index 451f093682a4..5c254e22c0e9 100644
---- dom/xslt/xslt/txMozillaXMLOutput.cpp
-+++ dom/xslt/xslt/txMozillaXMLOutput.cpp
-@@ -812,7 +812,7 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
- mNodeInfoManager = mDocument->NodeInfoManager();
-
- // Reset and set up the document
-- URIUtils::ResetWithSource(mDocument, aSourceDocument);
-+ URIUtils::ResetWithSource(mDocument, source);
-
- // Make sure we set the script handling object after resetting with the
- // source, so that we have the right principal.
-diff --git dom/xslt/xslt/txMozillaXSLTProcessor.cpp dom/xslt/xslt/txMozillaXSLTProcessor.cpp
-index bc554e54878e..54e7c2aed220 100644
---- dom/xslt/xslt/txMozillaXSLTProcessor.cpp
-+++ dom/xslt/xslt/txMozillaXSLTProcessor.cpp
-@@ -377,15 +377,27 @@ txMozillaXSLTProcessor::SetTransformObserver(nsITransformObserver* aObserver)
- }
-
- nsresult
--txMozillaXSLTProcessor::SetSourceContentModel(nsIDOMNode* aSourceDOM)
-+txMozillaXSLTProcessor::SetSourceContentModel(nsIDocument* aDocument,
-+ const nsTArray<nsCOMPtr<nsIContent>>& aSource)
- {
-- mSource = aSourceDOM;
--
- if (NS_FAILED(mTransformResult)) {
- notifyError();
- return NS_OK;
- }
-
-+ mSource = aDocument->CreateDocumentFragment();
-+
-+ ErrorResult rv;
-+ for (nsIContent* child : aSource) {
-+ // XPath data model doesn't have DocumentType nodes.
-+ if (child->NodeType() != nsIDOMNode::DOCUMENT_TYPE_NODE) {
-+ mSource->AppendChild(*child, rv);
-+ if (rv.Failed()) {
-+ return rv.StealNSResult();
-+ }
-+ }
-+ }
-+
- if (mStylesheet) {
- return DoTransform();
- }
-@@ -552,8 +564,7 @@ public:
-
- ~nsTransformBlockerEvent()
- {
-- nsCOMPtr<nsIDocument> document =
-- do_QueryInterface(mProcessor->GetSourceContentModel());
-+ nsCOMPtr<nsIDocument> document = mProcessor->GetSourceContentModel()->OwnerDoc();
- document->UnblockOnload(true);
- }
-
-@@ -572,13 +583,9 @@ txMozillaXSLTProcessor::DoTransform()
- NS_ASSERTION(mObserver, "no observer");
- NS_ASSERTION(NS_IsMainThread(), "should only be on main thread");
-
-- nsresult rv;
-- nsCOMPtr<nsIDocument> document = do_QueryInterface(mSource, &rv);
-- NS_ENSURE_SUCCESS(rv, rv);
--
- nsCOMPtr<nsIRunnable> event = new nsTransformBlockerEvent(this);
-- document->BlockOnload();
-- rv = NS_DispatchToCurrentThread(event);
-+ mSource->OwnerDoc()->BlockOnload();
-+ nsresult rv = NS_DispatchToCurrentThread(event);
- if (NS_FAILED(rv)) {
- // XXX Maybe we should just display the source document in this case?
- // Also, set up context information, see bug 204655.
-@@ -643,7 +650,7 @@ txMozillaXSLTProcessor::TransformToDocument(nsIDOMNode *aSource,
- nsresult rv = ensureStylesheet();
- NS_ENSURE_SUCCESS(rv, rv);
-
-- mSource = aSource;
-+ mSource = do_QueryInterface(aSource);
-
- return TransformToDoc(aResult, true);
- }
-@@ -657,11 +664,7 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult,
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
-- nsCOMPtr<nsIDOMDocument> sourceDOMDocument;
-- mSource->GetOwnerDocument(getter_AddRefs(sourceDOMDocument));
-- if (!sourceDOMDocument) {
-- sourceDOMDocument = do_QueryInterface(mSource);
-- }
-+ nsCOMPtr<nsIDOMDocument> sourceDOMDocument = do_QueryInterface(mSource->OwnerDoc());
-
- txExecutionState es(mStylesheet, IsLoadDisabled());
-
-diff --git dom/xslt/xslt/txMozillaXSLTProcessor.h dom/xslt/xslt/txMozillaXSLTProcessor.h
-index 569ca7adbf6e..b3c5420d6fee 100644
---- dom/xslt/xslt/txMozillaXSLTProcessor.h
-+++ dom/xslt/xslt/txMozillaXSLTProcessor.h
-@@ -75,7 +75,8 @@ public:
- // nsIDocumentTransformer interface
- NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) override;
- NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsIDocument* aLoaderDocument) override;
-- NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) override;
-+ NS_IMETHOD SetSourceContentModel(nsIDocument* aDocument,
-+ const nsTArray<nsCOMPtr<nsIContent>>& aSource) override;
- NS_IMETHOD CancelLoads() override {return NS_OK;}
- NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
- const nsString& aNamespace) override;
-@@ -136,7 +137,7 @@ public:
- void reportError(nsresult aResult, const char16_t *aErrorText,
- const char16_t *aSourceText);
-
-- nsIDOMNode *GetSourceContentModel()
-+ nsINode *GetSourceContentModel()
- {
- return mSource;
- }
-@@ -169,7 +170,7 @@ private:
- nsIDocument* mStylesheetDocument; // weak
- nsCOMPtr<nsIContent> mEmbeddedStylesheetRoot;
-
-- nsCOMPtr<nsIDOMNode> mSource;
-+ nsCOMPtr<nsINode> mSource;
- nsresult mTransformResult;
- nsresult mCompileResult;
- nsString mErrorText, mSourceText;
diff --git a/www/waterfox/files/patch-bug1389561 b/www/waterfox/files/patch-bug1389561
deleted file mode 100644
index 392628d98f1b..000000000000
--- a/www/waterfox/files/patch-bug1389561
+++ /dev/null
@@ -1,758 +0,0 @@
-commit 06e22a681925
-Author: Shawn Huang <shuang@mozilla.com>
-Date: Thu Oct 26 16:59:18 2017 +0800
-
- Bug 1389561 - Part 1: Ensure origin initialized in Maintenance::DirectoryWork. r=janv
-
- Make sure origins had been initialized in Maintenance::DirectoryWork before getting
- QuotaObject. It's possible that DatabaseMaintenance::Run before origins initialized.
----
- dom/indexedDB/ActorsParent.cpp | 20 ++++++++++++++++++--
- 1 file changed, 18 insertions(+), 2 deletions(-)
-
-diff --git dom/indexedDB/ActorsParent.cpp dom/indexedDB/ActorsParent.cpp
-index de613cc4eec0..06ffc9df84fa 100644
---- dom/indexedDB/ActorsParent.cpp
-+++ dom/indexedDB/ActorsParent.cpp
-@@ -18602,6 +18602,7 @@ Maintenance::DirectoryWork()
- continue;
- }
-
-+ nsCString suffix;
- nsCString group;
- nsCString origin;
- nsTArray<nsString> databasePaths;
-@@ -18659,17 +18660,17 @@ Maintenance::DirectoryWork()
-
- // Found a database.
- if (databasePaths.IsEmpty()) {
-+ MOZ_ASSERT(suffix.IsEmpty());
- MOZ_ASSERT(group.IsEmpty());
- MOZ_ASSERT(origin.IsEmpty());
-
- int64_t dummyTimeStamp;
- bool dummyPersisted;
-- nsCString dummySuffix;
- if (NS_WARN_IF(NS_FAILED(
- quotaManager->GetDirectoryMetadata2(originDir,
- &dummyTimeStamp,
- &dummyPersisted,
-- dummySuffix,
-+ suffix,
- group,
- origin)))) {
- // Not much we can do here...
-@@ -18687,6 +18688,21 @@ Maintenance::DirectoryWork()
- group,
- origin,
- Move(databasePaths)));
-+
-+ nsCOMPtr<nsIFile> directory;
-+
-+ // Idle maintenance may occur before origin is initailized.
-+ // Ensure origin is initialized first. It will initialize all origins
-+ // for temporary storage including IDB origins.
-+ rv = quotaManager->EnsureOriginIsInitialized(persistenceType,
-+ suffix,
-+ group,
-+ origin,
-+ getter_AddRefs(directory));
-+
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
- }
- }
- }
-commit a9f850009e15
-Author: Shawn Huang <shuang@mozilla.com>
-Date: Thu Nov 2 14:54:07 2017 +0800
-
- Bug 1389561 - Part 2: Wait for idle maintenance releasing DirectoryLock when finished. r=janv
----
- dom/indexedDB/ActorsParent.cpp | 68 +++++++++++++++++++++++++++++++-----------
- 1 file changed, 51 insertions(+), 17 deletions(-)
-
-diff --git dom/indexedDB/ActorsParent.cpp dom/indexedDB/ActorsParent.cpp
-index 47d621909119..cf3d32ef8fff 100644
---- dom/indexedDB/ActorsParent.cpp
-+++ dom/indexedDB/ActorsParent.cpp
-@@ -17984,11 +17984,22 @@ QuotaClient::ShutdownWorkThreads()
-
- mShutdownRequested = true;
-
-+ // Shutdown maintenance thread pool (this spins the event loop until all
-+ // threads are gone). This should release any maintenance related quota
-+ // objects.
- if (mMaintenanceThreadPool) {
- mMaintenanceThreadPool->Shutdown();
- mMaintenanceThreadPool = nullptr;
- }
-
-+ // Let any runnables dispatched from dying maintenance threads to be
-+ // processed. This should release any maintenance related directory locks.
-+ if (mCurrentMaintenance) {
-+ MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() {
-+ return !mCurrentMaintenance;
-+ }));
-+ }
-+
- RefPtr<ConnectionPool> connectionPool = gConnectionPool.get();
- if (connectionPool) {
- connectionPool->Shutdown();
-@@ -18312,7 +18323,8 @@ Maintenance::Start()
- AssertIsOnBackgroundThread();
- MOZ_ASSERT(mState == State::Initial);
-
-- if (IsAborted()) {
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
-+ IsAborted()) {
- return NS_ERROR_ABORT;
- }
-
-@@ -18336,7 +18348,8 @@ Maintenance::CreateIndexedDatabaseManager()
- MOZ_ASSERT(NS_IsMainThread());
- MOZ_ASSERT(mState == State::CreateIndexedDatabaseManager);
-
-- if (IsAborted()) {
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ IsAborted()) {
- return NS_ERROR_ABORT;
- }
-
-@@ -18361,7 +18374,8 @@ Maintenance::OpenDirectory()
- MOZ_ASSERT(!mDirectoryLock);
- MOZ_ASSERT(QuotaManager::Get());
-
-- if (IsAborted()) {
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
-+ IsAborted()) {
- return NS_ERROR_ABORT;
- }
-
-@@ -18385,7 +18399,8 @@ Maintenance::DirectoryOpen()
- MOZ_ASSERT(mState == State::DirectoryOpenPending);
- MOZ_ASSERT(mDirectoryLock);
-
-- if (IsAborted()) {
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
-+ IsAborted()) {
- return NS_ERROR_ABORT;
- }
-
-@@ -18415,7 +18430,8 @@ Maintenance::DirectoryWork()
- // We have to find all database files that match any persistence type and any
- // origin. We ignore anything out of the ordinary for now.
-
-- if (IsAborted()) {
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ IsAborted()) {
- return NS_ERROR_ABORT;
- }
-
-@@ -18754,6 +18770,11 @@ Maintenance::BeginDatabaseMaintenance()
- }
- };
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
-+ IsAborted()) {
-+ return NS_ERROR_ABORT;
-+ }
-+
- RefPtr<nsThreadPool> threadPool;
-
- for (DirectoryInfo& directoryInfo : mDirectoryInfos) {
-@@ -18940,6 +18961,11 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase()
- }
- };
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ mMaintenance->IsAborted()) {
-+ return;
-+ }
-+
- nsCOMPtr<nsIFile> databaseFile = GetFileForPath(mDatabasePath);
- MOZ_ASSERT(databaseFile);
-
-@@ -18956,10 +18982,6 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase()
-
- AutoClose autoClose(connection);
-
-- if (mMaintenance->IsAborted()) {
-- return;
-- }
--
- AutoProgressHandler progressHandler(mMaintenance);
- if (NS_WARN_IF(NS_FAILED(progressHandler.Register(connection)))) {
- return;
-@@ -18978,20 +19000,12 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase()
- return;
- }
-
-- if (mMaintenance->IsAborted()) {
-- return;
-- }
--
- MaintenanceAction maintenanceAction;
- rv = DetermineMaintenanceAction(connection, databaseFile, &maintenanceAction);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return;
- }
-
-- if (mMaintenance->IsAborted()) {
-- return;
-- }
--
- switch (maintenanceAction) {
- case MaintenanceAction::Nothing:
- break;
-@@ -19018,6 +19032,11 @@ DatabaseMaintenance::CheckIntegrity(mozIStorageConnection* aConnection,
- MOZ_ASSERT(aConnection);
- MOZ_ASSERT(aOk);
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ mMaintenance->IsAborted()) {
-+ return NS_ERROR_ABORT;
-+ }
-+
- nsresult rv;
-
- // First do a full integrity_check. Scope statements tightly here because
-@@ -19135,6 +19154,11 @@ DatabaseMaintenance::DetermineMaintenanceAction(
- MOZ_ASSERT(aDatabaseFile);
- MOZ_ASSERT(aMaintenanceAction);
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ mMaintenance->IsAborted()) {
-+ return NS_ERROR_ABORT;
-+ }
-+
- int32_t schemaVersion;
- nsresult rv = aConnection->GetSchemaVersion(&schemaVersion);
- if (NS_WARN_IF(NS_FAILED(rv))) {
-@@ -19344,6 +19368,11 @@ DatabaseMaintenance::IncrementalVacuum(mozIStorageConnection* aConnection)
- MOZ_ASSERT(!IsOnBackgroundThread());
- MOZ_ASSERT(aConnection);
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ mMaintenance->IsAborted()) {
-+ return;
-+ }
-+
- nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
- "PRAGMA incremental_vacuum;"
- ));
-@@ -19361,6 +19390,11 @@ DatabaseMaintenance::FullVacuum(mozIStorageConnection* aConnection,
- MOZ_ASSERT(aConnection);
- MOZ_ASSERT(aDatabaseFile);
-
-+ if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
-+ mMaintenance->IsAborted()) {
-+ return;
-+ }
-+
- nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
- "VACUUM;"
- ));
-commit 5d30f2130fd9
-Author: Shawn Huang <shuang@mozilla.com>
-Date: Wed Nov 1 11:14:20 2017 +0800
-
- Bug 1389561 - Part 3: Wait for releasing all AsmJSCache parent actors in Client::ShutdownWorkThreads(). r=janv
-
- This patch implements Client::ShutdownWorkThreads for taking care of unreleased DirectoryLock and QuotaObject objects.
----
- dom/asmjscache/AsmJSCache.cpp | 29 ++++++++++++++++++++++++++++-
- 1 file changed, 28 insertions(+), 1 deletion(-)
-
-diff --git dom/asmjscache/AsmJSCache.cpp dom/asmjscache/AsmJSCache.cpp
-index 22ab3dbf0136..49a7d6974134 100644
---- dom/asmjscache/AsmJSCache.cpp
-+++ dom/asmjscache/AsmJSCache.cpp
-@@ -67,6 +67,8 @@ namespace asmjscache {
-
- namespace {
-
-+class ParentRunnable;
-+
- // Anything smaller should compile fast enough that caching will just add
- // overhead.
- static const size_t sMinCachedModuleLength = 10000;
-@@ -74,6 +76,10 @@ static const size_t sMinCachedModuleLength = 10000;
- // The number of characters to hash into the Metadata::Entry::mFastHash.
- static const unsigned sNumFastHashChars = 4096;
-
-+// Track all live parent actors.
-+typedef nsTArray<const ParentRunnable*> ParentActorArray;
-+StaticAutoPtr<ParentActorArray> sLiveParentActors;
-+
- nsresult
- WriteMetadataFile(nsIFile* aMetadataFile, const Metadata& aMetadata)
- {
-@@ -802,6 +808,13 @@ ParentRunnable::FinishOnOwningThread()
- FileDescriptorHolder::Finish();
-
- mDirectoryLock = nullptr;
-+
-+ MOZ_ASSERT(sLiveParentActors);
-+ sLiveParentActors->RemoveElement(this);
-+
-+ if (sLiveParentActors->IsEmpty()) {
-+ sLiveParentActors = nullptr;
-+ }
- }
-
- NS_IMETHODIMP
-@@ -1039,6 +1052,12 @@ AllocEntryParent(OpenMode aOpenMode,
- RefPtr<ParentRunnable> runnable =
- new ParentRunnable(aPrincipalInfo, aOpenMode, aWriteParams);
-
-+ if (!sLiveParentActors) {
-+ sLiveParentActors = new ParentActorArray();
-+ }
-+
-+ sLiveParentActors->AppendElement(runnable);
-+
- nsresult rv = NS_DispatchToMainThread(runnable);
- NS_ENSURE_SUCCESS(rv, nullptr);
-
-@@ -1687,7 +1706,15 @@ public:
-
- void
- ShutdownWorkThreads() override
-- { }
-+ {
-+ AssertIsOnBackgroundThread();
-+
-+ if (sLiveParentActors) {
-+ MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() {
-+ return !sLiveParentActors;
-+ }));
-+ }
-+ }
-
- private:
- nsAutoRefCnt mRefCnt;
-commit 0693fefe1317
-Author: Jan Varga <jan.varga@gmail.com>
-Date: Thu Nov 2 14:54:18 2017 +0800
-
- Bug 1389561 - Part 4: Split AsmJSCache's Client implementation into declaration and definition; r=luke
----
- dom/asmjscache/AsmJSCache.cpp | 271 +++++++++++++++++++++++++-----------------
- 1 file changed, 165 insertions(+), 106 deletions(-)
-
-diff --git dom/asmjscache/AsmJSCache.cpp dom/asmjscache/AsmJSCache.cpp
-index 49a7d6974134..1ba4f66085a1 100644
---- dom/asmjscache/AsmJSCache.cpp
-+++ dom/asmjscache/AsmJSCache.cpp
-@@ -240,6 +240,60 @@ EvictEntries(nsIFile* aDirectory, const nsACString& aGroup,
- }
- }
-
-+/*******************************************************************************
-+ * Client
-+ ******************************************************************************/
-+
-+class Client
-+ : public quota::Client
-+{
-+public:
-+ NS_INLINE_DECL_REFCOUNTING(Client, override)
-+
-+ Type
-+ GetType() override;
-+
-+ nsresult
-+ InitOrigin(PersistenceType aPersistenceType,
-+ const nsACString& aGroup,
-+ const nsACString& aOrigin,
-+ const AtomicBool& aCanceled,
-+ UsageInfo* aUsageInfo) override;
-+
-+ nsresult
-+ GetUsageForOrigin(PersistenceType aPersistenceType,
-+ const nsACString& aGroup,
-+ const nsACString& aOrigin,
-+ const AtomicBool& aCanceled,
-+ UsageInfo* aUsageInfo) override;
-+
-+ void
-+ OnOriginClearCompleted(PersistenceType aPersistenceType,
-+ const nsACString& aOrigin)
-+ override;
-+
-+ void
-+ ReleaseIOThreadObjects() override;
-+
-+ void
-+ AbortOperations(const nsACString& aOrigin) override;
-+
-+ void
-+ AbortOperationsForProcess(ContentParentId aContentParentId) override;
-+
-+ void
-+ StartIdleMaintenance() override;
-+
-+ void
-+ StopIdleMaintenance() override;
-+
-+ void
-+ ShutdownWorkThreads() override;
-+
-+private:
-+ ~Client() override = default;
-+};
-+
- // FileDescriptorHolder owns a file descriptor and its memory mapping.
- // FileDescriptorHolder is derived by two runnable classes (that is,
- // (Parent|Child)Runnable.
-@@ -1593,136 +1647,141 @@ CloseEntryForWrite(size_t aSize,
- }
- }
-
--class Client : public quota::Client
--{
-- ~Client() override = default;
-+/*******************************************************************************
-+ * Client
-+ ******************************************************************************/
-
--public:
-- NS_IMETHOD_(MozExternalRefCountType)
-- AddRef() override;
--
-- NS_IMETHOD_(MozExternalRefCountType)
-- Release() override;
--
-- Type
-- GetType() override
-- {
-- return ASMJS;
-- }
-+Client::Type
-+Client::GetType()
-+{
-+ return ASMJS;
-+}
-
-- nsresult
-- InitOrigin(PersistenceType aPersistenceType,
-- const nsACString& aGroup,
-- const nsACString& aOrigin,
-- const AtomicBool& aCanceled,
-- UsageInfo* aUsageInfo) override
-- {
-- if (!aUsageInfo) {
-- return NS_OK;
-- }
-- return GetUsageForOrigin(aPersistenceType,
-- aGroup,
-- aOrigin,
-- aCanceled,
-- aUsageInfo);
-+nsresult
-+Client::InitOrigin(PersistenceType aPersistenceType,
-+ const nsACString& aGroup,
-+ const nsACString& aOrigin,
-+ const AtomicBool& aCanceled,
-+ UsageInfo* aUsageInfo)
-+{
-+ if (!aUsageInfo) {
-+ return NS_OK;
- }
-+ return GetUsageForOrigin(aPersistenceType,
-+ aGroup,
-+ aOrigin,
-+ aCanceled,
-+ aUsageInfo);
-+}
-
-- nsresult
-- GetUsageForOrigin(PersistenceType aPersistenceType,
-- const nsACString& aGroup,
-- const nsACString& aOrigin,
-- const AtomicBool& aCanceled,
-- UsageInfo* aUsageInfo) override
-- {
-- QuotaManager* qm = QuotaManager::Get();
-- MOZ_ASSERT(qm, "We were being called by the QuotaManager");
--
-- nsCOMPtr<nsIFile> directory;
-- nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin,
-- getter_AddRefs(directory));
-- NS_ENSURE_SUCCESS(rv, rv);
-- MOZ_ASSERT(directory, "We're here because the origin directory exists");
-+nsresult
-+Client::GetUsageForOrigin(PersistenceType aPersistenceType,
-+ const nsACString& aGroup,
-+ const nsACString& aOrigin,
-+ const AtomicBool& aCanceled,
-+ UsageInfo* aUsageInfo)
-+{
-+ QuotaManager* qm = QuotaManager::Get();
-+ MOZ_ASSERT(qm, "We were being called by the QuotaManager");
-
-- rv = directory->Append(NS_LITERAL_STRING(ASMJSCACHE_DIRECTORY_NAME));
-- NS_ENSURE_SUCCESS(rv, rv);
-+ nsCOMPtr<nsIFile> directory;
-+ nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin,
-+ getter_AddRefs(directory));
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
-
-- DebugOnly<bool> exists;
-- MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists);
-+ MOZ_ASSERT(directory, "We're here because the origin directory exists");
-
-- nsCOMPtr<nsISimpleEnumerator> entries;
-- rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
-- NS_ENSURE_SUCCESS(rv, rv);
-+ rv = directory->Append(NS_LITERAL_STRING(ASMJSCACHE_DIRECTORY_NAME));
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
-
-- bool hasMore;
-- while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
-- hasMore && !aCanceled) {
-- nsCOMPtr<nsISupports> entry;
-- rv = entries->GetNext(getter_AddRefs(entry));
-- NS_ENSURE_SUCCESS(rv, rv);
-+ DebugOnly<bool> exists;
-+ MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists);
-
-- nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
-- NS_ENSURE_TRUE(file, NS_NOINTERFACE);
-+ nsCOMPtr<nsISimpleEnumerator> entries;
-+ rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
-
-- int64_t fileSize;
-- rv = file->GetFileSize(&fileSize);
-- NS_ENSURE_SUCCESS(rv, rv);
-+ bool hasMore;
-+ while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
-+ hasMore && !aCanceled) {
-+ nsCOMPtr<nsISupports> entry;
-+ rv = entries->GetNext(getter_AddRefs(entry));
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
-
-- MOZ_ASSERT(fileSize >= 0, "Negative size?!");
-+ nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
-+ if (NS_WARN_IF(!file)) {
-+ return NS_NOINTERFACE;
-+ }
-
-- // Since the client is not explicitly storing files, append to database
-- // usage which represents implicit storage allocation.
-- aUsageInfo->AppendToDatabaseUsage(uint64_t(fileSize));
-+ int64_t fileSize;
-+ rv = file->GetFileSize(&fileSize);
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
- }
-- NS_ENSURE_SUCCESS(rv, rv);
-
-- return NS_OK;
-- }
-+ MOZ_ASSERT(fileSize >= 0, "Negative size?!");
-
-- void
-- OnOriginClearCompleted(PersistenceType aPersistenceType,
-- const nsACString& aOrigin)
-- override
-- { }
-+ // Since the client is not explicitly storing files, append to database
-+ // usage which represents implicit storage allocation.
-+ aUsageInfo->AppendToDatabaseUsage(uint64_t(fileSize));
-+ }
-+ if (NS_WARN_IF(NS_FAILED(rv))) {
-+ return rv;
-+ }
-
-- void
-- ReleaseIOThreadObjects() override
-- { }
-+ return NS_OK;
-+}
-
-- void
-- AbortOperations(const nsACString& aOrigin) override
-- { }
-+void
-+Client::OnOriginClearCompleted(PersistenceType aPersistenceType,
-+ const nsACString& aOrigin)
-+{
-+}
-
-- void
-- AbortOperationsForProcess(ContentParentId aContentParentId) override
-- { }
-+void
-+Client::ReleaseIOThreadObjects()
-+{
-+}
-
-- void
-- StartIdleMaintenance() override
-- { }
-+void
-+Client::AbortOperations(const nsACString& aOrigin)
-+{
-+}
-
-- void
-- StopIdleMaintenance() override
-- { }
-+void
-+Client::AbortOperationsForProcess(ContentParentId aContentParentId)
-+{
-+}
-
-- void
-- ShutdownWorkThreads() override
-- {
-- AssertIsOnBackgroundThread();
-+void
-+Client::StartIdleMaintenance()
-+{
-+}
-
-- if (sLiveParentActors) {
-- MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() {
-- return !sLiveParentActors;
-- }));
-- }
-- }
-+void
-+Client::StopIdleMaintenance()
-+{
-+}
-
--private:
-- nsAutoRefCnt mRefCnt;
-- NS_DECL_OWNINGTHREAD
--};
-+void
-+Client::ShutdownWorkThreads()
-+{
-+ AssertIsOnBackgroundThread();
-
--NS_IMPL_ADDREF(asmjscache::Client)
--NS_IMPL_RELEASE(asmjscache::Client)
-+ if (sLiveParentActors) {
-+ MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() {
-+ return !sLiveParentActors;
-+ }));
-+ }
-+}
-
- quota::Client*
- CreateClient()
-commit 58e99f59ab54
-Author: Jan Varga <jan.varga@gmail.com>
-Date: Thu Nov 2 14:54:29 2017 +0800
-
- Bug 1389561 - Part 5: Prevent allocation of parent actors if quota manager is shutting down; r=luke
----
- dom/asmjscache/AsmJSCache.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 58 insertions(+), 1 deletion(-)
-
-diff --git dom/asmjscache/AsmJSCache.cpp dom/asmjscache/AsmJSCache.cpp
-index 1ba4f66085a1..1d73c1c9546c 100644
---- dom/asmjscache/AsmJSCache.cpp
-+++ dom/asmjscache/AsmJSCache.cpp
-@@ -247,7 +247,41 @@ EvictEntries(nsIFile* aDirectory, const nsACString& aGroup,
- class Client
- : public quota::Client
- {
-+ static Client* sInstance;
-+
-+ bool mShutdownRequested;
-+
- public:
-+ Client();
-+
-+ static bool
-+ IsShuttingDownOnBackgroundThread()
-+ {
-+ AssertIsOnBackgroundThread();
-+
-+ if (sInstance) {
-+ return sInstance->IsShuttingDown();
-+ }
-+
-+ return QuotaManager::IsShuttingDown();
-+ }
-+
-+ static bool
-+ IsShuttingDownOnNonBackgroundThread()
-+ {
-+ MOZ_ASSERT(!IsOnBackgroundThread());
-+
-+ return QuotaManager::IsShuttingDown();
-+ }
-+
-+ bool
-+ IsShuttingDown() const
-+ {
-+ AssertIsOnBackgroundThread();
-+
-+ return mShutdownRequested;
-+ }
-+
- NS_INLINE_DECL_REFCOUNTING(Client, override)
-
- Type
-@@ -291,7 +325,7 @@ public:
- ShutdownWorkThreads() override;
-
- private:
-- ~Client() override = default;
-+ ~Client() override;
- };
-
- // FileDescriptorHolder owns a file descriptor and its memory mapping.
-@@ -1098,6 +1132,10 @@ AllocEntryParent(OpenMode aOpenMode,
- {
- AssertIsOnBackgroundThread();
-
-+ if (NS_WARN_IF(Client::IsShuttingDownOnBackgroundThread())) {
-+ return nullptr;
-+ }
-+
- if (NS_WARN_IF(aPrincipalInfo.type() == PrincipalInfo::TNullPrincipalInfo)) {
- MOZ_ASSERT(false);
- return nullptr;
-@@ -1651,6 +1689,25 @@ CloseEntryForWrite(size_t aSize,
- * Client
- ******************************************************************************/
-
-+Client* Client::sInstance = nullptr;
-+
-+Client::Client()
-+ : mShutdownRequested(false)
-+{
-+ AssertIsOnBackgroundThread();
-+ MOZ_ASSERT(!sInstance, "We expect this to be a singleton!");
-+
-+ sInstance = this;
-+}
-+
-+Client::~Client()
-+{
-+ AssertIsOnBackgroundThread();
-+ MOZ_ASSERT(sInstance == this, "We expect this to be a singleton!");
-+
-+ sInstance = nullptr;
-+}
-+
- Client::Type
- Client::GetType()
- {
diff --git a/www/waterfox/files/patch-bug1395508 b/www/waterfox/files/patch-bug1395508
deleted file mode 100644
index fd20d1b47f96..000000000000
--- a/www/waterfox/files/patch-bug1395508
+++ /dev/null
@@ -1,35 +0,0 @@
-commit e6d14191c530
-Author: Marco Bonardo <mbonardo@mozilla.com>
-Date: Wed Nov 8 15:42:21 2017 +0100
-
- Bug 1395508. r=dao, a=gchang
-
- MozReview-Commit-ID: 8jH9dyj5JZU
-
- --HG--
- extra : source : a14cc3bd9643311badcf1f8c00a58a493c2f5a2e
----
- browser/base/content/browser.js | 9 ++++++---
- .../content/test/urlbar/browser_urlbarCopying.js | 22 +++++++++++++++++++++-
- 2 files changed, 27 insertions(+), 4 deletions(-)
-
-diff --git browser/base/content/browser.js browser/base/content/browser.js
-index c4eb8b8c7e43..80c44f32dc38 100755
---- browser/base/content/browser.js
-+++ browser/base/content/browser.js
-@@ -2763,9 +2763,12 @@ function losslessDecodeURI(aURI) {
- // a sequence that survived decodeURI, i.e. one for:
- // ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '#'
- // (RFC 3987 section 3.2)
-- // 2. Re-encode whitespace so that it doesn't get eaten away
-- // by the location bar (bug 410726).
-- .replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]/ig,
-+ // 2. Re-encode select whitespace so that it doesn't get eaten
-+ // away by the location bar (bug 410726). Re-encode all
-+ // adjacent whitespace, to prevent spoofing attempts where
-+ // invisible characters would push part of the URL to
-+ // overflow the location bar (bug 1395508).
-+ .replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]|\s(?=\s)|\s$/ig,
- encodeURIComponent);
- } catch (e) {}
- }
diff --git a/www/waterfox/files/patch-bug1398581 b/www/waterfox/files/patch-bug1398581
new file mode 100644
index 000000000000..36845cb0a1a4
--- /dev/null
+++ b/www/waterfox/files/patch-bug1398581
@@ -0,0 +1,125 @@
+commit 762a3ec064d0
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date: Mon Sep 11 09:51:30 2017 +0200
+
+ Bug 1398581: Ensure a first-letter doesn't incorrectly inherit from a first-line. r=heycam
+
+ This approach kinda sucks, because we woefully throw away the style context
+ computed in the case it inherited from a first-line, but it's the easiest thing
+ I could think of without either making it more inefficient, or threading a
+ parent style ignoring first-line through ResolvePseudoElementStyle and related
+ functions.
+
+ MozReview-Commit-ID: 3uGuU7dHEnE
+---
+ layout/base/nsCSSFrameConstructor.cpp | 20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+diff --git layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp
+index 76d97a32ee4d..b668a837e2f3 100644
+--- layout/base/nsCSSFrameConstructor.cpp
++++ layout/base/nsCSSFrameConstructor.cpp
+@@ -11861,10 +11861,11 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
+
+ // Get style context for the first-letter-frame. Keep this in sync with
+ // nsBlockFrame::UpdatePseudoElementStyles.
+- nsStyleContext* parentStyleContext =
++ nsIFrame* parentFrame =
+ nsFrame::CorrectStyleParentFrame(aParentFrame,
+- nsCSSPseudoElements::firstLetter)->
+- StyleContext();
++ nsCSSPseudoElements::firstLetter);
++
++ nsStyleContext* parentStyleContext = parentFrame->StyleContext();
+
+ // Use content from containing block so that we can actually
+ // find a matching style rule.
+@@ -11873,7 +11874,20 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
+ // Create first-letter style rule
+ RefPtr<nsStyleContext> sc =
+ GetFirstLetterStyle(blockContent, parentStyleContext);
++
+ if (sc) {
++ if (sc->IsServo() && parentFrame->IsLineFrame()) {
++ ServoStyleContext* parentStyleIgnoringFirstLine =
++ aBlockFrame->StyleContext()->AsServo();
++ sc =
++ mPresShell->StyleSet()->AsServo()->ReparentStyleContext(
++ sc->AsServo(),
++ parentStyleContext->AsServo(),
++ parentStyleIgnoringFirstLine,
++ parentStyleIgnoringFirstLine,
++ blockContent->AsElement());
++ }
++
+ RefPtr<nsStyleContext> textSC = mPresShell->StyleSet()->
+ ResolveStyleForText(aTextContent, sc);
+
+commit 2a9742d4b68a
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date: Mon Sep 11 17:19:05 2017 +0200
+
+ Bug 1398581: Address followup comments. r=me
+
+ MozReview-Commit-ID: CymOOl4VLPj
+---
+ layout/base/nsCSSFrameConstructor.cpp | 15 +--------------
+ 1 file changed, 1 insertion(+), 14 deletions(-)
+
+diff --git layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp
+index b668a837e2f3..bd3d406f664f 100644
+--- layout/base/nsCSSFrameConstructor.cpp
++++ layout/base/nsCSSFrameConstructor.cpp
+@@ -11884,7 +11884,7 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
+ sc->AsServo(),
+ parentStyleContext->AsServo(),
+ parentStyleIgnoringFirstLine,
+- parentStyleIgnoringFirstLine,
++ parentStyleContext->AsServo(),
+ blockContent->AsElement());
+ }
+
+commit 9a42394a1f71
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date: Mon Sep 11 17:19:30 2017 +0200
+
+ Bug 1398581: Crashtest. r=me
+
+ MozReview-Commit-ID: 5xy5aeDWU12
+---
+ layout/style/crashtests/1398581.html | 17 +++++++++++++++++
+ layout/style/crashtests/crashtests.list | 1 +
+ 2 files changed, 18 insertions(+)
+
+diff --git layout/style/crashtests/1398581.html layout/style/crashtests/1398581.html
+new file mode 100644
+index 000000000000..e056ab44d55c
+--- /dev/null
++++ layout/style/crashtests/1398581.html
+@@ -0,0 +1,17 @@
++<script>
++function start() {
++ o3=document.createElement('div');
++ document.body.appendChild(o3);
++ o14=document.createElement('style');
++ document.documentElement.appendChild(o14);
++ o18=document.createElement('style');
++ o14.appendChild(o18);
++ s4=unescape('%u06A10');
++ o3.appendChild(document.createTextNode(s4));
++ o59=document.createTextNode("{}:first-letter{ all: inherit;'x'}\n*{ float: left}:first-line{");
++ o18['before'](o18,-1,o59);
++ document.documentElement.offsetHeight;
++ o3.appendChild(document.createTextNode("x"));
++}
++</script>
++<body onload="start()"></body>
+diff --git layout/style/crashtests/crashtests.list layout/style/crashtests/crashtests.list
+index a32d48fa3299..719bdaf8328a 100644
+--- layout/style/crashtests/crashtests.list
++++ layout/style/crashtests/crashtests.list
+@@ -201,3 +201,4 @@ load 1384824-2.html
+ load 1387481-1.html
+ load 1387499.html
+ load 1391577.html
++load 1398581.html
diff --git a/www/waterfox/files/patch-bug1399400 b/www/waterfox/files/patch-bug1399400
deleted file mode 100644
index be983e1369b7..000000000000
--- a/www/waterfox/files/patch-bug1399400
+++ /dev/null
@@ -1,39 +0,0 @@
-commit 7c15d03b1e83
-Author: Blake Kaplan <mrbkap@gmail.com>
-Date: Mon Dec 18 19:39:45 2017 -0500
-
- Bug 1399400 - Use a strong reference when handling mTextField. r=bz a=jcristau
-
- MozReview-Commit-ID: IqzGDM4ezeW
-
- --HG--
- extra : rebase_source : 8f9a1f72360fcabdc6e57fec3dbdda1bd705fd03
- extra : source : 02d457ace9bb8430e25cfb3a1fb6b0303c9d01c5
----
- layout/forms/nsNumberControlFrame.cpp | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git layout/forms/nsNumberControlFrame.cpp layout/forms/nsNumberControlFrame.cpp
-index 00b4492f23f1..68819267c906 100644
---- layout/forms/nsNumberControlFrame.cpp
-+++ layout/forms/nsNumberControlFrame.cpp
-@@ -592,15 +592,17 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
- {
- if (aEvent->mOriginalTarget != mTextField) {
- // Move focus to our text field
-+ RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
- IgnoredErrorResult ignored;
-- HTMLInputElement::FromContent(mTextField)->Focus(ignored);
-+ textField->Focus(ignored);
- }
- }
-
- void
- nsNumberControlFrame::HandleSelectCall()
- {
-- HTMLInputElement::FromContent(mTextField)->Select();
-+ RefPtr<HTMLInputElement> textField = HTMLInputElement::FromContent(mTextField);
-+ textField->Select();
- }
-
- #define STYLES_DISABLING_NATIVE_THEMING \
diff --git a/www/waterfox/files/patch-bug1401459 b/www/waterfox/files/patch-bug1401459
deleted file mode 100644
index 9461e3e91717..000000000000
--- a/www/waterfox/files/patch-bug1401459
+++ /dev/null
@@ -1,36 +0,0 @@
-commit 5d4e99313a0a
-Author: Shih-Chiang Chien <schien@mozilla.com>
-Date: Thu Jan 11 10:40:29 2018 +0800
-
- Bug 1401459 - always run HttpChannelChild::Release on main thread. r=mayhemer a=gchang
-
- --HG--
- extra : source : ce5f4fbbebc872f25557afa14342aad95adfa085
----
- netwerk/protocol/http/HttpChannelChild.cpp | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git netwerk/protocol/http/HttpChannelChild.cpp netwerk/protocol/http/HttpChannelChild.cpp
-index bde74561b6e1..21752ec27c83 100644
---- netwerk/protocol/http/HttpChannelChild.cpp
-+++ netwerk/protocol/http/HttpChannelChild.cpp
-@@ -245,6 +245,19 @@ NS_IMPL_ADDREF(HttpChannelChild)
-
- NS_IMETHODIMP_(MozExternalRefCountType) HttpChannelChild::Release()
- {
-+ if (!NS_IsMainThread()) {
-+ nsrefcnt count = mRefCnt;
-+ nsresult rv = NS_DispatchToMainThread(
-+ NewNonOwningRunnableMethod("HttpChannelChild::Release",
-+ this,
-+ &HttpChannelChild::Release));
-+
-+ // Continue Release procedure if failed to dispatch to main thread.
-+ if (!NS_WARN_IF(NS_FAILED(rv))) {
-+ return count - 1;
-+ }
-+ }
-+
- nsrefcnt count = --mRefCnt;
- MOZ_ASSERT(int32_t(count) >= 0, "dup release");
- NS_LOG_RELEASE(this, count, "HttpChannelChild");
diff --git a/www/waterfox/files/patch-bug1409449 b/www/waterfox/files/patch-bug1409449
deleted file mode 100644
index b711cd2f1724..000000000000
--- a/www/waterfox/files/patch-bug1409449
+++ /dev/null
@@ -1,161 +0,0 @@
-commit 0f648a99db03
-Author: Dragana Damjanovic <dd.mozilla@gmail.com>
-Date: Mon Jan 8 16:57:48 2018 +0200
-
- Bug 1409449 - Do not show auth-dialog for triggeringPrincipal==SystemPrincipal. r=ckerschb r=valentin r=francois a=gchang
-
- --HG--
- extra : amend_source : ca9c12183a4c25d451bb6ec2cc4b6ed25327d1ff
----
- modules/libpref/init/all.js | 5 ++++
- .../protocol/http/nsHttpChannelAuthProvider.cpp | 35 +++++++++++++++++-----
- netwerk/protocol/http/nsHttpChannelAuthProvider.h | 1 +
- toolkit/components/telemetry/Histograms.json | 8 ++---
- 4 files changed, 38 insertions(+), 11 deletions(-)
-
-diff --git modules/libpref/init/all.js modules/libpref/init/all.js
-index c06f1d869c0f..a1e8e7054e4d 100644
---- modules/libpref/init/all.js
-+++ modules/libpref/init/all.js
-@@ -2229,6 +2229,11 @@ pref("network.auth.subresource-http-auth-allow", 2);
- // have any effect.
- pref("network.auth.subresource-img-cross-origin-http-auth-allow", true);
-
-+// Resources that are triggered by some non-web-content:
-+// true - they are allow to present http auth. dialog
-+// false - they are not allow to present http auth. dialog.
-+pref("network.auth.non-web-content-triggered-resources-http-auth-allow", false);
-+
- // This preference controls whether to allow sending default credentials (SSO) to
- // NTLM/Negotiate servers allowed in the "trusted uri" list when navigating them
- // in a Private Browsing window.
-diff --git netwerk/protocol/http/nsHttpChannelAuthProvider.cpp netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
-index 92abed30355a..c70eb9455adb 100644
---- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
-+++ netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
-@@ -42,6 +42,7 @@ namespace net {
- #define HTTP_AUTH_DIALOG_TOP_LEVEL_DOC 29
- #define HTTP_AUTH_DIALOG_SAME_ORIGIN_SUBRESOURCE 30
- #define HTTP_AUTH_DIALOG_SAME_ORIGIN_XHR 31
-+#define HTTP_AUTH_DIALOG_NON_WEB_CONTENT 32
-
- #define HTTP_AUTH_BASIC_INSECURE 0
- #define HTTP_AUTH_BASIC_SECURE 1
-@@ -95,6 +96,7 @@ uint32_t nsHttpChannelAuthProvider::sAuthAllowPref =
- SUBRESOURCE_AUTH_DIALOG_ALLOW_ALL;
-
- bool nsHttpChannelAuthProvider::sImgCrossOriginAuthAllowPref = true;
-+bool nsHttpChannelAuthProvider::sNonWebContentTriggeredAuthAllow = false;
-
- void
- nsHttpChannelAuthProvider::InitializePrefs()
-@@ -106,6 +108,9 @@ nsHttpChannelAuthProvider::InitializePrefs()
- mozilla::Preferences::AddBoolVarCache(&sImgCrossOriginAuthAllowPref,
- "network.auth.subresource-img-cross-origin-http-auth-allow",
- true);
-+ mozilla::Preferences::AddBoolVarCache(&sNonWebContentTriggeredAuthAllow,
-+ "network.auth.non-web-content-triggered-resources-http-auth-allow",
-+ false);
- }
-
- NS_IMETHODIMP
-@@ -912,8 +917,10 @@ nsHttpChannelAuthProvider::GetCredentialsForChallenge(const char *challenge,
- // BlockPrompt will set mCrossOrigin parameter as well.
- if (BlockPrompt()) {
- LOG(("nsHttpChannelAuthProvider::GetCredentialsForChallenge: "
-- "Prompt is blocked [this=%p pref=%d img-pref=%d]\n",
-- this, sAuthAllowPref, sImgCrossOriginAuthAllowPref));
-+ "Prompt is blocked [this=%p pref=%d img-pref=%d "
-+ "non-web-content-triggered-pref=%d]\n",
-+ this, sAuthAllowPref, sImgCrossOriginAuthAllowPref,
-+ sNonWebContentTriggeredAuthAllow));
- return NS_ERROR_ABORT;
- }
-
-@@ -983,8 +990,15 @@ nsHttpChannelAuthProvider::BlockPrompt()
- // We will treat loads w/o loadInfo as a top level document.
- bool topDoc = true;
- bool xhr = false;
-+ bool nonWebContent = false;
-
- if (loadInfo) {
-+ nsCOMPtr<nsIPrincipal> triggeringPrinc =
-+ loadInfo->TriggeringPrincipal();
-+ if (nsContentUtils::IsSystemPrincipal(triggeringPrinc)) {
-+ nonWebContent = true;
-+ }
-+
- if (loadInfo->GetExternalContentPolicyType() !=
- nsIContentPolicy::TYPE_DOCUMENT) {
- topDoc = false;
-@@ -1013,23 +1027,30 @@ nsHttpChannelAuthProvider::BlockPrompt()
- }
-
- if (gHttpHandler->IsTelemetryEnabled()) {
-- if (topDoc) {
-- Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_2,
-+ if (nonWebContent) {
-+ Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
-+ HTTP_AUTH_DIALOG_NON_WEB_CONTENT);
-+ } else if (topDoc) {
-+ Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
- HTTP_AUTH_DIALOG_TOP_LEVEL_DOC);
- } else if (!mCrossOrigin) {
- if (xhr) {
-- Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_2,
-+ Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
- HTTP_AUTH_DIALOG_SAME_ORIGIN_XHR);
- } else {
-- Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_2,
-+ Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
- HTTP_AUTH_DIALOG_SAME_ORIGIN_SUBRESOURCE);
- }
- } else {
-- Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_2,
-+ Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
- loadInfo->GetExternalContentPolicyType());
- }
- }
-
-+ if (!sNonWebContentTriggeredAuthAllow && nonWebContent) {
-+ return true;
-+ }
-+
- switch (sAuthAllowPref) {
- case SUBRESOURCE_AUTH_DIALOG_DISALLOW_ALL:
- // Do not open the http-authentication credentials dialog for
-diff --git netwerk/protocol/http/nsHttpChannelAuthProvider.h netwerk/protocol/http/nsHttpChannelAuthProvider.h
-index 4cf61c5a5881..01c536a8be25 100644
---- netwerk/protocol/http/nsHttpChannelAuthProvider.h
-+++ netwerk/protocol/http/nsHttpChannelAuthProvider.h
-@@ -187,6 +187,7 @@ private:
- // sub-resources.
- static uint32_t sAuthAllowPref;
- static bool sImgCrossOriginAuthAllowPref;
-+ static bool sNonWebContentTriggeredAuthAllow;
- nsCOMPtr<nsICancelable> mGenerateCredentialsCancelable;
- };
-
-diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json
-index 41678ec2d2cf..dfc2183420a5 100644
---- toolkit/components/telemetry/Histograms.json
-+++ toolkit/components/telemetry/Histograms.json
-@@ -2427,14 +2427,14 @@
- "labels": ["NotSent", "CachedContentUsed", "CachedContentNotUsed"],
- "description": "Stats for validation requests when cache won the race."
- },
-- "HTTP_AUTH_DIALOG_STATS_2": {
-+ "HTTP_AUTH_DIALOG_STATS_3": {
- "record_in_processes": ["main", "content"],
- "expires_in_version": "61",
-- "alert_emails": ["necko@mozilla.com"],
-+ "alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
- "bug_numbers": [1357835],
- "kind": "enumerated",
-- "n_values": 32,
-- "description": "Stats about what kind of resource requested http authentication. (29=top-level doc, 30=same origin subresources, 31=same origin xhr, (nsIContentPolicy type)=cross-origin subresources per nsIContentPolicy type)"
-+ "n_values": 64,
-+ "description": "Stats about what kind of resource requested http authentication. (29=top-level doc, 30=same origin subresources, 31=same origin xhr, 32=non-web-content, (nsIContentPolicy type)=cross-origin subresources per nsIContentPolicy type)"
- },
- "HTTP_AUTH_TYPE_STATS": {
- "record_in_processes": ["main", "content"],
diff --git a/www/waterfox/files/patch-bug1412646 b/www/waterfox/files/patch-bug1412646
deleted file mode 100644
index 5b7bc874a1e3..000000000000
--- a/www/waterfox/files/patch-bug1412646
+++ /dev/null
@@ -1,162 +0,0 @@
-commit 0e19989ae721
-Author: Tristan Bourvon <tbourvon@mozilla.com>
-Date: Tue Oct 31 11:04:40 2017 +0100
-
- Bug 1412646 - Initialize some uninitialized fields in security/manager/ r=keeler a=jcristau
-
- MozReview-Commit-ID: HGj8xw5Uq6j
-
- --HG--
- extra : rebase_source : 320cb43e17001f33137fdd1e7a49be8cbf0a4b24
- extra : source : 202ff4e53892c94131974daf3b9637fac064e558
----
- security/manager/ssl/DataStorage.cpp | 1 +
- security/manager/ssl/ScopedNSSTypes.h | 1 +
- security/manager/ssl/SharedSSLState.cpp | 1 +
- security/manager/ssl/nsCertOverrideService.h | 1 +
- security/manager/ssl/nsCertTree.cpp | 5 ++++-
- security/manager/ssl/nsNSSCallbacks.cpp | 4 +++-
- security/manager/ssl/nsNSSCertValidity.cpp | 4 +++-
- security/manager/ssl/nsNTLMAuthModule.h | 2 +-
- security/manager/ssl/nsSecurityHeaderParser.cpp | 1 +
- security/manager/ssl/nsSiteSecurityService.cpp | 1 +
- 10 files changed, 17 insertions(+), 4 deletions(-)
-
-diff --git security/manager/ssl/DataStorage.cpp security/manager/ssl/DataStorage.cpp
-index 808b2392b518..5e43ec5dcc6d 100644
---- security/manager/ssl/DataStorage.cpp
-+++ security/manager/ssl/DataStorage.cpp
-@@ -73,6 +73,7 @@ StaticAutoPtr<DataStorage::DataStorages> DataStorage::sDataStorages;
-
- DataStorage::DataStorage(const nsString& aFilename)
- : mMutex("DataStorage::mMutex")
-+ , mTimerDelay(sDataStorageDefaultTimerDelay)
- , mPendingWrite(false)
- , mShuttingDown(false)
- , mInitCalled(false)
-diff --git security/manager/ssl/ScopedNSSTypes.h security/manager/ssl/ScopedNSSTypes.h
-index 34aa229cc247..e91e9b40ec41 100644
---- security/manager/ssl/ScopedNSSTypes.h
-+++ security/manager/ssl/ScopedNSSTypes.h
-@@ -108,6 +108,7 @@ class Digest
- {
- public:
- Digest()
-+ : mItemBuf()
- {
- mItem.type = siBuffer;
- mItem.data = mItemBuf;
-diff --git security/manager/ssl/SharedSSLState.cpp security/manager/ssl/SharedSSLState.cpp
-index c97687541326..df9d36369c0a 100644
---- security/manager/ssl/SharedSSLState.cpp
-+++ security/manager/ssl/SharedSSLState.cpp
-@@ -123,6 +123,7 @@ SharedSSLState::SharedSSLState()
- , mSocketCreated(false)
- , mOCSPStaplingEnabled(false)
- , mOCSPMustStapleEnabled(false)
-+, mSignedCertTimestampsEnabled(false)
- {
- mIOLayerHelpers.Init();
- mClientAuthRemember->Init();
-diff --git security/manager/ssl/nsCertOverrideService.h security/manager/ssl/nsCertOverrideService.h
-index 9f60aab37079..57992241c8d9 100644
---- security/manager/ssl/nsCertOverrideService.h
-+++ security/manager/ssl/nsCertOverrideService.h
-@@ -29,6 +29,7 @@ public:
-
- nsCertOverride()
- : mPort(-1)
-+ , mIsTemporary(false)
- , mOverrideBits(OverrideBits::None)
- {
- }
-diff --git security/manager/ssl/nsCertTree.cpp security/manager/ssl/nsCertTree.cpp
-index f58323ed4485..6fa9080de812 100644
---- security/manager/ssl/nsCertTree.cpp
-+++ security/manager/ssl/nsCertTree.cpp
-@@ -55,7 +55,8 @@ CompareCacheHashEntryPtr::~CompareCacheHashEntryPtr()
- }
-
- CompareCacheHashEntry::CompareCacheHashEntry()
--:key(nullptr)
-+ : key(nullptr)
-+ , mCritInit()
- {
- for (int i = 0; i < max_criterions; ++i) {
- mCritInit[i] = false;
-@@ -152,6 +153,8 @@ NS_IMPL_ISUPPORTS(nsCertTree, nsICertTree, nsITreeView)
-
- nsCertTree::nsCertTree()
- : mTreeArray(nullptr)
-+ , mNumOrgs(0)
-+ , mNumRows(0)
- , mCompareCache(&gMapOps, sizeof(CompareCacheHashEntryPtr),
- kInitialCacheLength)
- {
-diff --git security/manager/ssl/nsNSSCallbacks.cpp security/manager/ssl/nsNSSCallbacks.cpp
-index 480210836c18..bb81a5772a4b 100644
---- security/manager/ssl/nsNSSCallbacks.cpp
-+++ security/manager/ssl/nsNSSCallbacks.cpp
-@@ -546,7 +546,9 @@ nsNSSHttpRequestSession::~nsNSSHttpRequestSession()
- }
-
- nsHTTPListener::nsHTTPListener()
--: mResultData(nullptr),
-+: mHttpRequestSucceeded(false),
-+ mHttpResponseCode(0),
-+ mResultData(nullptr),
- mResultLen(0),
- mLock("nsHTTPListener.mLock"),
- mCondition(mLock, "nsHTTPListener.mCondition"),
-diff --git security/manager/ssl/nsNSSCertValidity.cpp security/manager/ssl/nsNSSCertValidity.cpp
-index d983df2cf6cf..62c0c4bb7e8a 100644
---- security/manager/ssl/nsNSSCertValidity.cpp
-+++ security/manager/ssl/nsNSSCertValidity.cpp
-@@ -13,7 +13,9 @@
- NS_IMPL_ISUPPORTS(nsX509CertValidity, nsIX509CertValidity)
-
- nsX509CertValidity::nsX509CertValidity(const mozilla::UniqueCERTCertificate& cert)
-- : mTimesInitialized(false)
-+ : mNotBefore(0)
-+ , mNotAfter(0)
-+ , mTimesInitialized(false)
- {
- MOZ_ASSERT(cert);
- if (!cert) {
-diff --git security/manager/ssl/nsNTLMAuthModule.h security/manager/ssl/nsNTLMAuthModule.h
-index 27bf2999f01b..0b0bfa505959 100644
---- security/manager/ssl/nsNTLMAuthModule.h
-+++ security/manager/ssl/nsNTLMAuthModule.h
-@@ -15,7 +15,7 @@ public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIAUTHMODULE
-
-- nsNTLMAuthModule() {}
-+ nsNTLMAuthModule() : mNTLMNegotiateSent(false) {}
-
- nsresult InitTest();
-
-diff --git security/manager/ssl/nsSecurityHeaderParser.cpp security/manager/ssl/nsSecurityHeaderParser.cpp
-index b0bff007203f..d6b65e3b2a5b 100644
---- security/manager/ssl/nsSecurityHeaderParser.cpp
-+++ security/manager/ssl/nsSecurityHeaderParser.cpp
-@@ -52,6 +52,7 @@ static mozilla::LazyLogModule sSHParserLog("nsSecurityHeaderParser");
-
- nsSecurityHeaderParser::nsSecurityHeaderParser(const nsCString& aHeader)
- : mCursor(aHeader.get())
-+ , mDirective(nullptr)
- , mError(false)
- {
- }
-diff --git security/manager/ssl/nsSiteSecurityService.cpp security/manager/ssl/nsSiteSecurityService.cpp
-index 237efc715f86..f39e34db6569 100644
---- security/manager/ssl/nsSiteSecurityService.cpp
-+++ security/manager/ssl/nsSiteSecurityService.cpp
-@@ -495,6 +495,7 @@ nsSiteSecurityService::nsSiteSecurityService()
- : mMaxMaxAge(kSixtyDaysInSeconds)
- , mUsePreloadList(true)
- , mPreloadListTimeOffset(0)
-+ , mProcessPKPHeadersFromNonBuiltInRoots(false)
- {
- }
-
diff --git a/www/waterfox/files/patch-bug1413143 b/www/waterfox/files/patch-bug1413143
new file mode 100644
index 000000000000..19067f325bd3
--- /dev/null
+++ b/www/waterfox/files/patch-bug1413143
@@ -0,0 +1,306 @@
+commit 51708fb1315d
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date: Wed Nov 1 11:24:17 2017 +0100
+
+ Bug 1413143: Make font inflation computation less lazy. r=bz,JanH
+
+ This makes it a bit more straight-forward to change the system font scale,
+ preserving the sync MediaFeatureChanged event.
+
+ This also avoids notifying media queries when the shell is not initialized.
+
+ In particular, the patch in bug 1404545 allows calling MediaFeatureValuesChanged
+ on a still-initializing pres-shell. This is nasty, and all this initialization
+ order is kind of a mess, but I'm not reworking it for now...
+
+ Also, this drops the invalidation of font-inflation when a doctype is added to
+ the document. GetViewportInfo() already relies on the doctype not changing, as
+ noted in a comment.
+
+ MozReview-Commit-ID: Knw7dM1B04Y
+---
+ dom/base/nsDocument.cpp | 2 +
+ layout/base/PresShell.cpp | 84 ++++++++++++++-------------------------
+ layout/base/nsIPresShell.h | 36 ++++-------------
+ layout/base/nsLayoutUtils.cpp | 8 ++--
+ layout/base/nsPresContext.cpp | 6 ++-
+ layout/reftests/bugs/reftest.list | 2 +-
+ 6 files changed, 48 insertions(+), 90 deletions(-)
+
+diff --git dom/base/nsDocument.cpp dom/base/nsDocument.cpp
+index 03bf17e6a4b9..f3579c9420d6 100644
+--- dom/base/nsDocument.cpp
++++ dom/base/nsDocument.cpp
+@@ -8172,6 +8172,8 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
+ nsViewportInfo
+ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
+ {
++ MOZ_ASSERT(mPresShell);
++
+ // Compute the CSS-to-LayoutDevice pixel scale as the product of the
+ // widget scale and the full zoom.
+ nsPresContext* context = mPresShell->GetPresContext();
+diff --git layout/base/PresShell.cpp layout/base/PresShell.cpp
+index 6983d2d3c894..a883791d3695 100644
+--- layout/base/PresShell.cpp
++++ layout/base/PresShell.cpp
+@@ -765,7 +765,6 @@ nsIPresShell::nsIPresShell()
+ , mFontSizeInflationForceEnabled(false)
+ , mFontSizeInflationDisabledInMasterProcess(false)
+ , mFontSizeInflationEnabled(false)
+- , mFontSizeInflationEnabledIsDirty(false)
+ , mPaintingIsFrozen(false)
+ , mIsNeverPainting(false)
+ , mInFlush(false)
+@@ -1010,7 +1009,13 @@ PresShell::Init(nsIDocument* aDocument,
+ QueryIsActive();
+
+ // Setup our font inflation preferences.
+- SetupFontInflation();
++ mFontSizeInflationEmPerLine = nsLayoutUtils::FontSizeInflationEmPerLine();
++ mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
++ mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
++ mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
++ mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
++ // We'll compute the font size inflation state in Initialize(), when we know
++ // the document type.
+
+ mTouchManager.Init(this, mDocument);
+
+@@ -1700,6 +1705,10 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
+ NS_ASSERTION(!mDidInitialize, "Why are we being called?");
+
+ nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
++
++ RecomputeFontSizeInflationEnabled();
++ MOZ_DIAGNOSTIC_ASSERT(!mIsDestroying);
++
+ mDidInitialize = true;
+
+ #ifdef DEBUG
+@@ -1725,6 +1734,7 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
+ // time we do this!
+ nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
+ NS_ASSERTION(!rootFrame, "How did that happen, exactly?");
++
+ if (!rootFrame) {
+ nsAutoScriptBlocker scriptBlocker;
+ mFrameConstructor->BeginUpdate();
+@@ -4456,11 +4466,6 @@ PresShell::ContentInserted(nsIDocument* aDocument,
+ nullptr,
+ nsCSSFrameConstructor::InsertionKind::Async);
+
+- if (aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
+- MOZ_ASSERT(container == aDocument);
+- NotifyFontSizeInflationEnabledIsDirty();
+- }
+-
+ VERIFY_STYLE_TREE;
+ }
+
+@@ -4505,11 +4510,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
+ mFrameConstructor->ContentRemoved(aMaybeContainer, aChild, oldNextSibling,
+ nsCSSFrameConstructor::REMOVE_CONTENT);
+
+- if (aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
+- MOZ_ASSERT(container == aDocument);
+- NotifyFontSizeInflationEnabledIsDirty();
+- }
+-
+ VERIFY_STYLE_TREE;
+ }
+
+@@ -10701,33 +10701,34 @@ nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aH
+ }
+ }
+
+-void
+-PresShell::SetupFontInflation()
+-{
+- mFontSizeInflationEmPerLine = nsLayoutUtils::FontSizeInflationEmPerLine();
+- mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
+- mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
+- mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
+- mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
+-
+- NotifyFontSizeInflationEnabledIsDirty();
+-}
+-
+ void
+ nsIPresShell::RecomputeFontSizeInflationEnabled()
+ {
+- mFontSizeInflationEnabledIsDirty = false;
+ mFontSizeInflationEnabled = DetermineFontSizeInflationState();
+
+- HandleSystemFontScale();
++ float fontScale = nsLayoutUtils::SystemFontScale();
++ if (fontScale == 0.0f) {
++ return;
++ }
++
++ MOZ_ASSERT(mDocument);
++ MOZ_ASSERT(mPresContext);
++ if (mFontSizeInflationEnabled || mDocument->IsSyntheticDocument()) {
++ mPresContext->SetSystemFontScale(1.0f);
++ } else {
++ mPresContext->SetSystemFontScale(fontScale);
++ }
+ }
+
+ bool
+ nsIPresShell::DetermineFontSizeInflationState()
+ {
+ MOZ_ASSERT(mPresContext, "our pres context should not be null");
+- if ((FontSizeInflationEmPerLine() == 0 &&
+- FontSizeInflationMinTwips() == 0) || mPresContext->IsChrome()) {
++ if (mPresContext->IsChrome()) {
++ return false;
++ }
++
++ if (FontSizeInflationEmPerLine() == 0 && FontSizeInflationMinTwips() == 0) {
+ return false;
+ }
+
+@@ -10788,33 +10789,6 @@ nsIPresShell::DetermineFontSizeInflationState()
+ return true;
+ }
+
+-bool
+-nsIPresShell::FontSizeInflationEnabled()
+-{
+- if (mFontSizeInflationEnabledIsDirty) {
+- RecomputeFontSizeInflationEnabled();
+- }
+-
+- return mFontSizeInflationEnabled;
+-}
+-
+-void
+-nsIPresShell::HandleSystemFontScale()
+-{
+- float fontScale = nsLayoutUtils::SystemFontScale();
+- if (fontScale == 0.0f) {
+- return;
+- }
+-
+- MOZ_ASSERT(mDocument && mPresContext, "our document and pres context should not be null");
+-
+- if (!mFontSizeInflationEnabled && !mDocument->IsSyntheticDocument()) {
+- mPresContext->SetSystemFontScale(fontScale);
+- } else {
+- mPresContext->SetSystemFontScale(1.0f);
+- }
+-}
+-
+ void
+ PresShell::PausePainting()
+ {
+diff --git layout/base/nsIPresShell.h layout/base/nsIPresShell.h
+index 32f4855347d5..3f6be216a60c 100644
+--- layout/base/nsIPresShell.h
++++ layout/base/nsIPresShell.h
+@@ -1507,24 +1507,14 @@ public:
+ return mFontSizeInflationDisabledInMasterProcess;
+ }
+
+- /**
+- * Determine if font size inflation is enabled. This value is cached until
+- * it becomes dirty.
+- *
+- * @returns true, if font size inflation is enabled; false otherwise.
+- */
+- bool FontSizeInflationEnabled();
++ bool FontSizeInflationEnabled() const {
++ return mFontSizeInflationEnabled;
++ }
+
+ /**
+- * Notify the pres shell that an event occurred making the current value of
+- * mFontSizeInflationEnabled invalid. This will schedule a recomputation of
+- * whether font size inflation is enabled on the next call to
+- * FontSizeInflationEnabled().
++ * Recomputes whether font-size inflation is enabled.
+ */
+- void NotifyFontSizeInflationEnabledIsDirty()
+- {
+- mFontSizeInflationEnabledIsDirty = true;
+- }
++ void RecomputeFontSizeInflationEnabled();
+
+ /**
+ * Return true if the most recent interruptible reflow was interrupted.
+@@ -1590,23 +1580,11 @@ protected:
+ void DoObserveLayoutFlushes();
+
+ /**
+- * Do computations necessary to determine if font size inflation is enabled.
+- * This value is cached after computation, as the computation is somewhat
+- * expensive.
+- */
+- void RecomputeFontSizeInflationEnabled();
+-
+- /**
+- * Does the actual work of figuring out the current state of font size inflation.
++ * Does the actual work of figuring out the current state of font size
++ * inflation.
+ */
+ bool DetermineFontSizeInflationState();
+
+- /**
+- * Apply the system font scale from the corresponding pref to the PresContext,
+- * taking into account the current state of font size inflation.
+- */
+- void HandleSystemFontScale();
+-
+ void RecordAlloc(void* aPtr) {
+ #ifdef DEBUG
+ MOZ_ASSERT(!mAllocatedPointers.Contains(aPtr));
+diff --git layout/base/nsLayoutUtils.cpp layout/base/nsLayoutUtils.cpp
+index e1289fd4a6a6..e165588e9c6c 100644
+--- layout/base/nsLayoutUtils.cpp
++++ layout/base/nsLayoutUtils.cpp
+@@ -9130,16 +9130,16 @@ MaybeReflowForInflationScreenSizeChange(nsPresContext *aPresContext)
+ {
+ if (aPresContext) {
+ nsIPresShell* presShell = aPresContext->GetPresShell();
+- bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
+- presShell->NotifyFontSizeInflationEnabledIsDirty();
++ const bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
++ presShell->RecomputeFontSizeInflationEnabled();
+ bool changed = false;
+- if (presShell && presShell->FontSizeInflationEnabled() &&
++ if (presShell->FontSizeInflationEnabled() &&
+ presShell->FontSizeInflationMinTwips() != 0) {
+ aPresContext->ScreenSizeInchesForFontInflation(&changed);
+ }
+
+ changed = changed ||
+- (fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
++ fontInflationWasEnabled != presShell->FontSizeInflationEnabled();
+ if (changed) {
+ nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
+ if (docShell) {
+diff --git layout/base/nsPresContext.cpp layout/base/nsPresContext.cpp
+index 2fadaf78a29f..1ce0b492673d 100644
+--- layout/base/nsPresContext.cpp
++++ layout/base/nsPresContext.cpp
+@@ -2123,6 +2123,10 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
+
+ mPendingViewportChange = false;
+
++ if (!mShell || !mShell->DidInitialize()) {
++ return;
++ }
++
+ if (mDocument->IsBeingUsedAsImage()) {
+ MOZ_ASSERT(mDocument->MediaQueryLists().isEmpty());
+ return;
+@@ -2130,7 +2134,7 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
+
+ mDocument->NotifyMediaFeatureValuesChanged();
+
+- MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
++ MOZ_DIAGNOSTIC_ASSERT(nsContentUtils::IsSafeToRunScript());
+
+ // Media query list listeners should be notified from a queued task
+ // (in HTML5 terms), although we also want to notify them on certain
diff --git a/www/waterfox/files/patch-bug1415291 b/www/waterfox/files/patch-bug1415291
new file mode 100644
index 000000000000..126262c997ca
--- /dev/null
+++ b/www/waterfox/files/patch-bug1415291
@@ -0,0 +1,52 @@
+commit 3055196eb5f1 (HEAD)
+Author: Luke Wagner <luke@mozilla.com>
+Date: Sat Dec 2 12:33:29 2017 -0500
+
+ Bug 1415291 - Baldr: factor out ToTableIndex(). r=bbouvier, a=gchang
+---
+ js/src/wasm/WasmJS.cpp | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git js/src/wasm/WasmJS.cpp js/src/wasm/WasmJS.cpp
+index 1d07b0d065fe..482de9788221 100644
+--- js/src/wasm/WasmJS.cpp
++++ js/src/wasm/WasmJS.cpp
+@@ -1694,6 +1694,20 @@ const JSPropertySpec WasmTableObject::properties[] =
+ JS_PS_END
+ };
+
++static bool
++ToTableIndex(JSContext* cx, HandleValue v, const Table& table, const char* noun, uint32_t* index)
++{
++ if (!ToNonWrappingUint32(cx, v, UINT32_MAX, "Table", noun, index))
++ return false;
++
++ if (*index >= table.length()) {
++ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_WASM_BAD_UINT32, "Table", noun);
++ return false;
++ }
++
++ return true;
++}
++
+ /* static */ bool
+ WasmTableObject::getImpl(JSContext* cx, const CallArgs& args)
+ {
+@@ -1701,7 +1715,7 @@ WasmTableObject::getImpl(JSContext* cx, const CallArgs& args)
+ const Table& table = tableObj->table();
+
+ uint32_t index;
+- if (!ToNonWrappingUint32(cx, args.get(0), table.length() - 1, "Table", "get index", &index))
++ if (!ToTableIndex(cx, args.get(0), table, "get index", &index))
+ return false;
+
+ ExternalTableElem& elem = table.externalArray()[index];
+@@ -1740,7 +1754,7 @@ WasmTableObject::setImpl(JSContext* cx, const CallArgs& args)
+ return false;
+
+ uint32_t index;
+- if (!ToNonWrappingUint32(cx, args.get(0), table.length() - 1, "Table", "set index", &index))
++ if (!ToTableIndex(cx, args.get(0), table, "set index", &index))
+ return false;
+
+ RootedFunction value(cx);
diff --git a/www/waterfox/files/patch-bug1415883 b/www/waterfox/files/patch-bug1415883
new file mode 100644
index 000000000000..3d862aa510cd
--- /dev/null
+++ b/www/waterfox/files/patch-bug1415883
@@ -0,0 +1,44 @@
+commit a4d70f676839
+Author: Jan de Mooij <jdemooij@mozilla.com>
+Date: Wed Nov 29 16:03:12 2017 +0100
+
+ Bug 1415883 - Fix some issues in ShiftFromList. r=arai, a=abillings
+
+ --HG--
+ extra : source : 2467d71d0e0de20103ce61cdd221461a48e4591b
+---
+ js/src/vm/List-inl.h | 4 ++--
+ js/src/vm/NativeObject.cpp | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git js/src/builtin/Stream.cpp js/src/builtin/Stream.cpp
+index e53f811a02e1..28cafd6c06d6 100644
+--- js/src/builtin/Stream.cpp
++++ js/src/builtin/Stream.cpp
+@@ -357,11 +357,11 @@ ShiftFromList(JSContext* cx, HandleNativeObject list)
+ Rooted<T*> entry(cx, &list->getDenseElement(0).toObject().as<T>());
+ if (!list->tryShiftDenseElements(1)) {
+ list->moveDenseElements(0, 1, length - 1);
++ list->setDenseInitializedLength(length - 1);
+ list->shrinkElements(cx, length - 1);
+ }
+
+- list->setDenseInitializedLength(length - 1);
+-
++ MOZ_ASSERT(list->getDenseInitializedLength() == length - 1);
+ return entry;
+ }
+
+diff --git js/src/vm/NativeObject.cpp js/src/vm/NativeObject.cpp
+index 780bc74192dc..deab37154af2 100644
+--- js/src/vm/NativeObject.cpp
++++ js/src/vm/NativeObject.cpp
+@@ -1000,6 +1000,8 @@ void
+ NativeObject::shrinkElements(JSContext* cx, uint32_t reqCapacity)
+ {
+ MOZ_ASSERT(canHaveNonEmptyElements());
++ MOZ_ASSERT(reqCapacity >= getDenseInitializedLength());
++
+ if (denseElementsAreCopyOnWrite())
+ MOZ_CRASH();
+
diff --git a/www/waterfox/files/patch-bug1417661 b/www/waterfox/files/patch-bug1417661
new file mode 100644
index 000000000000..a9ac6a9835cb
--- /dev/null
+++ b/www/waterfox/files/patch-bug1417661
@@ -0,0 +1,37 @@
+commit ad9b162b2a97
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date: Tue Nov 28 19:27:49 2017 +0100
+
+ Bug 1417661 - Use the correct parent style for inheriting from first-letter if the container is an anonymous box. r=bz, a=gchang
+
+ MozReview-Commit-ID: 1B7DrAVa274
+
+ --HG--
+ extra : source : 2be23298d4872b9d1677b6014683f554d857966f
+---
+ layout/base/nsCSSFrameConstructor.cpp | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp
+index f9994b31e649..0da45cc33544 100644
+--- layout/base/nsCSSFrameConstructor.cpp
++++ layout/base/nsCSSFrameConstructor.cpp
+@@ -11666,13 +11666,15 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
+
+ if (sc) {
+ if (sc->IsServo() && parentFrame->IsLineFrame()) {
+- ServoStyleContext* parentStyleIgnoringFirstLine =
+- aBlockFrame->StyleContext()->AsServo();
++ nsIFrame* parentIgnoringFirstLine =
++ nsFrame::CorrectStyleParentFrame(aBlockFrame,
++ nsCSSPseudoElements::firstLetter);
++
+ sc =
+ mPresShell->StyleSet()->AsServo()->ReparentStyleContext(
+ sc->AsServo(),
+ parentStyleContext->AsServo(),
+- parentStyleIgnoringFirstLine,
++ parentIgnoringFirstLine->StyleContext()->AsServo(),
+ parentStyleContext->AsServo(),
+ blockContent->AsElement());
+ }
diff --git a/www/waterfox/files/patch-bug1418447 b/www/waterfox/files/patch-bug1418447
deleted file mode 100644
index 87a08fef5b66..000000000000
--- a/www/waterfox/files/patch-bug1418447
+++ /dev/null
@@ -1,26 +0,0 @@
-commit 69f7bf805f94
-Author: Lee Salzman <lsalzman@mozilla.com>
-Date: Tue Nov 21 16:55:20 2017 -0500
-
- Bug 1418447 - Limit Skia edge builder allocations. r=milan, a=abillings
-
- MozReview-Commit-ID: 1SnxwtoYJJm
-
- --HG--
- extra : source : a81b848ebcc668f10a73eff586cebed570533b48
----
- gfx/skia/skia/src/core/SkEdgeBuilder.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git gfx/skia/skia/src/core/SkEdgeBuilder.cpp gfx/skia/skia/src/core/SkEdgeBuilder.cpp
-index ceb8f1ad3105..af8da00a2f04 100644
---- gfx/skia/skia/src/core/SkEdgeBuilder.cpp
-+++ gfx/skia/skia/src/core/SkEdgeBuilder.cpp
-@@ -248,6 +248,7 @@ int SkEdgeBuilder::buildPoly(const SkPath& path, const SkIRect* iclip, int shift
- // clipping can turn 1 line into (up to) kMaxClippedLineSegments, since
- // we turn portions that are clipped out on the left/right into vertical
- // segments.
-+ SkASSERT_RELEASE(maxEdgeCount <= std::numeric_limits<int>::max() / SkLineClipper::kMaxClippedLineSegments);
- maxEdgeCount *= SkLineClipper::kMaxClippedLineSegments;
- }
-
diff --git a/www/waterfox/files/patch-bug1418894 b/www/waterfox/files/patch-bug1418894
new file mode 100644
index 000000000000..b092b623b5b1
--- /dev/null
+++ b/www/waterfox/files/patch-bug1418894
@@ -0,0 +1,244 @@
+commit 408a8eddca66
+Author: Ted Campbell <tcampbell@mozilla.com>
+Date: Tue Nov 28 22:52:34 2017 -0500
+
+ Bug 1418894 - Use marker values in XDR data to detect corruption. r=nbp a=gchang
+
+ MozReview-Commit-ID: D6PxPBdgtPP
+
+ --HG--
+ extra : source : 3c5cc7786d922c70b937d1dbe57f0ce700c39551
+---
+ js/src/jsfun.cpp | 4 ++++
+ js/src/jsscript.cpp | 10 ++++++++++
+ js/src/vm/Xdr.h | 12 ++++++++++++
+ 3 files changed, 26 insertions(+)
+
+diff --git js/src/jsfun.cpp js/src/jsfun.cpp
+index 234d0cc3438c..5a461c9230eb 100644
+--- js/src/jsfun.cpp
++++ js/src/jsfun.cpp
+@@ -682,6 +682,10 @@ js::XDRInterpretedFunction(XDRState<mode>* xdr, HandleScope enclosingScope,
+ objp.set(fun);
+ }
+
++ // Verify marker at end of function to detect buffer trunction.
++ if (!xdr->codeMarker(0x9E35CA1F))
++ return false;
++
+ return true;
+ }
+
+diff --git js/src/jsscript.cpp js/src/jsscript.cpp
+index 1b31a0639644..88d6c7bc75b6 100644
+--- js/src/jsscript.cpp
++++ js/src/jsscript.cpp
+@@ -808,6 +808,11 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
+ if (mode == XDR_DECODE)
+ vector[i].init(scope);
+ }
++
++ // Verify marker to detect data corruption after decoding scope data. A
++ // mismatch here indicates we will almost certainly crash in release.
++ if (!xdr->codeMarker(0x48922BAB))
++ return false;
+ }
+
+ /*
+@@ -900,6 +905,11 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
+ }
+ }
+
++ // Verify marker to detect data corruption after decoding object data. A
++ // mismatch here indicates we will almost certainly crash in release.
++ if (!xdr->codeMarker(0xF83B989A))
++ return false;
++
+ if (ntrynotes != 0) {
+ JSTryNote* tnfirst = script->trynotes()->vector;
+ MOZ_ASSERT(script->trynotes()->length == ntrynotes);
+diff --git js/src/vm/Xdr.h js/src/vm/Xdr.h
+index 18fa1af8ab5b..0a6cbf01b50f 100644
+--- js/src/vm/Xdr.h
++++ js/src/vm/Xdr.h
+@@ -307,6 +307,18 @@ class XDRState : public XDRCoderBase
+ return true;
+ }
+
++ bool codeMarker(uint32_t magic) {
++ uint32_t actual = magic;
++ if (!codeUint32(&actual))
++ return false;
++ if (actual != magic) {
++ // Fail in debug, but only soft-fail in release
++ MOZ_ASSERT(false, "Bad XDR marker");
++ return fail(JS::TranscodeResult_Failure_BadDecode);
++ }
++ return true;
++ }
++
+ bool codeBytes(void* bytes, size_t len) {
+ if (len == 0)
+ return true;
+
+commit 885c19e8e675
+Author: Ted Campbell <tcampbell@mozilla.com>
+Date: Tue Nov 28 23:01:49 2017 -0500
+
+ Bug 1418894 - Harden XDR data decoding. r=nbp a=gchang
+
+ This patch adds better error detection to XDR decoding to reduce memory
+ corruption in the event that XDR data is corrupt (which is not
+ *supposed* to happen).
+
+ Add missing default cases. Make out-of-range values fail the decode by
+ asserting in debug, and returning a TranscodeError in release. Mix a
+ magic value into enum value before transcoding to buffer (to reduce
+ chance of garbage data being decoded).
+
+ MozReview-Commit-ID: 1wPkho9dm8c
+
+ --HG--
+ extra : source : 484499ffcbbad636a904832cc90c56c016ad4582
+---
+ js/src/jsapi.h | 2 +-
+ js/src/jsscript.cpp | 40 ++++++++++++++++++++++------------------
+ js/src/shell/js.cpp | 4 ++--
+ js/src/vm/Xdr.h | 8 ++++++--
+ 4 files changed, 31 insertions(+), 23 deletions(-)
+
+diff --git js/src/jsapi.h js/src/jsapi.h
+index 323396025b7a..c43a4c693778 100644
+--- js/src/jsapi.h
++++ js/src/jsapi.h
+@@ -6420,7 +6420,7 @@ enum TranscodeResult
+ TranscodeResult_Failure_BadBuildId = TranscodeResult_Failure | 0x1,
+ TranscodeResult_Failure_RunOnceNotSupported = TranscodeResult_Failure | 0x2,
+ TranscodeResult_Failure_AsmJSNotSupported = TranscodeResult_Failure | 0x3,
+- TranscodeResult_Failure_UnknownClassKind = TranscodeResult_Failure | 0x4,
++ TranscodeResult_Failure_BadDecode = TranscodeResult_Failure | 0x4,
+ TranscodeResult_Failure_WrongCompileOption = TranscodeResult_Failure | 0x5,
+ TranscodeResult_Failure_NotInterpretedFun = TranscodeResult_Failure | 0x6,
+
+diff --git js/src/jsscript.cpp js/src/jsscript.cpp
+index eff03d909353..1b31a0639644 100644
+--- js/src/jsscript.cpp
++++ js/src/jsscript.cpp
+@@ -92,24 +92,19 @@ js::XDRScriptConst(XDRState<mode>* xdr, MutableHandleValue vp)
+ {
+ JSContext* cx = xdr->cx();
+
+- /*
+- * A script constant can be an arbitrary primitive value as they are used
+- * to implement JSOP_LOOKUPSWITCH. But they cannot be objects, see
+- * bug 407186.
+- */
+ enum ConstTag {
+- SCRIPT_INT = 0,
+- SCRIPT_DOUBLE = 1,
+- SCRIPT_ATOM = 2,
+- SCRIPT_TRUE = 3,
+- SCRIPT_FALSE = 4,
+- SCRIPT_NULL = 5,
+- SCRIPT_OBJECT = 6,
+- SCRIPT_VOID = 7,
+- SCRIPT_HOLE = 8
++ SCRIPT_INT,
++ SCRIPT_DOUBLE,
++ SCRIPT_ATOM,
++ SCRIPT_TRUE,
++ SCRIPT_FALSE,
++ SCRIPT_NULL,
++ SCRIPT_OBJECT,
++ SCRIPT_VOID,
++ SCRIPT_HOLE
+ };
+
+- uint32_t tag;
++ ConstTag tag;
+ if (mode == XDR_ENCODE) {
+ if (vp.isInt32()) {
+ tag = SCRIPT_INT;
+@@ -133,7 +128,7 @@ js::XDRScriptConst(XDRState<mode>* xdr, MutableHandleValue vp)
+ }
+ }
+
+- if (!xdr->codeUint32(&tag))
++ if (!xdr->codeEnum32(&tag))
+ return false;
+
+ switch (tag) {
+@@ -199,6 +194,10 @@ js::XDRScriptConst(XDRState<mode>* xdr, MutableHandleValue vp)
+ if (mode == XDR_DECODE)
+ vp.setMagic(JS_ELEMENTS_HOLE);
+ break;
++ default:
++ // Fail in debug, but only soft-fail in release
++ MOZ_ASSERT(false, "Bad XDR value kind");
++ return xdr->fail(JS::TranscodeResult_Failure_BadDecode);
+ }
+ return true;
+ }
+@@ -800,6 +799,10 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
+ case ScopeKind::WasmFunction:
+ MOZ_CRASH("wasm functions cannot be nested in JSScripts");
+ break;
++ default:
++ // Fail in debug, but only soft-fail in release
++ MOZ_ASSERT(false, "Bad XDR scope kind");
++ return xdr->fail(JS::TranscodeResult_Failure_BadDecode);
+ }
+
+ if (mode == XDR_DECODE)
+@@ -890,8 +893,9 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
+ }
+
+ default: {
+- MOZ_ASSERT(false, "Unknown class kind.");
+- return xdr->fail(JS::TranscodeResult_Failure_UnknownClassKind);
++ // Fail in debug, but only soft-fail in release
++ MOZ_ASSERT(false, "Bad XDR class kind");
++ return xdr->fail(JS::TranscodeResult_Failure_BadDecode);
+ }
+ }
+ }
+diff --git js/src/shell/js.cpp js/src/shell/js.cpp
+index 16ee93bc66a8..1f5afb04e1f8 100644
+--- js/src/shell/js.cpp
++++ js/src/shell/js.cpp
+@@ -1519,9 +1519,9 @@ ConvertTranscodeResultToJSException(JSContext* cx, JS::TranscodeResult rv)
+ MOZ_ASSERT(!cx->isExceptionPending());
+ JS_ReportErrorASCII(cx, "Asm.js is not supported by XDR");
+ return false;
+- case JS::TranscodeResult_Failure_UnknownClassKind:
++ case JS::TranscodeResult_Failure_BadDecode:
+ MOZ_ASSERT(!cx->isExceptionPending());
+- JS_ReportErrorASCII(cx, "Unknown class kind, go fix it.");
++ JS_ReportErrorASCII(cx, "XDR data corruption");
+ return false;
+ case JS::TranscodeResult_Failure_WrongCompileOption:
+ MOZ_ASSERT(!cx->isExceptionPending());
+diff --git js/src/vm/Xdr.h js/src/vm/Xdr.h
+index e88968b9a4c0..18fa1af8ab5b 100644
+--- js/src/vm/Xdr.h
++++ js/src/vm/Xdr.h
+@@ -279,13 +279,17 @@ class XDRState : public XDRCoderBase
+ template <typename T>
+ bool codeEnum32(T* val, typename mozilla::EnableIf<mozilla::IsEnum<T>::value, T>::Type * = NULL)
+ {
++ // Mix the enumeration value with a random magic number, such that a
++ // corruption with a low-ranged value (like 0) is less likely to cause a
++ // miss-interpretation of the XDR content and instead cause a failure.
++ const uint32_t MAGIC = 0x21AB218C;
+ uint32_t tmp;
+ if (mode == XDR_ENCODE)
+- tmp = uint32_t(*val);
++ tmp = uint32_t(*val) ^ MAGIC;
+ if (!codeUint32(&tmp))
+ return false;
+ if (mode == XDR_DECODE)
+- *val = T(tmp);
++ *val = T(tmp ^ MAGIC);
+ return true;
+ }
+
diff --git a/www/waterfox/files/patch-bug1418966 b/www/waterfox/files/patch-bug1418966
deleted file mode 100644
index 5c1c3aceef47..000000000000
--- a/www/waterfox/files/patch-bug1418966
+++ /dev/null
@@ -1,232 +0,0 @@
-commit 229898bfe36d
-Author: Jan de Mooij <jdemooij@mozilla.com>
-Date: Wed Dec 13 14:13:43 2017 -0600
-
- Bug 1418966 - Pin TypeScripts better when doing Baseline debug mode OSR. r=bhackett a=ritu
-
- --HG--
- extra : source : f5ea86116d56e8e90689ec325061c948869159ba
----
- js/src/jit/BaselineCompiler.cpp | 4 +++-
- js/src/jit/BaselineDebugModeOSR.cpp | 2 ++
- js/src/jit/IonAnalysis.cpp | 3 ++-
- js/src/jit/VMFunctions.cpp | 3 ++-
- js/src/jsscript.h | 2 +-
- js/src/vm/EnvironmentObject.cpp | 4 +++-
- js/src/vm/TypeInference-inl.h | 17 ++++++++++++++++-
- js/src/vm/TypeInference.cpp | 3 +++
- js/src/vm/TypeInference.h | 19 +++++++++++++++++++
- 9 files changed, 51 insertions(+), 6 deletions(-)
-
-diff --git js/src/jit/BaselineCompiler.cpp js/src/jit/BaselineCompiler.cpp
-index fe02710d0105..5d1d7956bda3 100644
---- js/src/jit/BaselineCompiler.cpp
-+++ js/src/jit/BaselineCompiler.cpp
-@@ -36,6 +36,7 @@
- #include "jit/MacroAssembler-inl.h"
- #include "vm/Interpreter-inl.h"
- #include "vm/NativeObject-inl.h"
-+#include "vm/TypeInference-inl.h"
-
- using namespace js;
- using namespace js::jit;
-@@ -98,7 +99,8 @@ BaselineCompiler::compile()
- AutoTraceLog logScript(logger, scriptEvent);
- AutoTraceLog logCompile(logger, TraceLogger_BaselineCompilation);
-
-- if (!script->ensureHasTypes(cx) || !script->ensureHasAnalyzedArgsUsage(cx))
-+ AutoKeepTypeScripts keepTypes(cx);
-+ if (!script->ensureHasTypes(cx, keepTypes) || !script->ensureHasAnalyzedArgsUsage(cx))
- return Method_Error;
-
- // When code coverage is only enabled for optimizations, or when a Debugger
-diff --git js/src/jit/BaselineDebugModeOSR.cpp js/src/jit/BaselineDebugModeOSR.cpp
-index e4f0a87d4fe0..f8ff5f237fd0 100644
---- js/src/jit/BaselineDebugModeOSR.cpp
-+++ js/src/jit/BaselineDebugModeOSR.cpp
-@@ -16,6 +16,7 @@
- #include "jit/JitFrames-inl.h"
- #include "jit/MacroAssembler-inl.h"
- #include "vm/Stack-inl.h"
-+#include "vm/TypeInference-inl.h"
-
- using namespace js;
- using namespace js::jit;
-@@ -673,6 +674,7 @@ RecompileBaselineScriptForDebugMode(JSContext* cx, JSScript* script,
- JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%zu) for %s",
- script->filename(), script->lineno(), observing ? "DEBUGGING" : "NORMAL EXECUTION");
-
-+ AutoKeepTypeScripts keepTypes(cx);
- script->setBaselineScript(cx->runtime(), nullptr);
-
- MethodStatus status = BaselineCompile(cx, script, /* forceDebugMode = */ observing);
-diff --git js/src/jit/IonAnalysis.cpp js/src/jit/IonAnalysis.cpp
-index 72055a41c485..2191bbdea906 100644
---- js/src/jit/IonAnalysis.cpp
-+++ js/src/jit/IonAnalysis.cpp
-@@ -4430,7 +4430,8 @@ jit::AnalyzeArgumentsUsage(JSContext* cx, JSScript* scriptArg)
- if (script->length() > MAX_SCRIPT_SIZE)
- return true;
-
-- if (!script->ensureHasTypes(cx))
-+ AutoKeepTypeScripts keepTypes(cx);
-+ if (!script->ensureHasTypes(cx, keepTypes))
- return false;
-
- TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx);
-diff --git js/src/jit/VMFunctions.cpp js/src/jit/VMFunctions.cpp
-index bb47eb548f00..1baa93c0d063 100644
---- js/src/jit/VMFunctions.cpp
-+++ js/src/jit/VMFunctions.cpp
-@@ -624,7 +624,8 @@ CreateThis(JSContext* cx, HandleObject callee, HandleObject newTarget, MutableHa
- RootedFunction fun(cx, &callee->as<JSFunction>());
- if (fun->isInterpreted() && fun->isConstructor()) {
- JSScript* script = JSFunction::getOrCreateScript(cx, fun);
-- if (!script || !script->ensureHasTypes(cx))
-+ AutoKeepTypeScripts keepTypes(cx);
-+ if (!script || !script->ensureHasTypes(cx, keepTypes))
- return false;
- if (!js::CreateThis(cx, fun, script, newTarget, GenericObject, rval))
- return false;
-diff --git js/src/jsscript.h js/src/jsscript.h
-index b4ce7dc694b7..3611aa701424 100644
---- js/src/jsscript.h
-+++ js/src/jsscript.h
-@@ -1709,7 +1709,7 @@ class JSScript : public js::gc::TenuredCell
- bool isTopLevel() { return code() && !functionNonDelazifying(); }
-
- /* Ensure the script has a TypeScript. */
-- inline bool ensureHasTypes(JSContext* cx);
-+ inline bool ensureHasTypes(JSContext* cx, js::AutoKeepTypeScripts&);
-
- inline js::TypeScript* types();
-
-diff --git js/src/vm/EnvironmentObject.cpp js/src/vm/EnvironmentObject.cpp
-index 11f9015ddcfb..ee256b4a59c6 100644
---- js/src/vm/EnvironmentObject.cpp
-+++ js/src/vm/EnvironmentObject.cpp
-@@ -28,6 +28,7 @@
- #include "gc/Marking-inl.h"
- #include "vm/NativeObject-inl.h"
- #include "vm/Stack-inl.h"
-+#include "vm/TypeInference-inl.h"
-
- using namespace js;
- using namespace js::gc;
-@@ -1506,7 +1507,8 @@ class DebugEnvironmentProxyHandler : public BaseProxyHandler
- CallObject& callobj = env->as<CallObject>();
- RootedFunction fun(cx, &callobj.callee());
- RootedScript script(cx, JSFunction::getOrCreateScript(cx, fun));
-- if (!script->ensureHasTypes(cx) || !script->ensureHasAnalyzedArgsUsage(cx))
-+ AutoKeepTypeScripts keepTypes(cx);
-+ if (!script->ensureHasTypes(cx, keepTypes) || !script->ensureHasAnalyzedArgsUsage(cx))
- return false;
-
- BindingIter bi(script);
-diff --git js/src/vm/TypeInference-inl.h js/src/vm/TypeInference-inl.h
-index eb50e3d4b258..ea6e2492a113 100644
---- js/src/vm/TypeInference-inl.h
-+++ js/src/vm/TypeInference-inl.h
-@@ -683,6 +683,21 @@ TypeScript::SetArgument(JSContext* cx, JSScript* script, unsigned arg, const js:
- SetArgument(cx, script, arg, TypeSet::GetValueType(value));
- }
-
-+inline
-+AutoKeepTypeScripts::AutoKeepTypeScripts(JSContext* cx)
-+ : zone_(cx->zone()->types),
-+ prev_(zone_.keepTypeScripts)
-+{
-+ zone_.keepTypeScripts = true;
-+}
-+
-+inline
-+AutoKeepTypeScripts::~AutoKeepTypeScripts()
-+{
-+ MOZ_ASSERT(zone_.keepTypeScripts);
-+ zone_.keepTypeScripts = prev_;
-+}
-+
- /////////////////////////////////////////////////////////////////////
- // TypeHashSet
- /////////////////////////////////////////////////////////////////////
-@@ -1202,7 +1217,7 @@ JSScript::types()
- }
-
- inline bool
--JSScript::ensureHasTypes(JSContext* cx)
-+JSScript::ensureHasTypes(JSContext* cx, js::AutoKeepTypeScripts&)
- {
- return types() || makeTypes(cx);
- }
-diff --git js/src/vm/TypeInference.cpp js/src/vm/TypeInference.cpp
-index 10fc2391f3df..ecd83f47c8ec 100644
---- js/src/vm/TypeInference.cpp
-+++ js/src/vm/TypeInference.cpp
-@@ -4442,6 +4442,7 @@ JSScript::maybeSweepTypes(AutoClearTypeInferenceStateOnOOM* oom)
- // only do this if nothing has been compiled for the script, which will be
- // the case unless the script has been compiled since we started sweeping.
- if (types.sweepReleaseTypes &&
-+ !types.keepTypeScripts &&
- !hasBaselineScript() &&
- !hasIonScript())
- {
-@@ -4509,6 +4510,7 @@ TypeZone::TypeZone(Zone* zone)
- sweepCompilerOutputs(zone->group(), nullptr),
- sweepReleaseTypes(zone->group(), false),
- sweepingTypes(zone->group(), false),
-+ keepTypeScripts(zone->group(), false),
- activeAnalysis(zone->group(), nullptr)
- {
- }
-@@ -4518,6 +4520,7 @@ TypeZone::~TypeZone()
- js_delete(compilerOutputs.ref());
- js_delete(sweepCompilerOutputs.ref());
- MOZ_RELEASE_ASSERT(!sweepingTypes);
-+ MOZ_ASSERT(!keepTypeScripts);
- }
-
- void
-diff --git js/src/vm/TypeInference.h js/src/vm/TypeInference.h
-index 0e8e9c27ee12..358ac842f9e8 100644
---- js/src/vm/TypeInference.h
-+++ js/src/vm/TypeInference.h
-@@ -1286,6 +1286,20 @@ class TypeScript
- #endif
- };
-
-+// Ensures no TypeScripts are purged in the current zone.
-+class MOZ_RAII AutoKeepTypeScripts
-+{
-+ TypeZone& zone_;
-+ bool prev_;
-+
-+ AutoKeepTypeScripts(const AutoKeepTypeScripts&) = delete;
-+ void operator=(const AutoKeepTypeScripts&) = delete;
-+
-+ public:
-+ explicit inline AutoKeepTypeScripts(JSContext* cx);
-+ inline ~AutoKeepTypeScripts();
-+};
-+
- void
- FillBytecodeTypeMap(JSScript* script, uint32_t* bytecodeMap);
-
-@@ -1360,6 +1374,9 @@ class TypeZone
- static const size_t TYPE_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 8 * 1024;
- ZoneGroupData<LifoAlloc> typeLifoAlloc_;
-
-+ TypeZone(const TypeZone&) = delete;
-+ void operator=(const TypeZone&) = delete;
-+
- public:
- // Current generation for sweeping.
- ZoneGroupOrGCTaskOrIonCompileData<uint32_t> generation;
-@@ -1386,6 +1403,8 @@ class TypeZone
-
- ZoneGroupData<bool> sweepingTypes;
-
-+ ZoneGroupData<bool> keepTypeScripts;
-+
- // The topmost AutoEnterAnalysis on the stack, if there is one.
- ZoneGroupData<AutoEnterAnalysis*> activeAnalysis;
-
diff --git a/www/waterfox/files/patch-bug1419363 b/www/waterfox/files/patch-bug1419363
deleted file mode 100644
index e80b3cd55f6b..000000000000
--- a/www/waterfox/files/patch-bug1419363
+++ /dev/null
@@ -1,32 +0,0 @@
-commit 2eda8f3435d6
-Author: Andreas Pehrson <pehrsons@mozilla.com>
-Date: Fri Dec 1 10:52:18 2017 -0500
-
- Bug 1419363 - Switch to WeakPtr. r=jib a=gchang
-
- --HG--
- extra : source : e0a21cc26e07b19383d2bf5038b88eed211de53e
----
- dom/html/HTMLMediaElement.cpp | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git dom/html/HTMLMediaElement.cpp dom/html/HTMLMediaElement.cpp
-index 12ea373e8782..285a36400ad9 100644
---- dom/html/HTMLMediaElement.cpp
-+++ dom/html/HTMLMediaElement.cpp
-@@ -5168,11 +5168,14 @@ public:
- {
- NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
-
-+ if (!mElement) {
-+ return;
-+ }
- mElement->NotifyMediaStreamTracksAvailable(aStream);
- }
-
- private:
-- HTMLMediaElement* mElement;
-+ WeakPtr<HTMLMediaElement> mElement;
- };
-
- class HTMLMediaElement::MediaStreamTrackListener :
diff --git a/www/waterfox/files/patch-bug1420507 b/www/waterfox/files/patch-bug1420507
deleted file mode 100644
index 91cb37a477f1..000000000000
--- a/www/waterfox/files/patch-bug1420507
+++ /dev/null
@@ -1,32 +0,0 @@
-commit 24b71ccea227
-Author: Gijs Kruitbosch <gijskruitbosch@gmail.com>
-Date: Wed Nov 29 17:03:54 2017 +0000
-
- Bug 1420507, r=freddyb,francois a=gchang
-
- --HG--
- extra : source : f3ea44ff63eec1d2e6edafe94c213860a8cfe11f
----
- dom/base/nsTreeSanitizer.cpp | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git dom/base/nsTreeSanitizer.cpp dom/base/nsTreeSanitizer.cpp
-index 7b567eeed0ed..496cbd37ec88 100644
---- dom/base/nsTreeSanitizer.cpp
-+++ dom/base/nsTreeSanitizer.cpp
-@@ -172,6 +172,7 @@ nsStaticAtom** const kAttributesHTML[] = {
- &nsGkAtoms::contextmenu,
- &nsGkAtoms::controls,
- &nsGkAtoms::coords,
-+ &nsGkAtoms::crossorigin,
- &nsGkAtoms::datetime,
- &nsGkAtoms::dir,
- &nsGkAtoms::disabled,
-@@ -188,6 +189,7 @@ nsStaticAtom** const kAttributesHTML[] = {
- &nsGkAtoms::hreflang,
- &nsGkAtoms::icon,
- &nsGkAtoms::id,
-+ &nsGkAtoms::integrity,
- &nsGkAtoms::ismap,
- &nsGkAtoms::itemid,
- &nsGkAtoms::itemprop,
diff --git a/www/waterfox/files/patch-bug1423086 b/www/waterfox/files/patch-bug1423086
deleted file mode 100644
index 123fb66344b6..000000000000
--- a/www/waterfox/files/patch-bug1423086
+++ /dev/null
@@ -1,222 +0,0 @@
-commit 96370abe22e4
-Author: Byron Campen [:bwc] <docfaraday@gmail.com>
-Date: Mon Dec 18 12:36:23 2017 -0600
-
- Bug 1423086: (beta backport) Use nsITimerCallback for DTMF timers. r=drno a=ritu
-
- MozReview-Commit-ID: 2IlDknNhlAG
-
- --HG--
- extra : rebase_source : 344b2b1b10084099a37fb793fc25b71144a4428c
----
- .../src/peerconnection/PeerConnectionImpl.cpp | 72 +++++++++++-----------
- .../src/peerconnection/PeerConnectionImpl.h | 28 +++++----
- 2 files changed, 51 insertions(+), 49 deletions(-)
-
-diff --git media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
-index 68949feb7254..edb07486b45a 100644
---- media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
-+++ media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
-@@ -2521,8 +2521,8 @@ PeerConnectionImpl::RemoveTrack(MediaStreamTrack& aTrack) {
- nsString wideTrackId;
- aTrack.GetId(wideTrackId);
- for (size_t i = 0; i < mDTMFStates.Length(); ++i) {
-- if (mDTMFStates[i].mTrackId == wideTrackId) {
-- mDTMFStates[i].mSendTimer->Cancel();
-+ if (mDTMFStates[i]->mTrackId == wideTrackId) {
-+ mDTMFStates[i]->mSendTimer->Cancel();
- mDTMFStates.RemoveElementAt(i);
- break;
- }
-@@ -2593,17 +2593,17 @@ PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender,
- mst->GetId(senderTrackId);
-
- // Attempt to locate state for the DTMFSender
-- DTMFState* state = nullptr;
-+ RefPtr<DTMFState> state;
- for (auto& dtmfState : mDTMFStates) {
-- if (dtmfState.mTrackId == senderTrackId) {
-- state = &dtmfState;
-+ if (dtmfState->mTrackId == senderTrackId) {
-+ state = dtmfState;
- break;
- }
- }
-
- // No state yet, create a new one
- if (!state) {
-- state = mDTMFStates.AppendElement();
-+ state = *mDTMFStates.AppendElement(new DTMFState);
- state->mPeerConnectionImpl = this;
- state->mTrackId = senderTrackId;
- state->mSendTimer = NS_NewTimer();
-@@ -2627,9 +2627,7 @@ PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender,
- state->mDuration = duration;
- state->mInterToneGap = interToneGap;
- if (!state->mTones.IsEmpty()) {
-- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state, 0,
-- nsITimer::TYPE_ONE_SHOT,
-- "DTMFSendTimerCallback_m");
-+ state->mSendTimer->InitWithCallback(state, 0, nsITimer::TYPE_ONE_SHOT);
- }
- return NS_OK;
- }
-@@ -2653,8 +2651,8 @@ PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender,
-
- // Attempt to locate state for the DTMFSender
- for (auto& dtmfState : mDTMFStates) {
-- if (dtmfState.mTrackId == senderTrackId) {
-- outToneBuffer = dtmfState.mTones;
-+ if (dtmfState->mTrackId == senderTrackId) {
-+ outToneBuffer = dtmfState->mTones;
- break;
- }
- }
-@@ -2671,8 +2669,8 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
- aThisTrack.GetId(trackId);
-
- for (size_t i = 0; i < mDTMFStates.Length(); ++i) {
-- if (mDTMFStates[i].mTrackId == trackId) {
-- mDTMFStates[i].mSendTimer->Cancel();
-+ if (mDTMFStates[i]->mTrackId == trackId) {
-+ mDTMFStates[i]->mSendTimer->Cancel();
- mDTMFStates.RemoveElementAt(i);
- break;
- }
-@@ -3117,7 +3115,7 @@ PeerConnectionImpl::CloseInt()
- PC_AUTO_ENTER_API_CALL_NO_CHECK();
-
- for (auto& dtmfState : mDTMFStates) {
-- dtmfState.mSendTimer->Cancel();
-+ dtmfState->mSendTimer->Cancel();
- }
-
- // We do this at the end of the call because we want to make sure we've waited
-@@ -4201,63 +4199,63 @@ PeerConnectionImpl::GetRemoteStreams(nsTArray<RefPtr<DOMMediaStream > >& result)
- return NS_OK;
- }
-
--void
--PeerConnectionImpl::DTMFSendTimerCallback_m(nsITimer* timer, void* closure)
-+nsresult
-+PeerConnectionImpl::DTMFState::Notify(nsITimer* timer)
- {
- MOZ_ASSERT(NS_IsMainThread());
-
-- auto state = static_cast<DTMFState*>(closure);
--
- nsString eventTone;
-- if (!state->mTones.IsEmpty()) {
-- uint16_t toneChar = state->mTones.CharAt(0);
-+ if (!mTones.IsEmpty()) {
-+ uint16_t toneChar = mTones.CharAt(0);
- int tone = GetDTMFToneCode(toneChar);
-
- eventTone.Assign(toneChar);
-
-- state->mTones.Cut(0, 1);
-+ mTones.Cut(0, 1);
-
- if (tone == -1) {
-- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state,
-- 2000, nsITimer::TYPE_ONE_SHOT,
-- "DTMFSendTimerCallback_m");
-+ mSendTimer->InitWithCallback(this, 2000, nsITimer::TYPE_ONE_SHOT);
- } else {
- // Reset delay if necessary
-- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state,
-- state->mDuration + state->mInterToneGap,
-- nsITimer::TYPE_ONE_SHOT,
-- "DTMFSendTimerCallback_m");
-+ mSendTimer->InitWithCallback(this,
-+ mDuration + mInterToneGap,
-+ nsITimer::TYPE_ONE_SHOT);
-
- RefPtr<AudioSessionConduit> conduit =
-- state->mPeerConnectionImpl->mMedia->GetAudioConduit(state->mLevel);
-+ mPeerConnectionImpl->mMedia->GetAudioConduit(mLevel);
-
- if (conduit) {
-- uint32_t duration = state->mDuration;
-- state->mPeerConnectionImpl->mSTSThread->Dispatch(WrapRunnableNM([conduit, tone, duration] () {
-+ uint32_t duration = mDuration;
-+ mPeerConnectionImpl->mSTSThread->Dispatch(WrapRunnableNM([conduit, tone, duration] () {
- //Note: We default to channel 0, not inband, and 6dB attenuation.
- // here. We might want to revisit these choices in the future.
- conduit->InsertDTMFTone(0, tone, true, duration, 6);
- }), NS_DISPATCH_NORMAL);
- }
--
- }
- } else {
-- state->mSendTimer->Cancel();
-+ mSendTimer->Cancel();
- }
-
-- RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(state->mPeerConnectionImpl->mPCObserver);
-+ RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPeerConnectionImpl->mPCObserver);
- if (!pco) {
- NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!");
-- return;
-+ return NS_OK; // Return is ignored anyhow
- }
-
- JSErrorResult jrv;
-- pco->OnDTMFToneChange(state->mTrackId, eventTone, jrv);
-+ pco->OnDTMFToneChange(mTrackId, eventTone, jrv);
-
- if (jrv.Failed()) {
- NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!");
-- return;
- }
-+
-+ return NS_OK;
- }
-
-+PeerConnectionImpl::DTMFState::DTMFState() = default;
-+PeerConnectionImpl::DTMFState::~DTMFState() = default;
-+
-+NS_IMPL_ISUPPORTS(PeerConnectionImpl::DTMFState, nsITimerCallback)
-+
- } // end mozilla namespace
-diff --git media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
-index 3090a25bf57e..5213931161fc 100644
---- media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
-+++ media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
-@@ -829,20 +829,24 @@ private:
- uint16_t mMaxSending[SdpMediaSection::kMediaTypes];
-
- // DTMF
-- struct DTMFState {
-- PeerConnectionImpl* mPeerConnectionImpl;
-- nsCOMPtr<nsITimer> mSendTimer;
-- nsString mTrackId;
-- nsString mTones;
-- size_t mLevel;
-- uint32_t mDuration;
-- uint32_t mInterToneGap;
-+ class DTMFState : public nsITimerCallback {
-+ virtual ~DTMFState();
-+ public:
-+ DTMFState();
-+
-+ NS_DECL_NSITIMERCALLBACK
-+ NS_DECL_THREADSAFE_ISUPPORTS
-+
-+ PeerConnectionImpl* mPeerConnectionImpl;
-+ nsCOMPtr<nsITimer> mSendTimer;
-+ nsString mTrackId;
-+ nsString mTones;
-+ size_t mLevel;
-+ uint32_t mDuration;
-+ uint32_t mInterToneGap;
- };
-
-- static void
-- DTMFSendTimerCallback_m(nsITimer* timer, void*);
--
-- nsTArray<DTMFState> mDTMFStates;
-+ nsTArray<RefPtr<DTMFState>> mDTMFStates;
-
- std::vector<unsigned> mSendPacketDumpFlags;
- std::vector<unsigned> mRecvPacketDumpFlags;
diff --git a/www/waterfox/files/patch-bug1423159 b/www/waterfox/files/patch-bug1423159
deleted file mode 100644
index 85e7148b5b91..000000000000
--- a/www/waterfox/files/patch-bug1423159
+++ /dev/null
@@ -1,69 +0,0 @@
-commit 6508b1194af3
-Author: Olli Pettay <Olli.Pettay@helsinki.fi>
-Date: Sun Dec 10 14:49:49 2017 -0500
-
- Bug 1423159 - Ensure proper multiprocess mouse enter/exit handling. r=stone, a=abillings
-
- --HG--
- extra : source : 689357a9394830406290ae1fb2200521a99bd7ad
----
- dom/events/EventStateManager.cpp | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
-diff --git dom/events/EventStateManager.cpp dom/events/EventStateManager.cpp
-index 441036b5c5bf..f076f8ae0f09 100644
---- dom/events/EventStateManager.cpp
-+++ dom/events/EventStateManager.cpp
-@@ -4041,33 +4041,36 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
- return nullptr;
- }
-
-+ nsCOMPtr<nsIContent> targetContent = aTargetContent;
-+ nsCOMPtr<nsIContent> relatedContent = aRelatedContent;
-+
- nsAutoPtr<WidgetMouseEvent> dispatchEvent;
- CreateMouseOrPointerWidgetEvent(aMouseEvent, aMessage,
-- aRelatedContent, dispatchEvent);
-+ relatedContent, dispatchEvent);
-
- AutoWeakFrame previousTarget = mCurrentTarget;
-- mCurrentTargetContent = aTargetContent;
-+ mCurrentTargetContent = targetContent;
-
- nsIFrame* targetFrame = nullptr;
-
- nsEventStatus status = nsEventStatus_eIgnore;
-- ESMEventCB callback(aTargetContent);
-- EventDispatcher::Dispatch(aTargetContent, mPresContext, dispatchEvent, nullptr,
-+ ESMEventCB callback(targetContent);
-+ EventDispatcher::Dispatch(targetContent, mPresContext, dispatchEvent, nullptr,
- &status, &callback);
-
- if (mPresContext) {
- // Although the primary frame was checked in event callback, it may not be
- // the same object after event dispatch and handling, so refetch it.
-- targetFrame = mPresContext->GetPrimaryFrameFor(aTargetContent);
-+ targetFrame = mPresContext->GetPrimaryFrameFor(targetContent);
-
- // If we are entering/leaving remote content, dispatch a mouse enter/exit
- // event to the remote frame.
-- if (IsRemoteTarget(aTargetContent)) {
-+ if (IsRemoteTarget(targetContent)) {
- if (aMessage == eMouseOut) {
- // For remote content, send a "top-level" widget mouse exit event.
- nsAutoPtr<WidgetMouseEvent> remoteEvent;
- CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseExitFromWidget,
-- aRelatedContent, remoteEvent);
-+ relatedContent, remoteEvent);
- remoteEvent->mExitFrom = WidgetMouseEvent::eTopLevel;
-
- // mCurrentTarget is set to the new target, so we must reset it to the
-@@ -4079,7 +4082,7 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
- } else if (aMessage == eMouseOver) {
- nsAutoPtr<WidgetMouseEvent> remoteEvent;
- CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseEnterIntoWidget,
-- aRelatedContent, remoteEvent);
-+ relatedContent, remoteEvent);
- HandleCrossProcessEvent(remoteEvent, &status);
- }
- }
diff --git a/www/waterfox/files/patch-bug1423770 b/www/waterfox/files/patch-bug1423770
new file mode 100644
index 000000000000..bd82b116bf1d
--- /dev/null
+++ b/www/waterfox/files/patch-bug1423770
@@ -0,0 +1,44 @@
+commit 2506c20ded5b
+Author: Alex Chronopoulos <achronop@gmail.com>
+Date: Wed Dec 20 09:21:40 2017 -0500
+
+ Bug 1423770. r=padenot, a=jcristau
+
+ --HG--
+ extra : rebase_source : 6c9ad483fe1ef89966e1a2a1fac8a9bdb8bf43c8
+---
+ media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+index 5c2bcd16d017..2bb7203f85bd 100644
+--- media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
++++ media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+@@ -518,6 +518,7 @@ public:
+ packetizer_->Channels() != outputChannels) {
+ // It's ok to drop the audio still in the packetizer here.
+ packetizer_ = new AudioPacketizer<int16_t, int16_t>(audio_10ms, outputChannels);
++ packet_ = MakeUnique<int16_t[]>(audio_10ms * outputChannels);
+ }
+
+ packetizer_->Input(samples, chunk.mDuration);
+@@ -525,8 +526,8 @@ public:
+ while (packetizer_->PacketsAvailable()) {
+ uint32_t samplesPerPacket = packetizer_->PacketSize() *
+ packetizer_->Channels();
+- packetizer_->Output(packet_);
+- mConduit->SendAudioFrame(packet_, samplesPerPacket, rate, 0);
++ packetizer_->Output(packet_.get());
++ mConduit->SendAudioFrame(packet_.get(), samplesPerPacket, rate, 0);
+ }
+ }
+
+@@ -555,7 +556,7 @@ protected:
+ // Only accessed on mThread
+ nsAutoPtr<AudioPacketizer<int16_t, int16_t>> packetizer_;
+ // A buffer to hold a single packet of audio.
+- int16_t packet_[AUDIO_SAMPLE_BUFFER_MAX_BYTES / sizeof(int16_t)];
++ UniquePtr<int16_t[]> packet_;
+ };
+
+ static char kDTLSExporterLabel[] = "EXTRACTOR-dtls_srtp";
diff --git a/www/waterfox/files/patch-bug1425000 b/www/waterfox/files/patch-bug1425000
deleted file mode 100644
index 96a5ee22e36a..000000000000
--- a/www/waterfox/files/patch-bug1425000
+++ /dev/null
@@ -1,139 +0,0 @@
-commit 2e3c1926dbbb
-Author: Cameron McCormack <cam@mcc.id.au>
-Date: Thu Dec 21 14:07:31 2017 -0500
-
- Bug 1425000 - Use a consistent window for CSP, etc. for FontFace loads. r=jfkthame, a=abillings
-
- MozReview-Commit-ID: F2xhsgTBI1V
-
- --HG--
- extra : rebase_source : ba02ceab0317edfd9a4dd6c05618c5dbbcc4f830
- extra : source : c035522097125e8cf8fc8cbbc110be62a12aa055
----
- gfx/thebes/gfxUserFontSet.h | 4 ++++
- layout/style/FontFace.cpp | 5 +++++
- layout/style/FontFace.h | 2 ++
- layout/style/FontFaceSet.cpp | 18 ++++++++++--------
- layout/style/FontFaceSet.h | 4 ++--
- 5 files changed, 23 insertions(+), 10 deletions(-)
-
-diff --git gfx/thebes/gfxUserFontSet.h gfx/thebes/gfxUserFontSet.h
-index 076b7c119c6a..beddfc3bc0be 100644
---- gfx/thebes/gfxUserFontSet.h
-+++ gfx/thebes/gfxUserFontSet.h
-@@ -673,6 +673,10 @@ public:
- void GetFamilyNameAndURIForLogging(nsACString& aFamilyName,
- nsACString& aURI);
-
-+#ifdef DEBUG
-+ gfxUserFontSet* GetUserFontSet() const { return mFontSet; }
-+#endif
-+
- protected:
- const uint8_t* SanitizeOpenTypeData(const uint8_t* aData,
- uint32_t aLength,
-diff --git layout/style/FontFace.cpp layout/style/FontFace.cpp
-index 76d26910bb62..eeda8ca5ddb8 100644
---- layout/style/FontFace.cpp
-+++ layout/style/FontFace.cpp
-@@ -672,6 +672,11 @@ FontFace::SetUserFontEntry(gfxUserFontEntry* aEntry)
- if (mUserFontEntry) {
- mUserFontEntry->mFontFaces.AppendElement(this);
-
-+ MOZ_ASSERT(mUserFontEntry->GetUserFontSet() ==
-+ mFontFaceSet->GetUserFontSet(),
-+ "user font entry must be associated with the same user font set "
-+ "as the FontFace");
-+
- // Our newly assigned user font entry might be in the process of or
- // finished loading, so set our status accordingly. But only do so
- // if we're not going "backwards" in status, which could otherwise
-diff --git layout/style/FontFace.h layout/style/FontFace.h
-index 69e76c9b848a..355b340f9eed 100644
---- layout/style/FontFace.h
-+++ layout/style/FontFace.h
-@@ -94,6 +94,8 @@ public:
- void AddFontFaceSet(FontFaceSet* aFontFaceSet);
- void RemoveFontFaceSet(FontFaceSet* aFontFaceSet);
-
-+ FontFaceSet* GetPrimaryFontFaceSet() const { return mFontFaceSet; }
-+
- /**
- * Gets the family name of the FontFace as a raw string (such as 'Times', as
- * opposed to GetFamily, which returns a CSS-escaped string, such as
-diff --git layout/style/FontFaceSet.cpp layout/style/FontFaceSet.cpp
-index f5aa30f5d1ca..fe372044f6b5 100644
---- layout/style/FontFaceSet.cpp
-+++ layout/style/FontFaceSet.cpp
-@@ -983,7 +983,7 @@ FontFaceSet::InsertRuleFontFace(FontFace* aFontFace, SheetType aSheetType,
- mUserFontSet->AddUserFontEntry(fontfamily, entry);
- }
-
--already_AddRefed<gfxUserFontEntry>
-+/* static */ already_AddRefed<gfxUserFontEntry>
- FontFaceSet::FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace)
- {
- nsAutoString fontfamily;
-@@ -997,11 +997,13 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace)
- SheetType::Doc);
- }
-
--already_AddRefed<gfxUserFontEntry>
-+/* static */ already_AddRefed<gfxUserFontEntry>
- FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
- FontFace* aFontFace,
- SheetType aSheetType)
- {
-+ FontFaceSet* set = aFontFace->GetPrimaryFontFaceSet();
-+
- nsCSSValue val;
- nsCSSUnit unit;
-
-@@ -1128,7 +1130,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
- face->mURI = uri ? new gfxFontSrcURI(uri) : nullptr;
- URLValue* url = val.GetURLStructValue();
- face->mReferrer = url->mExtraData->GetReferrer();
-- face->mReferrerPolicy = mDocument->GetReferrerPolicy();
-+ face->mReferrerPolicy = set->mDocument->GetReferrerPolicy();
- face->mOriginPrincipal =
- new gfxFontSrcPrincipal(url->mExtraData->GetPrincipal());
- NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
-@@ -1195,11 +1197,11 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
- }
-
- RefPtr<gfxUserFontEntry> entry =
-- mUserFontSet->FindOrCreateUserFontEntry(aFamilyName, srcArray, weight,
-- stretch, italicStyle,
-- featureSettings,
-- languageOverride,
-- unicodeRanges, fontDisplay);
-+ set->mUserFontSet->FindOrCreateUserFontEntry(aFamilyName, srcArray, weight,
-+ stretch, italicStyle,
-+ featureSettings,
-+ languageOverride,
-+ unicodeRanges, fontDisplay);
- return entry.forget();
- }
-
-diff --git layout/style/FontFaceSet.h layout/style/FontFaceSet.h
-index a28afe39a13a..46c25087564d 100644
---- layout/style/FontFaceSet.h
-+++ layout/style/FontFaceSet.h
-@@ -136,7 +136,7 @@ public:
- * Finds an existing entry in the user font cache or creates a new user
- * font entry for the given FontFace object.
- */
-- already_AddRefed<gfxUserFontEntry>
-+ static already_AddRefed<gfxUserFontEntry>
- FindOrCreateUserFontEntryFromFontFace(FontFace* aFontFace);
-
- /**
-@@ -268,7 +268,7 @@ private:
- bool mLoadEventShouldFire;
- };
-
-- already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntryFromFontFace(
-+ static already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntryFromFontFace(
- const nsAString& aFamilyName,
- FontFace* aFontFace,
- SheetType aSheetType);
diff --git a/www/waterfox/files/patch-bug1425267 b/www/waterfox/files/patch-bug1425267
new file mode 100644
index 000000000000..0dcca4ec774b
--- /dev/null
+++ b/www/waterfox/files/patch-bug1425267
@@ -0,0 +1,55 @@
+commit d60383c31a25
+Author: Shane Caraveo <scaraveo@mozilla.com>
+Date: Thu Dec 21 15:18:26 2017 -0800
+
+ Bug 1425267 fix url param schema for launchWebAuthFlow, r=rpl a=gchang
+
+ --HG--
+ extra : source : 0c4f3b8d311e4751dafc00d689c3bf07f17c15dd
+---
+ toolkit/components/extensions/schemas/identity.json | 4 ++--
+ .../components/extensions/test/mochitest/test_ext_identity.html | 9 +++++++--
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git toolkit/components/extensions/schemas/identity.json toolkit/components/extensions/schemas/identity.json
+index 308687ce8c83..97b8a57f379c 100644
+--- toolkit/components/extensions/schemas/identity.json
++++ toolkit/components/extensions/schemas/identity.json
+@@ -162,7 +162,7 @@
+ "name": "details",
+ "type": "object",
+ "properties": {
+- "url": {"type": "string"},
++ "url": {"$ref": "manifest.HttpURL"},
+ "interactive": {"type": "boolean", "optional": true}
+ }
+ },
+@@ -185,7 +185,7 @@
+ "description": "Generates a redirect URL to be used in |launchWebAuthFlow|.",
+ "parameters": [
+ {
+- "name": " path",
++ "name": "path",
+ "type": "string",
+ "default": "",
+ "optional": true,
+diff --git toolkit/components/extensions/test/mochitest/test_chrome_ext_identity.html toolkit/components/extensions/test/mochitest/test_chrome_ext_identity.html
+index adf67b6ffe59..278223896749 100644
+--- toolkit/components/extensions/test/mochitest/test_chrome_ext_identity.html
++++ toolkit/components/extensions/test/mochitest/test_chrome_ext_identity.html
+@@ -78,8 +78,13 @@ add_task(async function test_badAuthURI() {
+ ],
+ },
+ async background() {
+- await browser.test.assertRejects(browser.identity.launchWebAuthFlow({interactive: true, url: "foobar"}),
+- "details.url is invalid", "invalid param url");
++ for (let url of ["foobar", "about:addons", "about:blank", "ftp://example.com/test"]) {
++ await browser.test.assertThrows(
++ () => { browser.identity.launchWebAuthFlow({interactive: true, url}); },
++ /Type error for parameter details/,
++ "details.url is invalid");
++ }
++
+ browser.test.sendMessage("done");
+ },
+ });
diff --git a/www/waterfox/files/patch-bug730495 b/www/waterfox/files/patch-bug730495
new file mode 100644
index 000000000000..ba1dbc83afde
--- /dev/null
+++ b/www/waterfox/files/patch-bug730495
@@ -0,0 +1,545 @@
+commit 47d3b3ac0b24
+Author: Kai Engert <kaie@kuix.de>
+Date: Fri Sep 29 13:25:06 2017 +0200
+
+ Bug 730495, guarantee that sqlite3_config is called before any other SQLite function, r=asuth, r=froydnj, r=mak
+---
+ security/manager/ssl/nsNSSComponent.cpp | 9 --
+ storage/TelemetryVFS.cpp | 7 +-
+ storage/mozStorageConnection.cpp | 8 +-
+ storage/mozStorageService.cpp | 149 +---------------------------
+ toolkit/xre/AutoSQLiteLifetime.cpp | 167 ++++++++++++++++++++++++++++++++
+ toolkit/xre/AutoSQLiteLifetime.h | 24 +++++
+ toolkit/xre/Bootstrap.cpp | 4 +
+ toolkit/xre/moz.build | 3 +-
+ 8 files changed, 212 insertions(+), 159 deletions(-)
+
+diff --git security/manager/ssl/nsNSSComponent.cpp security/manager/ssl/nsNSSComponent.cpp
+index 8c250e15eed1..a5749a0c69c5 100644
+--- security/manager/ssl/nsNSSComponent.cpp
++++ security/manager/ssl/nsNSSComponent.cpp
+@@ -13,7 +13,6 @@
+ #include "SharedSSLState.h"
+ #include "cert.h"
+ #include "certdb.h"
+-#include "mozStorageCID.h"
+ #include "mozilla/ArrayUtils.h"
+ #include "mozilla/Assertions.h"
+ #include "mozilla/Casting.h"
+@@ -2263,14 +2262,6 @@ nsNSSComponent::Init()
+ return NS_ERROR_NOT_AVAILABLE;
+ }
+
+- // To avoid a sqlite3_config race in NSS init, as a workaround for
+- // bug 730495, we require the storage service to get initialized first.
+- nsCOMPtr<nsISupports> storageService =
+- do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+- if (!storageService) {
+- return NS_ERROR_NOT_AVAILABLE;
+- }
+-
+ MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n"));
+
+ nsresult rv = InitializePIPNSSBundle();
+diff --git storage/TelemetryVFS.cpp storage/TelemetryVFS.cpp
+index 58b412c26dc8..9416772a78cf 100644
+--- storage/TelemetryVFS.cpp
++++ storage/TelemetryVFS.cpp
+@@ -834,6 +834,11 @@ xNextSystemCall(sqlite3_vfs *vfs, const char *zName)
+ namespace mozilla {
+ namespace storage {
+
++const char *GetVFSName()
++{
++ return "telemetry-vfs";
++}
++
+ sqlite3_vfs* ConstructTelemetryVFS()
+ {
+ #if defined(XP_WIN)
+@@ -867,7 +872,7 @@ sqlite3_vfs* ConstructTelemetryVFS()
+ MOZ_ASSERT(vfs->iVersion <= LAST_KNOWN_VFS_VERSION);
+ tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
+ tvfs->mxPathname = vfs->mxPathname;
+- tvfs->zName = "telemetry-vfs";
++ tvfs->zName = GetVFSName();
+ tvfs->pAppData = vfs;
+ tvfs->xOpen = xOpen;
+ tvfs->xDelete = xDelete;
+diff --git storage/mozStorageConnection.cpp storage/mozStorageConnection.cpp
+index aa49bbbaa90e..f3391776f574 100644
+--- storage/mozStorageConnection.cpp
++++ storage/mozStorageConnection.cpp
+@@ -73,6 +73,8 @@ namespace storage {
+
+ using mozilla::dom::quota::QuotaObject;
+
++const char *GetVFSName();
++
+ namespace {
+
+ int
+@@ -627,7 +629,7 @@ Connection::initialize()
+ AUTO_PROFILER_LABEL("Connection::initialize", STORAGE);
+
+ // in memory database requested, sqlite uses a magic file name
+- int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, nullptr);
++ int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, GetVFSName());
+ if (srv != SQLITE_OK) {
+ mDBConn = nullptr;
+ return convertResultCode(srv);
+@@ -660,7 +662,7 @@ Connection::initialize(nsIFile *aDatabaseFile)
+ #else
+ static const char* sIgnoreLockingVFS = "unix-none";
+ #endif
+- const char* vfs = mIgnoreLockingMode ? sIgnoreLockingVFS : nullptr;
++ const char* vfs = mIgnoreLockingMode ? sIgnoreLockingVFS : GetVFSName();
+
+ int srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
+ mFlags, vfs);
+@@ -694,7 +696,7 @@ Connection::initialize(nsIFileURL *aFileURL)
+ rv = aFileURL->GetSpec(spec);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, nullptr);
++ int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, GetVFSName());
+ if (srv != SQLITE_OK) {
+ mDBConn = nullptr;
+ return convertResultCode(srv);
+diff --git storage/mozStorageService.cpp storage/mozStorageService.cpp
+index 7c3cba8c1533..6439e60261cb 100644
+--- storage/mozStorageService.cpp
++++ storage/mozStorageService.cpp
+@@ -24,6 +24,7 @@
+ #include "mozIStoragePendingStatement.h"
+
+ #include "sqlite3.h"
++#include "mozilla/AutoSQLiteLifetime.h"
+
+ #ifdef SQLITE_OS_WIN
+ // "windows.h" was included and it can #define lots of things we care about...
+@@ -32,13 +33,6 @@
+
+ #include "nsIPromptService.h"
+
+-#ifdef MOZ_STORAGE_MEMORY
+-# include "mozmemory.h"
+-# ifdef MOZ_DMD
+-# include "DMD.h"
+-# endif
+-#endif
+-
+ ////////////////////////////////////////////////////////////////////////////////
+ //// Defines
+
+@@ -282,12 +276,6 @@ Service::~Service()
+ if (rc != SQLITE_OK)
+ NS_WARNING("Failed to unregister sqlite vfs wrapper.");
+
+- // Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
+- // there is nothing actionable we can do in that case.
+- rc = ::sqlite3_shutdown();
+- if (rc != SQLITE_OK)
+- NS_WARNING("sqlite3 did not shutdown cleanly.");
+-
+ shutdown(); // To release sXPConnect.
+
+ gService = nullptr;
+@@ -400,121 +388,7 @@ Service::shutdown()
+ }
+
+ sqlite3_vfs *ConstructTelemetryVFS();
+-
+-#ifdef MOZ_STORAGE_MEMORY
+-
+-namespace {
+-
+-// By default, SQLite tracks the size of all its heap blocks by adding an extra
+-// 8 bytes at the start of the block to hold the size. Unfortunately, this
+-// causes a lot of 2^N-sized allocations to be rounded up by jemalloc
+-// allocator, wasting memory. For example, a request for 1024 bytes has 8
+-// bytes added, becoming a request for 1032 bytes, and jemalloc rounds this up
+-// to 2048 bytes, wasting 1012 bytes. (See bug 676189 for more details.)
+-//
+-// So we register jemalloc as the malloc implementation, which avoids this
+-// 8-byte overhead, and thus a lot of waste. This requires us to provide a
+-// function, sqliteMemRoundup(), which computes the actual size that will be
+-// allocated for a given request. SQLite uses this function before all
+-// allocations, and may be able to use any excess bytes caused by the rounding.
+-//
+-// Note: the wrappers for malloc, realloc and moz_malloc_usable_size are
+-// necessary because the sqlite_mem_methods type signatures differ slightly
+-// from the standard ones -- they use int instead of size_t. But we don't need
+-// a wrapper for free.
+-
+-#ifdef MOZ_DMD
+-
+-// sqlite does its own memory accounting, and we use its numbers in our memory
+-// reporters. But we don't want sqlite's heap blocks to show up in DMD's
+-// output as unreported, so we mark them as reported when they're allocated and
+-// mark them as unreported when they are freed.
+-//
+-// In other words, we are marking all sqlite heap blocks as reported even
+-// though we're not reporting them ourselves. Instead we're trusting that
+-// sqlite is fully and correctly accounting for all of its heap blocks via its
+-// own memory accounting. Well, we don't have to trust it entirely, because
+-// it's easy to keep track (while doing this DMD-specific marking) of exactly
+-// how much memory SQLite is using. And we can compare that against what
+-// SQLite reports it is using.
+-
+-MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc)
+-MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree)
+-
+-#endif
+-
+-static void *sqliteMemMalloc(int n)
+-{
+- void* p = ::malloc(n);
+-#ifdef MOZ_DMD
+- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
+-#endif
+- return p;
+-}
+-
+-static void sqliteMemFree(void *p)
+-{
+-#ifdef MOZ_DMD
+- gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
+-#endif
+- ::free(p);
+-}
+-
+-static void *sqliteMemRealloc(void *p, int n)
+-{
+-#ifdef MOZ_DMD
+- gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
+- void *pnew = ::realloc(p, n);
+- if (pnew) {
+- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew);
+- } else {
+- // realloc failed; undo the SqliteMallocSizeOfOnFree from above
+- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
+- }
+- return pnew;
+-#else
+- return ::realloc(p, n);
+-#endif
+-}
+-
+-static int sqliteMemSize(void *p)
+-{
+- return ::moz_malloc_usable_size(p);
+-}
+-
+-static int sqliteMemRoundup(int n)
+-{
+- n = malloc_good_size(n);
+-
+- // jemalloc can return blocks of size 2 and 4, but SQLite requires that all
+- // allocations be 8-aligned. So we round up sub-8 requests to 8. This
+- // wastes a small amount of memory but is obviously safe.
+- return n <= 8 ? 8 : n;
+-}
+-
+-static int sqliteMemInit(void *p)
+-{
+- return 0;
+-}
+-
+-static void sqliteMemShutdown(void *p)
+-{
+-}
+-
+-const sqlite3_mem_methods memMethods = {
+- &sqliteMemMalloc,
+- &sqliteMemFree,
+- &sqliteMemRealloc,
+- &sqliteMemSize,
+- &sqliteMemRoundup,
+- &sqliteMemInit,
+- &sqliteMemShutdown,
+- nullptr
+-};
+-
+-} // namespace
+-
+-#endif // MOZ_STORAGE_MEMORY
++const char *GetVFSName();
+
+ static const char* sObserverTopics[] = {
+ "memory-pressure",
+@@ -527,28 +401,13 @@ Service::initialize()
+ {
+ MOZ_ASSERT(NS_IsMainThread(), "Must be initialized on the main thread");
+
+- int rc;
+-
+-#ifdef MOZ_STORAGE_MEMORY
+- rc = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
+- if (rc != SQLITE_OK)
+- return convertResultCode(rc);
+-#endif
+-
+- // TODO (bug 1191405): do not preallocate the connections caches until we
+- // have figured the impact on our consumers and memory.
+- sqlite3_config(SQLITE_CONFIG_PAGECACHE, NULL, 0, 0);
+-
+- // Explicitly initialize sqlite3. Although this is implicitly called by
+- // various sqlite3 functions (and the sqlite3_open calls in our case),
+- // the documentation suggests calling this directly. So we do.
+- rc = ::sqlite3_initialize();
++ int rc = AutoSQLiteLifetime::getInitResult();
+ if (rc != SQLITE_OK)
+ return convertResultCode(rc);
+
+ mSqliteVFS = ConstructTelemetryVFS();
+ if (mSqliteVFS) {
+- rc = sqlite3_vfs_register(mSqliteVFS, 1);
++ rc = sqlite3_vfs_register(mSqliteVFS, 0);
+ if (rc != SQLITE_OK)
+ return convertResultCode(rc);
+ } else {
+diff --git toolkit/xre/AutoSQLiteLifetime.cpp toolkit/xre/AutoSQLiteLifetime.cpp
+new file mode 100644
+index 000000000000..a122c4900530
+--- /dev/null
++++ toolkit/xre/AutoSQLiteLifetime.cpp
+@@ -0,0 +1,167 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "nsDebug.h"
++#include "AutoSQLiteLifetime.h"
++#include "sqlite3.h"
++
++#ifdef MOZ_STORAGE_MEMORY
++# include "mozmemory.h"
++# ifdef MOZ_DMD
++# include "DMD.h"
++# endif
++
++namespace {
++
++// By default, SQLite tracks the size of all its heap blocks by adding an extra
++// 8 bytes at the start of the block to hold the size. Unfortunately, this
++// causes a lot of 2^N-sized allocations to be rounded up by jemalloc
++// allocator, wasting memory. For example, a request for 1024 bytes has 8
++// bytes added, becoming a request for 1032 bytes, and jemalloc rounds this up
++// to 2048 bytes, wasting 1012 bytes. (See bug 676189 for more details.)
++//
++// So we register jemalloc as the malloc implementation, which avoids this
++// 8-byte overhead, and thus a lot of waste. This requires us to provide a
++// function, sqliteMemRoundup(), which computes the actual size that will be
++// allocated for a given request. SQLite uses this function before all
++// allocations, and may be able to use any excess bytes caused by the rounding.
++//
++// Note: the wrappers for malloc, realloc and moz_malloc_usable_size are
++// necessary because the sqlite_mem_methods type signatures differ slightly
++// from the standard ones -- they use int instead of size_t. But we don't need
++// a wrapper for free.
++
++#ifdef MOZ_DMD
++
++// sqlite does its own memory accounting, and we use its numbers in our memory
++// reporters. But we don't want sqlite's heap blocks to show up in DMD's
++// output as unreported, so we mark them as reported when they're allocated and
++// mark them as unreported when they are freed.
++//
++// In other words, we are marking all sqlite heap blocks as reported even
++// though we're not reporting them ourselves. Instead we're trusting that
++// sqlite is fully and correctly accounting for all of its heap blocks via its
++// own memory accounting. Well, we don't have to trust it entirely, because
++// it's easy to keep track (while doing this DMD-specific marking) of exactly
++// how much memory SQLite is using. And we can compare that against what
++// SQLite reports it is using.
++
++MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc)
++MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree)
++
++#endif
++
++static void *sqliteMemMalloc(int n)
++{
++ void* p = ::malloc(n);
++#ifdef MOZ_DMD
++ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
++#endif
++ return p;
++}
++
++static void sqliteMemFree(void *p)
++{
++#ifdef MOZ_DMD
++ gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
++#endif
++ ::free(p);
++}
++
++static void *sqliteMemRealloc(void *p, int n)
++{
++#ifdef MOZ_DMD
++ gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
++ void *pnew = ::realloc(p, n);
++ if (pnew) {
++ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew);
++ } else {
++ // realloc failed; undo the SqliteMallocSizeOfOnFree from above
++ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
++ }
++ return pnew;
++#else
++ return ::realloc(p, n);
++#endif
++}
++
++static int sqliteMemSize(void *p)
++{
++ return ::moz_malloc_usable_size(p);
++}
++
++static int sqliteMemRoundup(int n)
++{
++ n = malloc_good_size(n);
++
++ // jemalloc can return blocks of size 2 and 4, but SQLite requires that all
++ // allocations be 8-aligned. So we round up sub-8 requests to 8. This
++ // wastes a small amount of memory but is obviously safe.
++ return n <= 8 ? 8 : n;
++}
++
++static int sqliteMemInit(void *p)
++{
++ return 0;
++}
++
++static void sqliteMemShutdown(void *p)
++{
++}
++
++const sqlite3_mem_methods memMethods = {
++ &sqliteMemMalloc,
++ &sqliteMemFree,
++ &sqliteMemRealloc,
++ &sqliteMemSize,
++ &sqliteMemRoundup,
++ &sqliteMemInit,
++ &sqliteMemShutdown,
++ nullptr
++};
++
++} // namespace
++
++#endif // MOZ_STORAGE_MEMORY
++
++namespace mozilla {
++
++AutoSQLiteLifetime::AutoSQLiteLifetime()
++{
++ if (++AutoSQLiteLifetime::sSingletonEnforcer != 1) {
++ NS_RUNTIMEABORT("multiple instances of AutoSQLiteLifetime constructed!");
++ }
++
++#ifdef MOZ_STORAGE_MEMORY
++ sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
++#else
++ sResult = SQLITE_OK;
++#endif
++
++ if (sResult == SQLITE_OK) {
++ // TODO (bug 1191405): do not preallocate the connections caches until we
++ // have figured the impact on our consumers and memory.
++ sqlite3_config(SQLITE_CONFIG_PAGECACHE, NULL, 0, 0);
++
++ // Explicitly initialize sqlite3. Although this is implicitly called by
++ // various sqlite3 functions (and the sqlite3_open calls in our case),
++ // the documentation suggests calling this directly. So we do.
++ sResult = ::sqlite3_initialize();
++ }
++}
++
++AutoSQLiteLifetime::~AutoSQLiteLifetime()
++{
++ // Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
++ // there is nothing actionable we can do in that case.
++ sResult = ::sqlite3_shutdown();
++ NS_WARNING_ASSERTION(sResult == SQLITE_OK,
++ "sqlite3 did not shutdown cleanly.");
++}
++
++int AutoSQLiteLifetime::sSingletonEnforcer = 0;
++int AutoSQLiteLifetime::sResult = SQLITE_MISUSE;
++
++} // namespace mozilla
+diff --git toolkit/xre/AutoSQLiteLifetime.h toolkit/xre/AutoSQLiteLifetime.h
+new file mode 100644
+index 000000000000..b62963622ea1
+--- /dev/null
++++ toolkit/xre/AutoSQLiteLifetime.h
+@@ -0,0 +1,24 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_AutoSQLiteLifetime_h
++#define mozilla_AutoSQLiteLifetime_h
++
++namespace mozilla {
++
++class AutoSQLiteLifetime final
++{
++private:
++ static int sSingletonEnforcer;
++ static int sResult;
++public:
++ AutoSQLiteLifetime();
++ ~AutoSQLiteLifetime();
++ static int getInitResult() { return AutoSQLiteLifetime::sResult; }
++};
++
++} // namespace mozilla
++
++#endif
+diff --git toolkit/xre/Bootstrap.cpp toolkit/xre/Bootstrap.cpp
+index bd80732fdf51..c19f0498d08f 100644
+--- toolkit/xre/Bootstrap.cpp
++++ toolkit/xre/Bootstrap.cpp
+@@ -6,11 +6,15 @@
+ #include "mozilla/Bootstrap.h"
+ #include "nsXPCOM.h"
+
++#include "AutoSQLiteLifetime.h"
++
+ namespace mozilla {
+
+ class BootstrapImpl final : public Bootstrap
+ {
+ protected:
++ AutoSQLiteLifetime mSQLLT;
++
+ virtual void Dispose() override
+ {
+ delete this;
+diff --git toolkit/xre/moz.build toolkit/xre/moz.build
+index 7a65cd5d296b..08bf452980b5 100644
+--- toolkit/xre/moz.build
++++ toolkit/xre/moz.build
+@@ -30,7 +30,7 @@ EXPORTS += [
+ 'nsIAppStartupNotifier.h',
+ ]
+
+-EXPORTS.mozilla += ['Bootstrap.h']
++EXPORTS.mozilla += ['AutoSQLiteLifetime.h', 'Bootstrap.h']
+
+ if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
+ EXPORTS += ['EventTracer.h']
+@@ -91,6 +91,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
+ ]
+
+ UNIFIED_SOURCES += [
++ 'AutoSQLiteLifetime.cpp',
+ 'Bootstrap.cpp',
+ 'CreateAppData.cpp',
+ 'nsAppStartupNotifier.cpp',