https://bugs.webkit.org/show_bug.cgi?id=76861
../JavaScriptCore:
Reviewed by Gavin Barraclough.
This makes the common case -- toString() on a string -- faster and
inline-able. (Not a measureable speedup, but we can now remove a bunch
of duplicate hand-rolled code for this optimization.)
This also clarifies the boundary between "C++ strings" and "JS strings".
In all cases other than true, false, null, undefined, and multi-digit
numbers, the JS runtime was just retrieving a UString from a JSString,
so returning a JSString* is strictly better. In the other cases, we can
optimize to avoid creating a new JSString if we care to, but it doesn't
seem to be a big deal.
* JavaScriptCore.exp: Export!
* jsc.cpp:
(functionPrint):
(functionDebug):
(functionRun):
(functionLoad):
(functionCheckSyntax):
(runWithScripts):
(runInteractive):
* API/JSValueRef.cpp:
(JSValueToStringCopy):
* bytecode/CodeBlock.cpp:
(JSC::valueToSourceString): Call value() after calling toString(), to
convert from "JS string" (JSString*) to "C++ string" (UString), since
toString() no longer returns a "C++ string".
* dfg/DFGOperations.cpp:
(JSC::DFG::operationValueAddNotNumber):
* jit/JITStubs.cpp:
(op_add): Updated for removal of toPrimitiveString():
all '+' operands can use toString(), except for object operands, which
need to take a slow path to call toPrimitive().
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncPush):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::opIn):
* runtime/DateConstructor.cpp:
(JSC::dateParse):
* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate): Call value() after calling toString(), as above.
* runtime/ErrorInstance.h:
(JSC::ErrorInstance::create): Simplified down to one canonical create()
function, to make string handling easier.
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/ExceptionHelpers.cpp:
(JSC::createInvalidParamError):
(JSC::createNotAConstructorError):
(JSC::createNotAFunctionError):
(JSC::createNotAnObjectError):
* runtime/FunctionConstructor.cpp:
(JSC::constructFunctionSkippingEvalEnabledCheck):
* runtime/FunctionPrototype.cpp:
(JSC::functionProtoFuncBind):
* runtime/JSArray.cpp:
(JSC::JSArray::sort): Call value() after calling toString(), as above.
* runtime/JSCell.cpp:
* runtime/JSCell.h: Removed JSCell::toString() because JSValue does this
job now. Doing it in JSCell is slower (requires extra type checking), and
creates the misimpression that language-defined toString() behavior is
an implementation detail of JSCell.
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::encode):
(JSC::decode):
(JSC::globalFuncEval):
(JSC::globalFuncParseInt):
(JSC::globalFuncParseFloat):
(JSC::globalFuncEscape):
(JSC::globalFuncUnescape): Call value() after calling toString(), as above.
* runtime/JSONObject.cpp:
(JSC::unwrapBoxedPrimitive):
(JSC::Stringifier::Stringifier):
(JSC::JSONProtoFuncParse): Removed some manual optimization that toString()
takes care of.
* runtime/JSObject.cpp:
(JSC::JSObject::toString):
* runtime/JSObject.h: Updated to return JSString*.
* runtime/JSString.cpp:
* runtime/JSString.h:
(JSC::JSValue::toString): Removed, since I removed JSCell::toString().
* runtime/JSValue.cpp:
(JSC::JSValue::toStringSlowCase): Removed toPrimitiveString(), and re-
spawned toStringSlowCase() from its zombie corpse, since toPrimitiveString()
basically did what we want all the time. (Note that the toPrimitive()
preference changes from NoPreference to PreferString, because that's
how ToString is defined in the language. op_add does not want this behavior.)
* runtime/NumberPrototype.cpp:
(JSC::numberProtoFuncToString):
(JSC::numberProtoFuncToLocaleString): A little simpler, now that toString()
returns a JSString*.
* runtime/ObjectConstructor.cpp:
(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorDefineProperty):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable): More calls to value(), as above.
* runtime/Operations.cpp:
(JSC::jsAddSlowCase): Need to check for object before taking the toString()
fast path becuase adding an object to a string requires calling toPrimitive()
on the object, not toString(). (They differ in their preferred conversion
type.)
* runtime/Operations.h:
(JSC::jsString):
(JSC::jsStringFromArguments): This code gets simpler, now that toString()
does the right thing.
(JSC::jsAdd): Now checks for object, just like jsAddSlowCase().
* runtime/RegExpConstructor.cpp:
(JSC::setRegExpConstructorInput):
(JSC::constructRegExp):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::match):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString): More calls to value(), as above.
* runtime/StringConstructor.cpp:
(JSC::constructWithStringConstructor):
(JSC::callStringConstructor): This code gets simpler, now that toString()
does the right thing.
* runtime/StringPrototype.cpp:
(JSC::replaceUsingRegExpSearch):
(JSC::replaceUsingStringSearch):
(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncConcat):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncLastIndexOf):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplit):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncLocaleCompare):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
(JSC::trimString): Some of this code gets simpler, now that toString()
does the right thing. More calls to value(), as above.
../JavaScriptGlue:
Reviewed by Gavin Barraclough.
* JSUtils.cpp:
(KJSValueToCFTypeInternal):
../WebCore:
Reviewed by Gavin Barraclough.
Mechanical changes to call value() after calling toString(), to
convert from "JS string" (JSString*) to "C++ string" (UString), since
toString() no longer returns a "C++ string".
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
* bindings/js/JSClipboardCustom.cpp:
(WebCore::JSClipboard::clearData):
(WebCore::JSClipboard::getData):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSDOMBinding.cpp:
(WebCore::valueToStringWithNullCheck):
(WebCore::valueToStringWithUndefinedOrNullCheck):
(WebCore::reportException):
* bindings/js/JSDOMFormDataCustom.cpp:
(WebCore::JSDOMFormData::append):
* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::putDelegate):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setLocation):
(WebCore::JSDOMWindow::open):
(WebCore::JSDOMWindow::addEventListener):
(WebCore::JSDOMWindow::removeEventListener):
* bindings/js/JSDeviceMotionEventCustom.cpp:
(WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
* bindings/js/JSDeviceOrientationEventCustom.cpp:
(WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::setLocation):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::callHTMLAllCollection):
(WebCore::JSHTMLAllCollection::item):
(WebCore::JSHTMLAllCollection::namedItem):
* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::getContext):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::JSHTMLCollection::item):
(WebCore::JSHTMLCollection::namedItem):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::documentWrite):
* bindings/js/JSHTMLInputElementCustom.cpp:
(WebCore::JSHTMLInputElement::setSelectionDirection):
(WebCore::JSHTMLInputElement::setSelectionRange):
* bindings/js/JSInspectorFrontendHostCustom.cpp:
(WebCore::JSInspectorFrontendHost::showContextMenu):
* bindings/js/JSJavaScriptCallFrameCustom.cpp:
(WebCore::JSJavaScriptCallFrame::evaluate):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::setHref):
(WebCore::JSLocation::setProtocol):
(WebCore::JSLocation::setHost):
(WebCore::JSLocation::setHostname):
(WebCore::JSLocation::setPort):
(WebCore::JSLocation::setPathname):
(WebCore::JSLocation::setSearch):
(WebCore::JSLocation::setHash):
(WebCore::JSLocation::replace):
(WebCore::JSLocation::assign):
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
* bindings/js/JSSQLTransactionCustom.cpp:
(WebCore::JSSQLTransaction::executeSql):
* bindings/js/JSSQLTransactionSyncCustom.cpp:
(WebCore::JSSQLTransactionSync::executeSql):
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::putDelegate):
* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::JSWebGLRenderingContext::getExtension):
* bindings/js/JSWebSocketCustom.cpp:
(WebCore::JSWebSocketConstructor::constructJSWebSocket):
(WebCore::JSWebSocket::send):
(WebCore::JSWebSocket::close):
* bindings/js/JSWorkerContextCustom.cpp:
(WebCore::JSWorkerContext::importScripts):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::open):
(WebCore::JSXMLHttpRequest::send):
* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessor::setParameter):
(WebCore::JSXSLTProcessor::getParameter):
(WebCore::JSXSLTProcessor::removeParameter):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
* bindings/js/ScriptEventListener.cpp:
(WebCore::eventListenerHandlerBody):
* bindings/js/ScriptValue.cpp:
(WebCore::ScriptValue::toString):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateEventListenerCall):
(JSValueToNative):
(GenerateConstructorDefinition):
* bridge/c/c_utility.cpp:
(JSC::Bindings::convertValueToNPVariant):
* bridge/jni/jni_jsobject.mm:
(JavaJSObject::convertValueToJObject):
* bridge/jni/jsc/JNIUtilityPrivate.cpp:
(JSC::Bindings::convertArrayInstanceToJavaArray):
(JSC::Bindings::convertValueToJValue):
* bridge/jni/jsc/JavaFieldJSC.cpp:
(JavaField::dispatchValueFromInstance):
(JavaField::valueFromInstance):
(JavaField::dispatchSetValueToInstance):
(JavaField::setValueToInstance):
* bridge/jni/jsc/JavaInstanceJSC.cpp:
(JavaInstance::invokeMethod):
* testing/js/JSInternalsCustom.cpp:
(WebCore::JSInternals::setUserPreferredLanguages):
../WebKit/mac:
Reviewed by Gavin Barraclough.
Mechanical changes to call value() after calling toString(), to
convert from "JS string" (JSString*) to "C++ string" (UString), since
toString() no longer returns a "C++ string".
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::addValueToArray):
* WebView/WebFrame.mm:
(-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
(-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
../WebKit2:
Reviewed by Gavin Barraclough.
Mechanical changes to call value() after calling toString(), to
convert from "JS string" (JSString*) to "C++ string" (UString), since
toString() no longer returns a "C++ string".
* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105698
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
JSValue jsValue = toJS(exec, value);
- RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)));
+ RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)->value(exec)));
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ This makes the common case -- toString() on a string -- faster and
+ inline-able. (Not a measureable speedup, but we can now remove a bunch
+ of duplicate hand-rolled code for this optimization.)
+
+ This also clarifies the boundary between "C++ strings" and "JS strings".
+
+ In all cases other than true, false, null, undefined, and multi-digit
+ numbers, the JS runtime was just retrieving a UString from a JSString,
+ so returning a JSString* is strictly better. In the other cases, we can
+ optimize to avoid creating a new JSString if we care to, but it doesn't
+ seem to be a big deal.
+
+ * JavaScriptCore.exp: Export!
+
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ (runWithScripts):
+ (runInteractive):
+ * API/JSValueRef.cpp:
+ (JSValueToStringCopy):
+ * bytecode/CodeBlock.cpp:
+ (JSC::valueToSourceString): Call value() after calling toString(), to
+ convert from "JS string" (JSString*) to "C++ string" (UString), since
+ toString() no longer returns a "C++ string".
+
+ * dfg/DFGOperations.cpp:
+ (JSC::DFG::operationValueAddNotNumber):
+ * jit/JITStubs.cpp:
+ (op_add): Updated for removal of toPrimitiveString():
+ all '+' operands can use toString(), except for object operands, which
+ need to take a slow path to call toPrimitive().
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncPush):
+ * runtime/CommonSlowPaths.h:
+ (JSC::CommonSlowPaths::opIn):
+ * runtime/DateConstructor.cpp:
+ (JSC::dateParse):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate): Call value() after calling toString(), as above.
+
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::create): Simplified down to one canonical create()
+ function, to make string handling easier.
+
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunctionSkippingEvalEnabledCheck):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncBind):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort): Call value() after calling toString(), as above.
+
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h: Removed JSCell::toString() because JSValue does this
+ job now. Doing it in JSCell is slower (requires extra type checking), and
+ creates the misimpression that language-defined toString() behavior is
+ an implementation detail of JSCell.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape): Call value() after calling toString(), as above.
+
+ * runtime/JSONObject.cpp:
+ (JSC::unwrapBoxedPrimitive):
+ (JSC::Stringifier::Stringifier):
+ (JSC::JSONProtoFuncParse): Removed some manual optimization that toString()
+ takes care of.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::toString):
+ * runtime/JSObject.h: Updated to return JSString*.
+
+ * runtime/JSString.cpp:
+ * runtime/JSString.h:
+ (JSC::JSValue::toString): Removed, since I removed JSCell::toString().
+
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toStringSlowCase): Removed toPrimitiveString(), and re-
+ spawned toStringSlowCase() from its zombie corpse, since toPrimitiveString()
+ basically did what we want all the time. (Note that the toPrimitive()
+ preference changes from NoPreference to PreferString, because that's
+ how ToString is defined in the language. op_add does not want this behavior.)
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString): A little simpler, now that toString()
+ returns a JSString*.
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable): More calls to value(), as above.
+
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase): Need to check for object before taking the toString()
+ fast path becuase adding an object to a string requires calling toPrimitive()
+ on the object, not toString(). (They differ in their preferred conversion
+ type.)
+
+ * runtime/Operations.h:
+ (JSC::jsString):
+ (JSC::jsStringFromArguments): This code gets simpler, now that toString()
+ does the right thing.
+
+ (JSC::jsAdd): Now checks for object, just like jsAddSlowCase().
+
+ * runtime/RegExpConstructor.cpp:
+ (JSC::setRegExpConstructorInput):
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString): More calls to value(), as above.
+
+ * runtime/StringConstructor.cpp:
+ (JSC::constructWithStringConstructor):
+ (JSC::callStringConstructor): This code gets simpler, now that toString()
+ does the right thing.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::replaceUsingRegExpSearch):
+ (JSC::replaceUsingStringSearch):
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ (JSC::trimString): Some of this code gets simpler, now that toString()
+ does the right thing. More calls to value(), as above.
+
2012-01-23 Luke Macpherson <macpherson@chromium.org>
Unreviewed, rolling out r105676.
__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
__ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE
__ZNK3JSC6JSCell8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE
-__ZNK3JSC6JSCell8toStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
__ZNK3JSC7ArgList8getSliceEiRS0_
__ZNK3JSC7JSArray12subclassDataEv
__ZNK3JSC7JSValue16toNumberSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateEPNS_14JSGlobalObjectE
+__ZNK3JSC7JSValue16toStringSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
?toNumberSlowCase@JSValue@JSC@@ABENPAVExecState@2@@Z
?toObject@JSCell@JSC@@QBEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z
?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z
- ?toString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
- ?toString@JSObject@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
+ ?toString@JSObject@JSC@@QBEPAVJSString@2@PAVExecState@2@@Z
?toStringDecimal@DecimalNumber@WTF@@QBEIPA_WI@Z
?toStringExponential@DecimalNumber@WTF@@QBEIPA_WI@Z
+ ?toStringSlowCase@JSValue@JSC@@ABEPAVJSString@2@PAVExecState@2@@Z
?toThisObject@JSObject@JSC@@SAPAV12@PAVJSCell@2@PAVExecState@2@@Z
?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?toUInt32@Identifier@JSC@@SAIABVUString@2@AA_N@Z
return "0";
if (val.isString())
- return makeUString("\"", escapeQuotes(val.toString(exec)), "\"");
+ return makeUString("\"", escapeQuotes(val.toString(exec)->value(exec)), "\"");
return val.description();
}
JSGlobalData* globalData = &exec->globalData();
// Don't put to an object if toString throws an exception.
- Identifier ident(exec, property.toString(exec));
+ Identifier ident(exec, property.toString(exec)->value(exec));
if (!globalData->exception) {
PutPropertySlot slot(strict);
baseValue.put(exec, ident, value, slot);
ASSERT(!op1.isNumber() || !op2.isNumber());
- if (op1.isString()) {
- if (op2.isString())
- return JSValue::encode(jsString(exec, asString(op1), asString(op2)));
- return JSValue::encode(jsString(exec, asString(op1), op2.toPrimitiveString(exec)));
- }
+ if (op1.isString() && !op2.isObject())
+ return JSValue::encode(jsString(exec, asString(op1), op2.toString(exec)));
return JSValue::encode(jsAddSlowCase(exec, op1, op2));
}
}
}
- Identifier ident(exec, property.toString(exec));
+ Identifier ident(exec, property.toString(exec)->value(exec));
return JSValue::encode(baseValue.get(exec, ident));
}
return JSValue::encode(result);
}
- Identifier ident(exec, property.toString(exec));
+ Identifier ident(exec, property.toString(exec)->value(exec));
return JSValue::encode(JSValue(base).get(exec, ident));
}
JSValue v2 = stackFrame.args[1].jsValue();
CallFrame* callFrame = stackFrame.callFrame;
- if (v1.isString()) {
- JSValue result = v2.isString()
- ? jsString(callFrame, asString(v1), asString(v2))
- : jsString(callFrame, asString(v1), v2.toPrimitiveString(callFrame));
+ if (v1.isString() && !v2.isObject()) {
+ JSValue result = jsString(callFrame, asString(v1), v2.toString(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
}
return JSValue::encode(result);
}
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
JSValue result = baseValue.get(callFrame, property);
CHECK_FOR_EXCEPTION_AT_END();
return JSValue::encode(result);
ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));
}
} else {
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
result = baseValue.get(callFrame, property);
}
if (!isJSByteArray(baseValue))
ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));
} else {
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
result = baseValue.get(callFrame, property);
}
} else
baseValue.put(callFrame, i, value);
} else {
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
if (!stackFrame.globalData->exception) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
baseValue.put(callFrame, property, value, slot);
ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val));
baseValue.put(callFrame, i, value);
} else {
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
if (!stackFrame.globalData->exception) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
baseValue.put(callFrame, property, value, slot);
if (propName.getUInt32(i))
return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, i)));
- Identifier property(callFrame, propName.toString(callFrame));
+ Identifier property(callFrame, propName.toString(callFrame)->value(callFrame));
CHECK_FOR_EXCEPTION();
return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, property)));
}
result = baseObj->methodTable()->deletePropertyByIndex(baseObj, callFrame, i);
else {
CHECK_FOR_EXCEPTION();
- Identifier property(callFrame, subscript.toString(callFrame));
+ Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
CHECK_FOR_EXCEPTION();
result = baseObj->methodTable()->deleteProperty(baseObj, callFrame, property);
}
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- UString message = stackFrame.args[0].jsValue().toString(callFrame);
+ UString message = stackFrame.args[0].jsValue().toString(callFrame)->value(callFrame);
stackFrame.globalData->exception = createReferenceError(callFrame, message);
VM_THROW_EXCEPTION_AT_END();
}
if (i)
putchar(' ');
- printf("%s", exec->argument(i).toString(exec).utf8().data());
+ printf("%s", exec->argument(i).toString(exec)->value(exec).utf8().data());
}
putchar('\n');
EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
{
- fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).utf8().data());
+ fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec)->value(exec).utf8().data());
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec);
+ UString fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec);
+ UString fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec);
+ UString fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
success = success && !evaluationException;
if (dump) {
if (evaluationException)
- printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec()).utf8().data());
+ printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
else
- printf("End: %s\n", returnValue.toString(globalObject->globalExec()).utf8().data());
+ printf("End: %s\n", returnValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
}
globalData.stopSampling();
JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(line.data(), interpreterName), JSValue(), &evaluationException);
#endif
if (evaluationException)
- printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec()).utf8().data());
+ printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
else
- printf("%s\n", returnValue.toString(globalObject->globalExec()).utf8().data());
+ printf("%s\n", returnValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
globalObject->globalExec()->clearException();
}
if (element.isUndefinedOrNull())
continue;
- UString str = element.toString(exec);
+ UString str = element.toString(exec)->value(exec);
strBuffer[k] = str.impl();
totalSize += str.length();
allStrings8Bit = allStrings8Bit && str.is8Bit();
CallData callData;
CallType callType = getCallData(conversionFunction, callData);
if (callType != CallTypeNone)
- str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
+ str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec)->value(exec);
else
- str = element.toString(exec);
+ str = element.toString(exec)->value(exec);
strBuffer.append(str);
}
}
UString separator;
if (!exec->argument(0).isUndefined())
- separator = exec->argument(0).toString(exec);
+ separator = exec->argument(0).toString(exec)->value(exec);
unsigned k = 0;
if (isJSArray(thisObj)) {
goto skipFirstLoop;
JSValue element = array->getIndex(k);
if (!element.isUndefinedOrNull())
- strBuffer.append(element.toString(exec));
+ strBuffer.append(element.toString(exec)->value(exec));
k++;
}
strBuffer.append(',');
JSValue element = array->getIndex(k);
if (!element.isUndefinedOrNull())
- strBuffer.append(element.toString(exec));
+ strBuffer.append(element.toString(exec)->value(exec));
}
} else {
for (; k < length; k++) {
strBuffer.append(separator);
JSValue element = array->getIndex(k);
if (!element.isUndefinedOrNull())
- strBuffer.append(element.toString(exec));
+ strBuffer.append(element.toString(exec)->value(exec));
}
}
}
JSValue element = thisObj->get(exec, k);
if (!element.isUndefinedOrNull())
- strBuffer.append(element.toString(exec));
+ strBuffer.append(element.toString(exec)->value(exec));
}
return JSValue::encode(strBuffer.build(exec));
thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->argument(n));
else {
PutPropertySlot slot;
- Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toString(exec));
+ Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toString(exec)->value(exec));
thisObj->methodTable()->put(thisObj, exec, propertyName, exec->argument(n), slot);
}
}
if (propName.getUInt32(i))
return baseObj->hasProperty(exec, i);
- Identifier property(exec, propName.toString(exec));
+ Identifier property(exec, propName.toString(exec)->value(exec));
if (exec->globalData().exception)
return false;
return baseObj->hasProperty(exec, property);
static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec)
{
- return JSValue::encode(jsNumber(parseDate(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(jsNumber(parseDate(exec, exec->argument(0).toString(exec)->value(exec))));
}
static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*)
bool useCustomFormat = false;
UString customFormatString;
- UString arg0String = exec->argument(0).toString(exec);
+ UString arg0String = exec->argument(0).toString(exec)->value(exec);
if (arg0String == "custom" && !exec->argument(1).isUndefined()) {
useCustomFormat = true;
- customFormatString = exec->argument(1).toString(exec);
+ customFormatString = exec->argument(1).toString(exec)->value(exec);
} else if (format == LocaleDateAndTime && !exec->argument(1).isUndefined()) {
dateStyle = styleFromArgString(arg0String, dateStyle);
- timeStyle = styleFromArgString(exec->argument(1).toString(exec), timeStyle);
+ timeStyle = styleFromArgString(exec->argument(1).toString(exec)->value(exec), timeStyle);
} else if (format != LocaleTime && !exec->argument(0).isUndefined())
dateStyle = styleFromArgString(arg0String, dateStyle);
else if (format != LocaleDate && !exec->argument(0).isUndefined())
instance->finishCreation(globalData, message);
return instance;
}
+
static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message)
{
- if (message.isUndefined()) {
- ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure);
- instance->finishCreation(exec->globalData(), UString());
- return instance;
- }
- return create(exec->globalData(), structure, message.toString(exec));
+ return create(exec->globalData(), structure, message.isUndefined() ? UString() : message.toString(exec)->value(exec));
}
bool appendSourceToMessage() { return m_appendSourceToMessage; }
if (name.isUndefined())
nameString = "Error";
else {
- nameString = name.toString(exec);
+ nameString = name.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
}
if (message.isUndefined())
messageString = "";
else {
- messageString = message.toString(exec);
+ messageString = message.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
}
JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec), "' is not a valid argument for '", op, "'");
+ UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a valid argument for '", op, "'");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAConstructorError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec), "' is not a constructor");
+ UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a constructor");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAFunctionError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec), "' is not a function");
+ UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a function");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAnObjectError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec), "' is not an object");
+ UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not an object");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
if (args.isEmpty())
program = "(function() { \n})";
else if (args.size() == 1)
- program = makeUString("(function() { ", args.at(0).toString(exec), "\n})");
+ program = makeUString("(function() { ", args.at(0).toString(exec)->value(exec), "\n})");
else {
UStringBuilder builder;
builder.append("(function(");
- builder.append(args.at(0).toString(exec));
+ builder.append(args.at(0).toString(exec)->value(exec));
for (size_t i = 1; i < args.size() - 1; i++) {
builder.append(",");
- builder.append(args.at(i).toString(exec));
+ builder.append(args.at(i).toString(exec)->value(exec));
}
builder.append(") { ");
- builder.append(args.at(args.size() - 1).toString(exec));
+ builder.append(args.at(args.size() - 1).toString(exec)->value(exec));
builder.append("\n})");
program = builder.toUString();
}
length = targetLength - numBoundArgs;
}
- Identifier name(exec, target.get(exec, exec->propertyNames().name).toString(exec));
+ Identifier name(exec, target.get(exec, exec->propertyNames().name).toString(exec)->value(exec));
return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name));
}
// a toString call raises an exception.
for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
- values[i].second = values[i].first.toString(exec);
+ values[i].second = values[i].first.toString(exec)->value(exec);
if (exec->hadException()) {
Heap::heap(this)->popTempSortVector(&values);
return static_cast<const JSObject*>(this)->toNumber(exec);
}
-UString JSCell::toString(ExecState* exec) const
-{
- if (isString())
- return static_cast<const JSString*>(this)->toString(exec);
- return static_cast<const JSObject*>(this)->toString(exec);
-}
-
JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const
{
if (isString())
bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
bool toBoolean(ExecState*) const;
JS_EXPORT_PRIVATE double toNumber(ExecState*) const;
- JS_EXPORT_PRIVATE UString toString(ExecState*) const;
JS_EXPORT_PRIVATE JSObject* toObject(ExecState*, JSGlobalObject*) const;
static void visitChildren(JSCell*, SlotVisitor&);
static JSValue encode(ExecState* exec, const char* doNotEscape)
{
- UString str = exec->argument(0).toString(exec);
- CString cstr = str.utf8(true);
+ CString cstr = exec->argument(0).toString(exec)->value(exec).utf8(true);
if (!cstr.data())
return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence."));
static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict)
{
JSStringBuilder builder;
- UString str = exec->argument(0).toString(exec);
+ UString str = exec->argument(0).toString(exec)->value(exec);
if (str.is8Bit())
return decode(exec, str.characters8(), str.length(), doNotUnescape, strict);
if (!x.isString())
return JSValue::encode(x);
- UString s = x.toString(exec);
+ UString s = x.toString(exec)->value(exec);
if (s.is8Bit()) {
LiteralParser<LChar> preparser(exec, s.characters8(), s.length(), NonStrictJSON);
}
// If ToString throws, we shouldn't call ToInt32.
- UString s = value.toString(exec);
+ UString s = value.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
{
- return JSValue::encode(jsNumber(parseFloat(exec->argument(0).toString(exec))));
+ return JSValue::encode(jsNumber(parseFloat(exec->argument(0).toString(exec)->value(exec))));
}
EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
"*+-./@_";
JSStringBuilder builder;
- UString str = exec->argument(0).toString(exec);
+ UString str = exec->argument(0).toString(exec)->value(exec);
if (str.is8Bit()) {
const LChar* c = str.characters8();
for (unsigned k = 0; k < str.length(); k++, c++) {
EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
{
UStringBuilder builder;
- UString str = exec->argument(0).toString(exec);
+ UString str = exec->argument(0).toString(exec)->value(exec);
int k = 0;
int len = str.length();
if (object->inherits(&NumberObject::s_info))
return jsNumber(object->toNumber(exec));
if (object->inherits(&StringObject::s_info))
- return jsString(exec, object->toString(exec));
+ return object->toString(exec);
if (object->inherits(&BooleanObject::s_info))
return object->toPrimitive(exec);
return value;
if (exec->hadException())
break;
- UString propertyName;
- if (name.getString(exec, propertyName)) {
- m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
- continue;
- }
-
- if (name.isNumber()) {
- m_arrayReplacerPropertyNames.add(Identifier::from(exec, name.asNumber()));
- continue;
- }
-
if (name.isObject()) {
if (!asObject(name)->inherits(&NumberObject::s_info) && !asObject(name)->inherits(&StringObject::s_info))
continue;
- propertyName = name.toString(exec);
- if (exec->hadException())
- break;
- m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
}
+
+ m_arrayReplacerPropertyNames.add(Identifier(exec, name.toString(exec)->value(exec)));
}
return;
}
{
if (!exec->argumentCount())
return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter"));
- JSValue value = exec->argument(0);
- UString source = value.toString(exec);
+ UString source = exec->argument(0).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
return primitive.toNumber(exec);
}
-UString JSObject::toString(ExecState* exec) const
+JSString* JSObject::toString(ExecState* exec) const
{
JSValue primitive = toPrimitive(exec, PreferString);
if (exec->hadException())
- return "";
+ return jsEmptyString(exec);
return primitive.toString(exec);
}
JS_EXPORT_PRIVATE bool toBoolean(ExecState*) const;
bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
JS_EXPORT_PRIVATE double toNumber(ExecState*) const;
- JS_EXPORT_PRIVATE UString toString(ExecState*) const;
+ JS_EXPORT_PRIVATE JSString* toString(ExecState*) const;
// NOTE: JSObject and its subclasses must be able to gracefully handle ExecState* = 0,
// because this call may come from inside the compiler.
return jsToNumber(value(exec));
}
-UString JSString::toString(ExecState* exec) const
-{
- return value(exec);
-}
-
inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string)
{
StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure());
JS_EXPORT_PRIVATE bool toBoolean(ExecState*) const;
bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
JSObject* toObject(ExecState*, JSGlobalObject*) const;
- UString toString(ExecState*) const;
double toNumber(ExecState*) const;
bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
return isTrue(); // false, null, and undefined all convert to false.
}
- inline UString JSValue::toString(ExecState* exec) const
+ inline JSString* JSValue::toString(ExecState* exec) const
{
if (isString())
- return static_cast<JSString*>(asCell())->value(exec);
- if (isInt32())
- return exec->globalData().numericStrings.add(asInt32());
- if (isDouble())
- return exec->globalData().numericStrings.add(asDouble());
- if (isTrue())
- return "true";
- if (isFalse())
- return "false";
- if (isNull())
- return "null";
- if (isUndefined())
- return "undefined";
- ASSERT(isCell());
- return asCell()->toString(exec);
+ return static_cast<JSString*>(asCell());
+ return toStringSlowCase(exec);
}
} // namespace JSC
return asObject(asCell())->globalObject();
}
-JSString* JSValue::toPrimitiveString(ExecState* exec) const
+JSString* JSValue::toStringSlowCase(ExecState* exec) const
{
- if (isString())
- return static_cast<JSString*>(asCell());
+ ASSERT(!isString());
if (isInt32())
return jsString(&exec->globalData(), exec->globalData().numericStrings.add(asInt32()));
if (isDouble())
return jsNontrivialString(exec, exec->propertyNames().undefined.ustring());
ASSERT(isCell());
- JSValue v = asCell()->toPrimitive(exec, NoPreference);
- if (v.isString())
- return static_cast<JSString*>(v.asCell());
- return jsString(&exec->globalData(), v.toString(exec));
+ JSValue value = asCell()->toPrimitive(exec, PreferString);
+ if (exec->hadException())
+ return jsEmptyString(exec);
+ ASSERT(!value.isObject());
+ return value.toString(exec);
}
} // namespace JSC
// toNumber conversion is expected to be side effect free if an exception has
// been set in the ExecState already.
double toNumber(ExecState*) const;
- UString toString(ExecState*) const;
- JSString* toPrimitiveString(ExecState*) const;
+ JSString* toString(ExecState*) const;
JSObject* toObject(ExecState*) const;
JSObject* toObject(ExecState*, JSGlobalObject*) const;
inline const JSValue asValue() const { return *this; }
JS_EXPORT_PRIVATE double toNumberSlowCase(ExecState*) const;
+ JSString* toStringSlowCase(ExecState*) const;
JS_EXPORT_PRIVATE JSObject* toObjectSlowCase(ExecState*, JSGlobalObject*) const;
JS_EXPORT_PRIVATE JSObject* toThisObjectSlowCase(ExecState*) const;
radix = static_cast<int>(radixValue.toInteger(exec)); // nan -> 0
if (radix == 10)
- return JSValue::encode(jsString(exec, jsNumber(x).toString(exec)));
+ return JSValue::encode(jsNumber(x).toString(exec));
// Fast path for number to character conversion.
if (radix == 36) {
if (!toThisNumber(exec->hostThisValue(), x))
return throwVMTypeError(exec);
- return JSValue::encode(jsString(exec, jsNumber(x).toString(exec)));
+ return JSValue::encode(jsNumber(x).toString(exec));
}
EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
{
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object."));
- UString propertyName = exec->argument(1).toString(exec);
+ UString propertyName = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
JSObject* O = asObject(exec->argument(0));
- UString propertyName = exec->argument(1).toString(exec);
+ UString propertyName = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
PropertyDescriptor descriptor;
EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return JSValue::encode(jsBoolean(thisValue.toObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)))));
+ return JSValue::encode(jsBoolean(thisValue.toObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))));
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
CallData callData;
if (getCallData(exec->argument(1), callData) == CallTypeNone)
return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));
- thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)), 0);
+ thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0);
return JSValue::encode(jsUndefined());
}
CallData callData;
if (getCallData(exec->argument(1), callData) == CallTypeNone)
return throwVMError(exec, createSyntaxError(exec, "invalid setter usage"));
- thisObject->methodTable()->defineSetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)), 0);
+ thisObject->methodTable()->defineSetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0);
return JSValue::encode(jsUndefined());
}
if (exec->hadException())
return JSValue::encode(jsUndefined());
- return JSValue::encode(thisObject->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(thisObject->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec))));
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
if (exec->hadException())
return JSValue::encode(jsUndefined());
- return JSValue::encode(thisObject->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(thisObject->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec))));
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return JSValue::encode(jsBoolean(thisValue.toObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)))));
+ return JSValue::encode(jsBoolean(thisValue.toObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))));
}
// 15.2.4.3 Object.prototype.toLocaleString()
JSValue p1 = v1.toPrimitive(callFrame);
JSValue p2 = v2.toPrimitive(callFrame);
- if (p1.isString()) {
- return p2.isString()
- ? jsString(callFrame, asString(p1), asString(p2))
- : jsString(callFrame, asString(p1), jsString(callFrame, p2.toString(callFrame)));
- }
+ if (p1.isString())
+ return jsString(callFrame, asString(p1), p2.toString(callFrame));
+
if (p2.isString())
- return jsString(callFrame, jsString(callFrame, p1.toString(callFrame)), asString(p2));
+ return jsString(callFrame, p1.toString(callFrame), asString(p2));
return jsNumber(p1.toNumber(callFrame) + p2.toNumber(callFrame));
}
for (unsigned i = 0; i < count; ++i) {
JSValue v = strings[i].jsValue();
- if (v.isString())
- ropeBuilder.append(asString(v));
- else
- ropeBuilder.append(jsString(globalData, v.toString(exec)));
+ ropeBuilder.append(v.toString(exec));
if (ropeBuilder.length() < oldLength) // True for overflow
return throwOutOfMemoryError(exec);
{
JSGlobalData* globalData = &exec->globalData();
JSString::RopeBuilder ropeBuilder(*globalData);
-
- if (thisValue.isString())
- ropeBuilder.append(asString(thisValue));
- else
- ropeBuilder.append(jsString(globalData, thisValue.toString(exec)));
+ ropeBuilder.append(thisValue.toString(exec));
unsigned oldLength = 0;
for (unsigned i = 0; i < exec->argumentCount(); ++i) {
JSValue v = exec->argument(i);
- if (v.isString())
- ropeBuilder.append(asString(v));
- else
- ropeBuilder.append(jsString(globalData, v.toString(exec)));
+ ropeBuilder.append(v.toString(exec));
if (ropeBuilder.length() < oldLength) // True for overflow
return throwOutOfMemoryError(exec);
if (v1.isNumber() && v2.isNumber())
return jsNumber(v1.asNumber() + v2.asNumber());
- if (v1.isString()) {
- return v2.isString()
- ? jsString(callFrame, asString(v1), asString(v2))
- : jsString(callFrame, asString(v1), v2.toPrimitiveString(callFrame));
- }
+ if (v1.isString() && !v2.isObject())
+ return jsString(callFrame, asString(v1), v2.toString(callFrame));
// All other cases are pretty uncommon
return jsAddSlowCase(callFrame, v1, v2);
void setRegExpConstructorInput(ExecState* exec, JSObject* baseObject, JSValue value)
{
- asRegExpConstructor(baseObject)->setInput(value.toString(exec));
+ asRegExpConstructor(baseObject)->setInput(value.toString(exec)->value(exec));
}
void setRegExpConstructorMultiline(ExecState* exec, JSObject* baseObject, JSValue value)
return asObject(arg0);
}
- UString pattern = arg0.isUndefined() ? UString("") : arg0.toString(exec);
+ UString pattern = arg0.isUndefined() ? UString("") : arg0.toString(exec)->value(exec);
if (exec->hadException())
return 0;
RegExpFlags flags = NoFlags;
if (!arg1.isUndefined()) {
- flags = regExpFlags(arg1.toString(exec));
+ flags = regExpFlags(arg1.toString(exec)->value(exec));
if (exec->hadException())
return 0;
if (flags == InvalidFlags)
bool RegExpObject::match(ExecState* exec)
{
RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
- UString input = exec->argument(0).toString(exec);
+ UString input = exec->argument(0).toString(exec)->value(exec);
JSGlobalData* globalData = &exec->globalData();
if (!regExp()->global()) {
int position;
return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
regExp = asRegExpObject(arg0)->regExp();
} else {
- UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec);
+ UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
RegExpFlags flags = NoFlags;
if (!arg1.isUndefined()) {
- flags = regExpFlags(arg1.toString(exec));
+ flags = regExpFlags(arg1.toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
if (flags == InvalidFlags)
postfix[index++] = 'i';
if (thisObject->get(exec, exec->propertyNames().multiline).toBoolean(exec))
postfix[index] = 'm';
- UString source = thisObject->get(exec, exec->propertyNames().source).toString(exec);
+ UString source = thisObject->get(exec, exec->propertyNames().source).toString(exec)->value(exec);
// If source is empty, use "/(?:)/" to avoid colliding with comment syntax
return JSValue::encode(jsMakeNontrivialString(exec, "/", source.length() ? source : UString("(?:)"), postfix));
}
if (!exec->argumentCount())
return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure()));
- JSString* string = exec->argument(0).isString()
- ? asString(exec->argument(0))
- : jsString(exec, exec->argument(0).toString(exec));
- return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), string));
+ return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), exec->argument(0).toString(exec)));
}
ConstructType StringConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
if (!exec->argumentCount())
return JSValue::encode(jsEmptyString(exec));
- return JSValue::encode(jsString(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(exec->argument(0).toString(exec));
}
CallType StringConstructor::getCallData(JSCell*, CallData& callData)
CallData callData;
CallType callType = getCallData(replaceValue, callData);
if (callType == CallTypeNone)
- replacementString = replaceValue.toString(exec);
+ replacementString = replaceValue.toString(exec)->value(exec);
const UString& source = string->value(exec);
unsigned sourceLen = source.length();
cachedCall.setThis(jsUndefined());
JSValue result = cachedCall.call();
- if (LIKELY(result.isString()))
- replacements.append(asString(result)->value(exec));
- else
- replacements.append(result.toString(cachedCall.newCallFrame(exec)));
+ replacements.append(result.toString(cachedCall.newCallFrame(exec))->value(exec));
if (exec->hadException())
break;
cachedCall.setThis(jsUndefined());
JSValue result = cachedCall.call();
- if (LIKELY(result.isString()))
- replacements.append(asString(result)->value(exec));
- else
- replacements.append(result.toString(cachedCall.newCallFrame(exec)));
+ replacements.append(result.toString(cachedCall.newCallFrame(exec))->value(exec));
if (exec->hadException())
break;
args.append(jsNumber(completeMatchStart));
args.append(string);
- replacements.append(call(exec, replaceValue, callType, callData, jsUndefined(), args).toString(exec));
+ replacements.append(call(exec, replaceValue, callType, callData, jsUndefined(), args).toString(exec)->value(exec));
if (exec->hadException())
break;
} else {
static NEVER_INLINE EncodedJSValue replaceUsingStringSearch(ExecState* exec, JSString* jsString, JSValue searchValue, JSValue replaceValue)
{
const UString& string = jsString->value(exec);
- UString searchString = searchValue.toString(exec);
+ UString searchString = searchValue.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
return JSValue::encode(jsUndefined());
}
- UString replaceString = replaceValue.toString(exec);
+ UString replaceString = replaceValue.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- if (!thisValue.isString()) {
- if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
- return throwVMTypeError(exec);
- thisValue = jsString(exec, thisValue.toString(exec));
- }
- JSString* string = asString(thisValue);
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ JSString* string = thisValue.toString(exec);
JSValue searchValue = exec->argument(0);
JSValue replaceValue = exec->argument(1);
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
unsigned len = s.length();
JSValue a0 = exec->argument(0);
if (a0.isUInt32()) {
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
unsigned len = s.length();
JSValue a0 = exec->argument(0);
if (a0.isUInt32()) {
EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- if (thisValue.isString() && (exec->argumentCount() == 1)) {
- JSValue v = exec->argument(0);
- return JSValue::encode(v.isString()
- ? jsString(exec, asString(thisValue), asString(v))
- : jsString(exec, asString(thisValue), jsString(&exec->globalData(), v.toString(exec))));
- }
+ if (thisValue.isString() && (exec->argumentCount() == 1))
+ return JSValue::encode(jsString(exec, asString(thisValue), exec->argument(0).toString(exec)));
+
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
return JSValue::encode(jsStringFromArguments(exec, thisValue));
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
int len = s.length();
JSValue a0 = exec->argument(0);
JSValue a1 = exec->argument(1);
- UString u2 = a0.toString(exec);
+ UString u2 = a0.toString(exec)->value(exec);
int pos;
if (a1.isUndefined())
pos = 0;
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
int len = s.length();
JSValue a0 = exec->argument(0);
JSValue a1 = exec->argument(1);
- UString u2 = a0.toString(exec);
+ UString u2 = a0.toString(exec)->value(exec);
double dpos = a1.toIntegerPreserveNaN(exec);
if (dpos < 0)
dpos = 0;
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSGlobalData* globalData = &exec->globalData();
JSValue a0 = exec->argument(0);
* replaced with the result of the expression new RegExp(regexp).
* Per ECMA 15.10.4.1, if a0 is undefined substitute the empty string.
*/
- reg = RegExp::create(exec->globalData(), a0.isUndefined() ? UString("") : a0.toString(exec), NoFlags);
+ reg = RegExp::create(exec->globalData(), a0.isUndefined() ? UString("") : a0.toString(exec)->value(exec), NoFlags);
if (!reg->isValid())
return throwVMError(exec, createSyntaxError(exec, reg->errorMessage()));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSGlobalData* globalData = &exec->globalData();
JSValue a0 = exec->argument(0);
* replaced with the result of the expression new RegExp(regexp).
* Per ECMA 15.10.4.1, if a0 is undefined substitute the empty string.
*/
- reg = RegExp::create(exec->globalData(), a0.isUndefined() ? UString("") : a0.toString(exec), NoFlags);
+ reg = RegExp::create(exec->globalData(), a0.isUndefined() ? UString("") : a0.toString(exec)->value(exec), NoFlags);
if (!reg->isValid())
return throwVMError(exec, createSyntaxError(exec, reg->errorMessage()));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
int len = s.length();
JSValue a0 = exec->argument(0);
// 2. Let S be the result of calling ToString, giving it the this value as its argument.
// 6. Let s be the number of characters in S.
- UString input = thisValue.toString(exec);
+ UString input = thisValue.toString(exec)->value(exec);
// 3. Let A be a new array created as if by the expression new Array()
// where Array is the standard built-in constructor with that name.
}
}
} else {
- UString separator = separatorValue.toString(exec);
+ UString separator = separatorValue.toString(exec)->value(exec);
// 9. If lim == 0, return A.
if (!limit)
// CheckObjectCoercible
return throwVMTypeError(exec);
} else {
- uString = thisValue.toString(exec);
+ uString = thisValue.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
len = uString.length();
EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- int len;
- JSString* jsString = 0;
- UString uString;
- if (thisValue.isString()) {
- jsString = static_cast<JSString*>(thisValue.asCell());
- len = jsString->length();
- } else if (thisValue.isUndefinedOrNull()) {
- // CheckObjectCoercible
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- } else {
- uString = thisValue.toString(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- len = uString.length();
- }
+
+ JSString* jsString = thisValue.toString(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
JSValue a0 = exec->argument(0);
JSValue a1 = exec->argument(1);
+ int len = jsString->length();
double start = a0.toNumber(exec);
double end;
}
unsigned substringStart = static_cast<unsigned>(start);
unsigned substringLength = static_cast<unsigned>(end) - substringStart;
- if (jsString)
- return JSValue::encode(jsSubstring(exec, jsString, substringStart, substringLength));
- return JSValue::encode(jsSubstring(exec, uString, substringStart, substringLength));
+ return JSValue::encode(jsSubstring(exec, jsString, substringStart, substringLength));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- JSString* sVal = thisValue.isString() ? asString(thisValue) : jsString(exec, thisValue.toString(exec));
+ JSString* sVal = thisValue.toString(exec);
const UString& s = sVal->value(exec);
int sSize = s.length();
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- JSString* sVal = thisValue.isString() ? asString(thisValue) : jsString(exec, thisValue.toString(exec));
+ JSString* sVal = thisValue.toString(exec);
const UString& s = sVal->value(exec);
int sSize = s.length();
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSValue a0 = exec->argument(0);
- return JSValue::encode(jsNumber(localeCompare(s, a0.toString(exec))));
+ return JSValue::encode(jsNumber(localeCompare(s, a0.toString(exec)->value(exec))));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
}
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSValue a0 = exec->argument(0);
- return JSValue::encode(jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>"));
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec)->value(exec), "\">", s, "</font>"));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSValue a0 = exec->argument(0);
uint32_t smallInteger;
return JSValue::encode(jsNontrivialString(exec, impl));
}
- return JSValue::encode(jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>"));
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec)->value(exec), "\">", s, "</font>"));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSValue a0 = exec->argument(0);
- return JSValue::encode(jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>"));
+ return JSValue::encode(jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec)->value(exec), "\">", s, "</a>"));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
JSValue thisValue = exec->hostThisValue();
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwVMTypeError(exec);
- UString s = thisValue.toString(exec);
+ UString s = thisValue.toString(exec)->value(exec);
JSValue a0 = exec->argument(0);
- UString linkText = a0.toString(exec);
+ UString linkText = a0.toString(exec)->value(exec);
unsigned linkTextSize = linkText.length();
unsigned stringSize = s.length();
{
if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
return throwTypeError(exec);
- UString str = thisValue.toString(exec);
+ UString str = thisValue.toString(exec)->value(exec);
unsigned left = 0;
if (trimKind & TrimLeft) {
while (left < str.length() && isTrimWhitespace(str[left]))
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ * JSUtils.cpp:
+ (KJSValueToCFTypeInternal):
+
2012-01-19 Mark Hahnenberg <mhahnenberg@apple.com>
Implement a new allocator for backing stores
if (inValue.isString())
{
- UString uString = inValue.toString(exec);
+ UString uString = inValue.toString(exec)->value(exec);
result = UStringToCFString(uString);
return result;
}
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ Mechanical changes to call value() after calling toString(), to
+ convert from "JS string" (JSString*) to "C++ string" (UString), since
+ toString() no longer returns a "C++ string".
+
+ * bindings/js/IDBBindingUtilities.cpp:
+ (WebCore::createIDBKeyFromValue):
+ * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+ (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
+ * bindings/js/JSClipboardCustom.cpp:
+ (WebCore::JSClipboard::clearData):
+ (WebCore::JSClipboard::getData):
+ * bindings/js/JSCustomXPathNSResolver.cpp:
+ (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::valueToStringWithNullCheck):
+ (WebCore::valueToStringWithUndefinedOrNullCheck):
+ (WebCore::reportException):
+ * bindings/js/JSDOMFormDataCustom.cpp:
+ (WebCore::JSDOMFormData::append):
+ * bindings/js/JSDOMStringMapCustom.cpp:
+ (WebCore::JSDOMStringMap::putDelegate):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::setLocation):
+ (WebCore::JSDOMWindow::open):
+ (WebCore::JSDOMWindow::addEventListener):
+ (WebCore::JSDOMWindow::removeEventListener):
+ * bindings/js/JSDeviceMotionEventCustom.cpp:
+ (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
+ * bindings/js/JSDeviceOrientationEventCustom.cpp:
+ (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue):
+ * bindings/js/JSDocumentCustom.cpp:
+ (WebCore::JSDocument::setLocation):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSHTMLAllCollectionCustom.cpp:
+ (WebCore::callHTMLAllCollection):
+ (WebCore::JSHTMLAllCollection::item):
+ (WebCore::JSHTMLAllCollection::namedItem):
+ * bindings/js/JSHTMLCanvasElementCustom.cpp:
+ (WebCore::JSHTMLCanvasElement::getContext):
+ * bindings/js/JSHTMLCollectionCustom.cpp:
+ (WebCore::JSHTMLCollection::item):
+ (WebCore::JSHTMLCollection::namedItem):
+ * bindings/js/JSHTMLDocumentCustom.cpp:
+ (WebCore::documentWrite):
+ * bindings/js/JSHTMLInputElementCustom.cpp:
+ (WebCore::JSHTMLInputElement::setSelectionDirection):
+ (WebCore::JSHTMLInputElement::setSelectionRange):
+ * bindings/js/JSInspectorFrontendHostCustom.cpp:
+ (WebCore::JSInspectorFrontendHost::showContextMenu):
+ * bindings/js/JSJavaScriptCallFrameCustom.cpp:
+ (WebCore::JSJavaScriptCallFrame::evaluate):
+ * bindings/js/JSLocationCustom.cpp:
+ (WebCore::JSLocation::setHref):
+ (WebCore::JSLocation::setProtocol):
+ (WebCore::JSLocation::setHost):
+ (WebCore::JSLocation::setHostname):
+ (WebCore::JSLocation::setPort):
+ (WebCore::JSLocation::setPathname):
+ (WebCore::JSLocation::setSearch):
+ (WebCore::JSLocation::setHash):
+ (WebCore::JSLocation::replace):
+ (WebCore::JSLocation::assign):
+ * bindings/js/JSMessageEventCustom.cpp:
+ (WebCore::handleInitMessageEvent):
+ * bindings/js/JSSQLTransactionCustom.cpp:
+ (WebCore::JSSQLTransaction::executeSql):
+ * bindings/js/JSSQLTransactionSyncCustom.cpp:
+ (WebCore::JSSQLTransactionSync::executeSql):
+ * bindings/js/JSSharedWorkerCustom.cpp:
+ (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
+ * bindings/js/JSStorageCustom.cpp:
+ (WebCore::JSStorage::putDelegate):
+ * bindings/js/JSWebGLRenderingContextCustom.cpp:
+ (WebCore::JSWebGLRenderingContext::getExtension):
+ * bindings/js/JSWebSocketCustom.cpp:
+ (WebCore::JSWebSocketConstructor::constructJSWebSocket):
+ (WebCore::JSWebSocket::send):
+ (WebCore::JSWebSocket::close):
+ * bindings/js/JSWorkerContextCustom.cpp:
+ (WebCore::JSWorkerContext::importScripts):
+ * bindings/js/JSWorkerCustom.cpp:
+ (WebCore::JSWorkerConstructor::constructJSWorker):
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ (WebCore::JSXMLHttpRequest::open):
+ (WebCore::JSXMLHttpRequest::send):
+ * bindings/js/JSXSLTProcessorCustom.cpp:
+ (WebCore::JSXSLTProcessor::setParameter):
+ (WebCore::JSXSLTProcessor::getParameter):
+ (WebCore::JSXSLTProcessor::removeParameter):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::create):
+ * bindings/js/ScriptEventListener.cpp:
+ (WebCore::eventListenerHandlerBody):
+ * bindings/js/ScriptValue.cpp:
+ (WebCore::ScriptValue::toString):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateEventListenerCall):
+ (JSValueToNative):
+ (GenerateConstructorDefinition):
+ * bridge/c/c_utility.cpp:
+ (JSC::Bindings::convertValueToNPVariant):
+ * bridge/jni/jni_jsobject.mm:
+ (JavaJSObject::convertValueToJObject):
+ * bridge/jni/jsc/JNIUtilityPrivate.cpp:
+ (JSC::Bindings::convertArrayInstanceToJavaArray):
+ (JSC::Bindings::convertValueToJValue):
+ * bridge/jni/jsc/JavaFieldJSC.cpp:
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::valueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ (JavaField::setValueToInstance):
+ * bridge/jni/jsc/JavaInstanceJSC.cpp:
+ (JavaInstance::invokeMethod):
+ * testing/js/JSInternalsCustom.cpp:
+ (WebCore::JSInternals::setUserPreferredLanguages):
+
2012-01-23 Kentaro Hara <haraken@chromium.org>
In CodeGeneratorObjC.pm, overwrite the output .h/.mm
if (value.isInt32())
return IDBKey::create(value.toInt32(exec));
if (value.isString())
- return IDBKey::create(ustringToString(value.toString(exec)));
+ return IDBKey::create(ustringToString(value.toString(exec)->value(exec)));
// FIXME: Implement dates.
return 0;
}
JSValue JSCSSStyleDeclaration::getPropertyCSSValue(ExecState* exec)
{
- const String& propertyName(ustringToString(exec->argument(0).toString(exec)));
+ const String& propertyName(ustringToString(exec->argument(0).toString(exec)->value(exec)));
if (exec->hadException())
return jsUndefined();
}
if (exec->argumentCount() == 1) {
- clipboard->clearData(ustringToString(exec->argument(0).toString(exec)));
+ clipboard->clearData(ustringToString(exec->argument(0).toString(exec)->value(exec)));
return jsUndefined();
}
Clipboard* clipboard = impl();
bool success;
- String result = clipboard->getData(ustringToString(exec->argument(0).toString(exec)), success);
+ String result = clipboard->getData(ustringToString(exec->argument(0).toString(exec)->value(exec)), success);
if (!success)
return jsUndefined();
reportCurrentException(exec);
else {
if (!retval.isUndefinedOrNull())
- result = ustringToString(retval.toString(exec));
+ result = ustringToString(retval.toString(exec)->value(exec));
}
Document::updateStyleForAllDocuments();
{
if (value.isNull())
return String();
- return ustringToString(value.toString(exec));
+ return ustringToString(value.toString(exec)->value(exec));
}
String valueToStringWithUndefinedOrNullCheck(ExecState* exec, JSValue value)
{
if (value.isUndefinedOrNull())
return String();
- return ustringToString(value.toString(exec));
+ return ustringToString(value.toString(exec)->value(exec));
}
JSValue jsDateOrNull(ExecState* exec, double value)
if (isTerminatedExecutionException(exception))
return;
- UString errorMessage = exception.toString(exec);
+ UString errorMessage = exception.toString(exec)->value(exec);
JSObject* exceptionObject = exception.toObject(exec);
int lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
- UString exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec);
+ UString exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec)->value(exec);
exec->clearException();
if (ExceptionBase* exceptionBase = toExceptionBase(exception))
JSValue JSDOMFormData::append(ExecState* exec)
{
if (exec->argumentCount() >= 2) {
- String name = ustringToString(exec->argument(0).toString(exec));
+ String name = ustringToString(exec->argument(0).toString(exec)->value(exec));
JSValue value = exec->argument(1);
if (value.inherits(&JSBlob::s_info)) {
String filename;
if (exec->argumentCount() >= 3 && !exec->argument(2).isUndefinedOrNull())
- filename = ustringToString(exec->argument(2).toString(exec));
+ filename = ustringToString(exec->argument(2).toString(exec)->value(exec));
impl()->append(name, toBlob(value), filename);
} else
- impl()->append(name, ustringToString(value.toString(exec)));
+ impl()->append(name, ustringToString(value.toString(exec)->value(exec)));
}
return jsUndefined();
bool JSDOMStringMap::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&)
{
- String stringValue = ustringToString(value.toString(exec));
+ String stringValue = ustringToString(value.toString(exec)->value(exec));
if (exec->hadException())
return false;
ExceptionCode ec = 0;
}
#endif
- UString locationString = value.toString(exec);
+ UString locationString = value.toString(exec)->value(exec);
if (exec->hadException())
return;
String urlString = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
if (exec->hadException())
return jsUndefined();
- AtomicString frameName = exec->argument(1).isUndefinedOrNull() ? "_blank" : ustringToAtomicString(exec->argument(1).toString(exec));
+ AtomicString frameName = exec->argument(1).isUndefinedOrNull() ? "_blank" : ustringToAtomicString(exec->argument(1).toString(exec)->value(exec));
if (exec->hadException())
return jsUndefined();
String windowFeaturesString = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2));
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
+ impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
return jsUndefined();
}
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
+ impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
return jsUndefined();
}
JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec)
{
- const String& type = ustringToString(exec->argument(0).toString(exec));
+ const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec));
bool bubbles = exec->argument(1).toBoolean(exec);
bool cancelable = exec->argument(2).toBoolean(exec);
JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec)
{
- const String& type = ustringToString(exec->argument(0).toString(exec));
+ const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec));
bool bubbles = exec->argument(1).toBoolean(exec);
bool cancelable = exec->argument(2).toBoolean(exec);
// If alpha, beta or gamma are null or undefined, mark them as not provided.
void JSDictionary::convertValue(ExecState* exec, JSValue value, String& result)
{
- result = ustringToString(value.toString(exec));
+ result = ustringToString(value.toString(exec)->value(exec));
}
void JSDictionary::convertValue(ExecState* exec, JSValue value, ScriptValue& result)
if (!frame)
return;
- String str = ustringToString(value.toString(exec));
+ String str = ustringToString(value.toString(exec)->value(exec));
Frame* lexicalFrame = asJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame();
reportCurrentException(exec);
} else {
if (!retval.isUndefinedOrNull() && event->storesResultAsString())
- event->storeResult(ustringToString(retval.toString(exec)));
+ event->storeResult(ustringToString(retval.toString(exec)->value(exec)));
if (m_isAttribute) {
if (retval.isFalse())
event->preventDefault();
if (exec->argumentCount() == 1) {
// Support for document.all(<index>) etc.
bool ok;
- UString string = exec->argument(0).toString(exec);
+ UString string = exec->argument(0).toString(exec)->value(exec);
unsigned index = Identifier::toUInt32(string, ok);
if (ok)
return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index)));
// The second arg, if set, is the index of the item we want
bool ok;
- UString string = exec->argument(0).toString(exec);
- unsigned index = Identifier::toUInt32(exec->argument(1).toString(exec), ok);
+ UString string = exec->argument(0).toString(exec)->value(exec);
+ unsigned index = Identifier::toUInt32(exec->argument(1).toString(exec)->value(exec), ok);
if (ok) {
if (Node* node = collection->namedItemWithIndex(ustringToAtomicString(string), index))
return JSValue::encode(toJS(exec, jsCollection->globalObject(), node));
JSValue JSHTMLAllCollection::item(ExecState* exec)
{
bool ok;
- uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec), ok);
+ uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec)->value(exec), ok);
if (ok)
return toJS(exec, globalObject(), impl()->item(index));
- return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)));
+ return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
}
JSValue JSHTMLAllCollection::namedItem(ExecState* exec)
{
- return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)));
+ return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
}
} // namespace WebCore
JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
{
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
- const UString& contextId = exec->argument(0).toString(exec);
+ const UString& contextId = exec->argument(0).toString(exec)->value(exec);
RefPtr<CanvasContextAttributes> attrs;
#if ENABLE(WEBGL)
if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
JSValue JSHTMLCollection::item(ExecState* exec)
{
bool ok;
- uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec), ok);
+ uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec)->value(exec), ok);
if (ok)
return toJS(exec, globalObject(), impl()->item(index));
- return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)));
+ return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
}
JSValue JSHTMLCollection::namedItem(ExecState* exec)
{
- return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)));
+ return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
}
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection)
size_t size = exec->argumentCount();
- UString firstString = exec->argument(0).toString(exec);
+ UString firstString = exec->argument(0).toString(exec)->value(exec);
SegmentedString segmentedString = ustringToString(firstString);
if (size != 1) {
if (!size)
segmentedString.clear();
else {
for (size_t i = 1; i < size; ++i) {
- UString subsequentString = exec->argument(i).toString(exec);
+ UString subsequentString = exec->argument(i).toString(exec)->value(exec);
segmentedString.append(SegmentedString(ustringToString(subsequentString)));
}
}
return;
}
- input->setSelectionDirection(ustringToString(value.toString(exec)));
+ input->setSelectionDirection(ustringToString(value.toString(exec)->value(exec)));
}
JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec)
int start = exec->argument(0).toInt32(exec);
int end = exec->argument(1).toInt32(exec);
- String direction = ustringToString(exec->argument(2).toString(exec));
+ String direction = ustringToString(exec->argument(2).toString(exec)->value(exec));
input->setSelectionRange(start, end, direction);
return jsUndefined();
if (!type.isString())
continue;
- String typeString = ustringToString(type.toString(exec));
+ String typeString = ustringToString(type.toString(exec)->value(exec));
if (typeString == "separator") {
items.append(new ContextMenuItem(SeparatorType,
ContextMenuItemCustomTagNoAction,
String()));
} else {
ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
- ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)));
+ ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)->value(exec)));
if (!enabled.isUndefined())
menuItem->setEnabled(enabled.toBoolean(exec));
if (!checked.isUndefined())
JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec)
{
JSValue exception;
- JSValue result = impl()->evaluate(exec->argument(0).toString(exec), exception);
+ JSValue result = impl()->evaluate(exec->argument(0).toString(exec)->value(exec), exception);
if (exception)
throwError(exec, exception);
void JSLocation::setHref(ExecState* exec, JSValue value)
{
- UString href = value.toString(exec);
+ UString href = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setHref(ustringToString(href), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setProtocol(ExecState* exec, JSValue value)
{
- UString protocol = value.toString(exec);
+ UString protocol = value.toString(exec)->value(exec);
if (exec->hadException())
return;
ExceptionCode ec = 0;
void JSLocation::setHost(ExecState* exec, JSValue value)
{
- UString host = value.toString(exec);
+ UString host = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setHost(ustringToString(host), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setHostname(ExecState* exec, JSValue value)
{
- UString hostname = value.toString(exec);
+ UString hostname = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setHostname(ustringToString(hostname), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setPort(ExecState* exec, JSValue value)
{
- UString port = value.toString(exec);
+ UString port = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setPort(ustringToString(port), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setPathname(ExecState* exec, JSValue value)
{
- UString pathname = value.toString(exec);
+ UString pathname = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setPathname(ustringToString(pathname), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setSearch(ExecState* exec, JSValue value)
{
- UString pathname = value.toString(exec);
+ UString pathname = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setSearch(ustringToString(pathname), activeDOMWindow(exec), firstDOMWindow(exec));
void JSLocation::setHash(ExecState* exec, JSValue value)
{
- UString hash = value.toString(exec);
+ UString hash = value.toString(exec)->value(exec);
if (exec->hadException())
return;
impl()->setHash(ustringToString(hash), activeDOMWindow(exec), firstDOMWindow(exec));
JSValue JSLocation::replace(ExecState* exec)
{
- UString urlString = exec->argument(0).toString(exec);
+ UString urlString = exec->argument(0).toString(exec)->value(exec);
if (exec->hadException())
return jsUndefined();
impl()->replace(ustringToString(urlString), activeDOMWindow(exec), firstDOMWindow(exec));
JSValue JSLocation::assign(ExecState* exec)
{
- UString urlString = exec->argument(0).toString(exec);
+ UString urlString = exec->argument(0).toString(exec)->value(exec);
if (exec->hadException())
return jsUndefined();
impl()->assign(ustringToString(urlString), activeDOMWindow(exec), firstDOMWindow(exec));
static JSC::JSValue handleInitMessageEvent(JSMessageEvent* jsEvent, JSC::ExecState* exec)
{
- const UString& typeArg = exec->argument(0).toString(exec);
+ const UString& typeArg = exec->argument(0).toString(exec)->value(exec);
bool canBubbleArg = exec->argument(1).toBoolean(exec);
bool cancelableArg = exec->argument(2).toBoolean(exec);
- const UString& originArg = exec->argument(4).toString(exec);
- const UString& lastEventIdArg = exec->argument(5).toString(exec);
+ const UString& originArg = exec->argument(4).toString(exec)->value(exec);
+ const UString& lastEventIdArg = exec->argument(5).toString(exec)->value(exec);
DOMWindow* sourceArg = toDOMWindow(exec->argument(6));
OwnPtr<MessagePortArray> messagePorts;
if (!exec->argument(7).isUndefinedOrNull()) {
return jsUndefined();
}
- String sqlStatement = ustringToString(exec->argument(0).toString(exec));
+ String sqlStatement = ustringToString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return jsUndefined();
sqlValues.append(value.asNumber());
else {
// Convert the argument to a string and append it
- sqlValues.append(ustringToString(value.toString(exec)));
+ sqlValues.append(ustringToString(value.toString(exec)->value(exec)));
if (exec->hadException())
return jsUndefined();
}
return jsUndefined();
}
- String sqlStatement = ustringToString(exec->argument(0).toString(exec));
+ String sqlStatement = ustringToString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return jsUndefined();
sqlValues.append(value.asNumber());
else {
// Convert the argument to a string and append it
- sqlValues.append(ustringToString(value.toString(exec)));
+ sqlValues.append(ustringToString(value.toString(exec)->value(exec)));
if (exec->hadException())
return jsUndefined();
}
if (exec->argumentCount() < 1)
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
- UString scriptURL = exec->argument(0).toString(exec);
+ UString scriptURL = exec->argument(0).toString(exec)->value(exec);
UString name;
if (exec->argumentCount() > 1)
- name = exec->argument(1).toString(exec);
+ name = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(JSValue());
if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
return false;
- String stringValue = ustringToString(value.toString(exec));
+ String stringValue = ustringToString(value.toString(exec)->value(exec));
if (exec->hadException())
return true;
return throwSyntaxError(exec);
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
- const String& name = ustringToString(exec->argument(0).toString(exec));
+ const String& name = ustringToString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return jsUndefined();
WebGLExtension* extension = context->getExtension(name);
if (!exec->argumentCount())
return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- String urlString = ustringToString(exec->argument(0).toString(exec));
+ String urlString = ustringToString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return throwVMError(exec, createSyntaxError(exec, "wrong URL"));
RefPtr<WebSocket> webSocket = WebSocket::create(context);
Vector<String> protocols;
JSArray* protocolsArray = asArray(protocolsValue);
for (unsigned i = 0; i < protocolsArray->length(); ++i) {
- String protocol = ustringToString(protocolsArray->getIndex(i).toString(exec));
+ String protocol = ustringToString(protocolsArray->getIndex(i).toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(JSValue());
protocols.append(protocol);
}
webSocket->connect(urlString, protocols, ec);
} else {
- String protocol = ustringToString(protocolsValue.toString(exec));
+ String protocol = ustringToString(protocolsValue.toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(JSValue());
webSocket->connect(urlString, protocol, ec);
else if (message.inherits(&JSBlob::s_info))
result = impl()->send(toBlob(message), ec);
else {
- String stringMessage = ustringToString(message.toString(exec));
+ String stringMessage = ustringToString(message.toString(exec)->value(exec));
if (exec->hadException())
return jsUndefined();
result = impl()->send(stringMessage, ec);
x = clampTo(x, minValue, maxValue);
code = clampToInteger(x);
if (argumentCount >= 2) {
- reason = ustringToString(exec->argument(1).toString(exec));
+ reason = ustringToString(exec->argument(1).toString(exec)->value(exec));
if (exec->hadException()) {
setDOMException(exec, SYNTAX_ERR);
return jsUndefined();
Vector<String> urls;
for (unsigned i = 0; i < exec->argumentCount(); i++) {
- urls.append(ustringToString(exec->argument(i).toString(exec)));
+ urls.append(ustringToString(exec->argument(i).toString(exec)->value(exec)));
if (exec->hadException())
return jsUndefined();
}
if (!exec->argumentCount())
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
- UString scriptURL = exec->argument(0).toString(exec);
+ UString scriptURL = exec->argument(0).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(JSValue());
if (exec->argumentCount() < 2)
return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
- const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(exec->argument(1).toString(exec)));
- String method = ustringToString(exec->argument(0).toString(exec));
+ const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(exec->argument(1).toString(exec)->value(exec)));
+ String method = ustringToString(exec->argument(0).toString(exec)->value(exec));
ExceptionCode ec = 0;
if (exec->argumentCount() >= 3) {
else if (val.inherits(&JSArrayBuffer::s_info))
impl()->send(toArrayBuffer(val), ec);
else
- impl()->send(ustringToString(val.toString(exec)), ec);
+ impl()->send(ustringToString(val.toString(exec)->value(exec)), ec);
}
int signedLineNumber;
{
if (exec->argument(1).isUndefinedOrNull() || exec->argument(2).isUndefinedOrNull())
return jsUndefined(); // Throw exception?
- String namespaceURI = ustringToString(exec->argument(0).toString(exec));
- String localName = ustringToString(exec->argument(1).toString(exec));
- String value = ustringToString(exec->argument(2).toString(exec));
+ String namespaceURI = ustringToString(exec->argument(0).toString(exec)->value(exec));
+ String localName = ustringToString(exec->argument(1).toString(exec)->value(exec));
+ String value = ustringToString(exec->argument(2).toString(exec)->value(exec));
impl()->setParameter(namespaceURI, localName, value);
return jsUndefined();
}
{
if (exec->argument(1).isUndefinedOrNull())
return jsUndefined();
- String namespaceURI = ustringToString(exec->argument(0).toString(exec));
- String localName = ustringToString(exec->argument(1).toString(exec));
+ String namespaceURI = ustringToString(exec->argument(0).toString(exec)->value(exec));
+ String localName = ustringToString(exec->argument(1).toString(exec)->value(exec));
String value = impl()->getParameter(namespaceURI, localName);
return jsStringOrUndefined(exec, value);
}
{
if (exec->argument(1).isUndefinedOrNull())
return jsUndefined();
- String namespaceURI = ustringToString(exec->argument(0).toString(exec));
- String localName = ustringToString(exec->argument(1).toString(exec));
+ String namespaceURI = ustringToString(exec->argument(0).toString(exec)->value(exec));
+ String localName = ustringToString(exec->argument(1).toString(exec)->value(exec));
impl()->removeParameter(namespaceURI, localName);
return jsUndefined();
}
if (getCallData(v, callData) == CallTypeNone) {
if (policy && !policy->allowEval())
return nullptr;
- UString string = v.toString(exec);
+ UString string = v.toString(exec)->value(exec);
if (exec->hadException())
return nullptr;
return adoptPtr(new ScheduledAction(ustringToString(string), isolatedWorld));
JSC::JSObject* jsFunction = jsListener->jsFunction(document);
if (!jsFunction)
return "";
- return ustringToString(jsFunction->toString(scriptStateFromNode(jsListener->isolatedWorld(), document)));
+ ScriptState* scriptState = scriptStateFromNode(jsListener->isolatedWorld(), document);
+ return ustringToString(jsFunction->toString(scriptState)->value(scriptState));
}
bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, int& lineNumber)
String ScriptValue::toString(ScriptState* scriptState) const
{
- String result = ustringToString(m_value.get().toString(scriptState));
+ String result = ustringToString(m_value.get().toString(scriptState)->value(scriptState));
// Handle the case where an exception is thrown as part of invoking toString on the object.
if (scriptState->hadException())
scriptState->clearException();
JSValue listener = exec->argument(1);
if (!listener.isObject())
return JSValue::encode(jsUndefined());
- impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec));
+ impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec));
return JSValue::encode(jsUndefined());
END
return @GenerateEventListenerImpl;
if ($type eq "DOMString") {
return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"};
return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
- return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec))";
+ return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec)->value(exec))";
}
if ($type eq "DOMObject") {
if (!executionContext)
return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));
- AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec));
+ AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
VOID_TO_NPVARIANT(*result);
if (value.isString()) {
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
CString cstring = ustring.utf8();
NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) };
NPN_InitializeVariantWithStringCopy(result, &string);
result = env->NewObject (JSObjectClass, constructorID, (jdouble)value.toNumber(exec));
}
} else if (value.isString()) {
- UString stringValue = value.toString(exec);
+ UString stringValue = value.toString(exec)->value(exec);
JNIEnv *env = getJNIEnv();
result = env->NewString ((const jchar *)stringValue.characters(), stringValue.length());
} else if (value.isBoolean()) {
env->NewStringUTF(""));
for (unsigned i = 0; i < length; i++) {
JSValue item = jsArray->get(exec, i);
- UString stringValue = item.toString(exec);
+ UString stringValue = item.toString(exec)->value(exec);
env->SetObjectArrayElement(jarray, i,
env->functions->NewString(env, (const jchar *)stringValue.characters(), stringValue.length()));
}
jarray = (jobjectArray)env->NewCharArray(length);
for (unsigned i = 0; i < length; i++) {
JSValue item = jsArray->get(exec, i);
- UString stringValue = item.toString(exec);
+ UString stringValue = item.toString(exec)->value(exec);
jchar value = 0;
if (stringValue.length() > 0)
value = ((const jchar*)stringValue.characters())[0];
// converting from a null.
if (!result.l && !strcmp(javaClassName, "java.lang.String")) {
if (!value.isNull()) {
- UString stringValue = value.toString(exec);
+ UString stringValue = value.toString(exec)->value(exec);
JNIEnv* env = getJNIEnv();
jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length());
result.l = javaString;
args[0].l = jinstance;
dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
if (exceptionDescription)
- throwError(exec, createError(exec, exceptionDescription.toString(exec)));
+ throwError(exec, createError(exec, exceptionDescription.toString(exec)->value(exec)));
}
}
}
break;
}
- LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name().impl()).utf8().data(), jsresult.toString(exec).ascii().data());
+ LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name().impl()).utf8().data(), jsresult.toString(exec)->value(exec).ascii().data());
return jsresult;
}
args[1] = javaValue;
dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, JavaTypeVoid, mid, args, result, 0, exceptionDescription);
if (exceptionDescription)
- throwError(exec, createError(exec, exceptionDescription.toString(exec)));
+ throwError(exec, createError(exec, exceptionDescription.toString(exec)->value(exec)));
}
}
}
const JavaInstance* instance = static_cast<const JavaInstance*>(i);
jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_type, typeClassName());
- LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name().impl()).utf8().data(), aValue.toString(exec).ascii().data());
+ LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name().impl()).utf8().data(), aValue.toString(exec)->value(exec).ascii().data());
switch (m_type) {
case JavaTypeArray:
for (i = 0; i < count; i++) {
CString javaClassName = jMethod->parameterAt(i).utf8();
jArgs[i] = convertValueToJValue(exec, m_rootObject.get(), exec->argument(i), javaTypeFromClassName(javaClassName.data()), javaClassName.data());
- LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii().data());
+ LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec)->value(exec).ascii().data());
}
jvalue result;
jmethodID methodId = getMethodID(obj, jMethod->name().utf8().data(), jMethod->signature());
handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->returnType(), methodId, jArgs.data(), result, callingURL, exceptionDescription);
if (exceptionDescription) {
- throwError(exec, createError(exec, exceptionDescription.toString(exec)));
+ throwError(exec, createError(exec, exceptionDescription.toString(exec)->value(exec)));
return jsUndefined();
}
}
else
dist = 6;
} else {
- UString str = value.toString(exec);
+ UString str = value.toString(exec)->value(exec);
ret = QVariant(QChar(str.length() ? *(const ushort*)str.impl()->characters() : 0));
if (type == String)
dist = 3;
*distance = 1;
return QString();
} else {
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length()));
if (type == String)
dist = 0;
int len = rtarray->getLength();
for (int i = 0; i < len; ++i) {
JSValue val = rtarray->getConcreteArray()->valueAt(exec, i);
- UString ustring = val.toString(exec);
+ UString ustring = val.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
result.append(qstring);
int len = array->length();
for (int i = 0; i < len; ++i) {
JSValue val = array->get(exec, i);
- UString ustring = val.toString(exec);
+ UString ustring = val.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
result.append(qstring);
ret = QVariant(result);
} else {
// Make a single length array
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
QStringList result;
result.append(qstring);
ret = QVariant(QByteArray(reinterpret_cast<const char*>(arr->data()), arr->length()));
dist = 0;
} else {
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length()).toLatin1());
if (type == String)
dist = 5;
}
#ifndef QT_NO_DATESTRING
} else if (type == String) {
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
if (hint == QMetaType::QDateTime) {
RegExpObject *re = static_cast<RegExpObject*>(object);
*/
// Attempt to convert.. a bit risky
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
// this is of the form '/xxxxxx/i'
qConvDebug() << "couldn't parse a JS regexp";
}
} else if (type == String) {
- UString ustring = value.toString(exec);
+ UString ustring = value.toString(exec)->value(exec);
QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length());
QRegExp re(qstring);
funcObject = asObj;
} else {
// Convert it to a string
- UString funcName = exec->argument(1).toString(exec);
+ UString funcName = exec->argument(1).toString(exec)->value(exec);
Identifier funcIdent(exec, funcName);
// ### DropAllLocks
if (comp.complType() == Throw) {
Value exVal = comp.value();
- char *msg = exVal.toString(exec).ascii();
+ char* msg = exVal.toString(exec)->value(exec).ascii();
int lineno = -1;
if (exVal.type() == ObjectType) {
Value lineVal = Object::dynamicCast(exVal).get(exec,Identifier("line"));
if (comp.complType() == Throw) {
qDebug() << "exception thrown";
JSValue* exVal = comp.value();
- char* msg = exVal->toString(exec).ascii();
+ char* msg = exVal->toString(exec)->value(exec).ascii();
int lineno = -1;
if (exVal->type() == ObjectType) {
JSValue* lineVal = exVal->getObject()->get(exec, Identifier("line"));
Vector<String> languages;
JSArray* array = asArray(value);
for (unsigned i = 0; i < array->length(); ++i) {
- String language = ustringToString(array->getIndex(i).toString(exec));
+ String language = ustringToString(array->getIndex(i).toString(exec)->value(exec));
languages.append(language);
}
return 0;
JSC::JSLock lock(JSC::SilenceAssertionsOnly);
- resultString = WebCore::ustringToString(result.toString(smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()));
+ JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec();
+ resultString = WebCore::ustringToString(result.toString(exec)->value(exec));
return strdup(resultString.utf8().data());
#else
notImplemented();
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ Mechanical changes to call value() after calling toString(), to
+ convert from "JS string" (JSString*) to "C++ string" (UString), since
+ toString() no longer returns a "C++ string".
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::addValueToArray):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
+
2012-01-20 Sam Weinig <sam@webkit.org>
Make WebCore RunLoop work for WebKit1
if (value.isString()) {
[array addObject:[NSNumber numberWithInt:StringValueType]];
- [array addObject:ustringToString(value.toString(exec))];
+ [array addObject:ustringToString(value.toString(exec)->value(exec))];
} else if (value.isNumber()) {
[array addObject:[NSNumber numberWithInt:DoubleValueType]];
[array addObject:[NSNumber numberWithDouble:value.toNumber(exec)]];
return @"";
JSLock lock(SilenceAssertionsOnly);
- return ustringToString(result.toString(_private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()));
+ JSC::ExecState* exec = _private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec();
+ return ustringToString(result.toString(exec)->value(exec));
}
- (NSRect)_caretRectAtPosition:(const Position&)pos affinity:(NSSelectionAffinity)affinity
return @"";
JSLock lock(SilenceAssertionsOnly);
- return ustringToString(result.toString(anyWorldGlobalObject->globalExec()));
+ JSC::ExecState* exec = anyWorldGlobalObject->globalExec();
+ return ustringToString(result.toString(exec)->value(exec));
}
- (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world
return S_OK;
JSLock lock(SilenceAssertionsOnly);
- String resultString = ustringToString(result.toString(anyWorldGlobalObject->globalExec()));
+ JSC::ExecState* exec = anyWorldGlobalObject->globalExec();
+ String resultString = ustringToString(result.toString(exec)->value(exec));
*evaluationResult = BString(resultString).release();
return S_OK;
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ Mechanical changes to call value() after calling toString(), to
+ convert from "JS string" (JSString*) to "C++ string" (UString), since
+ toString() no longer returns a "C++ string".
+
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
+
2012-01-23 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
[Qt][WK2] QQuickWebView is initializing touch mode twice while being constructed
}
if (value.isString()) {
- NPString npString = createNPString(value.toString(exec).utf8());
+ NPString npString = createNPString(value.toString(exec)->value(exec).utf8());
STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, variant);
return;
}