string run(const url& url_) throw (bad_alloc) {
		vector<Value> args;
		args.push_back(glb.newString(url_.to_string()));
		args.push_back(glb.newString(url_.get_host()));

		Value res = glb.call("FindProxyForURL", args);
		if (res.isString() && !res.isException())
			return res.toString();
		return "";
	}
    string run(const url& url_) throw (bad_alloc) {
        JSStringRef str = NULL;
        JSValueRef  val = NULL;
        string      tmp;

        // Run the PAC
        tmp = string("FindProxyForURL(\"") + url_.to_string() + string("\", \"") + url_.get_host() + "\");";
        str = JSStringCreateWithUTF8CString(tmp.c_str());
        if (!str) throw bad_alloc();
        if (!JSCheckScriptSyntax(this->jsctx, str, NULL, 0, NULL))            goto error;
        if (!(val = JSEvaluateScript(this->jsctx, str, NULL, NULL, 1, NULL))) goto error;
        if (!JSValueIsString(this->jsctx, val))                               goto error;
        JSStringRelease(str);

        // Convert the return value to a string
        return jstr2str(JSValueToStringCopy(this->jsctx, val, NULL), true);

error:
        JSStringRelease(str);
        return "";
    }