https://bugs.webkit.org/show_bug.cgi?id=165795
Reviewed by Saam Barati.
Source/JavaScriptCore:
In old days, we frequently use the idiom like, `value.toString(exec)->value(exec)` to
get WTFString from the given JSValue. But now, we have better function, `toWTFString`.
`toWTFString` does not create intermediate JSString objects, then reduce unnecessary
allocations.
This patch mechanically replaces `value.toString(exec)->value(exec)` with `toWTFString(exec)`.
* API/JSValueRef.cpp:
(JSValueToStringCopy):
* bindings/ScriptValue.cpp:
(Deprecated::ScriptValue::toString):
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::reportAPIException):
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
* inspector/JSJavaScriptCallFrame.cpp:
(Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):
* inspector/ScriptCallStackFactory.cpp:
(Inspector::extractSourceInformationFromException):
* runtime/ConsoleObject.cpp:
(JSC::valueToStringWithUndefinedOrNullCheck):
(JSC::valueOrDefaultLabelString):
* runtime/DateConstructor.cpp:
(JSC::dateParse):
* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate):
* runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::sanitizedToString):
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/InspectorInstrumentationObject.cpp:
(JSC::inspectorInstrumentationObjectLog):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::fetch):
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
* runtime/RegExpConstructor.cpp:
(JSC::regExpCreate):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):
* runtime/StringPrototype.cpp:
(JSC::replaceUsingRegExpSearch):
(JSC::replaceUsingStringSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplitFast):
(JSC::stringProtoFuncSubstr):
(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):
(JSC::stringProtoFuncStartsWith):
(JSC::stringProtoFuncEndsWith):
(JSC::stringProtoFuncIncludes):
(JSC::builtinStringIncludesInternal):
(JSC::stringProtoFuncNormalize):
* tools/JSDollarVMPrototype.cpp:
(JSC::functionPrint):
* wasm/js/JSWebAssemblyCompileError.h:
(JSC::JSWebAssemblyCompileError::create):
* wasm/js/JSWebAssemblyRuntimeError.h:
(JSC::JSWebAssemblyRuntimeError::create):
Source/WebCore:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):
* bindings/js/JSAudioTrackCustom.cpp:
(WebCore::JSAudioTrack::setKind):
(WebCore::JSAudioTrack::setLanguage):
* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setLocation):
* bindings/js/JSDeviceMotionEventCustom.cpp:
(WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
* bindings/js/JSDeviceOrientationEventCustom.cpp:
(WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::callHTMLAllCollection):
(WebCore::JSHTMLAllCollection::namedItem):
* bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
(WebCore::JSHTMLFormControlsCollection::namedItem):
* bindings/js/JSHTMLInputElementCustom.cpp:
(WebCore::JSHTMLInputElement::setSelectionDirection):
* bindings/js/JSInspectorFrontendHostCustom.cpp:
(WebCore::populateContextMenuItems):
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
* bindings/js/JSSQLTransactionCustom.cpp:
(WebCore::JSSQLTransaction::executeSql):
* bindings/js/JSTextTrackCustom.cpp:
(WebCore::JSTextTrack::setLanguage):
* bindings/js/JSVideoTrackCustom.cpp:
(WebCore::JSVideoTrack::setKind):
(WebCore::JSVideoTrack::setLanguage):
* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
(WebCore::cryptoKeyFormatFromJSValue):
(WebCore::cryptoKeyUsagesFromJSValue):
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send):
* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessor::setParameter):
(WebCore::JSXSLTProcessor::getParameter):
(WebCore::JSXSLTProcessor::removeParameter):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
* bridge/c/c_utility.cpp:
(JSC::Bindings::convertValueToNPVariant):
* bridge/testbindings.cpp:
(main):
Source/WebKit2:
* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209801
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
JSValue jsValue = toJS(exec, value);
- auto stringRef(OpaqueJSString::create(jsValue.toString(exec)->value(exec)));
+ auto stringRef(OpaqueJSString::create(jsValue.toWTFString(exec)));
if (handleExceptionIfNeeded(exec, exception) == ExceptionStatus::DidThrow)
stringRef = nullptr;
return stringRef.leakRef();
+2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
+ https://bugs.webkit.org/show_bug.cgi?id=165795
+
+ Reviewed by Saam Barati.
+
+ In old days, we frequently use the idiom like, `value.toString(exec)->value(exec)` to
+ get WTFString from the given JSValue. But now, we have better function, `toWTFString`.
+ `toWTFString` does not create intermediate JSString objects, then reduce unnecessary
+ allocations.
+
+ This patch mechanically replaces `value.toString(exec)->value(exec)` with `toWTFString(exec)`.
+
+ * API/JSValueRef.cpp:
+ (JSValueToStringCopy):
+ * bindings/ScriptValue.cpp:
+ (Deprecated::ScriptValue::toString):
+ * inspector/JSGlobalObjectInspectorController.cpp:
+ (Inspector::JSGlobalObjectInspectorController::reportAPIException):
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
+ * inspector/JSJavaScriptCallFrame.cpp:
+ (Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):
+ * inspector/ScriptCallStackFactory.cpp:
+ (Inspector::extractSourceInformationFromException):
+ * runtime/ConsoleObject.cpp:
+ (JSC::valueToStringWithUndefinedOrNullCheck):
+ (JSC::valueOrDefaultLabelString):
+ * runtime/DateConstructor.cpp:
+ (JSC::dateParse):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::sanitizedToString):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/InspectorInstrumentationObject.cpp:
+ (JSC::inspectorInstrumentationObjectLog):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSModuleLoader.cpp:
+ (JSC::JSModuleLoader::fetch):
+ * runtime/ModuleLoaderPrototype.cpp:
+ (JSC::moduleLoaderPrototypeParseModule):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::regExpCreate):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringPrototype.cpp:
+ (JSC::replaceUsingRegExpSearch):
+ (JSC::replaceUsingStringSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplitFast):
+ (JSC::stringProtoFuncSubstr):
+ (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):
+ (JSC::stringProtoFuncStartsWith):
+ (JSC::stringProtoFuncEndsWith):
+ (JSC::stringProtoFuncIncludes):
+ (JSC::builtinStringIncludesInternal):
+ (JSC::stringProtoFuncNormalize):
+ * tools/JSDollarVMPrototype.cpp:
+ (JSC::functionPrint):
+ * wasm/js/JSWebAssemblyCompileError.h:
+ (JSC::JSWebAssemblyCompileError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.h:
+ (JSC::JSWebAssemblyRuntimeError::create):
+
2016-12-14 Gavin Barraclough <barraclough@apple.com>
MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
VM& vm = scriptState->vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
- String result = m_value.get().toString(scriptState)->value(scriptState);
+ String result = m_value.get().toWTFString(scriptState);
// Handle the case where an exception is thrown as part of invoking toString on the object.
if (UNLIKELY(scope.exception()))
scope.clearException();
// FIXME: <http://webkit.org/b/115087> Web Inspector: Should not evaluate JavaScript handling exceptions
// If this is a custom exception object, call toString on it to try and get a nice string representation for the exception.
- String errorMessage = exception->value().toString(exec)->value(exec);
+ String errorMessage = exception->value().toWTFString(exec);
scope.clearException();
if (JSGlobalObjectConsoleClient::logToSystemConsole()) {
if (!scriptValue.isString())
return throwTypeError(exec, scope, ASCIILiteral("InjectedScriptHost.evaluateWithScopeExtension first argument must be a string."));
- String program = scriptValue.toString(exec)->value(exec);
+ String program = scriptValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, JSValue());
NakedPtr<Exception> exception;
if (!scriptValue.isString())
return throwTypeError(exec, scope, ASCIILiteral("JSJavaScriptCallFrame.evaluateWithScopeExtension first argument must be a string."));
- String script = scriptValue.toString(exec)->value(exec);
+ String script = scriptValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, JSValue());
NakedPtr<Exception> exception;
JSValue columnValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "column"));
*columnNumber = columnValue && columnValue.isNumber() ? int(columnValue.toNumber(exec)) : 0;
JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "sourceURL"));
- *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : ASCIILiteral("undefined");
+ *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toWTFString(exec) : ASCIILiteral("undefined");
scope.clearException();
}
{
if (value.isUndefinedOrNull())
return String();
- return value.toString(exec)->value(exec);
+ return value.toWTFString(exec);
}
static EncodedJSValue consoleLogWithLevel(ExecState* exec, MessageLevel level)
{
if (value.isUndefined())
return ASCIILiteral("default");
- return value.toString(exec)->value(exec);
+ return value.toWTFString(exec);
}
static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec)
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- String dateStr = exec->argument(0).toString(exec)->value(exec);
+ String dateStr = exec->argument(0).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
return JSValue::encode(jsNumber(parseDate(vm, dateStr)));
}
bool useCustomFormat = false;
String customFormatString;
- String arg0String = exec->argument(0).toString(exec)->value(exec);
+ String arg0String = exec->argument(0).toWTFString(exec);
if (arg0String == "custom" && !exec->argument(1).isUndefined()) {
useCustomFormat = true;
- customFormatString = exec->argument(1).toString(exec)->value(exec);
+ customFormatString = exec->argument(1).toWTFString(exec);
} else if (format == LocaleDateAndTime && !exec->argument(1).isUndefined()) {
dateStyle = styleFromArgString(arg0String, dateStyle);
- timeStyle = styleFromArgString(exec->argument(1).toString(exec)->value(exec), timeStyle);
+ timeStyle = styleFromArgString(exec->argument(1).toWTFString(exec), timeStyle);
} else if (format != LocaleTime && !exec->argument(0).isUndefined())
dateStyle = styleFromArgString(arg0String, dateStyle);
else if (format != LocaleDate && !exec->argument(0).isUndefined())
if (!nameValue)
nameString = ASCIILiteral("Error");
else {
- nameString = nameValue.toString(exec)->value(exec);
+ nameString = nameValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, String());
}
if (!messageValue)
messageString = String();
else {
- messageString = messageValue.toString(exec)->value(exec);
+ messageString = messageValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, String());
}
if (name.isUndefined())
nameString = ASCIILiteral("Error");
else {
- nameString = name.toString(exec)->value(exec);
+ nameString = name.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
}
if (message.isUndefined())
messageString = String();
else {
- messageString = message.toString(exec)->value(exec);
+ messageString = message.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
}
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSValue target = exec->argument(0);
- String value = target.toString(exec)->value(exec);
+ String value = target.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
dataLog(value, "\n");
return JSValue::encode(jsUndefined());
return JSValue::encode(jsUndefined());
}
- String s = x.toString(exec)->value(exec);
+ String s = x.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (s.is8Bit()) {
if (globalObject->globalObjectMethodTable()->moduleLoaderFetch)
return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key, initiator);
JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
- String moduleKey = key.toString(exec)->value(exec);
+ String moduleKey = key.toWTFString(exec);
if (UNLIKELY(scope.exception())) {
JSValue exception = scope.exception()->value();
scope.clearException();
const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- String source = exec->argument(1).toString(exec)->value(exec);
+ String source = exec->argument(1).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
SourceCode sourceCode = makeSource(source, moduleKey.impl(), TextPosition(), SourceProviderSourceType::Module);
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- String pattern = patternArg.isUndefined() ? emptyString() : patternArg.toString(exec)->value(exec);
+ String pattern = patternArg.isUndefined() ? emptyString() : patternArg.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, nullptr);
RegExpFlags flags = toFlags(exec, flagsArg);
return throwVMTypeError(exec, scope, ASCIILiteral("Cannot supply flags when constructing one RegExp from another."));
regExp = asRegExpObject(arg0)->regExp();
} else {
- String pattern = arg0.isUndefined() ? emptyString() : arg0.toString(exec)->value(exec);
+ String pattern = arg0.isUndefined() ? emptyString() : arg0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
RegExpFlags flags = NoFlags;
if (!arg1.isUndefined()) {
- flags = regExpFlags(arg1.toString(exec)->value(exec));
+ flags = regExpFlags(arg1.toWTFString(exec));
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (flags == InvalidFlags)
return throwVMError(exec, scope, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor.")));
JSValue sourceValue = thisObject->get(exec, vm.propertyNames->source);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- String source = sourceValue.toString(exec)->value(exec);
+ String source = sourceValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue flagsValue = thisObject->get(exec, vm.propertyNames->flags);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- String flags = flagsValue.toString(exec)->value(exec);
+ String flags = flagsValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
cachedCall.setThis(jsUndefined());
JSValue jsResult = cachedCall.call();
- replacements.append(jsResult.toString(exec)->value(exec));
+ replacements.append(jsResult.toWTFString(exec));
RETURN_IF_EXCEPTION(scope, encodedJSValue());
lastIndex = result.end;
cachedCall.setThis(jsUndefined());
JSValue jsResult = cachedCall.call();
- replacements.append(jsResult.toString(exec)->value(exec));
+ replacements.append(jsResult.toWTFString(exec));
RETURN_IF_EXCEPTION(scope, encodedJSValue());
lastIndex = result.end;
JSValue replacement = call(exec, replaceValue, callType, callData, jsUndefined(), args);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- String replacementString = replacement.toString(exec)->value(exec);
+ String replacementString = replacement.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
replacements.append(replacementString);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
CallData callData;
CallType callType = getCallData(replaceValue, callData);
if (callType == CallType::None) {
- replacementString = replaceValue.toString(exec)->value(exec);
+ replacementString = replaceValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
}
auto scope = DECLARE_THROW_SCOPE(vm);
const String& string = jsString->value(exec);
- String searchString = searchValue.toString(exec)->value(exec);
+ String searchString = searchValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
size_t matchStart = string.find(searchString);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
}
- String replaceString = replaceValue.toString(exec)->value(exec);
+ String replaceString = replaceValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
StringImpl* stringImpl = string.impl();
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
int len = s.length();
// 3. Let S be the result of calling ToString, giving it the this value as its argument.
// 7. Let s be the number of characters in S.
- String input = thisValue.toString(exec)->value(exec);
+ String input = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
ASSERT(!input.isNull());
// 9. If separator is a RegExp object (its [[Class]] is "RegExp"), let R = separator;
// otherwise let R = ToString(separator).
JSValue separatorValue = exec->uncheckedArgument(0);
- String separator = separatorValue.toString(exec)->value(exec);
+ String separator = separatorValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
// 10. If lim == 0, return A.
jsString = jsCast<JSString*>(thisValue.asCell());
len = jsString->length();
} else {
- uString = thisValue.toString(exec)->value(exec);
+ uString = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
len = uString.length();
}
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
- String str = a0.toString(exec)->value(exec);
+ String str = a0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
return JSValue::encode(jsNumber(Collator().collate(s, str)));
}
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
scope.release();
return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
JSValue thisValue = exec->thisValue();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String s = thisValue.toString(exec)->value(exec);
+ String s = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
if (!checkObjectCoercible(thisValue))
return throwTypeError(exec, scope);
- String str = thisValue.toString(exec)->value(exec);
+ String str = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, { });
unsigned left = 0;
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String stringToSearchIn = thisValue.toString(exec)->value(exec);
+ String stringToSearchIn = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
if (isRegularExpression)
return throwVMTypeError(exec, scope, "Argument to String.prototype.startsWith cannot be a RegExp");
- String searchString = a0.toString(exec)->value(exec);
+ String searchString = a0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue positionArg = exec->argument(1);
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String stringToSearchIn = thisValue.toString(exec)->value(exec);
+ String stringToSearchIn = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
if (isRegularExpression)
return throwVMTypeError(exec, scope, "Argument to String.prototype.endsWith cannot be a RegExp");
- String searchString = a0.toString(exec)->value(exec);
+ String searchString = a0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
unsigned length = stringToSearchIn.length();
if (!checkObjectCoercible(thisValue))
return throwVMTypeError(exec, scope);
- String stringToSearchIn = thisValue.toString(exec)->value(exec);
+ String stringToSearchIn = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->argument(0);
if (isRegularExpression)
return throwVMTypeError(exec, scope, "Argument to String.prototype.includes cannot be a RegExp");
- String searchString = a0.toString(exec)->value(exec);
+ String searchString = a0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue positionArg = exec->argument(1);
JSValue thisValue = exec->thisValue();
ASSERT(checkObjectCoercible(thisValue));
- String stringToSearchIn = thisValue.toString(exec)->value(exec);
+ String stringToSearchIn = thisValue.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue a0 = exec->uncheckedArgument(0);
- String searchString = a0.toString(exec)->value(exec);
+ String searchString = a0.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue positionArg = exec->argument(1);
UNormalizationMode form = UNORM_NFC;
// Verify that the argument is provided and is not undefined.
if (!exec->argument(0).isUndefined()) {
- String formString = exec->uncheckedArgument(0).toString(exec)->value(exec);
+ String formString = exec->uncheckedArgument(0).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (formString == "NFC")
{
auto scope = DECLARE_THROW_SCOPE(exec->vm());
for (unsigned i = 0; i < exec->argumentCount(); ++i) {
- String argStr = exec->uncheckedArgument(i).toString(exec)->value(exec);
+ String argStr = exec->uncheckedArgument(i).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
dataLog(argStr);
}
static JSWebAssemblyCompileError* create(ExecState*, Structure*, const String&, bool);
static JSWebAssemblyCompileError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
{
- return create(exec, structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), useCurrentFrame);
+ return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
}
DECLARE_INFO;
static JSWebAssemblyRuntimeError* create(ExecState*, Structure*, const String&, bool useCurrentFrame = true);
static JSWebAssemblyRuntimeError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
{
- return create(exec, structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), useCurrentFrame);
+ return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
}
DECLARE_INFO;
+2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
+ https://bugs.webkit.org/show_bug.cgi?id=165795
+
+ Reviewed by Saam Barati.
+
+ * bindings/js/IDBBindingUtilities.cpp:
+ (WebCore::createIDBKeyFromValue):
+ * bindings/js/JSAudioTrackCustom.cpp:
+ (WebCore::JSAudioTrack::setKind):
+ (WebCore::JSAudioTrack::setLanguage):
+ * bindings/js/JSCryptoAlgorithmDictionary.cpp:
+ (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
+ * bindings/js/JSCustomXPathNSResolver.cpp:
+ (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::setLocation):
+ * bindings/js/JSDeviceMotionEventCustom.cpp:
+ (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
+ * bindings/js/JSDeviceOrientationEventCustom.cpp:
+ (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSHTMLAllCollectionCustom.cpp:
+ (WebCore::callHTMLAllCollection):
+ (WebCore::JSHTMLAllCollection::namedItem):
+ * bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
+ (WebCore::JSHTMLFormControlsCollection::namedItem):
+ * bindings/js/JSHTMLInputElementCustom.cpp:
+ (WebCore::JSHTMLInputElement::setSelectionDirection):
+ * bindings/js/JSInspectorFrontendHostCustom.cpp:
+ (WebCore::populateContextMenuItems):
+ * bindings/js/JSMessageEventCustom.cpp:
+ (WebCore::handleInitMessageEvent):
+ * bindings/js/JSSQLTransactionCustom.cpp:
+ (WebCore::JSSQLTransaction::executeSql):
+ * bindings/js/JSTextTrackCustom.cpp:
+ (WebCore::JSTextTrack::setLanguage):
+ * bindings/js/JSVideoTrackCustom.cpp:
+ (WebCore::JSVideoTrack::setKind):
+ (WebCore::JSVideoTrack::setLanguage):
+ * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
+ (WebCore::cryptoKeyFormatFromJSValue):
+ (WebCore::cryptoKeyUsagesFromJSValue):
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ (WebCore::JSXMLHttpRequest::send):
+ * bindings/js/JSXSLTProcessorCustom.cpp:
+ (WebCore::JSXSLTProcessor::setParameter):
+ (WebCore::JSXSLTProcessor::getParameter):
+ (WebCore::JSXSLTProcessor::removeParameter):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::create):
+ * bridge/c/c_utility.cpp:
+ (JSC::Bindings::convertValueToNPVariant):
+ * bridge/testbindings.cpp:
+ (main):
+
2016-12-14 Joonghun Park <jh718.park@samsung.com>
[EFL] Fix debug build break since r207192. Unreviewed.
return IDBKey::createNumber(value.toNumber(&exec));
if (value.isString())
- return IDBKey::createString(value.toString(&exec)->value(&exec));
+ return IDBKey::createString(value.toWTFString(&exec));
if (value.inherits(DateInstance::info()) && !std::isnan(valueToDate(&exec, value)))
return IDBKey::createDate(valueToDate(&exec, value));
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto& string = value.toString(&state)->value(&state);
+ auto string = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
wrapped().setKind(string);
#else
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto& string = value.toString(&state)->value(&state);
+ auto string = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
wrapped().setLanguage(string);
#else
String algorithmName;
if (value.isString())
- algorithmName = value.toString(exec)->value(exec);
+ algorithmName = value.toWTFString(exec);
else if (value.isObject()) {
if (value.getObject()->inherits(StringObject::info()))
algorithmName = asString(asStringObject(value)->internalValue())->value(exec);
reportException(exec, exception);
else {
if (!retval.isUndefinedOrNull())
- result = retval.toString(exec)->value(exec);
+ result = retval.toWTFString(exec);
}
return result;
}
#endif
- String locationString = value.toString(&state)->value(&state);
+ String locationString = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
if (Location* location = wrapped().location())
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- const String type = state.argument(0).toString(&state)->value(&state);
+ const String type = state.argument(0).toWTFString(&state);
bool bubbles = state.argument(1).toBoolean(&state);
bool cancelable = state.argument(2).toBoolean(&state);
JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState& state)
{
- const String type = state.argument(0).toString(&state)->value(&state);
+ const String type = state.argument(0).toWTFString(&state);
bool bubbles = state.argument(1).toBoolean(&state);
bool cancelable = state.argument(2).toBoolean(&state);
// If alpha, beta or gamma are null or undefined, mark them as not provided.
reportException(exec, exception);
} else {
if (!retval.isUndefinedOrNull() && is<BeforeUnloadEvent>(*event))
- downcast<BeforeUnloadEvent>(*event).setReturnValue(retval.toString(exec)->value(exec));
+ downcast<BeforeUnloadEvent>(*event).setReturnValue(retval.toWTFString(exec));
if (m_isAttribute) {
if (retval.isFalse())
event->preventDefault();
if (exec->argumentCount() == 1) {
// Support for document.all(<index>) etc.
- String string = exec->argument(0).toString(exec)->value(exec);
+ String string = exec->argument(0).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (std::optional<uint32_t> index = parseIndex(*string.impl()))
return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index.value())));
}
// The second arg, if set, is the index of the item we want
- String string = exec->argument(0).toString(exec)->value(exec);
+ String string = exec->argument(0).toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (std::optional<uint32_t> index = parseIndex(*exec->argument(1).toWTFString(exec).impl())) {
if (auto* item = collection.namedItemWithIndex(string, index.value()))
JSValue JSHTMLAllCollection::namedItem(ExecState& state)
{
- JSValue value = namedItems(state, this, Identifier::fromString(&state, state.argument(0).toString(&state)->value(&state)));
+ JSValue value = namedItems(state, this, Identifier::fromString(&state, state.argument(0).toWTFString(&state)));
return value.isUndefined() ? jsNull() : value;
}
if (UNLIKELY(state.argumentCount() < 1))
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
- JSValue value = namedItems(state, this, Identifier::fromString(&state, state.uncheckedArgument(0).toString(&state)->value(&state)));
+ JSValue value = namedItems(state, this, Identifier::fromString(&state, state.uncheckedArgument(0).toWTFString(&state)));
return value.isUndefined() ? jsNull() : value;
}
return;
}
- input.setSelectionDirection(value.toString(&state)->value(&state));
+ input.setSelectionDirection(value.toWTFString(&state));
}
JSValue JSHTMLInputElement::setSelectionRange(ExecState& state)
if (!type.isString())
continue;
- String typeString = type.toString(exec)->value(exec);
+ String typeString = type.toWTFString(exec);
if (typeString == "separator") {
ContextMenuItem item(SeparatorType, ContextMenuItemTagNoAction, String());
menu.appendItem(item);
ContextMenu subMenu;
JSArray* subItemsArray = asArray(subItems);
populateContextMenuItems(exec, subItemsArray, subMenu);
- ContextMenuItem item(SubmenuType, ContextMenuItemTagNoAction, label.toString(exec)->value(exec), &subMenu);
+ ContextMenuItem item(SubmenuType, ContextMenuItemTagNoAction, label.toWTFString(exec), &subMenu);
menu.appendItem(item);
} else {
ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
- ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, label.toString(exec)->value(exec));
+ ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, label.toWTFString(exec));
if (!enabled.isUndefined())
menuItem.setEnabled(enabled.toBoolean(exec));
if (!checked.isUndefined())
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- const String& typeArg = state.argument(0).toString(&state)->value(&state);
+ const String& typeArg = state.argument(0).toWTFString(&state);
RETURN_IF_EXCEPTION(scope, JSValue());
bool canBubbleArg = state.argument(1).toBoolean(&state);
const String originArg = convert<IDLUSVString>(state, state.argument(4));
RETURN_IF_EXCEPTION(scope, JSValue());
- const String lastEventIdArg = state.argument(5).toString(&state)->value(&state);
+ const String lastEventIdArg = state.argument(5).toWTFString(&state);
RETURN_IF_EXCEPTION(scope, JSValue());
auto sourceArg = convert<IDLNullable<IDLUnion<IDLInterface<DOMWindow>, IDLInterface<MessagePort>>>>(state, state.argument(6));
return jsUndefined();
}
- String sqlStatement = state.argument(0).toString(&state)->value(&state);
+ String sqlStatement = state.argument(0).toWTFString(&state);
RETURN_IF_EXCEPTION(scope, JSValue());
// Now assemble the list of SQL arguments
sqlValues.append(value.asNumber());
else {
// Convert the argument to a string and append it
- sqlValues.append(value.toString(&state)->value(&state));
+ sqlValues.append(value.toWTFString(&state));
RETURN_IF_EXCEPTION(scope, JSValue());
}
}
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto& string = value.toString(&state)->value(&state);
+ auto string = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
wrapped().setLanguage(string);
#else
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto& string = value.toString(&state)->value(&state);
+ auto string = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
wrapped().setKind(string);
#else
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto& string = value.toString(&state)->value(&state);
+ auto string = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, void());
wrapped().setLanguage(string);
#else
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- String keyFormatString = value.toString(&state)->value(&state);
+ String keyFormatString = value.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, false);
if (keyFormatString == "raw")
result = CryptoKeyFormat::Raw;
JSArray* array = asArray(value);
for (size_t i = 0; i < array->length(); ++i) {
JSValue element = array->getIndex(&state, i);
- String usageString = element.toString(&state)->value(&state);
+ String usageString = element.toWTFString(&state);
RETURN_IF_EXCEPTION(scope, false);
if (usageString == "encrypt")
result |= CryptoKeyUsageEncrypt;
else {
// FIXME: If toString raises an exception, should we exit before calling willSendXMLHttpRequest?
// FIXME: If toString raises an exception, should we exit before calling send?
- result = wrapped().send(value.toString(&state)->value(&state));
+ result = wrapped().send(value.toWTFString(&state));
}
// FIXME: This should probably use ShadowChicken so that we get the right frame even when it did a tail call.
{
if (state.argument(1).isUndefinedOrNull() || state.argument(2).isUndefinedOrNull())
return jsUndefined(); // Throw exception?
- String namespaceURI = state.uncheckedArgument(0).toString(&state)->value(&state);
- String localName = state.uncheckedArgument(1).toString(&state)->value(&state);
- String value = state.uncheckedArgument(2).toString(&state)->value(&state);
+ String namespaceURI = state.uncheckedArgument(0).toWTFString(&state);
+ String localName = state.uncheckedArgument(1).toWTFString(&state);
+ String value = state.uncheckedArgument(2).toWTFString(&state);
wrapped().setParameter(namespaceURI, localName, value);
return jsUndefined();
}
{
if (state.argument(1).isUndefinedOrNull())
return jsUndefined();
- String namespaceURI = state.uncheckedArgument(0).toString(&state)->value(&state);
- String localName = state.uncheckedArgument(1).toString(&state)->value(&state);
+ String namespaceURI = state.uncheckedArgument(0).toWTFString(&state);
+ String localName = state.uncheckedArgument(1).toWTFString(&state);
String value = wrapped().getParameter(namespaceURI, localName);
return jsStringOrUndefined(&state, value);
}
{
if (state.argument(1).isUndefinedOrNull())
return jsUndefined();
- String namespaceURI = state.uncheckedArgument(0).toString(&state)->value(&state);
- String localName = state.uncheckedArgument(1).toString(&state)->value(&state);
+ String namespaceURI = state.uncheckedArgument(0).toWTFString(&state);
+ String localName = state.uncheckedArgument(1).toWTFString(&state);
wrapped().removeParameter(namespaceURI, localName);
return jsUndefined();
}
if (getCallData(v, callData) == CallType::None) {
if (policy && !policy->allowEval(exec))
return nullptr;
- String string = v.toString(exec)->value(exec);
+ String string = v.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, nullptr);
return std::unique_ptr<ScheduledAction>(new ScheduledAction(string, isolatedWorld));
}
VOID_TO_NPVARIANT(*result);
if (value.isString()) {
- String ustring = value.toString(exec)->value(exec);
+ String ustring = value.toWTFString(exec);
CString cstring = ustring.utf8();
NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) };
NPN_InitializeVariantWithStringCopy(result, &string);
if (comp.complType() == Throw) {
Value exVal = comp.value();
- char* msg = exVal.toString(exec)->value(exec).ascii();
+ String message = exVal.toWTFString(exec);
+ auto cstring = msg.ascii();
+ const char* msg = cstring.data();
int lineno = -1;
if (exVal.type() == ObjectType) {
Value lineVal = Object::dynamicCast(exVal).get(exec, Identifier::fromString(exec, "line"));
+2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
+ https://bugs.webkit.org/show_bug.cgi?id=165795
+
+ Reviewed by Saam Barati.
+
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
+
2016-12-14 Enrique Ocaña González <eocanha@igalia.com>
REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
}
if (value.isString()) {
- NPString npString = createNPString(value.toString(exec)->value(exec).utf8());
+ NPString npString = createNPString(value.toWTFString(exec).utf8());
STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, variant);
return;
}