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

Unified Diff: dart/sdk/lib/_internal/lib/preambles/d8.js

Issue 345533004: Use "self" instead of globalThis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r37482. Created 6 years, 6 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
« no previous file with comments | « dart/sdk/lib/_internal/lib/js_helper.dart ('k') | dart/sdk/lib/_internal/lib/preambles/jsshell.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/lib/preambles/d8.js
diff --git a/dart/sdk/lib/_internal/lib/preambles/d8.js b/dart/sdk/lib/_internal/lib/preambles/d8.js
index e9650837f1493a192909e685dd15d2f10f1cba83..99fed2b15d3a6ab431eb3199beec611b58e9f381 100644
--- a/dart/sdk/lib/_internal/lib/preambles/d8.js
+++ b/dart/sdk/lib/_internal/lib/preambles/d8.js
@@ -4,14 +4,10 @@
// Javascript preamble, that lets the output of dart2js run on V8's d8 shell.
-var setTimeout;
-var clearTimeout;
-var setInterval;
-var clearInterval;
-var dartMainRunner;
-var scheduleImmediate;
+(function(self) {
+ // Using strict mode to avoid accidentally defining global variables.
+ "use strict"; // Should be first statement of this function.
-(function() {
// Event loop.
// Task queue as cyclic list queue.
@@ -247,14 +243,17 @@ var scheduleImmediate;
}
}
- dartMainRunner = function(main, args) {
+ // Global properties. "self" refers to the global object, so adding a
+ // property to "self" defines a global variable.
+ self.dartMainRunner = function(main, args) {
// Initialize.
var action = function() { main(args); }
eventLoop(action);
};
- setTimeout = addTimer;
- clearTimeout = cancelTimer;
- setInterval = addInterval;
- clearInterval = cancelTimer;
- scheduleImmediate = addTask;
-})();
+ self.setTimeout = addTimer;
+ self.clearTimeout = cancelTimer;
+ self.setInterval = addInterval;
+ self.clearInterval = cancelTimer;
+ self.scheduleImmediate = addTask;
+ self.self = self;
+})(this);
« no previous file with comments | « dart/sdk/lib/_internal/lib/js_helper.dart ('k') | dart/sdk/lib/_internal/lib/preambles/jsshell.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698