WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
39378
[chromium] Provide a way to catch exceptions thrown while interacting with a NPObject via WebBindings methods.
https://bugs.webkit.org/show_bug.cgi?id=39378
Summary
[chromium] Provide a way to catch exceptions thrown while interacting with a ...
Darin Fisher (:fishd, Google)
Reported
2010-05-19 13:33:35 PDT
[chromium] Provide a way to catch exceptions thrown while interacting with a NPObject via WebBindings methods. As a consumer of WebBindings, I can invoke methods on a NPObject, but if that results in an exception being thrown, I have no way to intercept that.
Attachments
v1 patch
(18.87 KB, patch)
2010-05-19 13:38 PDT
,
Darin Fisher (:fishd, Google)
no flags
Details
Formatted Diff
Diff
v2 patch
(18.77 KB, patch)
2010-05-19 14:09 PDT
,
Darin Fisher (:fishd, Google)
japhet
: review+
Details
Formatted Diff
Diff
v3 patch
(18.97 KB, patch)
2010-05-19 22:37 PDT
,
Darin Fisher (:fishd, Google)
japhet
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Darin Fisher (:fishd, Google)
Comment 1
2010-05-19 13:38:14 PDT
Created
attachment 56517
[details]
v1 patch
WebKit Review Bot
Comment 2
2010-05-19 13:40:27 PDT
Attachment 56517
[details]
did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 WebCore/bindings/v8/V8NPUtils.cpp:161: Should have a space between // and comment [whitespace/comments] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Fisher (:fishd, Google)
Comment 3
2010-05-19 14:09:51 PDT
Created
attachment 56518
[details]
v2 patch
Nate Chapin
Comment 4
2010-05-19 15:28:12 PDT
Comment on
attachment 56518
[details]
v2 patch Ok.
Darin Fisher (:fishd, Google)
Comment 5
2010-05-19 16:00:36 PDT
Landed at
http://trac.webkit.org/changeset/59790
Darin Fisher (:fishd, Google)
Comment 6
2010-05-19 20:25:47 PDT
Had to revert due to failing Chromium plugin tests (NPAPITester.NPObjectProxy)
Darin Fisher (:fishd, Google)
Comment 7
2010-05-19 22:37:23 PDT
Created
attachment 56565
[details]
v3 patch This is a slight modification to the V2 patch: 1- No longer ReThrow the exception if there is not an ExceptionHandler. This was causing problems since the next entered script context would see the re-thrown exception. That is clearly undesirable since the exception could be unrelated to the next entered script context. 2- Call SetVerbose(true) if there is not a registere ExceptionHandler. This way the exception will be logged to the JS console if it is not being externally handled. Interdiff: diff -u WebCore/bindings/v8/V8NPUtils.cpp WebCore/bindings/v8/V8NPUtils.cpp --- WebCore/bindings/v8/V8NPUtils.cpp (working copy) +++ WebCore/bindings/v8/V8NPUtils.cpp (working copy) @@ -152,6 +152,12 @@ delete doomed; } +ExceptionCatcher::ExceptionCatcher() +{ + if (!topHandler) + m_tryCatch.SetVerbose(true); +} + ExceptionCatcher::~ExceptionCatcher() { if (!m_tryCatch.HasCaught()) @@ -159,8 +165,6 @@ if (topHandler) topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.Exception())); - else - m_tryCatch.ReThrow(); } } // namespace WebCore diff -u WebCore/bindings/v8/V8NPUtils.h WebCore/bindings/v8/V8NPUtils.h --- WebCore/bindings/v8/V8NPUtils.h (working copy) +++ WebCore/bindings/v8/V8NPUtils.h (working copy) @@ -60,6 +60,7 @@ // current ExceptionHandler. class ExceptionCatcher { public: + ExceptionCatcher(); ~ExceptionCatcher(); private: v8::TryCatch m_tryCatch;
Darin Fisher (:fishd, Google)
Comment 8
2010-05-19 22:38:57 PDT
(In reply to
comment #7
)
> Created an attachment (id=56565) [details] > v3 patch > > This is a slight modification to the V2 patch: > > 1- No longer ReThrow the exception if there is not an ExceptionHandler. > This was causing problems since the next entered script context would > see the re-thrown exception. That is clearly undesirable since the > exception could be unrelated to the next entered script context.
Oops, one more important note: it appears that the JSC implementation of the _NPN_ functions also traps any exceptions and prevents them from leaking out, so this change to use v8::TryCatch is actually making the V8 <-> NPObject bindings more consistent with JSC.
Nate Chapin
Comment 9
2010-05-20 13:33:13 PDT
Comment on
attachment 56565
[details]
v3 patch Looks good, assuming all the tests are now passing :)
Darin Fisher (:fishd, Google)
Comment 10
2010-05-20 13:50:02 PDT
v3 patch landed as
http://trac.webkit.org/changeset/59862
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug