Accessing Trac from build.webkit.org/dashboard should enable XMLHttpRequest.withCrede...
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jan 2014 20:06:32 +0000 (20:06 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jan 2014 20:06:32 +0000 (20:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126391

Reviewed by Dan Bernstein.

Make it conditional, as trac.webkit.org doesn't work when withCredentials is enabled.
One can request credentials use via Initialization.js.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
(Trac):
(Trac.prototype.update):
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:
(loadXML):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js
Tools/ChangeLog

index ba73443..c1cc432 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-Trac = function(baseURL)
+Trac = function(baseURL, options)
 {
     BaseObject.call(this);
 
     console.assert(baseURL);
 
     this.baseURL = baseURL;
+    this._needsAuthentication = (typeof options === "object") && options[Trac.NeedsAuthentication] === true;
+
     this.recordedCommits = []; // Will be sorted in ascending order.
 
     this.update();
@@ -38,6 +40,7 @@ Trac = function(baseURL)
 
 BaseObject.addConstructorFunctions(Trac);
 
+Trac.NeedsAuthentication = "needsAuthentication";
 Trac.UpdateInterval = 45000; // 45 seconds
 
 Trac.Event = {
@@ -130,6 +133,6 @@ Trac.prototype = {
             this.recordedCommits = this.recordedCommits.concat(newCommits.reverse());
 
             this.dispatchEventToListeners(Trac.Event.NewCommitsRecorded, {newCommits: newCommits});
-        }.bind(this));
+        }.bind(this), this._needsAuthentication ? { withCredentials: true } : {});
     }
 };
index 5d674d1..d5c2b82 100644 (file)
@@ -50,7 +50,7 @@ JSON.load = function(url, callback)
     request.send();
 };
 
-function loadXML(url, callback) {
+function loadXML(url, callback, options) {
     console.assert(url);
 
     if (!(callback instanceof Function))
@@ -67,9 +67,8 @@ function loadXML(url, callback) {
     };
 
     request.open("GET", url);
-    // FIXME: It's not nice that one of the loading helpers here enables credentials, and
-    // others don't. Credentials are needed for some trac installations.
-    request.withCredentials = true;
+    if ((typeof options === "object") && options.hasOwnProperty("withCredentials"))
+        request.withCredentials = options.withCredentials;
     request.send();
 };
 
index 27656b1..f088040 100644 (file)
@@ -1,3 +1,19 @@
+2014-01-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Accessing Trac from build.webkit.org/dashboard should enable XMLHttpRequest.withCredentials
+        https://bugs.webkit.org/show_bug.cgi?id=126391
+
+        Reviewed by Dan Bernstein.
+
+        Make it conditional, as trac.webkit.org doesn't work when withCredentials is enabled.
+        One can request credentials use via Initialization.js.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
+        (Trac):
+        (Trac.prototype.update):
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:
+        (loadXML):
+
 2014-01-02  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r160846.