зеркало из https://github.com/mozilla/gecko-dev.git
Make XPCSafeJSObjectWrapper easier to use by not throwing for primitive values passed to the constructor. Use it in more places in PAC. bug 388450, r=crowder sr=brendan a=bzbarsky
This commit is contained in:
Родитель
48153c5284
Коммит
a9f1777416
|
@ -867,7 +867,8 @@ XPC_SJOW_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
obj = nsnull;
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(argv[0])) {
|
||||
return ThrowException(NS_ERROR_INVALID_ARG, cx);
|
||||
*rval = argv[0];
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *objToWrap = JSVAL_TO_OBJECT(argv[0]);
|
||||
|
|
|
@ -96,16 +96,17 @@ nsProxyAutoConfig.prototype = {
|
|||
return null;
|
||||
|
||||
// Call the original function
|
||||
var rval = this._sandBox.FindProxyForURL(testURI, testHost);
|
||||
try {
|
||||
var rval = this._sandBox.FindProxyForURL(testURI, testHost);
|
||||
} catch (e) {
|
||||
throw new XPCSafeJSObjectWrapper(e);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
function proxyAlert(msg) {
|
||||
// Ensure that we have a string.
|
||||
if (typeof msg != "string")
|
||||
msg = new XPCSafeJSObjectWrapper(msg).toString();
|
||||
|
||||
msg = new XPCSafeJSObjectWrapper(msg);
|
||||
try {
|
||||
// It would appear that the console service is threadsafe.
|
||||
var cns = Components.classes["@mozilla.org/consoleservice;1"]
|
||||
|
@ -127,9 +128,7 @@ function myIpAddress() {
|
|||
|
||||
// wrapper for resolving hostnames called by PAC file
|
||||
function dnsResolve(host) {
|
||||
if (typeof host != "string")
|
||||
host = new XPCSafeJSObjectWrapper(host).toString();
|
||||
|
||||
host = new XPCSafeJSObjectWrapper(host);
|
||||
try {
|
||||
return dns.resolve(host, 0).getNextAddrAsString();
|
||||
} catch (e) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче