execCommand("Paste") doesn't work in WebKitTestRunner One obvious aspect is the special preference setting for this, but even with that enabled, execCommand("Paste") doesn't seem to work.
For whatever reason, two preferences need to be set in order for DOM paste to work. I'm told that "Allow Automated Pasting" in Safari debug menu is already broken in WebKit1 because of this, perhaps WebKitTestRunner has the same issue?
Both javaScriptCanAccessClipboard and isDOMPasteAllowed must return true for paste to work: static bool supportedPaste(Frame* frame) { Settings* settings = frame ? frame->settings() : 0; return settings && (settings->javaScriptCanAccessClipboard() ? settings->isDOMPasteAllowed() : 0); }
(In reply to comment #1) > For whatever reason, two preferences need to be set in order for DOM paste to work. I'm told that "Allow Automated Pasting" in Safari debug menu is already broken in WebKit1 because of this, perhaps WebKitTestRunner has the same issue? These two preferences are really obscured. I'd really like to unsupport these two settings and add SecurityOrigin methods (see: https://bugs.webkit.org/show_bug.cgi?id=52417).
Created attachment 80370 [details] Patch
Comment on attachment 80370 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=80370&action=review > Source/WebKit2/Shared/WebPreferencesStore.h:69 > macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \ > macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \ > macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \ > + macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \ > macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \ Can we keep this sorted alphabetically? > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1268 > settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey())); > settings->setPaginateDuringLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::paginateDuringLayoutEnabledKey())); > settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey())); > + settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey())); > settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey())); Can we keep this sorted alphabetically?
Committed r76908: <http://trac.webkit.org/changeset/76908>
(In reply to comment #5) > (From update of attachment 80370 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=80370&action=review > > > Source/WebKit2/Shared/WebPreferencesStore.h:69 > > macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \ > > macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \ > > macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \ > > + macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \ > > macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \ > > Can we keep this sorted alphabetically? > > > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1268 > > settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey())); > > settings->setPaginateDuringLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::paginateDuringLayoutEnabledKey())); > > settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey())); > > + settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey())); > > settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey())); > > Can we keep this sorted alphabetically? I ended up not sorting because I didn't want to inject an unrelated change, but yes, I believe this can be sorted as an independent cleanup.