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

Side by Side Diff: chrome/test/data/extensions/api_test/crazy_extension/background.js

Issue 12853007: Don't throw exceptions when v8 objects/contexts are missing, and catch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test #2 Created 7 years, 9 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
« no previous file with comments | « chrome/renderer/extensions/object_backed_native_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This test is for bizarre things that extensions probably will do. We just 5 // This test is for bizarre things that extensions probably will do. We just
6 // need to ensure that behaviour is predictable. 6 // need to ensure that behaviour is predictable.
7 7
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function accessNonexistentIframe() { 9 function accessNonexistentIframe() {
10 var iframe = document.createElement("iframe"); 10 var iframe = document.createElement("iframe");
(...skipping 14 matching lines...) Expand all
25 // Second test is that it does if accessed before removal. 25 // Second test is that it does if accessed before removal.
26 var iframeChrome = iframe.contentWindow.chrome; 26 var iframeChrome = iframe.contentWindow.chrome;
27 var iframeChromeWebstore = iframeChrome.webstore; 27 var iframeChromeWebstore = iframeChrome.webstore;
28 chrome.test.assertTrue(typeof(iframeChromeWebstore) == 'object'); 28 chrome.test.assertTrue(typeof(iframeChromeWebstore) == 'object');
29 document.body.removeChild(iframe); 29 document.body.removeChild(iframe);
30 chrome.test.assertTrue(typeof(iframeChrome.webstore) == 'object'); 30 chrome.test.assertTrue(typeof(iframeChrome.webstore) == 'object');
31 document.body.appendChild(iframe); 31 document.body.appendChild(iframe);
32 break; 32 break;
33 } 33 }
34 case 2: { 34 case 2: {
35 // Third test is that calling frame-dependent methods doesn't crash 35 // Third test is that accessing API methods doesn't crash the
36 // the renderer if the frame doesn't exist anymore. 36 // renderer if the frame doesn't exist anymore.
37 // TODO(kalman): this fails. Fix.
37 var iframeChromeApp = iframe.contentWindow.chrome.app; 38 var iframeChromeApp = iframe.contentWindow.chrome.app;
38 document.body.removeChild(iframe); 39 document.body.removeChild(iframe);
39 var exception = null; 40 chrome.test.assertEq(undefined, iframeChromeApp.getDetails);
40 try {
41 iframeChromeApp.getDetails();
42 } catch (e) {
43 exception = e;
44 }
45 chrome.test.assertEq("Extension view no longer exists", exception);
46 chrome.test.succeed(); 41 chrome.test.succeed();
47 break; 42 break;
48 } 43 }
49 } 44 }
50 iteration++; 45 iteration++;
51 }); 46 });
52 document.body.appendChild(iframe); 47 document.body.appendChild(iframe);
53 } 48 }
54 ]); 49 ]);
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/object_backed_native_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698