Bug 58280

Summary: SerializedScriptValue shouldn't always throw exceptions
Product: WebKit Reporter: Stephanie Lewis <slewis>
Component: WebCore JavaScriptAssignee: Stephanie Lewis <slewis>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, eric, gustavo, rniwa, slewis, webkit-ews, webkit.review.bot, xan.lopez
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
patch
oliver: review-
patch
oliver: review+
patch to fix layout test
none
patch to fix layout test
none
patch to fix layout test oliver: review+

Stephanie Lewis
Reported 2011-04-11 15:43:00 PDT
<rdar://problem/9252824> javascript in an inconsistent state due to serialization returning an un-handled exception SerializedScriptValue is used in several places that don't call back into javascript. The callers should decide whether or not to throw exceptions.
Attachments
patch (23.74 KB, patch)
2011-04-11 16:07 PDT, Stephanie Lewis
oliver: review-
patch (24.48 KB, patch)
2011-04-11 19:44 PDT, Stephanie Lewis
oliver: review+
patch to fix layout test (1.08 KB, application/octet-stream)
2011-04-12 16:16 PDT, Stephanie Lewis
no flags
patch to fix layout test (1.08 KB, patch)
2011-04-12 16:17 PDT, Stephanie Lewis
no flags
patch to fix layout test (2.79 KB, patch)
2011-04-12 17:09 PDT, Stephanie Lewis
oliver: review+
Stephanie Lewis
Comment 1 2011-04-11 16:07:21 PDT
WebKit Review Bot
Comment 2 2011-04-11 16:10:18 PDT
Attachment 89113 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebKit2/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Source/WebCore/loader/FrameLoader.h:42: Alphabetical sorting problem. [build/include_order] [4] Source/WebCore/bindings/js/SerializedScriptValue.h:31: Alphabetical sorting problem. [build/include_order] [4] Source/WebCore/bindings/js/SerializedScriptValue.h:54: The parameter name "exec" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/bindings/js/SerializedScriptValue.h:54: The parameter name "value" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/bindings/js/SerializedScriptValue.h:54: Missing spaces around = [whitespace/operators] [4] Source/WebCore/bindings/js/SerializedScriptValue.h:67: The parameter name "exec" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/bindings/js/SerializedScriptValue.h:67: The parameter name "globalObject" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/bindings/js/SerializedScriptValue.h:67: Missing spaces around = [whitespace/operators] [4] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1259: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1318: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1346: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1393: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1422: Non-label code inside switch statements should be indented. [whitespace/indent] [4] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1422: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1424: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1425: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1427: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1428: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1430: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1431: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/bindings/js/SerializedScriptValue.cpp:1434: Tab found; better to use spaces [whitespace/tab] [1] Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1239: Missing space before ( in if( [whitespace/parens] [5] Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1240: Tab found; better to use spaces [whitespace/tab] [1] Source/WebCore/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Total errors found: 25 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Oliver Hunt
Comment 3 2011-04-11 16:16:15 PDT
Comment on attachment 89113 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=89113&action=review Rather than a bool i'd prefer enum SerializationErrorMode { Throwing, NonThrowing } as that makes things more explicit. The use of Global will also fail on ToT as geoff has renamed everything, i believe you'll want heap/Strong.h and Strong<..> r-ing due to the style errors, and it failing to build on tot :-( > Source/WebCore/bindings/js/SerializedScriptValue.cpp:1435 > + switch (code) { > + case SuccessfullyCompleted: > + break; > + case StackOverflowError: > + throwError(exec, createStackOverflowError(exec)); > + break; > + case InterruptedExecutionError: > + throwError(exec, createInterruptedExecutionException(&exec->globalData())); > + break; > + case ValidationError: > + throwError(exec, createTypeError(exec, "Unable to deserialize data.")); > + break; > + case ExistingExceptionError: > + case UnspecifiedError: > + break; > + } I don't like this code, i'd prefer: if (code == SuccessfullyCompleted) return; switch (code) { case ...: throwError(exec, ...) return; default: return; Also UnspecifiedError and ExistingExceptionError should both create a generic exception message (as we apparently don't know what has gone wrong).
Early Warning System Bot
Comment 4 2011-04-11 16:29:36 PDT
Stephanie Lewis
Comment 5 2011-04-11 19:44:14 PDT
Build Bot
Comment 6 2011-04-11 20:00:22 PDT
Gustavo Noronha (kov)
Comment 7 2011-04-12 11:28:16 PDT
Oliver Hunt
Comment 8 2011-04-12 14:28:21 PDT
Comment on attachment 89147 [details] patch r=me, gtk seems to have failed on its own
Stephanie Lewis
Comment 9 2011-04-12 14:52:26 PDT
gtk failure was fallout from removing a header from SerializedScriptValue.h. It just needed a header include. committed http://trac.webkit.org/projects/webkit/changeset/83645
Stephanie Lewis
Comment 10 2011-04-12 16:10:03 PDT
Oops, I broke a test. Patch to fix it coming.
Stephanie Lewis
Comment 11 2011-04-12 16:16:25 PDT
Created attachment 89299 [details] patch to fix layout test
Stephanie Lewis
Comment 12 2011-04-12 16:17:51 PDT
Created attachment 89300 [details] patch to fix layout test
Oliver Hunt
Comment 13 2011-04-12 16:21:57 PDT
Comment on attachment 89300 [details] patch to fix layout test r=me, but the =0/=1 are unnecessary, and i want a follow up patch that removes the implicit checks that obviously must currently exist.
Stephanie Lewis
Comment 14 2011-04-12 17:09:18 PDT
Created attachment 89311 [details] patch to fix layout test
Stephanie Lewis
Comment 15 2011-04-12 17:14:16 PDT
Ryosuke Niwa
Comment 16 2011-06-18 10:13:10 PDT
Is this bug fixed? If also, please close the bug and clear r+ flags so that it won't show up on the commit queue.
Eric Seidel (no email)
Comment 17 2011-06-18 13:23:15 PDT
Comment on attachment 89300 [details] patch to fix layout test Cleared Oliver Hunt's review+ from obsolete attachment 89300 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Eric Seidel (no email)
Comment 18 2011-06-18 13:43:08 PDT
Attachment 89311 [details] was posted by a committer and has review+, assigning to Stephanie Lewis for commit.
Stephanie Lewis
Comment 19 2011-06-18 19:17:20 PDT
Note You need to log in before you can comment on or make changes to this bug.