OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var defaultUrl = 'http://www.google.com'; | 5 var defaultUrl = 'http://www.google.com'; |
6 | 6 |
7 // Utility function to open a URL in a new tab. If the useIncognito global is | 7 // Utility function to open a URL in a new tab. If the useIncognito global is |
8 // true, the URL is opened in a new incognito window, otherwise it is opened in | 8 // true, the URL is opened in a new incognito window, otherwise it is opened in |
9 // a new tab in the current window. Alternatively, whether to use incognito | 9 // a new tab in the current window. Alternatively, whether to use incognito |
10 // can be specified as a second argument which overrides the global setting. | 10 // can be specified as a second argument which overrides the global setting. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 'store.removeItem("foo"); ' + | 302 'store.removeItem("foo"); ' + |
303 'store.clear();'; | 303 'store.clear();'; |
304 | 304 |
305 // Same but for localStorage. | 305 // Same but for localStorage. |
306 code += 'var store = window.localStorage; ' + | 306 code += 'var store = window.localStorage; ' + |
307 'store.setItem("foo", 42); ' + | 307 'store.setItem("foo", 42); ' + |
308 'var val = store.getItem("foo"); ' + | 308 'var val = store.getItem("foo"); ' + |
309 'store.removeItem("foo"); ' + | 309 'store.removeItem("foo"); ' + |
310 'store.clear();'; | 310 'store.clear();'; |
311 | 311 |
312 // Accesses the HTML5 Notification API from inside a content script. | |
313 code += 'try {' + | |
314 ' webkitNotifications.createNotification("myIcon.png", ' + | |
315 ' "myTitle", ' + | |
316 ' "myContent");' + | |
317 '} catch (e) {}'; | |
318 | |
319 // Accesses the HTML5 ApplicationCache API from inside a content script. | 312 // Accesses the HTML5 ApplicationCache API from inside a content script. |
320 code += 'var appCache = window.applicationCache;'; | 313 code += 'var appCache = window.applicationCache;'; |
321 | 314 |
322 // Accesses the HTML5 WebDatabase API from inside a content script. | 315 // Accesses the HTML5 WebDatabase API from inside a content script. |
323 code += 'var db = openDatabase("testdb", "1.0", "test database", ' + | 316 code += 'var db = openDatabase("testdb", "1.0", "test database", ' + |
324 ' 1024 * 1024);'; | 317 ' 1024 * 1024);'; |
325 | 318 |
326 // Accesses the HTML5 Canvas API from inside a content script. | 319 // Accesses the HTML5 Canvas API from inside a content script. |
327 code += 'var testCanvas = document.createElement("canvas"); ' + | 320 code += 'var testCanvas = document.createElement("canvas"); ' + |
328 'var testContext = testCanvas.getContext("2d");'; | 321 'var testContext = testCanvas.getContext("2d");'; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 477 |
485 // Automatically launch a requested test if specified in the URL. | 478 // Automatically launch a requested test if specified in the URL. |
486 if (window.location.hash) { | 479 if (window.location.hash) { |
487 var requestedTest = window.location.hash.substr(1); | 480 var requestedTest = window.location.hash.substr(1); |
488 if (fnMap.hasOwnProperty(requestedTest)) { | 481 if (fnMap.hasOwnProperty(requestedTest)) { |
489 fnMap[requestedTest](); | 482 fnMap[requestedTest](); |
490 } | 483 } |
491 } | 484 } |
492 } | 485 } |
493 document.addEventListener('DOMContentLoaded', setupEvents); | 486 document.addEventListener('DOMContentLoaded', setupEvents); |
OLD | NEW |