Chromium Code Reviews| Index: sdk/lib/html/dart2js/html_dart2js.dart |
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart |
| index 1bc1d73ac5c57f6872778604cd678570376f7f1f..d8cc5ce9ed1ee89d7cdefd8eb917267c1be5684f 100644 |
| --- a/sdk/lib/html/dart2js/html_dart2js.dart |
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart |
| @@ -27469,8 +27469,7 @@ class Window extends EventTarget implements WindowEventHandlers, WindowBase, Glo |
| } |
| // API level getter and setter for Location. |
| - // TODO: The cross domain safe wrapper can be inserted here or folded into |
| - // _LocationWrapper. |
| + // TODO: The cross domain safe wrapper can be inserted here. |
| /** |
| * The current location of this window. |
| * |
| @@ -27478,50 +27477,23 @@ class Window extends EventTarget implements WindowEventHandlers, WindowBase, Glo |
| * print(currentLocation.href); // 'http://www.example.com:80/' |
| */ |
| Location get location { |
|
blois
2014/04/10 21:31:14
=> _location?
|
| - // Firefox work-around for Location. The Firefox location object cannot be |
| - // made to behave like a Dart object so must be wrapped. |
| - var result = _location; |
| - if (_isDartLocation(result)) return result; // e.g. on Chrome. |
| - if (null == _location_wrapper) { |
| - _location_wrapper = new _LocationWrapper(result); |
| - } |
| - return _location_wrapper; |
| + return _location; |
| } |
| // TODO: consider forcing users to do: window.location.assign('string'). |
| /** |
| * Sets the window's location, which causes the browser to navigate to the new |
| - * location. [value] may be a Location object or a string. |
| + * location. [value] may be a Location object or a String. |
| */ |
| void set location(value) { |
| - if (value is _LocationWrapper) { |
| - _location = value._ptr; |
| - } else { |
| - _location = value; |
| - } |
| + _location = value; |
| } |
| - _LocationWrapper _location_wrapper; // Cached wrapped Location object. |
| - |
| // Native getter and setter to access raw Location object. |
| dynamic get _location => JS('Location|=Object', '#.location', this); |
| void set _location(value) { |
| JS('void', '#.location = #', this, value); |
| } |
| - // Prevent compiled from thinking 'location' property is available for a Dart |
| - // member. |
| - @JSName('location') |
| - _protect_location() native; |
| - |
| - static _isDartLocation(thing) { |
| - // On Firefox the code that implements 'is Location' fails to find the patch |
| - // stub on Object.prototype and throws an exception. |
| - try { |
| - return thing is Location; |
| - } catch (e) { |
| - return false; |
| - } |
| - } |
| /** |
| * Called to draw an animation frame and then request the window to repaint |
| @@ -35723,94 +35695,6 @@ class KeyEvent extends _WrappedEvent implements KeyboardEvent { |
| bool get repeat => throw new UnimplementedError(); |
| dynamic get _get_view => throw new UnimplementedError(); |
| } |
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| -// for details. All rights reserved. Use of this source code is governed by a |
| -// BSD-style license that can be found in the LICENSE file. |
| - |
| - |
| -// On Firefox 11, the object obtained from 'window.location' is very strange. |
| -// It can't be monkey-patched and seems immune to putting methods on |
| -// Object.prototype. We are forced to wrap the object. |
| - |
| -class _LocationWrapper implements Location { |
| - |
| - final _ptr; // Opaque reference to real location. |
| - |
| - _LocationWrapper(this._ptr); |
| - |
| - // TODO(sra): Replace all the _set and _get calls with 'JS' forms. |
| - |
| - // final List<String> ancestorOrigins; |
| - List<String> get ancestorOrigins => _get(_ptr, 'ancestorOrigins'); |
| - |
| - // String hash; |
| - String get hash => _get(_ptr, 'hash'); |
| - void set hash(String value) { |
| - _set(_ptr, 'hash', value); |
| - } |
| - |
| - // String host; |
| - String get host => _get(_ptr, 'host'); |
| - void set host(String value) { |
| - _set(_ptr, 'host', value); |
| - } |
| - |
| - // String hostname; |
| - String get hostname => _get(_ptr, 'hostname'); |
| - void set hostname(String value) { |
| - _set(_ptr, 'hostname', value); |
| - } |
| - |
| - // String href; |
| - String get href => _get(_ptr, 'href'); |
| - void set href(String value) { |
| - _set(_ptr, 'href', value); |
| - } |
| - |
| - // final String origin; |
| - String get origin { |
| - if (JS('bool', '("origin" in #)', _ptr)) { |
| - return JS('String', '#.origin', _ptr); |
| - } |
| - return '${this.protocol}//${this.host}'; |
| - } |
| - |
| - // String pathname; |
| - String get pathname => _get(_ptr, 'pathname'); |
| - void set pathname(String value) { |
| - _set(_ptr, 'pathname', value); |
| - } |
| - |
| - // String port; |
| - String get port => _get(_ptr, 'port'); |
| - void set port(String value) { |
| - _set(_ptr, 'port', value); |
| - } |
| - |
| - // String protocol; |
| - String get protocol => _get(_ptr, 'protocol'); |
| - void set protocol(String value) { |
| - _set(_ptr, 'protocol', value); |
| - } |
| - |
| - // String search; |
| - String get search => _get(_ptr, 'search'); |
| - void set search(String value) { |
| - _set(_ptr, 'search', value); |
| - } |
| - |
| - void assign(String url) => JS('void', '#.assign(#)', _ptr, url); |
| - |
| - void reload() => JS('void', '#.reload()', _ptr); |
| - |
| - void replace(String url) => JS('void', '#.replace(#)', _ptr, url); |
| - |
| - String toString() => JS('String', '#.toString()', _ptr); |
| - |
| - |
| - static _get(p, m) => JS('var', '#[#]', p, m); |
| - static _set(p, m, v) => JS('void', '#[#] = #', p, m, v); |
| -} |
| // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |