| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 | 243 |
| 244 return false; | 244 return false; |
| 245 } | 245 } |
| 246 | 246 |
| 247 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 247 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 248 { | 248 { |
| 249 v8::Isolate* isolate = info.GetIsolate(); | 249 v8::Isolate* isolate = info.GetIsolate(); |
| 250 | 250 |
| 251 if (!info.IsConstructCall()) { | 251 if (!info.IsConstructCall()) { |
| 252 V8ThrowException::throwTypeError("DOM object constructor cannot be calle
d as a function.", isolate); | 252 V8ThrowException::throwTypeError(isolate, "DOM object constructor cannot
be called as a function."); |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 | 255 |
| 256 if (info.Length() > 0) { | 256 if (info.Length() > 0) { |
| 257 V8ThrowException::throwTypeError("This constructor should be called with
out arguments.", isolate); | 257 V8ThrowException::throwTypeError(isolate, "This constructor should be ca
lled without arguments."); |
| 258 return; | 258 return; |
| 259 } | 259 } |
| 260 | 260 |
| 261 Document* document = V8Document::toImpl(V8HiddenValue::getHiddenValue(info.G
etIsolate(), info.Callee(), V8HiddenValue::customElementDocument(isolate)).As<v8
::Object>()); | 261 Document* document = V8Document::toImpl(V8HiddenValue::getHiddenValue(info.G
etIsolate(), info.Callee(), V8HiddenValue::customElementDocument(isolate)).As<v8
::Object>()); |
| 262 TOSTRING_VOID(V8StringResource<>, namespaceURI, V8HiddenValue::getHiddenValu
e(isolate, info.Callee(), V8HiddenValue::customElementNamespaceURI(isolate))); | 262 TOSTRING_VOID(V8StringResource<>, namespaceURI, V8HiddenValue::getHiddenValu
e(isolate, info.Callee(), V8HiddenValue::customElementNamespaceURI(isolate))); |
| 263 TOSTRING_VOID(V8StringResource<>, tagName, V8HiddenValue::getHiddenValue(iso
late, info.Callee(), V8HiddenValue::customElementTagName(isolate))); | 263 TOSTRING_VOID(V8StringResource<>, tagName, V8HiddenValue::getHiddenValue(iso
late, info.Callee(), V8HiddenValue::customElementTagName(isolate))); |
| 264 v8::Handle<v8::Value> maybeType = V8HiddenValue::getHiddenValue(info.GetIsol
ate(), info.Callee(), V8HiddenValue::customElementType(isolate)); | 264 v8::Handle<v8::Value> maybeType = V8HiddenValue::getHiddenValue(info.GetIsol
ate(), info.Callee(), V8HiddenValue::customElementType(isolate)); |
| 265 TOSTRING_VOID(V8StringResource<>, type, maybeType); | 265 TOSTRING_VOID(V8StringResource<>, type, maybeType); |
| 266 | 266 |
| 267 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 267 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
| 268 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 268 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 269 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); | 269 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); |
| 270 if (exceptionState.throwIfNeeded()) | 270 if (exceptionState.throwIfNeeded()) |
| 271 return; | 271 return; |
| 272 v8SetReturnValueFast(info, element.release(), document); | 272 v8SetReturnValueFast(info, element.release(), document); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace blink | 275 } // namespace blink |
| OLD | NEW |