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

Side by Side Diff: client/dom/frog/dom_frog.dart

Issue 9539003: Safely wrap window.top in frog dom. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 #library('dom'); 1 #library('dom');
2 2
3 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 6
7 // DO NOT EDIT 7 // DO NOT EDIT
8 // Auto-generated Dart DOM library. 8 // Auto-generated Dart DOM library.
9 9
10 10
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 1173
1174 void remove(String token) native; 1174 void remove(String token) native;
1175 1175
1176 String toString() native; 1176 String toString() native;
1177 1177
1178 bool toggle(String token) native; 1178 bool toggle(String token) native;
1179 } 1179 }
1180 1180
1181 class _DOMURLJs extends _DOMTypeJs implements DOMURL native "*DOMURL" { 1181 class _DOMURLJs extends _DOMTypeJs implements DOMURL native "*DOMURL" {
1182 } 1182 }
1183 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1184 // for details. All rights reserved. Use of this source code is governed by a
1185 // BSD-style license that can be found in the LICENSE file.
1183 1186
1184 class _DOMWindowJs extends _EventTargetJs implements DOMWindow native "@*DOMWind ow" { 1187 class _DOMWindowJs extends _EventTargetJs implements DOMWindow native "@*DOMWind ow" {
1185 1188
1186 static final int PERSISTENT = 1; 1189 static final int PERSISTENT = 1;
1187 1190
1188 static final int TEMPORARY = 0; 1191 static final int TEMPORARY = 0;
1189 1192
1190 final _DOMApplicationCacheJs applicationCache; 1193 final _DOMApplicationCacheJs applicationCache;
1191 1194
1192 final _NavigatorJs clientInformation; 1195 final _NavigatorJs clientInformation;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 final _StorageJs sessionStorage; 1271 final _StorageJs sessionStorage;
1269 1272
1270 String status; 1273 String status;
1271 1274
1272 final _BarInfoJs statusbar; 1275 final _BarInfoJs statusbar;
1273 1276
1274 final _StyleMediaJs styleMedia; 1277 final _StyleMediaJs styleMedia;
1275 1278
1276 final _BarInfoJs toolbar; 1279 final _BarInfoJs toolbar;
1277 1280
1278 final _DOMWindowJs top;
1279
1280 final _IDBFactoryJs webkitIndexedDB; 1281 final _IDBFactoryJs webkitIndexedDB;
1281 1282
1282 final _NotificationCenterJs webkitNotifications; 1283 final _NotificationCenterJs webkitNotifications;
1283 1284
1284 final _StorageInfoJs webkitStorageInfo; 1285 final _StorageInfoJs webkitStorageInfo;
1285 1286
1286 final _DOMWindowJs window; 1287 final _DOMWindowJs window;
1287 1288
1288 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native; 1289 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native;
1289 1290
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 1364
1364 _WebKitPointJs webkitConvertPointFromPageToNode(_NodeJs node, _WebKitPointJs p ) native; 1365 _WebKitPointJs webkitConvertPointFromPageToNode(_NodeJs node, _WebKitPointJs p ) native;
1365 1366
1366 void webkitPostMessage(Dynamic message, String targetOrigin, [List transferLis t = null]) native; 1367 void webkitPostMessage(Dynamic message, String targetOrigin, [List transferLis t = null]) native;
1367 1368
1368 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, _Eleme ntJs element) native; 1369 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, _Eleme ntJs element) native;
1369 1370
1370 void webkitRequestFileSystem(int type, int size, FileSystemCallback successCal lback, [ErrorCallback errorCallback = null]) native; 1371 void webkitRequestFileSystem(int type, int size, FileSystemCallback successCal lback, [ErrorCallback errorCallback = null]) native;
1371 1372
1372 void webkitResolveLocalFileSystemURL(String url, [EntryCallback successCallbac k = null, ErrorCallback errorCallback = null]) native; 1373 void webkitResolveLocalFileSystemURL(String url, [EntryCallback successCallbac k = null, ErrorCallback errorCallback = null]) native;
1374
1375
1376 Window get _top() native "return this.top;";
1377
1378 // Override top to return secure wrapper.
1379 Window get top() {
1380 return _DOMWindowCrossFrameImpl._createSafe(_top);
1381 }
1373 } 1382 }
1374 1383
1375 class _DataTransferItemJs extends _DOMTypeJs implements DataTransferItem native "*DataTransferItem" { 1384 class _DataTransferItemJs extends _DOMTypeJs implements DataTransferItem native "*DataTransferItem" {
1376 1385
1377 final String kind; 1386 final String kind;
1378 1387
1379 final String type; 1388 final String type;
1380 1389
1381 _BlobJs getAsFile() native; 1390 _BlobJs getAsFile() native;
1382 1391
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 3016
3008 3017
3009 Window get _contentWindow() native "return this.contentWindow;"; 3018 Window get _contentWindow() native "return this.contentWindow;";
3010 3019
3011 // Override contentWindow to return secure wrapper. 3020 // Override contentWindow to return secure wrapper.
3012 Window get contentWindow() { 3021 Window get contentWindow() {
3013 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow); 3022 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow);
3014 } 3023 }
3015 } 3024 }
3016 3025
3017 // TODO(vsm): Unify with Dartium version.
3018 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow {
3019 // Private window.
3020 _DOMWindowJs _window;
3021
3022 // DOMType
3023 var dartObjectLocalStorage;
3024 String get typeName() => "DOMWindow";
3025
3026 // Fields.
3027 // TODO(vsm): Wrap these two.
3028 History get history() => _window.history;
3029 Location get location() => _window.location;
3030
3031 bool get closed() => _window.closed;
3032 int get length() => _window.length;
3033 DOMWindow get opener() => _createDOMWindowCrossFrame(_window.opener);
3034 DOMWindow get parent() => _createDOMWindowCrossFrame(_window.parent);
3035 DOMWindow get top() => _createDOMWindowCrossFrame(_window.top);
3036
3037 // Methods.
3038 void focus() {
3039 _window.focus();
3040 }
3041
3042 void blur() {
3043 _window.blur();
3044 }
3045
3046 void close() {
3047 _window.close();
3048 }
3049
3050 void postMessage(Dynamic message,
3051 String targetOrigin,
3052 [List messagePorts = null]) {
3053 if (messagePorts == null) {
3054 _window.postMessage(message, targetOrigin);
3055 } else {
3056 _window.postMessage(message, targetOrigin, messagePorts);
3057 }
3058 }
3059
3060 // Implementation support.
3061 _DOMWindowCrossFrameImpl(this._window);
3062
3063 static DOMWindow _createSafe(w) {
3064 // TODO(vsm): Check if it's the top-level window. Return unwrapped.
3065
3066 // TODO(vsm): Cache or implement equality.
3067 return new _DOMWindowCrossFrameImpl(w);
3068 }
3069 }
3070
3071 class _HTMLImageElementJs extends _HTMLElementJs implements HTMLImageElement nat ive "*HTMLImageElement" { 3026 class _HTMLImageElementJs extends _HTMLElementJs implements HTMLImageElement nat ive "*HTMLImageElement" {
3072 3027
3073 String align; 3028 String align;
3074 3029
3075 String alt; 3030 String alt;
3076 3031
3077 String border; 3032 String border;
3078 3033
3079 final bool complete; 3034 final bool complete;
3080 3035
(...skipping 20873 matching lines...) Expand 10 before | Expand all | Expand 10 after
23954 for (final e in source) { 23909 for (final e in source) {
23955 if (f(e)) destination.add(e); 23910 if (f(e)) destination.add(e);
23956 } 23911 }
23957 return destination; 23912 return destination;
23958 } 23913 }
23959 23914
23960 static bool isEmpty(Iterable<Object> iterable) { 23915 static bool isEmpty(Iterable<Object> iterable) {
23961 return !iterable.iterator().hasNext(); 23916 return !iterable.iterator().hasNext();
23962 } 23917 }
23963 } 23918 }
23919 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
23920 // for details. All rights reserved. Use of this source code is governed by a
23921 // BSD-style license that can be found in the LICENSE file.
23922
23923 // TODO(vsm): Unify with Dartium version.
23924 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow {
23925 // Private window.
23926 _DOMWindowJs _window;
23927
23928 // DOMType
23929 var dartObjectLocalStorage;
23930 String get typeName() => "DOMWindow";
23931
23932 // Fields.
23933 // TODO(vsm): Wrap these two.
23934 History get history() => _window.history;
23935 Location get location() => _window.location;
23936
23937 bool get closed() => _window.closed;
23938 int get length() => _window.length;
23939 DOMWindow get opener() => _createSafe(_window.opener);
23940 DOMWindow get parent() => _createSafe(_window.parent);
23941 DOMWindow get top() => _createSafe(_window.top);
23942
23943 // Methods.
23944 void focus() {
23945 _window.focus();
23946 }
23947
23948 void blur() {
23949 _window.blur();
23950 }
23951
23952 void close() {
23953 _window.close();
23954 }
23955
23956 void postMessage(Dynamic message,
23957 String targetOrigin,
23958 [List messagePorts = null]) {
23959 if (messagePorts == null) {
23960 _window.postMessage(message, targetOrigin);
23961 } else {
23962 _window.postMessage(message, targetOrigin, messagePorts);
23963 }
23964 }
23965
23966 // Implementation support.
23967 _DOMWindowCrossFrameImpl(this._window);
23968
23969 static DOMWindow _createSafe(w) {
23970 if (w === window) {
23971 return w;
23972 } else {
23973 // TODO(vsm): Cache or implement equality.
23974 return new _DOMWindowCrossFrameImpl(w);
23975 }
23976 }
23977 }
23964 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 23978 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
23965 // for details. All rights reserved. Use of this source code is governed by a 23979 // for details. All rights reserved. Use of this source code is governed by a
23966 // BSD-style license that can be found in the LICENSE file. 23980 // BSD-style license that can be found in the LICENSE file.
23967 23981
23968 interface DOMType { 23982 interface DOMType {
23969 // TODO(vsm): Remove if/when Dart supports OLS for all objects. 23983 // TODO(vsm): Remove if/when Dart supports OLS for all objects.
23970 var dartObjectLocalStorage; 23984 var dartObjectLocalStorage;
23971 23985
23972 String get typeName(); 23986 String get typeName();
23973 } 23987 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
24147 if (length < 0) throw new IllegalArgumentException('length'); 24161 if (length < 0) throw new IllegalArgumentException('length');
24148 if (start < 0) throw new IndexOutOfRangeException(start); 24162 if (start < 0) throw new IndexOutOfRangeException(start);
24149 int end = start + length; 24163 int end = start + length;
24150 if (end > a.length) throw new IndexOutOfRangeException(end); 24164 if (end > a.length) throw new IndexOutOfRangeException(end);
24151 for (int i = start; i < end; i++) { 24165 for (int i = start; i < end; i++) {
24152 accumulator.add(a[i]); 24166 accumulator.add(a[i]);
24153 } 24167 }
24154 return accumulator; 24168 return accumulator;
24155 } 24169 }
24156 } 24170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698