| 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_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 if (needsDefineClass) { | 850 if (needsDefineClass) { |
| 851 copyFinishClasses.add( | 851 copyFinishClasses.add( |
| 852 js('newIsolate.$finishClassesProperty = ' | 852 js('newIsolate.$finishClassesProperty = ' |
| 853 ' oldIsolate.$finishClassesProperty')); | 853 ' oldIsolate.$finishClassesProperty')); |
| 854 } | 854 } |
| 855 | 855 |
| 856 // function(oldIsolate) { | 856 // function(oldIsolate) { |
| 857 return js.fun('oldIsolate', [ | 857 return js.fun('oldIsolate', [ |
| 858 js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'), | 858 js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'), |
| 859 | 859 |
| 860 js(r'isolateProperties.$currentScript = null'), | |
| 861 | |
| 862 js('var isolatePrototype = oldIsolate.prototype'), | 860 js('var isolatePrototype = oldIsolate.prototype'), |
| 863 js('var str = "{\\n"'), | 861 js('var str = "{\\n"'), |
| 864 js('str += "var properties = ' | 862 js('str += "var properties = ' |
| 865 'arguments.callee.${namer.isolatePropertiesName};\\n"'), | 863 'arguments.callee.${namer.isolatePropertiesName};\\n"'), |
| 866 js('var hasOwnProperty = Object.prototype.hasOwnProperty'), | 864 js('var hasOwnProperty = Object.prototype.hasOwnProperty'), |
| 867 | 865 |
| 868 // for (var staticName in isolateProperties) { | 866 // for (var staticName in isolateProperties) { |
| 869 js.forIn('staticName', 'isolateProperties', [ | 867 js.forIn('staticName', 'isolateProperties', [ |
| 870 js.if_('hasOwnProperty.call(isolateProperties, staticName)', [ | 868 js.if_('hasOwnProperty.call(isolateProperties, staticName)', [ |
| 871 js('str += ("this." + staticName + "= properties." + staticName + ' | 869 js('str += ("this." + staticName + "= properties." + staticName + ' |
| (...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2955 function onLoad(event) { | 2953 function onLoad(event) { |
| 2956 for (var i = 0; i < scripts.length; ++i) { | 2954 for (var i = 0; i < scripts.length; ++i) { |
| 2957 scripts[i].removeEventListener('load', onLoad, false); | 2955 scripts[i].removeEventListener('load', onLoad, false); |
| 2958 } | 2956 } |
| 2959 callback(event.target); | 2957 callback(event.target); |
| 2960 } | 2958 } |
| 2961 for (var i = 0; i < scripts.length; ++i) { | 2959 for (var i = 0; i < scripts.length; ++i) { |
| 2962 scripts[i].addEventListener('load', onLoad, false); | 2960 scripts[i].addEventListener('load', onLoad, false); |
| 2963 } | 2961 } |
| 2964 })(function(currentScript) { | 2962 })(function(currentScript) { |
| 2965 ${namer.isolateName}.${namer.isolatePropertiesName}.\$currentScript = | 2963 init.currentScript = currentScript; |
| 2966 currentScript; | |
| 2967 | 2964 |
| 2968 if (typeof console !== 'undefined' && typeof document !== 'undefined' && | 2965 if (typeof console !== 'undefined' && typeof document !== 'undefined' && |
| 2969 document.readyState == "loading") { | 2966 document.readyState == "loading") { |
| 2970 console.warn("Dart script executed synchronously, use <script src='" + | 2967 console.warn("Dart script executed synchronously, use <script src='" + |
| 2971 currentScript.src + "' defer></scr" + "ipt> to execute after parsing " + | 2968 currentScript.src + "' defer></scr" + "ipt> to execute after parsing " + |
| 2972 "has completed. See also http://dartbug.com/12281."); | 2969 "has completed. See also http://dartbug.com/12281."); |
| 2973 } | 2970 } |
| 2974 if (typeof dartMainRunner === "function") { | 2971 if (typeof dartMainRunner === "function") { |
| 2975 dartMainRunner(function() { ${mainCall}; }); | 2972 dartMainRunner(function() { ${mainCall}; }); |
| 2976 } else { | 2973 } else { |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4113 | 4110 |
| 4114 const String HOOKS_API_USAGE = """ | 4111 const String HOOKS_API_USAGE = """ |
| 4115 // The code supports the following hooks: | 4112 // The code supports the following hooks: |
| 4116 // dartPrint(message) - if this function is defined it is called | 4113 // dartPrint(message) - if this function is defined it is called |
| 4117 // instead of the Dart [print] method. | 4114 // instead of the Dart [print] method. |
| 4118 // dartMainRunner(main) - if this function is defined, the Dart [main] | 4115 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 4119 // method will not be invoked directly. | 4116 // method will not be invoked directly. |
| 4120 // Instead, a closure that will invoke [main] is | 4117 // Instead, a closure that will invoke [main] is |
| 4121 // passed to [dartMainRunner]. | 4118 // passed to [dartMainRunner]. |
| 4122 """; | 4119 """; |
| OLD | NEW |