- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / bindings / exception_in_handler_should_not_crash / page.js
1 // Copyright (c) 2011 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 function testCallback(callback) {
6   var done = chrome.test.callbackAdded();
7   return function() {
8     try {
9       callback.call(null, arguments);
10     } finally {
11       done();
12     }
13   };
14 }
15
16 chrome.test.runTests([
17   function tabsCreateThrowsError() {
18     chrome.tabs.create({}, testCallback(function() {
19       throw new Error("tata");
20     }));
21   },
22   function permissionsGetAllThrowsError() {
23     // permissions.getAll has a custom callback, as do many other methods, but
24     // this is easy to call.
25     chrome.permissions.getAll(testCallback(function() {
26       throw new Error("boom");
27     }));
28   }
29 ]);