Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2164)

Unified Diff: sdk/lib/_internal/js_runtime/lib/native_helper.dart

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/js_runtime/lib/native_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/native_helper.dart b/sdk/lib/_internal/js_runtime/lib/native_helper.dart
index c6aad9430c4302c697a8244b7b667d39de0029fd..30d3ba7458745ee64f0a0888b47e10f3c32f51ff 100644
--- a/sdk/lib/_internal/js_runtime/lib/native_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/native_helper.dart
@@ -449,9 +449,13 @@ applyHooksTransformer(transformer, hooks) {
const _baseHooks = const JS_CONST(r'''
function() {
- var toStringFunction = Object.prototype.toString;
- function getTag(o) {
- var s = toStringFunction.call(o);
+ function typeNameInChrome(o) {
+ var constructor = o.constructor;
+ if (constructor) {
+ var name = constructor.name;
+ if (name) return name;
+ }
+ var s = Object.prototype.toString.call(o);
return s.substring(8, s.length - 1);
}
function getUnknownTag(object, tag) {
@@ -459,7 +463,7 @@ function() {
// here allows [getUnknownTag] to be tested on d8.
if (/^HTML[A-Z].*Element$/.test(tag)) {
// Check that it is not a simple JavaScript object.
- var name = toStringFunction.call(object);
+ var name = Object.prototype.toString.call(object);
if (name == "[object Object]") return null;
return "HTMLElement";
}
@@ -480,7 +484,7 @@ function() {
var isBrowser = typeof navigator == "object";
return {
- getTag: getTag,
+ getTag: typeNameInChrome,
getUnknownTag: isBrowser ? getUnknownTagGenericBrowser : getUnknownTag,
prototypeForTag: prototypeForTag,
discriminator: discriminator };
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/interceptors.dart ('k') | tests/compiler/dart2js_native/abstract_class_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698