Title: [161925] trunk/Source/WebCore
Revision
161925
Author
mmaxfi...@apple.com
Date
2014-01-13 17:02:15 -0800 (Mon, 13 Jan 2014)

Log Message

Highlighting password field then making a Sticky Note via Safari Services exposes password
https://bugs.webkit.org/show_bug.cgi?id=126946

Reviewed by Enrica Casucci.

Using the Services menu has a slightly different codepath than Editor::copy() does. This
patch duplicates the canCopy() check that Editor::copy() does.

Testing is not possible because the Services menu is not accessible to our tests.

* editing/mac/EditorMac.mm:
(WebCore::Editor::stringSelectionForPasteboard):
(WebCore::Editor::stringSelectionForPasteboardWithImageAltText):
(WebCore::Editor::dataSelectionForPasteboard):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161924 => 161925)


--- trunk/Source/WebCore/ChangeLog	2014-01-14 01:00:54 UTC (rev 161924)
+++ trunk/Source/WebCore/ChangeLog	2014-01-14 01:02:15 UTC (rev 161925)
@@ -1,3 +1,20 @@
+2014-01-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Highlighting password field then making a Sticky Note via Safari Services exposes password
+        https://bugs.webkit.org/show_bug.cgi?id=126946
+
+        Reviewed by Enrica Casucci.
+
+        Using the Services menu has a slightly different codepath than Editor::copy() does. This
+        patch duplicates the canCopy() check that Editor::copy() does.
+
+        Testing is not possible because the Services menu is not accessible to our tests.
+
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::stringSelectionForPasteboard):
+        (WebCore::Editor::stringSelectionForPasteboardWithImageAltText):
+        (WebCore::Editor::dataSelectionForPasteboard):
+
 2014-01-13  Brent Fulgham  <bfulg...@apple.com>
 
         [WebGL] Crash due to forceLostContext

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (161924 => 161925)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2014-01-14 01:00:54 UTC (rev 161924)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2014-01-14 01:02:15 UTC (rev 161925)
@@ -269,6 +269,8 @@
 // This was left in a bad state when selectedTextForClipboard was added. Need to look over clients and fix this.
 String Editor::stringSelectionForPasteboard()
 {
+    if (!canCopy())
+        return "";
     String text = selectedText();
     text.replace(noBreakSpace, ' ');
     return text;
@@ -276,6 +278,8 @@
 
 String Editor::stringSelectionForPasteboardWithImageAltText()
 {
+    if (!canCopy())
+        return "";
     String text = selectedTextForClipboard();
     text.replace(noBreakSpace, ' ');
     return text;
@@ -324,6 +328,8 @@
     // which is only used to support OS X services.
 
     // FIXME: Does this function really need to use adjustedSelectionRange()? Because writeSelectionToPasteboard() just uses selectedRange().
+    if (!canCopy())
+        return nullptr;
 
     if (pasteboardType == WebArchivePboardType)
         return selectionInWebArchiveFormat();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to