Skip to content

Commit fbb9040

Browse files
committed
move setting embedder data of Node from blink
together with be948af in Blink, Fix nwjs#2996
1 parent fcf09f1 commit fbb9040

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/renderer/shell_content_renderer_client.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
6767
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
6868
#include "third_party/WebKit/public/web/WebView.h"
69+
#include "gin/public/context_holder.h"
70+
#include "gin/public/gin_embedders.h"
71+
6972
//#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
7073
#include "content/common/dom_storage/dom_storage_map.h"
7174

@@ -233,6 +236,16 @@ void ShellContentRendererClient::DidCreateScriptContext(
233236
InstallNodeSymbols(frame, context, url);
234237
creating_first_context_ = false;
235238

239+
#if 1 //defined(NW_IMPLEMENTATION)
240+
v8::Local<v8::Context> node_context =
241+
v8::Local<v8::Context>::New(context->GetIsolate(), node::g_context);
242+
//need to stay sync with V8PerContextData.h
243+
int v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink);
244+
node_context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex,
245+
context->GetAlignedPointerFromEmbedderData(v8ContextPerContextDataIndex));
246+
#endif
247+
248+
236249
if (extension_dispatcher_.get())
237250
extension_dispatcher_->DidCreateScriptContext(frame, context, extension_group, world_id);
238251
}

0 commit comments

Comments
 (0)