(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,
});
};
// 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({});
},
});
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>' +
+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