Bug 155917 - Date.prototype.toLocaleDateString uses overridable Object.create
Summary: Date.prototype.toLocaleDateString uses overridable Object.create
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
Depends on:
Reported: 2016-03-25 20:44 PDT by Joseph Pecoraro
Modified: 2016-03-25 22:31 PDT (History)
8 users (show)

See Also:

[PATCH] Proposed Fix (5.89 KB, patch)
2016-03-25 21:25 PDT, Joseph Pecoraro
mark.lam: review+
joepeck: commit-queue-
Details | Formatted Diff | Diff
[PATCH] For Landing (5.88 KB, patch)
2016-03-25 21:31 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-03-25 20:44:41 PDT
Date.prototype.toLocaleDateString uses overridable Object.create.

Object.create = function() { console.log("HERE"); }
(new Date).toLocaleString()

"HERE" is logged and a TypeError is thrown.

The builtin implementation has:

    options = @Object.create(options)

Seems this should be:

    options = @Object.@create(options);

Otherwise it could be using a user overridden version of Object.create.

Perhaps here we can just use a regular object literal here.
Comment 1 Joseph Pecoraro 2016-03-25 21:25:04 PDT
Created attachment 274973 [details]
[PATCH] Proposed Fix
Comment 2 Mark Lam 2016-03-25 21:28:38 PDT
Comment on attachment 274973 [details]
[PATCH] Proposed Fix

Comment 3 Joseph Pecoraro 2016-03-25 21:30:18 PDT
Comment on attachment 274973 [details]
[PATCH] Proposed Fix

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

> LayoutTests/js/script-tests/regress-155917.js:2
> +"Regression test for https://webkit.org/b/140579. This test should run without throwing an exception."

Typo! This should be 155917
Comment 4 Joseph Pecoraro 2016-03-25 21:31:27 PDT
Created attachment 274974 [details]
[PATCH] For Landing
Comment 5 WebKit Commit Bot 2016-03-25 22:31:24 PDT
Comment on attachment 274974 [details]
[PATCH] For Landing

Clearing flags on attachment: 274974

Committed r198711: <http://trac.webkit.org/changeset/198711>
Comment 6 WebKit Commit Bot 2016-03-25 22:31:27 PDT
All reviewed patches have been landed.  Closing bug.