JSValue* JSInspectedObjectWrapper::prepareIncomingValue(ExecState*, JSValue* value) const { // The Inspector is only allowed to pass primitive values and wrapped objects to objects from the inspected page. if (!value->isObject()) return value; JSQuarantinedObjectWrapper* wrapper = asWrapper(value); ASSERT_WITH_MESSAGE(wrapper, "Objects passed to JSInspectedObjectWrapper must be wrapped"); if (!wrapper) return jsUndefined(); if (wrapper->allowsUnwrappedAccessFrom(unwrappedExecState())) { ASSERT_WITH_MESSAGE(wrapper->inherits(&s_info), "A wrapper contains an object from the inspected page but is not a JSInspectedObjectWrapper"); if (!wrapper->inherits(&s_info)) return jsUndefined(); // Return the unwrapped object so the inspected page never sees one of its own objects in wrapped form. return wrapper->unwrappedObject(); } ASSERT_WITH_MESSAGE(wrapper->inherits(&JSInspectorCallbackWrapper::s_info), "A wrapper that was not from the inspected page and is not an Inspector callback was passed to a JSInspectedObjectWrapper"); if (!wrapper->inherits(&JSInspectorCallbackWrapper::s_info)) return jsUndefined(); return wrapper; }
JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, JSValue* wrappedPrototype) : JSObject(wrappedPrototype) , m_unwrappedGlobalObject(unwrappedExec->dynamicGlobalObject()) , m_unwrappedObject(unwrappedObject) { ASSERT_ARG(unwrappedExec, unwrappedExec); ASSERT_ARG(unwrappedObject, unwrappedObject); ASSERT_ARG(wrappedPrototype, wrappedPrototype); ASSERT_ARG(wrappedPrototype, !wrappedPrototype->isObject() || asWrapper(wrappedPrototype)); }