svn commit: r458874 - in branches/2018Q1/www/waterfox: . files

Jan Beich jbeich at FreeBSD.org
Fri Jan 12 21:37:17 UTC 2018


Author: jbeich
Date: Fri Jan 12 21:37:15 2018
New Revision: 458874
URL: https://svnweb.freebsd.org/changeset/ports/458874

Log:
  MFH: r458873
  
  www/waterfox: update to 56.0.3
  
  - Apply more FF58 fixes [1]
  
  Changes:	https://github.com/MrAlex94/Waterfox/compare/56.0.2...56.0.3
  Security:	a891c5b4-3d7a-4de9-9c71-eef3fd698c77 [1]
  Approved by:	ports-secteam blanket

Added:
  branches/2018Q1/www/waterfox/files/patch-bug1246883
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1246883
  branches/2018Q1/www/waterfox/files/patch-bug1387427
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1387427
  branches/2018Q1/www/waterfox/files/patch-bug1395508
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1395508
  branches/2018Q1/www/waterfox/files/patch-bug1402715
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1402715
  branches/2018Q1/www/waterfox/files/patch-bug1408017
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1408017
  branches/2018Q1/www/waterfox/files/patch-bug1408631
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1408631
  branches/2018Q1/www/waterfox/files/patch-bug1409449
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1409449
  branches/2018Q1/www/waterfox/files/patch-bug1411745
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1411745
  branches/2018Q1/www/waterfox/files/patch-bug1412646
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1412646
  branches/2018Q1/www/waterfox/files/patch-bug1418966
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1418966
  branches/2018Q1/www/waterfox/files/patch-bug1419762
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1419762
  branches/2018Q1/www/waterfox/files/patch-bug1420507
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1420507
  branches/2018Q1/www/waterfox/files/patch-bug1421009
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1421009
  branches/2018Q1/www/waterfox/files/patch-bug1422518
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1422518
  branches/2018Q1/www/waterfox/files/patch-bug1422545
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1422545
  branches/2018Q1/www/waterfox/files/patch-bug1423647
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1423647
  branches/2018Q1/www/waterfox/files/patch-bug1425000
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1425000
  branches/2018Q1/www/waterfox/files/patch-bug1425107
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1425107
  branches/2018Q1/www/waterfox/files/patch-bug1425780
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1425780
  branches/2018Q1/www/waterfox/files/patch-bug1426042
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1426042
  branches/2018Q1/www/waterfox/files/patch-bug1426801
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1426801
  branches/2018Q1/www/waterfox/files/patch-bug1426996
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1426996
  branches/2018Q1/www/waterfox/files/patch-bug1427126
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1427126
  branches/2018Q1/www/waterfox/files/patch-bug1428589
     - copied unchanged from r458873, head/www/waterfox/files/patch-bug1428589
Modified:
  branches/2018Q1/www/waterfox/Makefile
  branches/2018Q1/www/waterfox/distinfo
Directory Properties:
  branches/2018Q1/   (props changed)

Modified: branches/2018Q1/www/waterfox/Makefile
==============================================================================
--- branches/2018Q1/www/waterfox/Makefile	Fri Jan 12 21:36:02 2018	(r458873)
+++ branches/2018Q1/www/waterfox/Makefile	Fri Jan 12 21:37:15 2018	(r458874)
@@ -1,8 +1,7 @@
 # $FreeBSD$
 
 PORTNAME=	waterfox
-DISTVERSION=	56.0.2
-PORTREVISION=	1
+DISTVERSION=	56.0.3
 CATEGORIES=	www ipv6
 
 MAINTAINER=	jbeich at FreeBSD.org

Modified: branches/2018Q1/www/waterfox/distinfo
==============================================================================
--- branches/2018Q1/www/waterfox/distinfo	Fri Jan 12 21:36:02 2018	(r458873)
+++ branches/2018Q1/www/waterfox/distinfo	Fri Jan 12 21:37:15 2018	(r458874)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1515201685
-SHA256 (MrAlex94-Waterfox-56.0.2_GH0.tar.gz) = baf0717ed49005535cce646976c4d088a25033bd83960381388e7b2ba23389c9
-SIZE (MrAlex94-Waterfox-56.0.2_GH0.tar.gz) = 394203428
+TIMESTAMP = 1515710085
+SHA256 (MrAlex94-Waterfox-56.0.3_GH0.tar.gz) = 80d4bba90b2d8aac7223aa81302ea56e0dc226e29d01c206e2cbf375d471a9fa
+SIZE (MrAlex94-Waterfox-56.0.3_GH0.tar.gz) = 394227402

