[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

ap at apple.com ap at apple.com
Thu Oct 29 20:43:58 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 136840d5e0024c06bbbfeb35f033207b3e7226f1
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 13 22:02:38 2009 +0000

            Reviewed by Dan Bernstein.
    
            https://bugs.webkit.org/show_bug.cgi?id=30150
            <rdar://problem/7283540> REGRESSION: Crash when accessing clipboardData.types
    
            Test: editing/pasteboard/crash-accessing-clipboardData-types.html
    
            * platform/mac/ClipboardMac.mm: (WebCore::addHTMLClipboardTypesForCocoaType): The String
            class doesn't have operator bool, it's operator NSString* that is invoked instead, and it
            converts null strings to non-null @"".
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a54ab57..7cb8d70 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-13  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30150
+        <rdar://problem/7283540> REGRESSION: Crash when accessing clipboardData.types
+
+        * editing/pasteboard/crash-accessing-clipboardData-types-expected.txt: Added.
+        * editing/pasteboard/crash-accessing-clipboardData-types.html: Added.
+
 2009-10-13  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types-expected.txt b/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types-expected.txt
new file mode 100644
index 0000000..c88fc16
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types-expected.txt
@@ -0,0 +1,5 @@
+Test for bug 30150 Crash when accessing clipboardData.types
+
+PASS if didn't crash.
+
+Test
diff --git a/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types.html b/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types.html
new file mode 100644
index 0000000..9110ddc
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/crash-accessing-clipboardData-types.html
@@ -0,0 +1,19 @@
+<body>
+
+<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=30150">bug 30150</a> Crash when accessing clipboardData.types</p>
+<p>PASS if didn't crash.</p>
+
+<div contenteditable id=d>Test</div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+document.body.addEventListener("paste", function(e){ e.clipboardData.types }, true);
+
+document.getElementById("d").focus();
+document.execCommand("Cut");
+document.execCommand("Paste");
+
+</script>
+</body>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ea57e11..ad80f87 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-10-13  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30150
+        <rdar://problem/7283540> REGRESSION: Crash when accessing clipboardData.types
+
+        Test: editing/pasteboard/crash-accessing-clipboardData-types.html
+
+        * platform/mac/ClipboardMac.mm: (WebCore::addHTMLClipboardTypesForCocoaType): The String
+        class doesn't have operator bool, it's operator NSString* that is invoked instead, and it
+        converts null strings to non-null @"".
+
 2009-10-13  Drew Wilson  <atwilson at atwilson-macpro.local>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/platform/mac/ClipboardMac.mm b/WebCore/platform/mac/ClipboardMac.mm
index 78fb659..f4321ad 100644
--- a/WebCore/platform/mac/ClipboardMac.mm
+++ b/WebCore/platform/mac/ClipboardMac.mm
@@ -107,11 +107,15 @@ static String utiTypeFromCocoaType(NSString *type)
 static void addHTMLClipboardTypesForCocoaType(HashSet<String>& resultTypes, NSString *cocoaType, NSPasteboard *pasteboard)
 {
     // UTI may not do these right, so make sure we get the right, predictable result
-    if ([cocoaType isEqualToString:NSStringPboardType])
+    if ([cocoaType isEqualToString:NSStringPboardType]) {
         resultTypes.add("text/plain");
-    else if ([cocoaType isEqualToString:NSURLPboardType])
+        return;
+    }
+    if ([cocoaType isEqualToString:NSURLPboardType]) {
         resultTypes.add("text/uri-list");
-    else if ([cocoaType isEqualToString:NSFilenamesPboardType]) {
+        return;
+    }
+    if ([cocoaType isEqualToString:NSFilenamesPboardType]) {
         // If file list is empty, add nothing.
         // Note that there is a chance that the file list count could have changed since we grabbed the types array.
         // However, this is not really an issue for us doing a sanity check here.
@@ -122,12 +126,15 @@ static void addHTMLClipboardTypesForCocoaType(HashSet<String>& resultTypes, NSSt
             resultTypes.add("text/uri-list");
             resultTypes.add("Files");
         }
-    } else if (String utiType = utiTypeFromCocoaType(cocoaType))
+        return;
+    }
+    String utiType = utiTypeFromCocoaType(cocoaType);
+    if (!utiType.isEmpty()) {
         resultTypes.add(utiType);
-    else {
-        // No mapping, just pass the whole string though
-        resultTypes.add(cocoaType);
+        return;
     }
+    // No mapping, just pass the whole string though
+    resultTypes.add(cocoaType);
 }
 
 void ClipboardMac::clearData(const String& type)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list