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

Unified Diff: sdk/lib/_internal/lib/core_patch.dart

Issue 23686021: Add property base to the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/lib/core_patch.dart
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index aaa816442dc320e3b21552d9f60f39a1e1f26b10..8384896b28b8c92b5352b9aa22682ff199c5a1b8 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -3,13 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
// Patch file for dart:core classes.
+import "dart:_collection-dev" as _symbol_dev;
+import 'dart:_foreign_helper' show JS;
floitsch 2013/09/17 11:49:11 I think the dart2js doesn't want JS except in the
Søren Gjesse 2013/09/17 11:59:53 I don't understand this comment.
ahe 2013/09/17 12:23:48 It would be better to add a "primitive" to the cla
Søren Gjesse 2013/09/17 14:12:10 OK, that was also what floitsch@ ment - I just saw
import 'dart:_interceptors';
import 'dart:_js_helper' show checkNull,
getRuntimeType,
JSSyntaxRegExp,
Primitives,
stringJoinUnchecked;
-import "dart:_collection-dev" as _symbol_dev;
String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
@@ -311,4 +312,12 @@ patch class NoSuchMethodError {
patch class Uri {
patch static bool get _isWindows => false;
+
+ patch static Uri get base {
+ if (JS('bool', 'typeof window != "undefined" && window !== null')) {
+ return Uri.parse(JS('String', 'window.location.href'));
+ } else {
+ throw new UnsupportedError("No base URI available on this platform");
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698