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

Unified Diff: tools/dom/src/native_DOMImplementation.dart

Issue 1873933002: Fix handling of cross-origin windows in dartium and better align general handling of different fram… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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: tools/dom/src/native_DOMImplementation.dart
diff --git a/tools/dom/src/native_DOMImplementation.dart b/tools/dom/src/native_DOMImplementation.dart
index 713f6ec270cc69d3ecfd764ae879a0d6a024b76f..8847ea715886dacca08d92dba31e54d13496ff42 100644
--- a/tools/dom/src/native_DOMImplementation.dart
+++ b/tools/dom/src/native_DOMImplementation.dart
@@ -1065,33 +1065,31 @@ class _Utils {
_blink.Blink_Utils.createElement(document, tagName);
}
-// TODO(jacobr): this seems busted. I believe we are actually
-// giving users real windows for opener, parent, top, etc.
-// Or worse, we are probaly returning a raw JSObject.
class _DOMWindowCrossFrame extends DartHtmlDomObject implements WindowBase {
_DOMWindowCrossFrame.internal();
static _createSafe(win) =>
- _blink.Blink_Utils.setInstanceInterceptor(win, _DOMWindowCrossFrame);
+ win is _DOMWindowCrossFrame ? win : _blink.Blink_Utils.setInstanceInterceptor(win, _DOMWindowCrossFrame);
// Fields.
- HistoryBase get history => _blink.Blink_DOMWindowCrossFrame.get_history(this);
- LocationBase get location =>
- _blink.Blink_DOMWindowCrossFrame.get_location(this);
- bool get closed => _blink.Blink_DOMWindowCrossFrame.get_closed(this);
- WindowBase get opener => _blink.Blink_DOMWindowCrossFrame.get_opener(this);
- WindowBase get parent => _blink.Blink_DOMWindowCrossFrame.get_parent(this);
- WindowBase get top => _blink.Blink_DOMWindowCrossFrame.get_top(this);
+ HistoryBase get history {
+ var history = _blink.BlinkWindow.instance.history_Getter_(this);
+ return history is _HistoryCrossFrame ? history : _blink.Blink_Utils.setInstanceInterceptor(history, _HistoryCrossFrame);
+ }
+
+ LocationBase get location {
+ var location = _blink.BlinkWindow.instance.location_Getter_(this);
+ return location is _LocationCrossFrame ? location : _blink.Blink_Utils.setInstanceInterceptor(location, _LocationCrossFrame);
+ }
+
+ bool get closed => _blink.BlinkWindow.instance.closed_Getter_(this);
+ WindowBase get opener => _convertNativeToDart_Window(_blink.BlinkWindow.instance.opener_Getter_(this));
+ WindowBase get parent => _convertNativeToDart_Window(_blink.BlinkWindow.instance.parent_Getter_(this));
+ WindowBase get top => _convertNativeToDart_Window(_blink.BlinkWindow.instance.top_Getter_(this));
// Methods.
- void close() => _blink.Blink_DOMWindowCrossFrame.close(this);
- void postMessage(/*SerializedScriptValue*/ message, String targetOrigin,
- [List messagePorts]) =>
- _blink.Blink_DOMWindowCrossFrame.postMessage(
- this,
- convertDartToNative_SerializedScriptValue(message),
- targetOrigin,
- messagePorts);
+ void close() => _blink.BlinkWindow.instance.close_Callback_0_(this);
+ void postMessage(Object message, String targetOrigin, [List<MessagePort> transfer]) => _blink.BlinkWindow.instance.postMessage_Callback_3_(this, convertDartToNative_SerializedScriptValue(message), targetOrigin, transfer);
// Implementation support.
String get typeName => "Window";
@@ -1128,9 +1126,16 @@ class _HistoryCrossFrame extends DartHtmlDomObject implements HistoryBase {
_HistoryCrossFrame.internal();
// Methods.
- void back() => _blink.Blink_HistoryCrossFrame.back(this);
- void forward() => _blink.Blink_HistoryCrossFrame.forward(this);
- void go(int distance) => _blink.Blink_HistoryCrossFrame.go(this, distance);
+ void back() => _blink.BlinkHistory.instance.back_Callback_0_(this);
+ void forward() => _blink.BlinkHistory.instance.forward_Callback_0_(this);
+ void go([int delta]) {
+ if (delta != null) {
+ _blink.BlinkHistory.instance.go_Callback_1_(this, delta);
+ return;
+ }
+ _blink.BlinkHistory.instance.go_Callback_0_(this);
+ return;
+ }
// Implementation support.
String get typeName => "History";
@@ -1140,7 +1145,7 @@ class _LocationCrossFrame extends DartHtmlDomObject implements LocationBase {
_LocationCrossFrame.internal();
// Fields.
- set href(String h) => _blink.Blink_LocationCrossFrame.set_href(this, h);
+ set href(String value) => _blink.BlinkLocation.instance.href_Setter_(this, value);
// Implementation support.
String get typeName => "Location";

Powered by Google App Engine
This is Rietveld 408576698