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

Side by Side Diff: webkit/port/bindings/v8/v8_proxy.cpp

Issue 27326: Isolate exceptions when evaluating javascript code from C++.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « no previous file | 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 (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 // Compile the script. 1365 // Compile the script.
1366 v8::Local<v8::String> code = v8ExternalString(str); 1366 v8::Local<v8::String> code = v8ExternalString(str);
1367 ChromiumBridge::traceEventBegin("v8.compile", n, ""); 1367 ChromiumBridge::traceEventBegin("v8.compile", n, "");
1368 v8::Handle<v8::Script> script = CompileScript(code, fileName, baseLine); 1368 v8::Handle<v8::Script> script = CompileScript(code, fileName, baseLine);
1369 ChromiumBridge::traceEventEnd("v8.compile", n, ""); 1369 ChromiumBridge::traceEventEnd("v8.compile", n, "");
1370 1370
1371 // Set inlineCode to true for <a href="javascript:doSomething()"> 1371 // Set inlineCode to true for <a href="javascript:doSomething()">
1372 // and false for <script>doSomething</script>. For some reason, fileName 1372 // and false for <script>doSomething</script>. For some reason, fileName
1373 // gives us this information. 1373 // gives us this information.
1374 ChromiumBridge::traceEventBegin("v8.run", n, ""); 1374 ChromiumBridge::traceEventBegin("v8.run", n, "");
1375 v8::Local<v8::Value> result = RunScript(script, fileName.isNull()); 1375 v8::Local<v8::Value> result;
1376 {
1377 // Isolate exceptions that occur when executing the code. These
1378 // exceptions should not interfere with javascript code we might
1379 // evaluate from C++ when returning from here
1380 v8::TryCatch try_catch;
1381 try_catch.SetVerbose(true);
1382 result = RunScript(script, fileName.isNull());
1383 }
1376 ChromiumBridge::traceEventEnd("v8.run", n, ""); 1384 ChromiumBridge::traceEventEnd("v8.run", n, "");
1377 return result; 1385 return result;
1378 } 1386 }
1379 1387
1380 v8::Local<v8::Value> V8Proxy::RunScript(v8::Handle<v8::Script> script, 1388 v8::Local<v8::Value> V8Proxy::RunScript(v8::Handle<v8::Script> script,
1381 bool inline_code) 1389 bool inline_code)
1382 { 1390 {
1383 if (script.IsEmpty()) 1391 if (script.IsEmpty())
1384 return v8::Local<v8::Value>(); 1392 return v8::Local<v8::Value>();
1385 1393
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3530 } 3538 }
3531 return ToWebCoreString(v8::Debug::Call(frame_source_name)); 3539 return ToWebCoreString(v8::Debug::Call(frame_source_name));
3532 } 3540 }
3533 3541
3534 void V8Proxy::RegisterExtension(v8::Extension* extension) { 3542 void V8Proxy::RegisterExtension(v8::Extension* extension) {
3535 v8::RegisterExtension(extension); 3543 v8::RegisterExtension(extension);
3536 m_extensions.push_back(extension); 3544 m_extensions.push_back(extension);
3537 } 3545 }
3538 3546
3539 } // namespace WebCore 3547 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698