Chromium Code Reviews| Index: Source/bindings/v8/V8Binding.cpp |
| diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp |
| index fc3766666959d2f33f738b784c9519ad426f4334..709de17f91813e63fa028346fd6ff8f3f5e49542 100644 |
| --- a/Source/bindings/v8/V8Binding.cpp |
| +++ b/Source/bindings/v8/V8Binding.cpp |
| @@ -495,6 +495,8 @@ float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| { |
| // 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()); |
| @@ -513,6 +515,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()); |
|
haraken
2014/06/11 04:21:12
Probably you can (or should?) use TOSTRING_DEFAULT
jsbell
2014/06/12 17:45:55
As discussed in the ByteString bug, I think we wan
haraken
2014/06/12 17:49:02
Yes!
|
| + |
| + // 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; |