| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/ScriptCustomElementDefinition.h" | 5 #include "bindings/core/v8/ScriptCustomElementDefinition.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8CustomElementRegistry.h" | 10 #include "bindings/core/v8/V8CustomElementRegistry.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // catch it. The side effect is to report the error. | 233 // catch it. The side effect is to report the error. |
| 234 v8::TryCatch tryCatch(isolate); | 234 v8::TryCatch tryCatch(isolate); |
| 235 tryCatch.SetVerbose(true); | 235 tryCatch.SetVerbose(true); |
| 236 | 236 |
| 237 Element* result = runConstructor(); | 237 Element* result = runConstructor(); |
| 238 | 238 |
| 239 // To report exception thrown from runConstructor() | 239 // To report exception thrown from runConstructor() |
| 240 if (tryCatch.HasCaught()) | 240 if (tryCatch.HasCaught()) |
| 241 return false; | 241 return false; |
| 242 | 242 |
| 243 // To report InvalidStateError Exception, when the constructor returns some di
fferent object | 243 // To report InvalidStateError Exception, when the constructor returns some |
| 244 // different object |
| 244 if (result != element) { | 245 if (result != element) { |
| 245 const String& message = | 246 const String& message = |
| 246 "custom element constructors must call super() first and must " | 247 "custom element constructors must call super() first and must " |
| 247 "not return a different object"; | 248 "not return a different object"; |
| 248 v8::Local<v8::Value> exception = V8ThrowException::createDOMException( | 249 v8::Local<v8::Value> exception = V8ThrowException::createDOMException( |
| 249 m_scriptState->isolate(), InvalidStateError, message); | 250 m_scriptState->isolate(), InvalidStateError, message); |
| 250 dispatchErrorEvent(isolate, exception, constructor()); | 251 dispatchErrorEvent(isolate, exception, constructor()); |
| 251 return false; | 252 return false; |
| 252 } | 253 } |
| 253 | 254 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 v8::Local<v8::Value> argv[] = { | 358 v8::Local<v8::Value> argv[] = { |
| 358 v8String(isolate, name.localName()), v8StringOrNull(isolate, oldValue), | 359 v8String(isolate, name.localName()), v8StringOrNull(isolate, oldValue), |
| 359 v8StringOrNull(isolate, newValue), | 360 v8StringOrNull(isolate, newValue), |
| 360 v8StringOrNull(isolate, name.namespaceURI()), | 361 v8StringOrNull(isolate, name.namespaceURI()), |
| 361 }; | 362 }; |
| 362 runCallback(m_attributeChangedCallback.newLocal(isolate), element, | 363 runCallback(m_attributeChangedCallback.newLocal(isolate), element, |
| 363 WTF_ARRAY_LENGTH(argv), argv); | 364 WTF_ARRAY_LENGTH(argv), argv); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace blink | 367 } // namespace blink |
| OLD | NEW |