Index: pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart |
index 3423d30833aba3d5304e043936ee89858e8fd112..f391ed903190fd1536a18838df1015620b4f2b3d 100644 |
--- a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart |
+++ b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart |
@@ -52,7 +52,9 @@ class MainCallStubGenerator { |
callback(null); |
return; |
} |
- if (document.currentScript) { |
+ // When running as a content-script of a chrome-extension the |
+ // 'currentScript' is `null` (but not undefined). |
+ if (typeof document.currentScript != 'undefined') { |
callback(document.currentScript); |
return; |
} |