[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.2.2-27-g91dab87

Gustavo Noronha Silva gns at gnome.org
Thu Jul 15 21:13:21 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 65e8dc5cbd4b140ea5e9bba7f170c6253154593a
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon May 3 21:50:27 2010 +0000

    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Tests that javascript cannot access clipboard.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * editing/execCommand/clipboard-access-expected.txt: Added.
            * editing/execCommand/clipboard-access.html: Added.
            * editing/execCommand/script-tests/clipboard-access.js: Added.
            (enabled):
            (whenEnabled):
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            Test: editing/execCommand/clipboard-access.html
    
            * WebCore.base.exp:
            * editing/EditorCommand.cpp:
            (WebCore::supportedCopyCut):
            (WebCore::supportedPaste):
            (WebCore::createCommandMap):
            * page/Settings.cpp:
            (WebCore::Settings::Settings):
            (WebCore::Settings::setJavaScriptCanAccessClipboard):
            * page/Settings.h:
            (WebCore::Settings::javaScriptCanAccessClipboard):
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * public/WebSettings.h:
            * src/WebSettingsImpl.cpp:
            (WebKit::WebSettingsImpl::setJavaScriptCanAccessClipboard):
            * src/WebSettingsImpl.h:
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * webkit/webkitwebsettings.cpp:
            (webkit_web_settings_class_init):
            (webkit_web_settings_set_property):
            (webkit_web_settings_get_property):
            (webkit_web_settings_copy):
            * webkit/webkitwebview.cpp:
            (webkit_web_view_update_settings):
            (webkit_web_view_settings_notify):
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * WebView/WebPreferenceKeysPrivate.h:
            * WebView/WebPreferences.mm:
            (+[WebPreferences initialize]):
            (-[WebPreferences javaScriptCanAccessClipboard]):
            (-[WebPreferences setJavaScriptCanAccessClipboard:]):
            * WebView/WebPreferencesPrivate.h:
            * WebView/WebView.mm:
            (-[WebView _preferencesChangedNotification:]):
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * Api/qwebsettings.cpp:
            (QWebSettingsPrivate::apply):
            * Api/qwebsettings.h:
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is disabled by default.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * Interfaces/IWebPreferencesPrivate.idl:
            * WebPreferenceKeysPrivate.h:
            * WebPreferences.cpp:
            (WebPreferences::initializeDefaultSettings):
            (WebPreferences::javaScriptCanAccessClipboard):
            (WebPreferences::setJavaScriptCanAccessClipboard):
            * WebPreferences.h:
            * WebView.cpp:
            (WebView::notifyPreferencesChanged):
    2010-05-03  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add support for controlling clipboard access from javascript.
            Clipboard access from javascript is enabled in test framework.
            https://bugs.webkit.org/show_bug.cgi?id=27751
    
            * DumpRenderTree/LayoutTestController.cpp:
            (setJavaScriptCanAccessClipboardCallback):
            (LayoutTestController::staticFunctions):
            * DumpRenderTree/LayoutTestController.h:
            * DumpRenderTree/chromium/LayoutTestController.cpp:
            (LayoutTestController::LayoutTestController):
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            (LayoutTestController::overridePreference):
            * DumpRenderTree/chromium/LayoutTestController.h:
            * DumpRenderTree/chromium/TestShell.cpp:
            (TestShell::resetWebSettings):
            * DumpRenderTree/gtk/DumpRenderTree.cpp:
            (resetDefaultsToConsistentValues):
            * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            * DumpRenderTree/mac/DumpRenderTree.mm:
            (resetDefaultsToConsistentValues):
            * DumpRenderTree/mac/LayoutTestControllerMac.mm:
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
            (WebCore::WebPage::WebPage):
            (WebCore::WebPage::resetSettings):
            * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            * DumpRenderTree/qt/LayoutTestControllerQt.h:
            * DumpRenderTree/win/DumpRenderTree.cpp:
            (resetDefaultsToConsistentValues):
            * DumpRenderTree/win/LayoutTestControllerWin.cpp:
            (LayoutTestController::setJavaScriptCanAccessClipboard):
            * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
            (LayoutTestController::setJavaScriptCanAccessClipboard):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58703 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0aad425..adc5c18 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Tests that javascript cannot access clipboard.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * editing/execCommand/clipboard-access-expected.txt: Added.
+        * editing/execCommand/clipboard-access.html: Added.
+        * editing/execCommand/script-tests/clipboard-access.js: Added.
+        (enabled):
+        (whenEnabled):
+
 2010-05-05  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/editing/execCommand/clipboard-access-expected.txt b/LayoutTests/editing/execCommand/clipboard-access-expected.txt
new file mode 100644
index 0000000..580ad49
--- /dev/null
+++ b/LayoutTests/editing/execCommand/clipboard-access-expected.txt
@@ -0,0 +1,13 @@
+This test checks whether javascript programs can access clipboard.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS whenEnabled('Copy') is 0
+PASS whenEnabled('Cut') is 0
+PASS whenEnabled('Paste') is 0
+PASS whenEnabled('PasteAndMatchStyle') is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/editing/execCommand/clipboard-access.html b/LayoutTests/editing/execCommand/clipboard-access.html
new file mode 100644
index 0000000..74dae55
--- /dev/null
+++ b/LayoutTests/editing/execCommand/clipboard-access.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/clipboard-access.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/editing/execCommand/script-tests/clipboard-access.js b/LayoutTests/editing/execCommand/script-tests/clipboard-access.js
new file mode 100644
index 0000000..4dc74e9
--- /dev/null
+++ b/LayoutTests/editing/execCommand/script-tests/clipboard-access.js
@@ -0,0 +1,90 @@
+description("This test checks whether javascript programs can access clipboard.");
+
+if (window.layoutTestController)
+{
+    window.layoutTestController.setJavaScriptCanAccessClipboard(false);
+}
+
+var nonEditableParagraph = document.createElement("p");
+nonEditableParagraph.appendChild(document.createTextNode("x"));
+document.body.appendChild(nonEditableParagraph);
+
+var editableParagraph = document.createElement("p");
+editableParagraph.appendChild(document.createTextNode("x"));
+editableParagraph.setAttribute("contentEditable", "true");
+document.body.appendChild(editableParagraph);
+
+var editablePlainTextParagraph = document.createElement("p");
+editablePlainTextParagraph.appendChild(document.createTextNode("x"));
+editablePlainTextParagraph.setAttribute("contentEditable", "plaintext-only");
+document.body.appendChild(editablePlainTextParagraph);
+
+function enabled(command, element, selectionStart, selectionEnd)
+{
+    var selection = document.getSelection();
+    selection.removeAllRanges();
+    if (element) {
+        var range = document.createRange();
+        range.setStart(element.firstChild, selectionStart);
+        range.setEnd(element.firstChild, selectionEnd);
+        selection.addRange(range);
+    }
+    var result = document.queryCommandEnabled(command)
+    selection.removeAllRanges();
+    return result;
+}
+
+function whenEnabled(command)
+{
+    var enabledWithNoSelection = enabled(command);
+    var enabledWithCaret = enabled(command, editableParagraph, 0, 0);
+    var enabledWithEditableRange = enabled(command, editableParagraph, 0, 1);
+    var enabledWithPlainTextCaret = enabled(command, editablePlainTextParagraph, 0, 0);
+    var enabledWithPlainTextEditableRange = enabled(command, editablePlainTextParagraph, 0, 1);
+    var enabledWithPoint = enabled(command, nonEditableParagraph, 0, 0);
+    var enabledWithNonEditableRange = enabled(command, nonEditableParagraph, 0, 1);
+
+    var summaryInteger = enabledWithNoSelection
+        | (enabledWithCaret << 1)
+        | (enabledWithEditableRange << 2)
+        | (enabledWithPlainTextCaret << 3)
+        | (enabledWithPlainTextEditableRange << 4)
+        | (enabledWithPoint << 5)
+        | (enabledWithNonEditableRange << 6);
+
+    if (summaryInteger === 0x7F)
+        return "always";
+
+    if (summaryInteger === 0x54)
+        return "range";
+
+    if (summaryInteger === 0x1E)
+        return "editable";
+    if (summaryInteger === 0x0A)
+        return "caret";
+    if (summaryInteger === 0x14)
+        return "editable range";
+
+    if (summaryInteger === 0x06)
+        return "richly editable";
+    if (summaryInteger === 0x02)
+        return "richly editable caret";
+    if (summaryInteger === 0x04)
+        return "richly editable range";
+
+    if (summaryInteger === 0x5E)
+        return "visible";
+
+    return summaryInteger;
+}
+
+shouldBe("whenEnabled('Copy')", "0");
+shouldBe("whenEnabled('Cut')", "0");
+shouldBe("whenEnabled('Paste')", "0");
+shouldBe("whenEnabled('PasteAndMatchStyle')", "0");
+
+document.body.removeChild(nonEditableParagraph);
+document.body.removeChild(editableParagraph);
+document.body.removeChild(editablePlainTextParagraph);
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 69d200b..c475296 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        Test: editing/execCommand/clipboard-access.html
+
+        * WebCore.base.exp:
+        * editing/EditorCommand.cpp:
+        (WebCore::supportedCopyCut):
+        (WebCore::supportedPaste):
+        (WebCore::createCommandMap):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::setJavaScriptCanAccessClipboard):
+        * page/Settings.h:
+        (WebCore::Settings::javaScriptCanAccessClipboard):
+
 2010-05-05  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 16def96..7e6f265 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -674,6 +674,7 @@ __ZN7WebCore8Settings28setFrameSetFlatteningEnabledEb
 __ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb
 __ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb
 __ZN7WebCore8Settings30setAllowFileAccessFromFileURLsEb
