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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2538403002: Revert of binding: Removes Document::wrap that must be equivalent to Node::wrap. (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/core/dom/Document.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 5832e23db0f3a0c51729120b4500e2019bf03309..8a394b442085bdb71681852e61ec9f615ff941ec 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6337,6 +6337,38 @@
styleEngine().platformColorsChanged();
}
+v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate,
+ v8::Local<v8::Object> creationContext) {
+ DCHECK(!DOMDataStore::containsWrapper(this, isolate));
+
+ const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
+
+ if (frame() && frame()->script().initializeMainWorld()) {
+ // initializeMainWorld may have created a wrapper for the object, retry from
+ // the start.
+ v8::Local<v8::Object> wrapper = DOMDataStore::getWrapper(this, isolate);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ }
+
+ v8::Local<v8::Object> wrapper =
+ V8DOMWrapper::createWrapper(isolate, creationContext, wrapperType);
+ DCHECK(!wrapper.IsEmpty());
+ return associateWithWrapper(isolate, wrapperType, wrapper);
+}
+
+v8::Local<v8::Object> Document::associateWithWrapper(
+ v8::Isolate* isolate,
+ const WrapperTypeInfo* wrapperType,
+ v8::Local<v8::Object> wrapper) {
+ wrapper = V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType,
+ wrapper);
+ DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
+ if (world.isMainWorld() && frame())
+ frame()->script().windowProxy(world)->updateDocumentWrapper(wrapper);
+ return wrapper;
+}
+
bool Document::isSecureContext(
String& errorMessage,
const SecureContextCheck privilegeContextCheck) const {
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698