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

Side by Side Diff: tools/dom/src/dart2js_LocationWrapper.dart

Issue 14646032: Fixing Location.origin to work on non-WebKit browsers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 html; 5 part of html;
6 6
7 // On Firefox 11, the object obtained from 'window.location' is very strange. 7 // On Firefox 11, the object obtained from 'window.location' is very strange.
8 // It can't be monkey-patched and seems immune to putting methods on 8 // It can't be monkey-patched and seems immune to putting methods on
9 // Object.prototype. We are forced to wrap the object. 9 // Object.prototype. We are forced to wrap the object.
10 10
(...skipping 26 matching lines...) Expand all
37 _set(_ptr, 'hostname', value); 37 _set(_ptr, 'hostname', value);
38 } 38 }
39 39
40 // String href; 40 // String href;
41 String get href => _get(_ptr, 'href'); 41 String get href => _get(_ptr, 'href');
42 void set href(String value) { 42 void set href(String value) {
43 _set(_ptr, 'href', value); 43 _set(_ptr, 'href', value);
44 } 44 }
45 45
46 // final String origin; 46 // final String origin;
47 String get origin => _get(_ptr, 'origin'); 47 String get origin {
48 if (JS('bool', '("origin" in #)', _ptr)) {
49 return JS('String', '#.origin', _ptr);
50 }
51 return '${this.protocol}//${this.host}';
52 }
48 53
49 // String pathname; 54 // String pathname;
50 String get pathname => _get(_ptr, 'pathname'); 55 String get pathname => _get(_ptr, 'pathname');
51 void set pathname(String value) { 56 void set pathname(String value) {
52 _set(_ptr, 'pathname', value); 57 _set(_ptr, 'pathname', value);
53 } 58 }
54 59
55 // String port; 60 // String port;
56 String get port => _get(_ptr, 'port'); 61 String get port => _get(_ptr, 'port');
57 void set port(String value) { 62 void set port(String value) {
(...skipping 17 matching lines...) Expand all
75 void reload() => JS('void', '#.reload()', _ptr); 80 void reload() => JS('void', '#.reload()', _ptr);
76 81
77 void replace(String url) => JS('void', '#.replace(#)', _ptr, url); 82 void replace(String url) => JS('void', '#.replace(#)', _ptr, url);
78 83
79 String toString() => JS('String', '#.toString()', _ptr); 84 String toString() => JS('String', '#.toString()', _ptr);
80 85
81 86
82 static _get(p, m) => JS('var', '#[#]', p, m); 87 static _get(p, m) => JS('var', '#[#]', p, m);
83 static _set(p, m, v) => JS('void', '#[#] = #', p, m, v); 88 static _set(p, m, v) => JS('void', '#[#] = #', p, m, v);
84 } 89 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/html/impl/impl_Location.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698