static JSBool resolve(JSContext *js_context, JSObject *obj, jsval id, uintN flags, JSObject **objp) { if ((flags & JSRESOLVE_ASSIGNING) == 0) { JSBool resolved_p; if (!JS_ResolveStandardClass(js_context, obj, id, &resolved_p)) return JS_FALSE; if (resolved_p) *objp = obj; } return JS_TRUE; }
/* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */ NS_IMETHODIMP nsJSSh::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval) { JSBool resolved; JSAutoRequest ar(cx); *_retval = JS_ResolveStandardClass(cx, obj, id, &resolved); if (*_retval && resolved) *objp = obj; return NS_OK; }
/** Lazy resolver for global classes. * Originally from js.c; cruft removed. */ static JSBool global_newresolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp) { if ((flags & JSRESOLVE_ASSIGNING) == 0) { JSBool resolved; if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) return JS_FALSE; if (resolved) { *objp = obj; } } return JS_TRUE; }
/* static */ bool WebIDLGlobalNameHash::ResolveForSystemGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId, bool* aResolvedp) { MOZ_ASSERT(JS_IsGlobalObject(aObj)); // First we try to resolve standard classes. if (!JS_ResolveStandardClass(aCx, aObj, aId, aResolvedp)) { return false; } if (*aResolvedp) { return true; } // We don't resolve any non-string entries. if (!JSID_IS_STRING(aId)) { return true; } // XXX(nika): In the Window case, we unwrap our global object here to handle // XRays. I don't think we ever create xrays to system globals, so I believe // we can skip this step. MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(aObj), "Xrays not supported!"); // Look up the corresponding entry in the name table, and resolve if enabled. const WebIDLNameTableEntry* entry = GetEntry(JSID_TO_FLAT_STRING(aId)); if (entry && (!entry->mEnabled || entry->mEnabled(aCx, aObj))) { if (NS_WARN_IF(!GetPerInterfaceObjectHandle( aCx, entry->mConstructorId, entry->mCreate, /* aDefineOnGlobal = */ true))) { return Throw(aCx, NS_ERROR_FAILURE); } *aResolvedp = true; } return true; }
static JSBool global_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, MutableHandleObject objp) { #ifdef LAZY_STANDARD_CLASSES if ((flags & JSRESOLVE_ASSIGNING) == 0) { JSBool resolved; if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) return JS_FALSE; if (resolved) { objp.set(obj); return JS_TRUE; } } #endif #if defined(SHELL_HACK) && defined(DEBUG) && defined(XP_UNIX) if ((flags & (JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING)) == 0) { /* * Do this expensive hack only for unoptimized Unix builds, which are * not used for benchmarking. */ char *path, *comp, *full; const char *name; JSBool ok, found; JSFunction *fun; if (!JSVAL_IS_STRING(id)) return JS_TRUE; path = getenv("PATH"); if (!path) return JS_TRUE; path = JS_strdup(cx, path); if (!path) return JS_FALSE; name = JS_GetStringBytes(JSVAL_TO_STRING(id)); ok = JS_TRUE; for (comp = strtok(path, ":"); comp; comp = strtok(NULL, ":")) { if (*comp != '\0') { full = JS_smprintf("%s/%s", comp, name); if (!full) { JS_ReportOutOfMemory(cx); ok = JS_FALSE; break; } } else { full = (char *)name; } found = (access(full, X_OK) == 0); if (*comp != '\0') free(full); if (found) { fun = JS_DefineFunction(cx, obj, name, Exec, 0, JSPROP_ENUMERATE); ok = (fun != NULL); if (ok) objp.set(obj); break; } } JS_free(cx, path); return ok; } #else return JS_TRUE; #endif }
static JSBool SafeGlobalResolve(JSContext *cx, JSObject *obj, jsid id) { JSBool resolved; return JS_ResolveStandardClass(cx, obj, id, &resolved); }
JSBool JsGlobal::ResolveClass(JSContext *cx, JSObject *obj, jsid id, JSBool *resolved) { if (!JS_ResolveStandardClass(cx, obj, id, resolved)) return JS_FALSE; return JS_TRUE; }
static bool GlobalResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id) { bool resolved = false; return JS_ResolveStandardClass(cx, obj, id, &resolved); }