[tbb-commits] [tor-browser/tor-browser-31.6.0esr-4.5-1] fixup! Bug 12827: Create preference to disable SVG.

mikeperry at torproject.org mikeperry at torproject.org
Fri Apr 24 19:46:53 UTC 2015


commit 3006aa548cefa2f9d0968c978786dcefa9309119
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Fri Apr 24 10:40:44 2015 -0400

    fixup! Bug 12827: Create preference to disable SVG.
    
    During parsing, avoid dereferencing null pointers when script and
    style elements are created as generic elements (i.e., when
    svg.in-content.enabled=false). Fixes ticket #15794.
---
 parser/html/nsHtml5TreeOperation.cpp |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp
index 7ad65247..b9f1768 100644
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -607,8 +607,8 @@ void
 nsHtml5TreeOperation::PreventScriptExecution(nsIContent* aNode)
 {
   nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aNode);
-  MOZ_ASSERT(sele);
-  sele->PreventExecution();
+  if (sele)
+    sele->PreventExecution();
 }
 
 void
@@ -827,14 +827,18 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
     case eTreeOpSetStyleLineNumber: {
       nsIContent* node = *(mOne.node);
       nsCOMPtr<nsIStyleSheetLinkingElement> ssle = do_QueryInterface(node);
-      NS_ASSERTION(ssle, "Node didn't QI to style.");
+      if (!ssle)
+        return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
+
       ssle->SetLineNumber(mFour.integer);
       return NS_OK;
     }
     case eTreeOpSetScriptLineNumberAndFreeze: {
       nsIContent* node = *(mOne.node);
       nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node);
-      NS_ASSERTION(sele, "Node didn't QI to script.");
+      if (!sele)
+        return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
+
       sele->SetScriptLineNumber(mFour.integer);
       sele->FreezeUriAsyncDefer();
       return NS_OK;



More information about the tbb-commits mailing list