Bug 65292

Summary: Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics
Product: WebKit Reporter: Luke Zarko <lukezarko+bugzilla>
Component: JavaScriptCoreAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, dglazkov, haraken, kenneth, levin, mikhail.pozdnyakov, oliver, s.choi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#safe-passing-of-structured-data
Bug Depends on: 65286, 94493    
Bug Blocks:    
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Patch
buildbot: commit-queue-
Patch
buildbot: commit-queue-
Patch
buildbot: commit-queue-
Patch
buildbot: commit-queue-
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from gce-cr-linux-03
none
Patch none

Description Luke Zarko 2011-07-27 15:49:08 PDT
The layout tests at fast/dom/Window/window-postmessage-clone.html and fast/dom/Window/window-postmessage-clone-really-deep-array.html differ from the expected results in platform/chromium (both with the integration of the patch for https://bugs.webkit.org/show_bug.cgi?id=65286). Ideally the platform-specific expectations should be eliminated and the behavior of all platforms would be harmonized.
Comment 1 David Levin 2011-07-27 15:53:02 PDT
This is about a fix that needs to happen the structured clone implementation in bindings/js.
Comment 2 Luke Zarko 2011-08-08 15:19:45 PDT
The legacy behavior for postMessage differs between Chrome and Safari for https://bugs.webkit.org/show_bug.cgi?id=65209 -- where Chrome forbids MessagePorts from appearing within a message, Safari allows it but serializes them as plain Objects.
Comment 3 Chris Dumez 2012-08-22 14:06:47 PDT
Created attachment 160008 [details]
Patch
Comment 4 Oliver Hunt 2012-08-22 14:20:17 PDT
Comment on attachment 160008 [details]
Patch

Are the posted String/Boolean/Number objects expected to transfer expands? (a la Arrays)

Also this appears to result in breaking object identity semantics.  eg. foo=new String(s); bar = {a:foo, b:foo}; postMessage(bar)  will produce an object with data.a !== data.b despite bar.a === bar.b

If this is expected behaviour according to the spec i would consider it a spec bug.
Comment 5 Build Bot 2012-08-22 14:42:44 PDT
Comment on attachment 160008 [details]
Patch

Attachment 160008 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13574119
Comment 6 Chris Dumez 2012-08-22 14:52:26 PDT
Created attachment 160014 [details]
Patch

Attempt to fix Windows build.
Comment 7 Build Bot 2012-08-22 15:25:48 PDT
Comment on attachment 160014 [details]
Patch

Attachment 160014 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13561423
Comment 8 Chris Dumez 2012-08-22 15:36:25 PDT
Created attachment 160023 [details]
Patch

Another attempt to fix Windows build.
Comment 9 Build Bot 2012-08-22 16:26:39 PDT
Comment on attachment 160023 [details]
Patch

Attachment 160023 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13565465
Comment 10 Build Bot 2012-08-22 16:31:05 PDT
Comment on attachment 160023 [details]
Patch

Attachment 160023 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13563440
Comment 11 Chris Dumez 2012-08-23 00:25:39 PDT
Created attachment 160100 [details]
Patch

Attempt to fix mac/win builds.
Comment 12 Build Bot 2012-08-23 00:59:50 PDT
Comment on attachment 160100 [details]
Patch

Attachment 160100 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13571541
Comment 13 Chris Dumez 2012-08-23 01:25:16 PDT
Created attachment 160111 [details]
Patch

Export a few JSC symbols for Mac and Win.
Comment 14 Build Bot 2012-08-23 01:57:47 PDT
Comment on attachment 160111 [details]
Patch

Attachment 160111 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13559648
Comment 15 Chris Dumez 2012-08-23 02:19:19 PDT
(In reply to comment #14)
> (From update of attachment 160111 [details])
> Attachment 160111 [details] did not pass mac-ews (mac):
> Output: http://queues.webkit.org/results/13559648

I added the symbols to Source/JavaScriptCore/JavaScriptCore.order. Any idea why I'm still getting linking errors on Mac?
Comment 16 Mikhail Pozdnyakov 2012-08-23 02:26:13 PDT
(In reply to comment #15)
> (In reply to comment #14)
> > (From update of attachment 160111 [details] [details])
> > Attachment 160111 [details] [details] did not pass mac-ews (mac):
> > Output: http://queues.webkit.org/results/13559648
> I added the symbols to Source/JavaScriptCore/JavaScriptCore.order. Any idea why I'm still getting linking errors on Mac?

To export symbols from core you should add them to Source/WebCore/WebCore.exp.in
Comment 17 Chris Dumez 2012-08-23 02:29:02 PDT
(In reply to comment #16)
> (In reply to comment #15)
> > (In reply to comment #14)
> > > (From update of attachment 160111 [details] [details] [details])
> > > Attachment 160111 [details] [details] [details] did not pass mac-ews (mac):
> > > Output: http://queues.webkit.org/results/13559648
> > I added the symbols to Source/JavaScriptCore/JavaScriptCore.order. Any idea why I'm still getting linking errors on Mac?
> 
> To export symbols from core you should add them to Source/WebCore/WebCore.exp.in

AFAIK, WebCore.exp.in is used to export symbols from WebCore to WebKit API. In my case, I need to export symbols from JavaScriptCore to WebCore.
Comment 18 Chris Dumez 2012-08-23 02:43:39 PDT
Created attachment 160120 [details]
Patch

Export several JSC symbols, hopefully fixing Mac build.
Comment 19 Kentaro Hara 2012-08-23 02:44:13 PDT
This page might be helpful for you:
http://trac.webkit.org/wiki/ExportingSymbols
Comment 20 Chris Dumez 2012-08-23 03:03:26 PDT
Created attachment 160121 [details]
Patch

Clean up the symbols export based on the wiki page Haraken provided (Thanks!)
Comment 21 Chris Dumez 2012-08-23 03:52:23 PDT
Comment on attachment 160121 [details]
Patch

Will handle the object identify issue reported by Oliver.
Comment 22 Chris Dumez 2012-08-23 03:56:19 PDT
Created attachment 160126 [details]
Patch

Fix the object identity issue mentionned by Oliver.
Comment 23 WebKit Review Bot 2012-08-23 04:41:17 PDT
Comment on attachment 160126 [details]
Patch

Attachment 160126 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13563636

New failing tests:
animations/suspend-resume-animation-events.html
Comment 24 WebKit Review Bot 2012-08-23 04:41:21 PDT
Created attachment 160128 [details]
Archive of layout-test-results from gce-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-03  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 25 Chris Dumez 2012-08-23 04:43:36 PDT
Comment on attachment 160126 [details]
Patch

Chrome warning seems unrelated. Setting cq? again.
Comment 26 Chris Dumez 2012-08-23 11:38:06 PDT
Created attachment 160204 [details]
Patch

Bump CurrentVersion in SerializedScriptValue.cpp as requested on IRC.
Comment 27 WebKit Review Bot 2012-08-23 12:08:32 PDT
Comment on attachment 160204 [details]
Patch

Clearing flags on attachment: 160204

Committed r126464: <http://trac.webkit.org/changeset/126464>
Comment 28 WebKit Review Bot 2012-08-23 12:08:38 PDT
All reviewed patches have been landed.  Closing bug.