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

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: Address comments and merge 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
« no previous file with comments | « client/dom/dom_frog.dart ('k') | client/dom/generated/src/frog/DOMWindow.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() => _DOMWindowCrossFrameImpl._createSafe(_top);
1373 } 1380 }
1374 1381
1375 class _DataTransferItemJs extends _DOMTypeJs implements DataTransferItem native "*DataTransferItem" { 1382 class _DataTransferItemJs extends _DOMTypeJs implements DataTransferItem native "*DataTransferItem" {
1376 1383
1377 final String kind; 1384 final String kind;
1378 1385
1379 final String type; 1386 final String type;
1380 1387
1381 _BlobJs getAsFile() native; 1388 _BlobJs getAsFile() native;
1382 1389
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 3014
3008 3015
3009 Window get _contentWindow() native "return this.contentWindow;"; 3016 Window get _contentWindow() native "return this.contentWindow;";
3010 3017
3011 // Override contentWindow to return secure wrapper. 3018 // Override contentWindow to return secure wrapper.
3012 Window get contentWindow() { 3019 Window get contentWindow() {
3013 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow); 3020 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow);
3014 } 3021 }
3015 } 3022 }
3016 3023
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" { 3024 class _HTMLImageElementJs extends _HTMLElementJs implements HTMLImageElement nat ive "*HTMLImageElement" {
3072 3025
3073 String align; 3026 String align;
3074 3027
3075 String alt; 3028 String alt;
3076 3029
3077 String border; 3030 String border;
3078 3031
3079 final bool complete; 3032 final bool complete;
3080 3033
(...skipping 6919 matching lines...) Expand 10 before | Expand all | Expand 10 after
10000 9953
10001 factory Uint8ClampedArray.fromList(List<int> list) => _construct_Uint8ClampedA rray(list); 9954 factory Uint8ClampedArray.fromList(List<int> list) => _construct_Uint8ClampedA rray(list);
10002 9955
10003 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer) => _construct_Uint8Cl ampedArray(buffer); 9956 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer) => _construct_Uint8Cl ampedArray(buffer);
10004 9957
10005 static _construct_Uint8ClampedArray(arg) native 'return new Uint8ClampedArray( arg);'; 9958 static _construct_Uint8ClampedArray(arg) native 'return new Uint8ClampedArray( arg);';
10006 9959
10007 // Use implementation from Uint8Array. 9960 // Use implementation from Uint8Array.
10008 // final int length; 9961 // final int length;
10009 9962
9963 void setElements(Object array, [int offset = null]) native '''
9964 if (offset == null) return this.set(array);
9965 return this.set(array, offset);''';
9966
10010 _Uint8ClampedArrayJs subarray(int start, [int end = null]) native; 9967 _Uint8ClampedArrayJs subarray(int start, [int end = null]) native;
10011 } 9968 }
10012 9969
10013 class _ValidityStateJs extends _DOMTypeJs implements ValidityState native "*Vali dityState" { 9970 class _ValidityStateJs extends _DOMTypeJs implements ValidityState native "*Vali dityState" {
10014 9971
10015 final bool customError; 9972 final bool customError;
10016 9973
10017 final bool patternMismatch; 9974 final bool patternMismatch;
10018 9975
10019 final bool rangeOverflow; 9976 final bool rangeOverflow;
(...skipping 11502 matching lines...) Expand 10 before | Expand all | Expand 10 after
21522 interface Uint8ClampedArray extends Uint8Array default _TypedArrayFactoryProvide r { 21479 interface Uint8ClampedArray extends Uint8Array default _TypedArrayFactoryProvide r {
21523 21480
21524 Uint8ClampedArray(int length); 21481 Uint8ClampedArray(int length);
21525 21482
21526 Uint8ClampedArray.fromList(List<int> list); 21483 Uint8ClampedArray.fromList(List<int> list);
21527 21484
21528 Uint8ClampedArray.fromBuffer(ArrayBuffer buffer); 21485 Uint8ClampedArray.fromBuffer(ArrayBuffer buffer);
21529 21486
21530 final int length; 21487 final int length;
21531 21488
21489 void setElements(Object array, [int offset]);
21490
21532 Uint8ClampedArray subarray(int start, [int end]); 21491 Uint8ClampedArray subarray(int start, [int end]);
21533 } 21492 }
21534 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 21493 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
21535 // for details. All rights reserved. Use of this source code is governed by a 21494 // for details. All rights reserved. Use of this source code is governed by a
21536 // BSD-style license that can be found in the LICENSE file. 21495 // BSD-style license that can be found in the LICENSE file.
21537 21496
21538 // WARNING: Do not edit - generated code. 21497 // WARNING: Do not edit - generated code.
21539 21498
21540 interface ValidityState { 21499 interface ValidityState {
21541 21500
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
23954 for (final e in source) { 23913 for (final e in source) {
23955 if (f(e)) destination.add(e); 23914 if (f(e)) destination.add(e);
23956 } 23915 }
23957 return destination; 23916 return destination;
23958 } 23917 }
23959 23918
23960 static bool isEmpty(Iterable<Object> iterable) { 23919 static bool isEmpty(Iterable<Object> iterable) {
23961 return !iterable.iterator().hasNext(); 23920 return !iterable.iterator().hasNext();
23962 } 23921 }
23963 } 23922 }
23923 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
23924 // for details. All rights reserved. Use of this source code is governed by a
23925 // BSD-style license that can be found in the LICENSE file.
23926
23927 // TODO(vsm): Unify with Dartium version.
23928 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow {
23929 // Private window.
23930 _DOMWindowJs _window;
23931
23932 // DOMType
23933 var dartObjectLocalStorage;
23934 String get typeName() => "DOMWindow";
23935
23936 // Fields.
23937 // TODO(vsm): Implement history and location getters.
23938
23939 bool get closed() => _window.closed;
23940 int get length() => _window.length;
23941 DOMWindow get opener() => _createSafe(_window.opener);
23942 DOMWindow get parent() => _createSafe(_window.parent);
23943 DOMWindow get top() => _createSafe(_window.top);
23944
23945 // Methods.
23946 void focus() => _window.focus();
23947
23948 void blur() => _window.blur();
23949
23950 void close() => _window.close();
23951
23952 void postMessage(Dynamic message,
23953 String targetOrigin,
23954 [List messagePorts = null]) {
23955 if (messagePorts == null) {
23956 _window.postMessage(message, targetOrigin);
23957 } else {
23958 _window.postMessage(message, targetOrigin, messagePorts);
23959 }
23960 }
23961
23962 // Implementation support.
23963 _DOMWindowCrossFrameImpl(this._window);
23964
23965 static DOMWindow _createSafe(w) {
23966 if (w === window) {
23967 return w;
23968 } else {
23969 // TODO(vsm): Cache or implement equality.
23970 return new _DOMWindowCrossFrameImpl(w);
23971 }
23972 }
23973 }
23964 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 23974 // 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 23975 // 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. 23976 // BSD-style license that can be found in the LICENSE file.
23967 23977
23968 interface DOMType { 23978 interface DOMType {
23969 // TODO(vsm): Remove if/when Dart supports OLS for all objects. 23979 // TODO(vsm): Remove if/when Dart supports OLS for all objects.
23970 var dartObjectLocalStorage; 23980 var dartObjectLocalStorage;
23971 23981
23972 String get typeName(); 23982 String get typeName();
23973 } 23983 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
24147 if (length < 0) throw new IllegalArgumentException('length'); 24157 if (length < 0) throw new IllegalArgumentException('length');
24148 if (start < 0) throw new IndexOutOfRangeException(start); 24158 if (start < 0) throw new IndexOutOfRangeException(start);
24149 int end = start + length; 24159 int end = start + length;
24150 if (end > a.length) throw new IndexOutOfRangeException(end); 24160 if (end > a.length) throw new IndexOutOfRangeException(end);
24151 for (int i = start; i < end; i++) { 24161 for (int i = start; i < end; i++) {
24152 accumulator.add(a[i]); 24162 accumulator.add(a[i]);
24153 } 24163 }
24154 return accumulator; 24164 return accumulator;
24155 } 24165 }
24156 } 24166 }
OLDNEW
« no previous file with comments | « client/dom/dom_frog.dart ('k') | client/dom/generated/src/frog/DOMWindow.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698