| Index: lib/html/src/frog_LocationWrapper.dart
|
| diff --git a/lib/html/src/frog_LocationWrapper.dart b/lib/html/src/frog_LocationWrapper.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..201ce94a482fc79fbd34a096108059f8ef370aac
|
| --- /dev/null
|
| +++ b/lib/html/src/frog_LocationWrapper.dart
|
| @@ -0,0 +1,73 @@
|
| +// 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() => _get(_ptr, 'origin');
|
| +
|
| + // 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) => _assign(_ptr, url);
|
| +
|
| + void reload() => _reload(_ptr);
|
| +
|
| + void replace(String url) => _replace(_ptr, url);
|
| +
|
| + String toString() => _toString(_ptr);
|
| +
|
| +
|
| + static _get(p, m) native 'return p[m];';
|
| + static _set(p, m, v) native 'p[m] = v;';
|
| +
|
| + static _assign(p, url) native 'p.assign(url);';
|
| + static _reload(p) native 'p.reload()';
|
| + static _replace(p, url) native 'p.replace(url);';
|
| + static _toString(p) native 'return p.toString();';
|
| +}
|
|
|