Index: Source/bindings/v8/V8Binding.cpp |
diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp |
index bef984e7af5aff1ac0aafda305d59436dbe6173d..3a30b2c108f71599bc4b6bed18695324104b87d5 100644 |
--- a/Source/bindings/v8/V8Binding.cpp |
+++ b/Source/bindings/v8/V8Binding.cpp |
@@ -499,6 +499,8 @@ String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
return String(); |
// From the Web IDL spec: http://heycam.github.io/webidl/#es-ByteString |
+ if (value.IsEmpty()) |
+ return String(); |
// 1. Let x be ToString(v) |
TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::String>, stringObject, value->ToString(), exceptionState, String()); |
@@ -517,6 +519,21 @@ String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
return x; |
} |
+String toScalarValueString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
+{ |
+ // From the Encoding standard (with a TODO to move to Web IDL): |
+ // http://encoding.spec.whatwg.org/#type-scalarvaluestring |
+ if (value.IsEmpty()) |
+ return String(); |
+ TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::String>, stringObject, value->ToString(), exceptionState, String()); |
+ |
+ // ScalarValueString is identical to DOMString except that "convert a |
+ // DOMString to a sequence of Unicode characters" is used subsequently |
+ // when converting to an IDL value |
+ String x = toCoreString(stringObject); |
+ return x.toScalarValueString(); |
+} |
+ |
PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value, v8::Isolate* isolate) |
{ |
RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr; |