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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ToV8.cpp

Issue 2640123006: Use the current context as the creation context for cross-origin objects. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ToV8.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8.cpp b/third_party/WebKit/Source/bindings/core/v8/ToV8.cpp
index 42889491ff216295e7912e8a80b7e652bf8828b5..b07317d256c2fc10e658f4c86a9696b1b50db9d4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8.cpp
@@ -8,6 +8,7 @@
#include "core/events/EventTarget.h"
#include "core/frame/DOMWindow.h"
#include "core/frame/Frame.h"
+#include "core/frame/Location.h"
namespace blink {
@@ -29,6 +30,34 @@ v8::Local<v8::Value> ToV8(DOMWindow* window,
->globalIfNotDetached();
}
+v8::Local<v8::Value> ToV8(Location* location,
+ v8::Local<v8::Object> creationContext,
+ v8::Isolate* isolate) {
+ // https://whatwg.org/C/browsers.html#crossorigingetownpropertyhelper-(-o,-p-)
+ //
+ // If e.[[NeedsGet]] is true, then set crossOriginGet to an anonymous
+ // built-in function, created in the current Realm Record, that performs the
+ // same steps as the getter of the IDL attribute P on object O.
+ //
+ // Thus, the returned object should be created in the current Realm Record as
+ // well, so ignore creationContext and use the current context as the creation
+ // context.
+ //
+ // TODO(dcheng): Is it possible for v8 to just always return the current
+ // context as the creation context of a remote context's global proxy?
+
+ if (UNLIKELY(!location))
+ return v8::Null(isolate);
+
+ v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(location, isolate);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+
+ wrapper = location->wrap(isolate, isolate->GetCurrentContext()->Global());
+ DCHECK(!wrapper.IsEmpty());
+ return wrapper;
+}
dcheng 2017/01/19 23:34:07 Modifying ToV8 was my original approach, but it ha
+
v8::Local<v8::Value> ToV8(EventTarget* impl,
v8::Local<v8::Object> creationContext,
v8::Isolate* isolate) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698