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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 12288047: Change IsolateNatives.computeThisScript to use captured value of document.currentScript. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // 571 //
572 // We also copy over old values like the prototype, and the 572 // We also copy over old values like the prototype, and the
573 // isolateProperties themselves. 573 // isolateProperties themselves.
574 574
575 // function(oldIsolate) { 575 // function(oldIsolate) {
576 return js.fun('oldIsolate', [ 576 return js.fun('oldIsolate', [
577 // var isolateProperties = oldIsolate.${namer.isolatePropertiesName}; 577 // var isolateProperties = oldIsolate.${namer.isolatePropertiesName};
578 js['isolateProperties'].def( 578 js['isolateProperties'].def(
579 js['oldIsolate'][namer.isolatePropertiesName]), 579 js['oldIsolate'][namer.isolatePropertiesName]),
580 580
581 // isolateProperties.$currentScript =
582 // document && (document.currentScript ||
ngeoffray 2013/02/19 15:22:26 Don't you need to use globalThis.document in the f
ahe 2013/02/19 15:50:37 I have changed this to (typeof document == 'object
583 // document.scripts[document.scripts.length - 1]);
584 js['isolateProperties'][r'$currentScript'].assign(
585 js['document'].binary(
586 '&&',
587 js['document']['currentScript'].binary(
588 '||',
589 js['document']['scripts'][
590 js['document']['scripts']['length'] - 1]))),
ngeoffray 2013/02/19 15:22:26 So this works on all browsers now?
ahe 2013/02/19 15:50:37 As far as I can tell.
591
581 // var isolatePrototype = oldIsolate.prototype; 592 // var isolatePrototype = oldIsolate.prototype;
582 js['isolatePrototype'].def(js['oldIsolate']['prototype']), 593 js['isolatePrototype'].def(js['oldIsolate']['prototype']),
583 594
584 // var str = "{\\n"; 595 // var str = "{\\n";
585 js['str'].def(js.string(r'{\n')), 596 js['str'].def(js.string(r'{\n')),
586 597
587 // str += "var properties = $isolate.${namer.isolatePropertiesName};\\n"; 598 // str += "var properties = $isolate.${namer.isolatePropertiesName};\\n";
588 js['str'].update('+', js.string('var properties = ' 599 js['str'].update('+', js.string('var properties = '
589 '$isolate.${namer.isolatePropertiesName};' 600 '$isolate.${namer.isolatePropertiesName};'
590 r'\n')), 601 r'\n')),
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 """; 2687 """;
2677 const String HOOKS_API_USAGE = """ 2688 const String HOOKS_API_USAGE = """
2678 // The code supports the following hooks: 2689 // The code supports the following hooks:
2679 // dartPrint(message) - if this function is defined it is called 2690 // dartPrint(message) - if this function is defined it is called
2680 // instead of the Dart [print] method. 2691 // instead of the Dart [print] method.
2681 // dartMainRunner(main) - if this function is defined, the Dart [main] 2692 // dartMainRunner(main) - if this function is defined, the Dart [main]
2682 // method will not be invoked directly. 2693 // method will not be invoked directly.
2683 // Instead, a closure that will invoke [main] is 2694 // Instead, a closure that will invoke [main] is
2684 // passed to [dartMainRunner]. 2695 // passed to [dartMainRunner].
2685 """; 2696 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698