OLD | NEW |
1 // Copyright 2012, Google Inc. | 1 // Copyright 2012, Google Inc. |
2 // All rights reserved. | 2 // 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 fail: | 187 fail: |
188 Dart_ThrowException(exception); | 188 Dart_ThrowException(exception); |
189 ASSERT_NOT_REACHED(); | 189 ASSERT_NOT_REACHED(); |
190 } | 190 } |
191 | 191 |
192 void initializeCustomElement(Dart_NativeArguments args) | 192 void initializeCustomElement(Dart_NativeArguments args) |
193 { | 193 { |
194 Dart_Handle exception = 0; | 194 Dart_Handle exception = 0; |
195 { | 195 { |
196 Dart_Handle elementWrapper = Dart_GetNativeArgument(args, 0); | 196 Dart_Handle elementWrapper = Dart_GetNativeArgument(args, 0); |
197 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); | 197 if (!DartDOMWrapper::subtypeOf(elementWrapper, DartHTMLElement::dartClas
sId)) { |
198 if (!DartUtilities::isHtmlElement(domData, elementWrapper)) { | |
199 exception = Dart_NewStringFromCString("Invalid class: expected insta
nce of HtmlElement"); | 198 exception = Dart_NewStringFromCString("Invalid class: expected insta
nce of HtmlElement"); |
200 goto fail; | 199 goto fail; |
201 } | 200 } |
202 DartCustomElementWrapper<HTMLElement>::initializeCustomElement(elementWr
apper, exception); | 201 DartCustomElementWrapper<HTMLElement>::initializeCustomElement(elementWr
apper, exception); |
203 if (exception) { | 202 if (exception) { |
204 goto fail; | 203 goto fail; |
205 } | 204 } |
206 return; | 205 return; |
207 } | 206 } |
208 | 207 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 if (argumentCount == 1 && str == "Utils_initializeCustomElement") | 244 if (argumentCount == 1 && str == "Utils_initializeCustomElement") |
246 return DartNativeUtilitiesInternal::initializeCustomElement; | 245 return DartNativeUtilitiesInternal::initializeCustomElement; |
247 if (argumentCount == 1 && str == "Window_history_cross_frame_Getter") | 246 if (argumentCount == 1 && str == "Window_history_cross_frame_Getter") |
248 return DartWindowInternal::historyCrossFrameGetter; | 247 return DartWindowInternal::historyCrossFrameGetter; |
249 if (argumentCount == 1 && str == "Window_location_cross_frame_Getter") | 248 if (argumentCount == 1 && str == "Window_location_cross_frame_Getter") |
250 return DartWindowInternal::locationCrossFrameGetter; | 249 return DartWindowInternal::locationCrossFrameGetter; |
251 return 0; | 250 return 0; |
252 } | 251 } |
253 | 252 |
254 } | 253 } |
OLD | NEW |