PassRefPtr<SerializedScriptValue> InjectedScript::wrapForConsole(ScriptValue value) { ASSERT(!hasNoValue()); ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObjectForConsole"); wrapFunction.appendArgument(value); wrapFunction.appendArgument(canAccessInspectedWindow()); bool hadException = false; ScriptValue r = wrapFunction.call(hadException); if (hadException) return SerializedScriptValue::create("<exception>"); return r.serialize(m_injectedScriptObject.scriptState()); }
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) const { ASSERT(!isEmpty()); ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject"); wrapFunction.appendArgument(value); wrapFunction.appendArgument(groupName); wrapFunction.appendArgument(canAccessInspectedWindow()); wrapFunction.appendArgument(generatePreview); bool hadException = false; ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) return nullptr; RefPtr<JSONObject> rawResult = toJSONValue(r)->asObject(); return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); }
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(ScriptValue value, const String& groupName) const { ASSERT(!hasNoValue()); ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject"); wrapFunction.appendArgument(value); wrapFunction.appendArgument(groupName); wrapFunction.appendArgument(canAccessInspectedWindow()); bool hadException = false; ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) { return 0; } RefPtr<InspectorObject> rawResult = r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject(); return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); }
void f0ext_bang(t_f0ext *x) { switch(x->loop) { case 1: x->val= wrapFunction(x, x->val, x->min, x->max); break; case 2: x->val= foldFunction(x, x->val, x->min, x->max); break; default: x->val= clipFunction(x, x->val, x->min, x->max); break; } outlet_float(x->out, x->val); x->val = x->val+x->step; }
PassRefPtr<InspectorObject> InjectedScript::wrapObject(ScriptValue value, const String& groupName) const { ASSERT(!hasNoValue()); ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject"); wrapFunction.appendArgument(value); wrapFunction.appendArgument(groupName); wrapFunction.appendArgument(canAccessInspectedWindow()); bool hadException = false; ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) { RefPtr<InspectorObject> result = InspectorObject::create(); result->setString("description", "<exception>"); return result; } return r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject(); }
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const ScriptValue& table, const ScriptValue& columns) const { ASSERT(!isEmpty()); ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapTable"); wrapFunction.appendArgument(canAccessInspectedWindow()); wrapFunction.appendArgument(table); if (columns.isEmpty()) wrapFunction.appendArgument(false); else wrapFunction.appendArgument(columns); bool hadException = false; ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) return nullptr; RefPtr<JSONObject> rawResult = toJSONValue(r)->asObject(); return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); }
PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const { ASSERT(!hasNoValue()); Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapObject"), inspectorEnvironment()->functionCallHandler()); wrapFunction.appendArgument(value); wrapFunction.appendArgument(groupName); wrapFunction.appendArgument(hasAccessToInspectedScriptState()); wrapFunction.appendArgument(generatePreview); bool hadException = false; Deprecated::ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) return nullptr; RefPtr<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject(); return Inspector::TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); }
PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const { ASSERT(!hasNoValue()); Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapTable"), inspectorEnvironment()->functionCallHandler()); wrapFunction.appendArgument(hasAccessToInspectedScriptState()); wrapFunction.appendArgument(table); if (columns.hasNoValue()) wrapFunction.appendArgument(false); else wrapFunction.appendArgument(columns); bool hadException = false; Deprecated::ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); if (hadException) return nullptr; RefPtr<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject(); return Inspector::TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); }