Bug 128080 - WebKit Bot Watcher's Dashboard: Teach JSON.load() to interpret third argument as either an option dictionary or a failure callback
Summary: WebKit Bot Watcher's Dashboard: Teach JSON.load() to interpret third argument...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-02 12:55 PST by Daniel Bates
Modified: 2014-02-03 10:04 PST (History)
1 user (show)

See Also:


Attachments
Patch (2.77 KB, patch)
2014-02-02 13:04 PST, Daniel Bates
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2014-02-02 12:55:15 PST
For convenience JSON.load() should accept either a Function object or an Object for the data type of the third argument of JSON.load() such that we can call JSON.load() with following forms:

1. JSON.load("http://www.apple.com", function() {/* success */})
2. JSON.load("http://www.apple.com", function() {/* success */}, {withCredentials: true, ...});
3. JSON.load("http://www.apple.com", function() {/* success */}, function() { /* failure */ })
4. JSON.load("http://www.apple.com", function() {/* success */}, function() {/* failure */}, {withCredentials: true, ...})

Currently JSON.load() can be called with forms: (1), (3), and (4).

As implied above, form (2) makes using JSON.load() more convenient when a failure callback function isn't necessary, but a person wants to pass an option dictionary because a person doesn't need to explicitly pass null or a reference to an empty function for the value of the third argument.
Comment 1 Daniel Bates 2014-02-02 13:04:08 PST
Created attachment 222936 [details]
Patch
Comment 2 Daniel Bates 2014-02-03 10:04:18 PST
Committed r163313: <http://trac.webkit.org/changeset/163313>