| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of _js_helper; | 5 part of _js_helper; |
| 6 | 6 |
| 7 String typeNameInChrome(obj) { | 7 String typeNameInChrome(obj) { |
| 8 String name = JS('String', "#.constructor.name", obj); | 8 String name = JS('String', "#.constructor.name", obj); |
| 9 return typeNameInWebKitCommon(name); | 9 return typeNameInWebKitCommon(name); |
| 10 } | 10 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Returns the function to use to get the type name of an object. | 159 * Returns the function to use to get the type name of an object. |
| 160 */ | 160 */ |
| 161 Function getFunctionForTypeNameOf() { | 161 Function getFunctionForTypeNameOf() { |
| 162 // If we're not in the browser, we're almost certainly running on v8. | 162 // If we're not in the browser, we're almost certainly running on v8. |
| 163 if (!identical(JS('String', 'typeof(navigator)'), 'object')) return typeNameIn
Chrome; | 163 if (!identical(JS('String', 'typeof(navigator)'), 'object')) return typeNameIn
Chrome; |
| 164 | 164 |
| 165 String userAgent = JS('String', "navigator.userAgent"); | 165 String userAgent = JS('String', "navigator.userAgent"); |
| 166 // TODO(antonm): remove a reference to DumpRenderTree. |
| 166 if (contains(userAgent, 'Chrome') || contains(userAgent, 'DumpRenderTree')) { | 167 if (contains(userAgent, 'Chrome') || contains(userAgent, 'DumpRenderTree')) { |
| 167 return typeNameInChrome; | 168 return typeNameInChrome; |
| 168 } else if (contains(userAgent, 'Firefox')) { | 169 } else if (contains(userAgent, 'Firefox')) { |
| 169 return typeNameInFirefox; | 170 return typeNameInFirefox; |
| 170 } else if (contains(userAgent, 'MSIE')) { | 171 } else if (contains(userAgent, 'MSIE')) { |
| 171 return typeNameInIE; | 172 return typeNameInIE; |
| 172 } else if (contains(userAgent, 'Opera')) { | 173 } else if (contains(userAgent, 'Opera')) { |
| 173 return typeNameInOpera; | 174 return typeNameInOpera; |
| 174 } else if (contains(userAgent, 'AppleWebKit')) { | 175 } else if (contains(userAgent, 'AppleWebKit')) { |
| 175 // Chrome matches 'AppleWebKit' too, but we test for Chrome first, so this | 176 // Chrome matches 'AppleWebKit' too, but we test for Chrome first, so this |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 302 } |
| 302 var isLeaf = | 303 var isLeaf = |
| 303 (leafTags != null) && JS('bool', '(#[#]) === true', leafTags, tag); | 304 (leafTags != null) && JS('bool', '(#[#]) === true', leafTags, tag); |
| 304 if (isLeaf) { | 305 if (isLeaf) { |
| 305 return makeDispatchRecord(interceptor, false, null); | 306 return makeDispatchRecord(interceptor, false, null); |
| 306 } else { | 307 } else { |
| 307 var proto = JS('', 'Object.getPrototypeOf(#)', obj); | 308 var proto = JS('', 'Object.getPrototypeOf(#)', obj); |
| 308 return makeDispatchRecord(interceptor, proto, null); | 309 return makeDispatchRecord(interceptor, proto, null); |
| 309 } | 310 } |
| 310 } | 311 } |
| OLD | NEW |