+__ZN7WebCore8Settings31setJavaScriptCanAccessClipboardEb
 __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
 __ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb
 __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index 34fa46d..4cb34ac 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -1069,6 +1069,21 @@ static bool supportedFromMenuOrKeyBinding(Frame*, EditorCommandSource source)
     return source == CommandFromMenuOrKeyBinding;
 }
 
+static bool supportedCopyCut(Frame* frame, EditorCommandSource source)
+{
+    switch (source) {
+        case CommandFromMenuOrKeyBinding:
+            return true;
+        case CommandFromDOM:
+        case CommandFromDOMWithUserInterface: {
+            Settings* settings = frame ? frame->settings() : 0;
+            return settings && settings->javaScriptCanAccessClipboard();
+        }
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 static bool supportedPaste(Frame* frame, EditorCommandSource source)
 {
     switch (source) {
@@ -1077,7 +1092,7 @@ static bool supportedPaste(Frame* frame, EditorCommandSource source)
         case CommandFromDOM:
         case CommandFromDOMWithUserInterface: {
             Settings* settings = frame ? frame->settings() : 0;
-            return settings && settings->isDOMPasteAllowed();
+            return settings && (settings->javaScriptCanAccessClipboard() ? settings->isDOMPasteAllowed() : 0);
         }
     }
     ASSERT_NOT_REACHED();
@@ -1304,9 +1319,9 @@ static const CommandMap& createCommandMap()
         { "BackColor", { executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueBackColor, notTextInsertion, doNotAllowExecutionWhenDisabled } },
         { "BackwardDelete", { executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, // FIXME: remove BackwardDelete when Safari for Windows stops using it.
         { "Bold", { executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
-        { "Copy", { executeCopy, supported, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
+        { "Copy", { executeCopy, supportedCopyCut, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
         { "CreateLink", { executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
-        { "Cut", { executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
+        { "Cut", { executeCut, supportedCopyCut, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
         { "Delete", { executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
         { "DeleteBackward", { executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
         { "DeleteBackwardByDecomposingPreviousCharacter", { executeDeleteBackwardByDecomposingPreviousCharacter, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index a791f74..d60de12 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -79,6 +79,7 @@ Settings::Settings(Page* page)
     , m_allowUniversalAccessFromFileURLs(true)
     , m_allowFileAccessFromFileURLs(true)
     , m_javaScriptCanOpenWindowsAutomatically(false)
+    , m_javaScriptCanAccessClipboard(false)
     , m_shouldPrintBackgrounds(false)
     , m_textAreasAreResizable(false)
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -291,6 +292,11 @@ void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWi
     m_javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
 }
 
+void Settings::setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard)
+{
+    m_javaScriptCanAccessClipboard = javaScriptCanAccessClipboard;
+}
+
 void Settings::setDefaultTextEncodingName(const String& defaultTextEncodingName)
 {
     m_defaultTextEncodingName = defaultTextEncodingName;
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 70c3cbd..20cd847 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -122,6 +122,9 @@ namespace WebCore {
         void setJavaScriptCanOpenWindowsAutomatically(bool);
         bool javaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
 
+        void setJavaScriptCanAccessClipboard(bool);
+        bool javaScriptCanAccessClipboard() const { return m_javaScriptCanAccessClipboard; }
+
         void setSpatialNavigationEnabled(bool);
         bool isSpatialNavigationEnabled() const { return m_isSpatialNavigationEnabled; }
 
@@ -330,6 +333,7 @@ namespace WebCore {
         bool m_allowUniversalAccessFromFileURLs: 1;
         bool m_allowFileAccessFromFileURLs: 1;
         bool m_javaScriptCanOpenWindowsAutomatically : 1;
+        bool m_javaScriptCanAccessClipboard : 1;
         bool m_shouldPrintBackgrounds : 1;
         bool m_textAreasAreResizable : 1;
 #if ENABLE(DASHBOARD_SUPPORT)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index fc55ba6..18591e1 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,16 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * public/WebSettings.h:
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::setJavaScriptCanAccessClipboard):
+        * src/WebSettingsImpl.h:
+
 2010-03-28  Alexey Proskuryakov  <ap at apple.com>
 
         Build fix. Removed extraneous includes of KeyboardCodesWin.h and KeyboardCodesPosix.h -
diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h
index 709d9c2..6ba8a2c 100644
--- a/WebKit/chromium/public/WebSettings.h
+++ b/WebKit/chromium/public/WebSettings.h
@@ -71,6 +71,7 @@ public:
     virtual void setUserStyleSheetLocation(const WebURL&) = 0;
     virtual void setUsesPageCache(bool) = 0;
     virtual void setDownloadableBinaryFontsEnabled(bool) = 0;
+    virtual void setJavaScriptCanAccessClipboard(bool) = 0;
     virtual void setXSSAuditorEnabled(bool) = 0;
     virtual void setLocalStorageEnabled(bool) = 0;
     virtual void setEditableLinkBehaviorNeverLive() = 0;
diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp
index 6515524..895a57e 100644
--- a/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -195,6 +195,11 @@ void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled)
     m_settings->setDownloadableBinaryFontsEnabled(enabled);
 }
 
+void WebSettingsImpl::setJavaScriptCanAccessClipboard(bool enabled)
+{
+    m_settings->setJavaScriptCanAccessClipboard(enabled);
+}
+
 void WebSettingsImpl::setXSSAuditorEnabled(bool enabled)
 {
     m_settings->setXSSAuditorEnabled(enabled);
diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h
index d03099d..3679f52 100644
--- a/WebKit/chromium/src/WebSettingsImpl.h
+++ b/WebKit/chromium/src/WebSettingsImpl.h
@@ -73,6 +73,7 @@ public:
     virtual void setUserStyleSheetLocation(const WebURL&);
     virtual void setUsesPageCache(bool);
     virtual void setDownloadableBinaryFontsEnabled(bool);
+    virtual void setJavaScriptCanAccessClipboard(bool);
     virtual void setXSSAuditorEnabled(bool);
     virtual void setLocalStorageEnabled(bool);
     virtual void setEditableLinkBehaviorNeverLive();
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 3e5d490..4271c2f 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,20 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * webkit/webkitwebsettings.cpp:
+        (webkit_web_settings_class_init):
+        (webkit_web_settings_set_property):
+        (webkit_web_settings_get_property):
+        (webkit_web_settings_copy):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_update_settings):
+        (webkit_web_view_settings_notify):
+
 2010-06-04  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp
index 7ec6154..19c4168 100644
--- a/WebKit/gtk/webkit/webkitwebsettings.cpp
+++ b/WebKit/gtk/webkit/webkitwebsettings.cpp
@@ -96,6 +96,7 @@ struct _WebKitWebSettingsPrivate {
     gboolean enable_spatial_navigation;
     gchar* user_agent;
     gboolean javascript_can_open_windows_automatically;
+    gboolean javascript_can_access_clipboard;
     gboolean enable_offline_web_application_cache;
     WebKitEditingBehavior editing_behavior;
     gboolean enable_universal_access_from_file_uris;
@@ -145,6 +146,7 @@ enum {
     PROP_ENABLE_SPATIAL_NAVIGATION,
     PROP_USER_AGENT,
     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
+    PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
     PROP_EDITING_BEHAVIOR,
     PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS,
@@ -623,6 +625,22 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
                                                          _("Whether JavaScript can open windows automatically"),
                                                          FALSE,
                                                          flags));
+
+    /**
+    * WebKitWebSettings:javascript-can-access-clipboard
+    *
+    * Whether JavaScript can access Clipboard.
+    *
+    * Since: 1.3.0
+    */
+    g_object_class_install_property(gobject_class,
+                                    PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
+                                    g_param_spec_boolean("javascript-can-access-clipboard",
+                                                         _("JavaScript can access Clipboard"),
+                                                         _("Whether JavaScript can access Clipboard"),
+                                                         FALSE,
+                                                         flags));
+
     /**
     * WebKitWebSettings:enable-offline-web-application-cache
     *
@@ -1023,6 +1041,9 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
         priv->javascript_can_open_windows_automatically = g_value_get_boolean(value);
         break;
+    case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
+        priv->javascript_can_access_clipboard = g_value_get_boolean(value);
+        break;
     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
         priv->enable_offline_web_application_cache = g_value_get_boolean(value);
         break;
@@ -1161,6 +1182,9 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa
     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
         g_value_set_boolean(value, priv->javascript_can_open_windows_automatically);
         break;
+    case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
+        g_value_set_boolean(value, priv->javascript_can_access_clipboard);
+        break;
     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
         g_value_set_boolean(value, priv->enable_offline_web_application_cache);
         break;
@@ -1255,6 +1279,7 @@ WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings)
                  "enable-spatial-navigation", priv->enable_spatial_navigation,
                  "user-agent", webkit_web_settings_get_user_agent(web_settings),
                  "javascript-can-open-windows-automatically", priv->javascript_can_open_windows_automatically,
+                 "javascript-can-access-clipboard", priv->javascript_can_access_clipboard,
                  "enable-offline-web-application-cache", priv->enable_offline_web_application_cache,
                  "editing-behavior", priv->editing_behavior,
                  "enable-universal-access-from-file-uris", priv->enable_universal_access_from_file_uris,
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index b8ebea2..1f3a445 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -2646,7 +2646,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
     gboolean autoLoadImages, autoShrinkImages, printBackgrounds,
         enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas,
         enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage,
-        enableXSSAuditor, enableSpatialNavigation, javascriptCanOpenWindows, enableOfflineWebAppCache,
+        enableXSSAuditor, enableSpatialNavigation, javascriptCanOpenWindows,
+        javaScriptCanAccessClipboard, enableOfflineWebAppCache,
         enableUniversalAccessFromFileURI, enableFileAccessFromFileURI,
         enableDOMPaste, tabKeyCyclesThroughElements,
         enableSiteSpecificQuirks, usePageCache, enableJavaApplet;
@@ -2676,6 +2677,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
                  "enable-xss-auditor", &enableXSSAuditor,
                  "enable-spatial-navigation", &enableSpatialNavigation,
                  "javascript-can-open-windows-automatically", &javascriptCanOpenWindows,
+                 "javascript-can-access-clipboard", &javaScriptCanAccessClipboard,
                  "enable-offline-web-application-cache", &enableOfflineWebAppCache,
                  "editing-behavior", &editingBehavior,
                  "enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI,
@@ -2711,6 +2713,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
     settings->setXSSAuditorEnabled(enableXSSAuditor);
     settings->setSpatialNavigationEnabled(enableSpatialNavigation);
     settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows);
+    settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
     settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache);
     settings->setEditingBehavior(core(editingBehavior));
     settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI);
@@ -2808,6 +2811,8 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
         settings->setSpatialNavigationEnabled(g_value_get_boolean(&value));
     else if (name == g_intern_string("javascript-can-open-windows-automatically"))
         settings->setJavaScriptCanOpenWindowsAutomatically(g_value_get_boolean(&value));
+    else if (name == g_intern_string("javascript-can-access-clipboard"))
+        settings->setJavaScriptCanAccessClipboard(g_value_get_boolean(&value));
     else if (name == g_intern_string("enable-offline-web-application-cache"))
         settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value));
     else if (name == g_intern_string("editing-behavior"))
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 44013d5..37589c2 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,20 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences javaScriptCanAccessClipboard]):
+        (-[WebPreferences setJavaScriptCanAccessClipboard:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChangedNotification:]):
+
 2010-04-07  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 150a020..b8575f8 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -84,6 +84,7 @@
 #define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown"
 #define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled"
 #define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly"
+#define WebKitJavaScriptCanAccessClipboardPreferenceKey @"WebKitJavaScriptCanAccessClipboard"
 #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled"
 #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled"
 #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders"
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index bd3c2a7..f181c69 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -350,6 +350,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithBool:NO],   WebKitLocalFileContentSniffingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitZoomsTextOnlyPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitJavaScriptCanAccessClipboardPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitXSSAuditorEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAcceleratedCompositingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitShowDebugBordersPreferenceKey,
@@ -831,6 +832,16 @@ static WebCacheModel cacheModelForMainBundle(void)
     [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];
 }
 
+- (BOOL)javaScriptCanAccessClipboard
+{
+    return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
+}
+
+- (void)setJavaScriptCanAccessClipboard:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
+}
+
 - (BOOL)isXSSAuditorEnabled
 {
     return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey];
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index b516640..1ec6253 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -107,6 +107,9 @@ extern NSString *WebPreferencesRemovedNotification;
 - (BOOL)zoomsTextOnly;
 - (void)setZoomsTextOnly:(BOOL)zoomsTextOnly;
 
+- (BOOL)javaScriptCanAccessClipboard;
+- (void)setJavaScriptCanAccessClipboard:(BOOL)flag;
+
 - (BOOL)isXSSAuditorEnabled;
 - (void)setXSSAuditorEnabled:(BOOL)flag;
 
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index e1f1fd7..dc8e41e 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1345,6 +1345,7 @@ static bool fastDocumentTeardownEnabled()
     settings->setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]);
     settings->setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]);
     settings->setZoomMode([preferences zoomsTextOnly] ? ZoomTextOnly : ZoomPage);
+    settings->setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]);
     settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
     settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1));
     
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 096acca..09cc322 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,15 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * Api/qwebsettings.cpp:
+        (QWebSettingsPrivate::apply):
+        * Api/qwebsettings.h:
+
 2010-03-28  Alexey Proskuryakov  <ap at apple.com>
 
         Build fix. Include WindowsKeyboardCodes.h instead of KeyboardCodes.h.
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index b55df66..13c8551 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,21 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is disabled by default.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::javaScriptCanAccessClipboard):
+        (WebPreferences::setJavaScriptCanAccessClipboard):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2010-05-18  Brent Fulgham  <bfulgham at webkit.org>
 
         Reviewed by Adam Roben.
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
index d1e0f5e..abe3b04 100644
--- a/WebKit/win/WebPreferenceKeysPrivate.h
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -125,6 +125,8 @@
 
 #define WebKitZoomsTextOnlyPreferenceKey "WebKitZoomsTextOnly"
 
+#define WebKitJavaScriptCanAccessClipboardPreferenceKey "WebKitJavaScriptCanAccessClipboard"
+
 #define WebKitXSSAuditorEnabledPreferenceKey "WebKitXSSAuditorEnabled"
 
 #define WebKitUseHighResolutionTimersPreferenceKey "WebKitUseHighResolutionTimers"
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index 0e44d9f..de89b74 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -206,6 +206,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitWebSecurityEnabledPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitAllowUniversalAccessFromFileURLsPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitAllowFileAccessFromFileURLsPreferenceKey), kCFBooleanTrue);
+    CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanAccessClipboardPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitXSSAuditorEnabledPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitFrameSetFlatteningEnabledPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue);
@@ -807,6 +808,20 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setAllowFileAccessFromFileURLs(
     return S_OK;
 }
 
+HRESULT STDMETHODCALLTYPE WebPreferences::javaScriptCanAccessClipboard(
+    /* [retval][out] */ BOOL* enabled)
+{
+    *enabled = boolValueForKey(CFSTR(WebKitJavaScriptCanAccessClipboardPreferenceKey));
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setJavaScriptCanAccessClipboard(
+    /* [in] */ BOOL enabled)
+{
+    setBoolValue(CFSTR(WebKitJavaScriptCanAccessClipboardPreferenceKey), enabled);
+    return S_OK;
+}
+
 HRESULT STDMETHODCALLTYPE WebPreferences::isXSSAuditorEnabled(
     /* [retval][out] */ BOOL* enabled)
 {
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
index e4af17a..9fdc2d8 100644
--- a/WebKit/win/WebPreferences.h
+++ b/WebKit/win/WebPreferences.h
@@ -368,6 +368,12 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setAllowFileAccessFromFileURLs(
     /* [in] */ BOOL allowAccess);
 
+    virtual HRESULT STDMETHODCALLTYPE javaScriptCanAccessClipboard(
+    /* [retval][out] */ BOOL* enabled);
+
+    virtual HRESULT STDMETHODCALLTYPE setJavaScriptCanAccessClipboard(
+    /* [in] */ BOOL enabled);
+
     virtual HRESULT STDMETHODCALLTYPE isXSSAuditorEnabled(
     /* [retval][out] */ BOOL* enabled);
 
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 209af1e..7d0b3d3 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -4657,6 +4657,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         return hr;
     settings->setAllowFileAccessFromFileURLs(!!enabled);
 
+    hr = prefsPrivate->javaScriptCanAccessClipboard(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings->setJavaScriptCanAccessClipboard(!!enabled);
+
     hr = prefsPrivate->isXSSAuditorEnabled(&enabled);
     if (FAILED(hr))
         return hr;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 65a5305..ec14c7d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,43 @@
+2010-05-03  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add support for controlling clipboard access from javascript.
+        Clipboard access from javascript is enabled in test framework.
+        https://bugs.webkit.org/show_bug.cgi?id=27751
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (setJavaScriptCanAccessClipboardCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        (LayoutTestController::overridePreference):
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::resetWebSettings):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (resetDefaultsToConsistentValues):
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::WebPage::WebPage):
+        (WebCore::WebPage::resetSettings):
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        * DumpRenderTree/qt/LayoutTestControllerQt.h:
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetDefaultsToConsistentValues):
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+        (LayoutTestController::setJavaScriptCanAccessClipboard):
+
 2010-06-01  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 72e10d2..cf84eb1 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -79,6 +79,7 @@ public:
     void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme);
     void setIconDatabaseEnabled(bool iconDatabaseEnabled);
     void setJavaScriptProfilingEnabled(bool profilingEnabled);
+    void setJavaScriptCanAccessClipboard(bool flag);
     void setMainFrameIsFirstResponder(bool flag);
     void setMockGeolocationError(int code, JSStringRef message);
     void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index dbb1344..6141b21 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -320,6 +320,7 @@ static void resetDefaultsToConsistentValues()
                  "enable-html5-local-storage", TRUE,
                  "enable-xss-auditor", FALSE,
                  "enable-spatial-navigation", FALSE,
+                 "javascript-can-access-clipboard", TRUE,
                  "javascript-can-open-windows-automatically", TRUE,
                  "enable-offline-web-application-cache", TRUE,
                  "enable-universal-access-from-file-uris", TRUE,
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index ff2ca58..6b3a46c 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -337,6 +337,15 @@ void LayoutTestController::setPrivateBrowsingEnabled(bool flag)
     g_object_set(G_OBJECT(settings), "enable-private-browsing", flag, NULL);
 }
 
+void LayoutTestController::setJavaScriptCanAccessClipboard(bool flag)
+{
+    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+    ASSERT(view);
+
+    WebKitWebSettings* settings = webkit_web_view_get_settings(view);
+    g_object_set(G_OBJECT(settings), "javascript-can-access-clipboard", flag, NULL);
+}
+
 void LayoutTestController::setXSSAuditorEnabled(bool flag)
 {
     WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index a20721c..1f23dbf 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -423,6 +423,7 @@ static void resetDefaultsToConsistentValues()
     [preferences setPrivateBrowsingEnabled:NO];
     [preferences setAuthorAndUserStylesEnabled:YES];
     [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
+    [preferences setJavaScriptCanAccessClipboard:YES];
     [preferences setOfflineWebApplicationCacheEnabled:YES];
     [preferences setDeveloperExtrasEnabled:NO];
     [preferences setLoadsImagesAutomatically:YES];
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index e3e0729..ac2573e 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -349,6 +349,11 @@ void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
     [[[mainFrame webView] preferences] setJavaScriptCanOpenWindowsAutomatically:!popupBlockingEnabled];
 }
 
+void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled)
+{
+    [[[mainFrame webView] preferences] setJavaScriptCanAccessClipboard:enabled];
+}
+
 void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
 {
     [[mainFrame webView] setTabKeyCyclesThroughElements:cycles];
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index c8a2929..5f87b54 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -371,6 +371,11 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool isFirst)
     //FIXME: only need this for the moment: https://bugs.webkit.org/show_bug.cgi?id=32990
 }
 
+void LayoutTestController::setJavaScriptCanAccessClipboard(bool enable)
+{
+    m_drt->webPage()->settings()->setAttribute(QWebSettings::JavaScriptCanAccessClipboard, enable);
+}
+
 void LayoutTestController::setXSSAuditorEnabled(bool enable)
 {
     // Set XSSAuditorEnabled globally so that windows created by the test inherit it too.
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 8a9f26f..a78b623 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -134,6 +134,7 @@ public slots:
     void resetLoadFinished() { m_loadFinished = false; }
     void setWindowIsKey(bool isKey);
     void setMainFrameIsFirstResponder(bool isFirst);
+    void setJavaScriptCanAccessClipboard(bool enable);
     void setXSSAuditorEnabled(bool enable);
     void setCaretBrowsingEnabled(bool enable);
 
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index e445798..04aac35 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -790,6 +790,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
         prefsPrivate->setDeveloperExtrasEnabled(FALSE);
         prefsPrivate->setExperimentalNotificationsEnabled(TRUE);
         prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
+        prefsPrivate->setJavaScriptCanAccessClipboard(TRUE);
         prefsPrivate->setXSSAuditorEnabled(FALSE);
         prefsPrivate->setFrameSetFlatteningEnabled(FALSE);
         prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE);
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 77f7443..3dc97ee 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -441,6 +441,23 @@ void LayoutTestController::setPopupBlockingEnabled(bool enabled)
     preferences->setJavaScriptCanOpenWindowsAutomatically(!enabled);
 }
 
+void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled)
+{
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebPreferences> preferences;
+    if (FAILED(webView->preferences(&preferences)))
+        return;
+
+    COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+    if (!prefsPrivate)
+        return;
+
+    prefsPrivate->setJavaScriptCanAccessClipboard(enabled);
+}
+
 void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle)
 {
     COMPtr<IWebView> webView;
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index b0cd419..cc13429 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -165,6 +165,11 @@ void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled
     // FIXME: implement
 }
 
+void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled)
+{
+    // FIXME: implement
+}
+
 void LayoutTestController::setXSSAuditorEnabled(bool enabled)
 {
     // FIXME: implement

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list