[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

apavlov at chromium.org apavlov at chromium.org
Sun Feb 20 23:26:29 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit d41cebd083f01f136d2740ecdb8a7d36ff479288
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 15:46:28 2011 +0000

    2011-01-20  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Crash when adding a rule for an ImageDocument
            https://bugs.webkit.org/show_bug.cgi?id=52811
    
            * inspector/InspectorCSSAgent.cpp:
            (WebCore::InspectorCSSAgent::addRule2):
            (WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index d7ef62c..9e3eca0 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-20  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Crash when adding a rule for an ImageDocument
+        https://bugs.webkit.org/show_bug.cgi?id=52811
+
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::addRule2):
+        (WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
+
 2011-01-20  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index 725a26d..bacf741 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -349,6 +349,8 @@ void InspectorCSSAgent::addRule2(const long contextNodeId, const String& selecto
         return;
 
     InspectorStyleSheet* inspectorStyleSheet = viaInspectorStyleSheet(node->document(), true);
+    if (!inspectorStyleSheet)
+        return;
     CSSStyleRule* newRule = inspectorStyleSheet->addRule(selector);
     if (!newRule)
         return;
@@ -447,8 +449,17 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen
     RefPtr<Element> styleElement = document->createElement("style", ec);
     if (!ec)
         styleElement->setAttribute("type", "text/css", ec);
-    if (!ec)
-        document->head()->appendChild(styleElement, ec);
+    if (!ec) {
+        ContainerNode* targetNode;
+        // HEAD is absent in ImageDocuments, for example.
+        if (document->head())
+            targetNode = document->head();
+        else if (document->body())
+            targetNode = document->body();
+        else
+            return 0;
+        targetNode->appendChild(styleElement, ec);
+    }
     if (ec)
         return 0;
     StyleSheetList* styleSheets = document->styleSheets();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list