Copied: branches/2018Q1/www/waterfox/files/patch-bug1246883 (from r458873, head/www/waterfox/files/patch-bug1246883)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1246883	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1246883)
@@ -0,0 +1,56 @@
+commit b175b27efefd
+Author: Mantaroh Yoshinaga <mantaroh at gmail.com>
+Date:   Wed Dec 13 08:58:05 2017 +0900
+
+    Bug 1246883 - Load UA Stylesheet when printing the SVG document. r=jwatt, a=gchang
+    
+    Currently, Gecko load only minimal-xul.css if the document is the SVG[1].
+    In the case of printing SVG document, gecko should load ua.css for using style
+    which related to print.
+    
+    This patch will load ua.css when printing the SVG document.
+    
+    [1] http://searchfox.org/mozilla-central/rev/67f38de2443e6b613d874fcf4d2cd1f2fc3d5e97/layout/base/nsDocumentViewer.cpp#2472
+    
+    MozReview-Commit-ID: JtdaEvX8QTw
+    
+    --HG--
+    extra : source : 727a90ad06e715b3a4457b2532e922d22a2469a2
+---
+ layout/printing/nsPrintEngine.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git layout/printing/nsPrintEngine.cpp layout/printing/nsPrintEngine.cpp
+index f8d8f1077ba5..3ac2211d159d 100644
+--- layout/printing/nsPrintEngine.cpp
++++ layout/printing/nsPrintEngine.cpp
+@@ -75,6 +75,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
+ #include "nsISupportsUtils.h"
+ #include "nsIScriptContext.h"
+ #include "nsIDOMDocument.h"
++#include "nsIDocumentObserver.h"
+ #include "nsISelectionListener.h"
+ #include "nsISelectionPrivate.h"
+ #include "nsIDOMRange.h"
+@@ -82,6 +83,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
+ #include "nsLayoutCID.h"
+ #include "nsContentUtils.h"
+ #include "nsIPresShell.h"
++#include "nsLayoutStylesheetCache.h"
+ #include "nsLayoutUtils.h"
+ #include "mozilla/Preferences.h"
+ 
+@@ -2267,6 +2269,13 @@ nsPrintEngine::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO)
+ 
+   StyleSetHandle styleSet = mDocViewerPrint->CreateStyleSet(aPO->mDocument);
+ 
++  if (aPO->mDocument->IsSVGDocument()) {
++    // The SVG document only loads minimal-xul.css, so it doesn't apply other
++    // styles. We should add ua.css for applying style which related to print.
++    auto cache = nsLayoutStylesheetCache::For(aPO->mDocument->GetStyleBackendType());
++    styleSet->PrependStyleSheet(SheetType::Agent, cache->UASheet());
++  }
++
+   aPO->mPresShell = aPO->mDocument->CreateShell(aPO->mPresContext,
+                                                 aPO->mViewManager, styleSet);
+   if (!aPO->mPresShell) {

Copied: branches/2018Q1/www/waterfox/files/patch-bug1387427 (from r458873, head/www/waterfox/files/patch-bug1387427)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1387427	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1387427)
@@ -0,0 +1,499 @@
+commit ecb753bbae79
+Author: Peter Van der Beken <peterv at 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;

Copied: branches/2018Q1/www/waterfox/files/patch-bug1395508 (from r458873, head/www/waterfox/files/patch-bug1395508)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1395508	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1395508)
@@ -0,0 +1,35 @@
+commit e6d14191c530
+Author: Marco Bonardo <mbonardo at 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) {}
+     }

