Bug 151813 - JSON.stringify returns empty when used with performance.timing.
Summary: JSON.stringify returns empty when used with performance.timing.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 9
Hardware: Macintosh OS X 10.10
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-12-03 11:45 PST by Guilherme
Modified: 2016-09-01 03:10 PDT (History)
7 users (show)

See Also:


Attachments
Patch (17.67 KB, patch)
2016-08-29 16:30 PDT, Dean Jackson
sam: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-yosemite (982.16 KB, application/zip)
2016-08-29 17:05 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme 2015-12-03 11:45:13 PST
> performance.timing
< PerformanceTiming {navigationStart: 1449169187074, unloadEventStart: 0, unloadEventEnd: 0, redirectStart: 0, redirectEnd: 0, …} = $1
> JSON.stringify(performance.timing)

< "{}" = $2
Comment 1 euskadi31 2016-07-13 10:00:55 PDT
I confirm the problem.

Safari Version 9.1.1 (11601.6.17)
Comment 2 tpessato 2016-08-26 12:31:15 PDT
I'm having the same problem.

Are there any plans to fix this anytime soon? Really need this.
Comment 3 Radar WebKit Bug Importer 2016-08-29 16:24:51 PDT
<rdar://problem/28066067>
Comment 4 Dean Jackson 2016-08-29 16:26:15 PDT
(In reply to comment #2)
> I'm having the same problem.
> 
> Are there any plans to fix this anytime soon? Really need this.

Yes, because you asked nicely!!! :)
Comment 5 tpessato 2016-08-29 16:29:04 PDT
(In reply to comment #4)
> (In reply to comment #2)
> > I'm having the same problem.
> > 
> > Are there any plans to fix this anytime soon? Really need this.
> 
> Yes, because you asked nicely!!! :)

Yey, Thank you! :)
Comment 6 Dean Jackson 2016-08-29 16:30:05 PDT
Created attachment 287347 [details]
Patch
Comment 7 Sam Weinig 2016-08-29 16:39:04 PDT
Comment on attachment 287347 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287347&action=review

> Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp:46
> +    CodeBlock* codeBlock = state.codeBlock();
> +    PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);

I don't think you need to set the isStrictMode bit here. Just set it to false and remove the code block.  Probably also want to use putDirect.
Comment 8 Build Bot 2016-08-29 17:05:37 PDT
Comment on attachment 287347 [details]
Patch

Attachment 287347 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1968461

New failing tests:
http/tests/misc/webtiming-no-origin.html
http/tests/misc/webtiming-cross-origin-redirect.php
http/tests/misc/webtiming-cross-origin-and-back1.html
Comment 9 Build Bot 2016-08-29 17:05:40 PDT
Created attachment 287354 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 10 Dean Jackson 2016-08-29 17:17:38 PDT
Committed r205161: <http://trac.webkit.org/changeset/205161>
Comment 11 Csaba Osztrogonác 2016-09-01 03:10:13 PDT
(In reply to comment #10)
> Committed r205161: <http://trac.webkit.org/changeset/205161>

It broke the !ENABLE(WEB_TIMING) build:

../../Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp:38:14: error: 'JSPerformanceTiming' has not been declared
../../Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp: In function 'JSC::JSValue WebCore::toJSON(JSC::ExecState&)':
../../Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp:40:5: error: 'PerformanceTiming' was not declared in this scope
../../Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp:40:24: error: 'timing' was not declared in this scope
../../Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp:40:41: error: 'wrapped' was not declared in this scope


Source/WebCore/page/PerformanceTiming.idl is guarded,
so JSPerformanceTimingCustom.cpp should be guarded too.