Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/test/data/extensions/api_test/clipboard/extension/content_script.js

Issue 498513002: Respect the clipboardRead and clipboardWrite permissions in content scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address more comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // TODO(kalman): Consolidate this test script with the other clipboard tests.
6
7 function appendTextarea() {
8 return document.body.appendChild(document.createElement('textarea'));
9 }
10
11 function run() {
12 var textIn = appendTextarea();
13
14 textIn.focus();
15 textIn.value = 'foobar';
16 textIn.selectionStart = 0;
17 textIn.selectionEnd = 'foobar'.length;
18 if (!document.execCommand('copy'))
19 return 'Failed to copy';
20
21 var textOut = appendTextarea();
22
23 textOut.focus();
24 if (!document.execCommand('paste'))
25 return 'Failed to paste';
26 if (textOut.value != 'foobar')
27 return 'Expected "foobar", got ' + textOut.value;
28
29 return '';
30 }
31
32 chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
33 sendResponse(run());
34 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698