Copied: branches/2018Q1/www/waterfox/files/patch-bug1402715 (from r458873, head/www/waterfox/files/patch-bug1402715)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1402715	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1402715)
@@ -0,0 +1,44 @@
+commit 6c7fb56e58c5
+Author: Mats Palmgren <mats at mozilla.com>
+Date:   Wed Sep 27 14:12:01 2017 +0200
+
+    Bug 1402715 - Treat URL bar contents as raw text when copying.  r=mak
+    
+    MozReview-Commit-ID: LuSvwRUVwAq
+---
+ browser/base/content/test/urlbar/browser_urlbarCopying.js | 5 +++++
+ browser/base/content/urlbarBindings.xml                   | 5 ++++-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git browser/base/content/test/urlbar/browser_urlbarCopying.js browser/base/content/test/urlbar/browser_urlbarCopying.js
+index 521dace780f2..9559b06b2ec6 100644
+--- browser/base/content/test/urlbar/browser_urlbarCopying.js
++++ browser/base/content/test/urlbar/browser_urlbarCopying.js
+@@ -164,6 +164,11 @@ var tests = [
+     copyVal: "<example.com/?\xf7>\xf7",
+     copyExpected: "http://example.com/?\xf7"
+   },
++  {
++    loadURL: "http://example.com/%20%20%20",
++    expectedURL: "example.com/   ",
++    copyExpected: "http://example.com/%20%20%20"
++  },
+ 
+   // data: and javsacript: URIs shouldn't be encoded
+   {
+diff --git browser/base/content/urlbarBindings.xml browser/base/content/urlbarBindings.xml
+index 8999ab379cb2..4a86ce38e893 100644
+--- browser/base/content/urlbarBindings.xml
++++ browser/base/content/urlbarBindings.xml
+@@ -972,7 +972,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+           // Grab the actual input field's value, not our value, which could include moz-action:
+           var inputVal = this.inputField.value;
+           let selection = this.editor.selection;
+-          var selectedVal = selection.toString();
++          const flags = Ci.nsIDocumentEncoder.OutputPreformatted |
++                        Ci.nsIDocumentEncoder.OutputRaw;
++          let selectedVal = selection.QueryInterface(Ci.nsISelectionPrivate)
++                                     .toStringWithFormat("text/plain", flags, 0);
+ 
+           // Handle multiple-range selection as a string for simplicity.
+           if (selection.rangeCount > 1) {

Copied: branches/2018Q1/www/waterfox/files/patch-bug1408017 (from r458873, head/www/waterfox/files/patch-bug1408017)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1408017	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1408017)
@@ -0,0 +1,40 @@
+commit 5738242a26f0
+Author: Andrew McCreight <continuation at gmail.com>
+Date:   Thu Oct 26 16:47:27 2017 -0400
+
+    Bug 1408017 - Clear gStartupCacheWrapper in the dtor. r=froydnj
+---
+ startupcache/StartupCache.cpp | 6 ++++++
+ startupcache/StartupCache.h   | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git startupcache/StartupCache.cpp startupcache/StartupCache.cpp
+index 895696d854eb..c84da5c16d41 100644
+--- startupcache/StartupCache.cpp
++++ startupcache/StartupCache.cpp
+@@ -700,6 +700,12 @@ StartupCacheWrapper* StartupCacheWrapper::gStartupCach
+ 
+ NS_IMPL_ISUPPORTS(StartupCacheWrapper, nsIStartupCache)
+ 
++StartupCacheWrapper::~StartupCacheWrapper()
++{
++  MOZ_ASSERT(gStartupCacheWrapper == this);
++  gStartupCacheWrapper = nullptr;
++}
++
+ StartupCacheWrapper* StartupCacheWrapper::GetSingleton()
+ {
+   if (!gStartupCacheWrapper)
+diff --git startupcache/StartupCache.h startupcache/StartupCache.h
+index a7618415dd1f..f8994749aa5c 100644
+--- startupcache/StartupCache.h
++++ startupcache/StartupCache.h
+@@ -209,7 +209,7 @@ class StartupCacheDebugOutputStream final
+ class StartupCacheWrapper final
+   : public nsIStartupCache
+ {
+-  ~StartupCacheWrapper() {}
++  ~StartupCacheWrapper();
+ 
+   NS_DECL_THREADSAFE_ISUPPORTS
+   NS_DECL_NSISTARTUPCACHE

Copied: branches/2018Q1/www/waterfox/files/patch-bug1408631 (from r458873, head/www/waterfox/files/patch-bug1408631)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1408631	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1408631)
@@ -0,0 +1,174 @@
+commit 48a63f5601f6
+Author: dimi <dlee at mozilla.com>
+Date:   Fri Oct 20 10:18:59 2017 +0800
+
+    Bug 1408631 - Release SafeBrowsing lookupcache in worker thread while shutdown. r=francois
+    
+    MozReview-Commit-ID: HuPUyIDFLPX
+    
+    --HG--
+    extra : rebase_source : d6e4f5bbcf96c97541792e23447f0810150c5ac9
+---
+ toolkit/components/url-classifier/Classifier.cpp   | 13 +++++---
+ .../url-classifier/nsUrlClassifierDBService.cpp    | 37 ++++++++++++++++++++++
+ .../url-classifier/nsUrlClassifierDBService.h      |  5 +++
+ .../url-classifier/nsUrlClassifierProxies.cpp      | 10 ++++++
+ .../url-classifier/nsUrlClassifierProxies.h        |  1 +
+ 5 files changed, 62 insertions(+), 4 deletions(-)
+
+diff --git toolkit/components/url-classifier/Classifier.cpp toolkit/components/url-classifier/Classifier.cpp
+index 404e31e2421e..9946469268fa 100644
+--- toolkit/components/url-classifier/Classifier.cpp
++++ toolkit/components/url-classifier/Classifier.cpp
+@@ -267,6 +267,8 @@ Classifier::Open(nsIFile& aCacheDirectory)
+ void
+ Classifier::Close()
+ {
++  // Close will be called by PreShutdown, so it is important to note that
++  // things put here should not affect an ongoing update thread.
+   DropStores();
+ }
+ 
+@@ -1428,10 +1430,8 @@ Classifier::UpdateCache(TableUpdate* aUpdate)
+ LookupCache *
+ Classifier::GetLookupCache(const nsACString& aTable, bool aForUpdate)
+ {
+-  if (aForUpdate) {
+-    MOZ_ASSERT(NS_GetCurrentThread() == mUpdateThread,
+-               "GetLookupCache(aForUpdate==true) can only be called on update thread.");
+-  }
++  // GetLookupCache(aForUpdate==true) can only be called on update thread.
++  MOZ_ASSERT_IF(aForUpdate, NS_GetCurrentThread() == mUpdateThread);
+ 
+   nsTArray<LookupCache*>& lookupCaches = aForUpdate ? mNewLookupCaches
+                                                     : mLookupCaches;
+@@ -1444,6 +1444,11 @@ Classifier::GetLookupCache(const nsACString& aTable, bool aForUpdate)
+     }
+   }
+ 
++  // We don't want to create lookupcache when shutdown is already happening.
++  if (nsUrlClassifierDBService::ShutdownHasStarted()) {
++    return nullptr;
++  }
++
+   // TODO : Bug 1302600, It would be better if we have a more general non-main
+   //        thread method to convert table name to protocol version. Currently
+   //        we can only know this by checking if the table name ends with '-proto'.
+diff --git toolkit/components/url-classifier/nsUrlClassifierDBService.cpp toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+index 78dbfaeaf046..e1a1be065aaf 100644
+--- toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
++++ toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+@@ -817,6 +817,20 @@ nsUrlClassifierDBServiceWorker::CloseDb()
+   return NS_OK;
+ }
+ 
++nsresult
++nsUrlClassifierDBServiceWorker::PreShutdown()
++{
++  if (mClassifier) {
++    // Classifier close will release all lookup caches which may be a time-consuming job.
++    // See Bug 1408631.
++    mClassifier->Close();
++  }
++
++  // WARNING: nothing we put here should affect an ongoing update thread. When in doubt,
++  // put things in Shutdown() instead.
++  return NS_OK;
++}
++
+ nsresult
+ nsUrlClassifierDBServiceWorker::CacheCompletions(CacheResultArray *results)
+ {
+@@ -2427,6 +2441,13 @@ nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic,
+   } else if (!strcmp(aTopic, "quit-application")) {
+     // Tell the update thread to finish as soon as possible.
+     gShuttingDownThread = true;
++
++    // The code in ::Shutdown() is run on a 'profile-before-change' event and
++    // ensures that objects are freed by blocking on this freeing.
++    // We can however speed up the shutdown time by using the worker thread to
++    // release, in an earlier event, any objects that cannot affect an ongoing
++    // update on the update thread.
++    PreShutdown();
+   } else if (!strcmp(aTopic, "profile-before-change")) {
+     gShuttingDownThread = true;
+     Shutdown();
+@@ -2437,6 +2458,22 @@ nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic,
+   return NS_OK;
+ }
+ 
++// Post a PreShutdown task to worker thread to release objects without blocking
++// main-thread. Notice that shutdown process may still be blocked by PreShutdown task
++// when ::Shutdown() is executed and synchronously waits for worker thread to finish
++// PreShutdown event.
++nsresult
++nsUrlClassifierDBService::PreShutdown()
++{
++  MOZ_ASSERT(XRE_IsParentProcess());
++
++  if (mWorkerProxy) {
++    mWorkerProxy->PreShutdown();
++  }
++
++  return NS_OK;
++}
++
+ // Join the background thread if it exists.
+ nsresult
+ nsUrlClassifierDBService::Shutdown()
+diff --git toolkit/components/url-classifier/nsUrlClassifierDBService.h toolkit/components/url-classifier/nsUrlClassifierDBService.h
+index a4c5952e91bb..9d9671d9d8fa 100644
+--- toolkit/components/url-classifier/nsUrlClassifierDBService.h
++++ toolkit/components/url-classifier/nsUrlClassifierDBService.h
+@@ -140,6 +140,9 @@ private:
+                      nsIUrlClassifierCallback* c,
+                      bool forceCheck, bool *didCheck);
+ 
++  // Post an event to worker thread to release objects when receive 'quit-application'
++  nsresult PreShutdown();
++
+   // Close db connection and join the background thread if it exists.
+   nsresult Shutdown();
+ 
+@@ -220,6 +223,8 @@ public:
+   // Provide a way to forcibly close the db connection.
+   nsresult GCC_MANGLING_WORKAROUND CloseDb();
+ 
++  nsresult GCC_MANGLING_WORKAROUND PreShutdown();
++
+   nsresult CacheCompletions(CacheResultArray * aEntries);
+ 
+   // Used to probe the state of the worker thread. When the update begins,
+diff --git toolkit/components/url-classifier/nsUrlClassifierProxies.cpp toolkit/components/url-classifier/nsUrlClassifierProxies.cpp
+index 1af4f9266aeb..38e294df7320 100644
+--- toolkit/components/url-classifier/nsUrlClassifierProxies.cpp
++++ toolkit/components/url-classifier/nsUrlClassifierProxies.cpp
+@@ -214,6 +214,16 @@ UrlClassifierDBServiceWorkerProxy::CloseDb()
+   return DispatchToWorkerThread(r);
+ }
+ 
++nsresult
++UrlClassifierDBServiceWorkerProxy::PreShutdown()
++{
++  nsCOMPtr<nsIRunnable> r =
++    NewRunnableMethod("nsUrlClassifierDBServiceWorker::PreShutdown",
++                      mTarget,
++                      &nsUrlClassifierDBServiceWorker::PreShutdown);
++  return DispatchToWorkerThread(r);
++}
++
+ nsresult
+ UrlClassifierDBServiceWorkerProxy::CacheCompletions(CacheResultArray * aEntries)
+ {
+diff --git toolkit/components/url-classifier/nsUrlClassifierProxies.h toolkit/components/url-classifier/nsUrlClassifierProxies.h
+index f8cf5229e1ca..39cf47f837a2 100644
+--- toolkit/components/url-classifier/nsUrlClassifierProxies.h
++++ toolkit/components/url-classifier/nsUrlClassifierProxies.h
+@@ -229,6 +229,7 @@ public:
+ 
+   nsresult OpenDb();
+   nsresult CloseDb();
++  nsresult PreShutdown();
+ 
+   nsresult CacheCompletions(mozilla::safebrowsing::CacheResultArray * aEntries);
+ 

Copied: branches/2018Q1/www/waterfox/files/patch-bug1409449 (from r458873, head/www/waterfox/files/patch-bug1409449)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/www/waterfox/files/patch-bug1409449	Fri Jan 12 21:37:15 2018	(r458874, copy of r458873, head/www/waterfox/files/patch-bug1409449)
@@ -0,0 +1,161 @@
+commit 0f648a99db03
+Author: Dragana Damjanovic <dd.mozilla at 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,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-branches mailing list