feed-parts/header: The wrapped Utils.uri() now accepts the 2nd argument. Utils.parseRemoteDocument() works again.

This commit is contained in:
satyr 2010-04-15 09:14:02 +09:00
Родитель 46b08f59bc
Коммит 87d0ae6550
1 изменённых файлов: 15 добавлений и 18 удалений

Просмотреть файл

@ -2,29 +2,27 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var Utils = {
__proto__: Cu.import("resource://ubiquity/modules/utils.js", null).Utils,
__globalObject: this,
// Just like the standard Utils.uri, only if we get a malformed URI
// error, we'll try re-evaluating the string using a base URI of the
// feed making the call.
uri: function uri(obj) {
try {
return this.__proto__.uri(obj);
} catch (e if (typeof obj !== "string" &&
e.result === Cr.NS_ERROR_MALFORMED_URI)) {
return this.__proto__.uri({uri: obj, base: feed.id});
}
};
// Just like the standard Utils.uri, only if we get a malformed URI
// error, we'll try re-evaluating the string using a base URI of the
// feed making the call.
Utils.uri = Utils.url = function uri(obj, defaultUri) {
try {
return this.__proto__.uri(obj, defaultUri);
} catch (e if (typeof obj !== "string" &&
e.result === Cr.NS_ERROR_MALFORMED_URI)) {
return this.__proto__.uri({uri: obj, base: feed.id}, defaultUri);
}
};
Utils.url = Utils.uri;
Utils.ajaxGet = function ajaxGet(url, callbackFunction, failureFunction) (
jQuery.ajax({url: url, success: callbackFunction, error: failureFunction}));
Utils.ajaxGet = function ajaxGet(url, callback, errorCallback) {
return jQuery.ajax({url: url, success: callback, error: errorCallback});
};
Utils.parseRemoteDocument = function parseRemoteDocument(
remoteUrl, postParams, successCallback, errorCallback) {
remoteUrl, postParams, callback, errorCallback) {
var ajaxOptions = {
url: remoteUrl,
dataType: "text",
success: function pRD_success(htm) { Utils.parseDocument(htm, callback) },
success: function pRD_success(htm) { Utils.parseHtml(htm, callback) },
error: errorCallback,
};
if (postParams) {
@ -38,7 +36,6 @@ var CmdUtils = {
__proto__:
Cu.import("resource://ubiquity/modules/cmdutils.js", null).CmdUtils,
__globalObject: this,
__nextId: 0,
};
Cu.import("resource://ubiquity/modules/nountypes.js");