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

Unified Diff: Source/bindings/core/v8/custom/V8WindowCustom.cpp

Issue 1138583002: Make Window.prototype.toString return [object Window] at all times. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: shouldBeEqualToString Created 5 years, 7 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
« no previous file with comments | « LayoutTests/http/tests/security/resources/cross-frame-window-to-string-test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8WindowCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/Source/bindings/core/v8/custom/V8WindowCustom.cpp
index f2d3ecc95104851b0406ae4abc62cb7a0a550285..5af2203cbf40bc00d14d517ac9ff96c88dea094e 100644
--- a/Source/bindings/core/v8/custom/V8WindowCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8WindowCustom.cpp
@@ -218,17 +218,10 @@ void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>
exceptionState.throwIfNeeded();
}
-// FIXME(fqian): returning string is cheating, and we should
-// fix this by calling toString function on the receiver.
-// However, V8 implements toString in JavaScript, which requires
-// switching context of receiver. I consider it is dangerous.
+// TODO(arv): Remove this custom method and implement Symbol.toStringTag instead.
void V8Window::toStringMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- v8::Local<v8::Object> domWrapper = V8Window::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
- v8::Local<v8::Object> target = domWrapper.IsEmpty() ? info.This() : domWrapper;
- v8::Local<v8::String> value;
- if (target->ObjectProtoToString(info.GetIsolate()->GetCurrentContext()).ToLocal(&value))
- v8SetReturnValue(info, value);
+ v8SetReturnValueString(info, "[object Window]", info.GetIsolate());
}
void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
« no previous file with comments | « LayoutTests/http/tests/security/resources/cross-frame-window-to-string-test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698