Title: [163313] trunk/Tools
Revision
163313
Author
dba...@webkit.org
Date
2014-02-03 10:08:59 -0800 (Mon, 03 Feb 2014)

Log Message

WebKit Bot Watcher's Dashboard: Teach JSON.load() to interpret third argument as either an
option dictionary or a failure callback
https://bugs.webkit.org/show_bug.cgi?id=128080

Reviewed by Alexey Proskuryakov.

Currently JSON.load() takes a failure callback function as its third argument and
an option dictionary as its fourth argument. So, a caller that wants to ignore errors
and pass an option dictionary must pass null or a reference to an empty function for
the value of third argument. Instead, we should make the third argument polymorphic for
convenience. Then a caller can either pass a failure callback function or an option dictionary.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js (163312 => 163313)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js	2014-02-03 17:39:25 UTC (rev 163312)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js	2014-02-03 18:08:59 UTC (rev 163313)
@@ -26,6 +26,15 @@
 JSON.LoadError = "JSONLoadError";
 JSON.ParseError = "JSONParseError";
 
+// JSON.load() may be called using the following forms:
+//
+// JSON.load("http://www.apple.com", function() {/* success */})
+// OR
+// JSON.load("http://www.apple.com", function() {/* success */}, {withCredentials: true, ...})
+// OR
+// JSON.load("http://www.apple.com", function() {/* success */}, function() {/* failure */})
+// OR
+// JSON.load("http://www.apple.com", function() {/* success */}, function() {/* failure */}, {withCredentials: true, ...})
 JSON.load = function(url, successCallback, failureCallback, options)
 {
     console.assert(url);
@@ -33,6 +42,9 @@
     if (!(successCallback instanceof Function))
         return;
 
+    if (failureCallback && typeof failureCallback === "object")
+        options = failureCallback;
+
     if (!(failureCallback instanceof Function))
         failureCallback = function() { };
 

Modified: trunk/Tools/ChangeLog (163312 => 163313)


--- trunk/Tools/ChangeLog	2014-02-03 17:39:25 UTC (rev 163312)
+++ trunk/Tools/ChangeLog	2014-02-03 18:08:59 UTC (rev 163313)
@@ -1,3 +1,19 @@
+2014-02-03  Daniel Bates  <daba...@apple.com>
+
+        WebKit Bot Watcher's Dashboard: Teach JSON.load() to interpret third argument as either an
+        option dictionary or a failure callback
+        https://bugs.webkit.org/show_bug.cgi?id=128080
+
+        Reviewed by Alexey Proskuryakov.
+
+        Currently JSON.load() takes a failure callback function as its third argument and
+        an option dictionary as its fourth argument. So, a caller that wants to ignore errors
+        and pass an option dictionary must pass null or a reference to an empty function for
+        the value of third argument. Instead, we should make the third argument polymorphic for
+        convenience. Then a caller can either pass a failure callback function or an option dictionary.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:
+
 2014-02-03  Krzysztof Czech  <k.cz...@samsung.com>
 
         [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to