garden-o-matic broken: TypeError: 'undefined' is not an object (evaluating 'buildLoca...
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jun 2012 03:36:48 +0000 (03:36 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jun 2012 03:36:48 +0000 (03:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90243

Reviewed by Dirk Pranke.

jQuery was trying to be too smart and parsing the jsonp as json because of it's content-type.
Excise jQuery and just use XHR directly since it's easier to maintain something where we control it
all.

Not really sure how to unittest this. I tested it all manually of course.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/net.js:
Made net.ajax a drop-in replacement for the features of $.ajax that we were using.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui_unittests.js:
Not related to this patch, but figured I'd update the failing test while I was at it.

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/net.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui_unittests.js
Tools/ChangeLog

index 0a4baae..cc14057 100644 (file)
@@ -27,23 +27,51 @@ var net = net || {};
 
 (function () {
 
-net.post = $.post;
-net.get = $.get;
-net.ajax = $.ajax;
+// FIXME: Excise this last bit of jquery ajax code.
+// There are callers that depend on automatically parsing the content as JSON or XML
+// based off the content-type. Instead we should add net.json and net.xml for those cases.
+net.get = function(url, success)
+{
+    $.get(url, success);
+};
+
+net.ajax = function(options)
+{
+    var xhr = new XMLHttpRequest();
+    var method = options.type || 'GET';
+    var async = true;
+    xhr.open(method, options.url, async);
+    xhr.onload = function() {
+        if (xhr.status == 200 && options.success)
+            options.success(xhr.responseText);
+        else if (xhr.status != 200 && options.error)
+            options.error();
+    };
+    xhr.onerror = function() {
+        if (options.error)
+            options.error();
+    };
+    xhr.send(options.data || null);
+};
+
+net.post = function(url, data, success)
+{
+    net.ajax({
+        url: url,
+        type: 'POST',
+        data: data,
+        success: success,
+    });
+
+};
 
 net.probe = function(url, options)
 {
-    $.ajax({
+    net.ajax({
         url: url,
         type: 'HEAD',
-        success: function() {
-            if (options.success)
-                options.success.call();
-        },
-        error: function() {
-            if (options.error)
-                options.error.call();
-        },
+        success: options.success,
+        error: options.error,
     });
 };
 
@@ -52,12 +80,12 @@ net.probe = function(url, options)
 // by setting CORS headers.
 net.jsonp = function(url, callback)
 {
-    $.ajax({
+    net.ajax({
         url: url,
         success: function(jsonp) {
             callback(base.parseJSONP(jsonp));
         },
-        error: function(request, textStatus, errorThrown) {
+        error: function() {
             callback({});
         },
     });
index a86177d..74de3e4 100644 (file)
@@ -54,7 +54,7 @@ test("ui.onebar", 3, function() {
     onebar = new ui.onebar();
     onebar.attach();
     equal(onebar.innerHTML,
-        '<div><select id="platform-picker"><option>Apple</option><option>Chromium</option><option>GTK</option></select></div>' +
+        '<div><select id="platform-picker"><option>Apple</option><option>Chromium</option><option>GTK</option><option>Qt</option></select></div>' +
         '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">' +
             '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#unexpected">Unexpected Failures</a></li>' +
             '<li class="ui-state-default ui-corner-top"><a href="#expected">Expected Failures</a></li>' +
index adb373b..f752f39 100644 (file)
@@ -1,3 +1,21 @@
+2012-06-29  Ojan Vafai  <ojan@chromium.org>
+
+        garden-o-matic broken: TypeError: 'undefined' is not an object (evaluating 'buildLocations[currentIndex].url')
+        https://bugs.webkit.org/show_bug.cgi?id=90243
+
+        Reviewed by Dirk Pranke.
+
+        jQuery was trying to be too smart and parsing the jsonp as json because of it's content-type.
+        Excise jQuery and just use XHR directly since it's easier to maintain something where we control it
+        all.
+
+        Not really sure how to unittest this. I tested it all manually of course.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/net.js:
+        Made net.ajax a drop-in replacement for the features of $.ajax that we were using.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui_unittests.js:
+        Not related to this patch, but figured I'd update the failing test while I was at it.
+
 2012-06-29  Yaron Friedman  <yfriedman@chromium.org>
 
         Fix layout test runner for Android after https://bugs.webkit.org/show_bug.cgi?id=88134