Index: third_party/WebKit/LayoutTests/resources/mojo-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js |
index aca02bc9b78c7375375d4a1a43c11a5e4d427eae..10350f7fc6da14d53e0c579956f578d7d414356b 100644 |
--- a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js |
+++ b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js |
@@ -6,26 +6,15 @@ |
// Fix up the global window.define, since all baked-in Mojo modules expect to |
// find it there. This define() also returns a promise to the module. |
-let define = (function(){ |
- let moduleCache = new Map(); |
- |
- return function(name, deps, factory) { |
- let promise = moduleCache.get(name); |
- if (promise === undefined) { |
- // This promise must be cached as mojo.define will only call the factory |
- // function the first time the module is defined. |
- promise = new Promise(resolve => { |
- mojo.define(name, deps, (...modules) => { |
- let result = factory(...modules); |
- resolve(result); |
- return result; |
- }); |
- }); |
- moduleCache.set(name, promise); |
- } |
- return promise; |
- } |
-})(); |
+function define(name, deps, factory) { |
+ return new Promise(resolve => { |
+ mojo.define(name, deps, (...modules) => { |
+ let result = factory(...modules); |
+ resolve(result); |
+ return result; |
+ }); |
+ }); |
+} |
// Returns a promise to an object that exposes common Mojo module interfaces. |
// Additional modules to load can be specified in the |modules| parameter. The |