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

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp

Issue 1389163007: Pass IJS_Runtime, not IJS_Context, to native object constructors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: comment Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "../../../third_party/base/nonstd_unique_ptr.h" 5 #include "../../../third_party/base/nonstd_unique_ptr.h"
6 #include "../../../core/include/fpdfapi/fpdf_parser.h" 6 #include "../../../core/include/fpdfapi/fpdf_parser.h"
7 #include "../../../testing/embedder_test.h" 7 #include "../../../testing/embedder_test.h"
8 #include "../../include/jsapi/fxjs_v8.h" 8 #include "../../include/jsapi/fxjs_v8.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 ~FXJSV8Embeddertest() override { m_pIsolate->Dispose(); } 26 ~FXJSV8Embeddertest() override { m_pIsolate->Dispose(); }
27 27
28 void SetUp() override { 28 void SetUp() override {
29 EmbedderTest::SetExternalIsolate(m_pIsolate); 29 EmbedderTest::SetExternalIsolate(m_pIsolate);
30 EmbedderTest::SetUp(); 30 EmbedderTest::SetUp();
31 31
32 v8::Isolate::Scope isolate_scope(m_pIsolate); 32 v8::Isolate::Scope isolate_scope(m_pIsolate);
33 v8::HandleScope handle_scope(m_pIsolate); 33 v8::HandleScope handle_scope(m_pIsolate);
34 FXJS_PerIsolateData::SetUp(m_pIsolate); 34 FXJS_PerIsolateData::SetUp(m_pIsolate);
35 FXJS_InitializeRuntime(m_pIsolate, nullptr, nullptr, m_pPersistentContext); 35 FXJS_InitializeRuntime(m_pIsolate, nullptr, m_pPersistentContext);
36 } 36 }
37 37
38 void TearDown() override { 38 void TearDown() override {
39 FXJS_ReleaseRuntime(m_pIsolate, m_pPersistentContext); 39 FXJS_ReleaseRuntime(m_pIsolate, m_pPersistentContext);
40 m_pPersistentContext.Reset(); 40 m_pPersistentContext.Reset();
41 FXJS_Release(); 41 FXJS_Release();
42 EmbedderTest::TearDown(); 42 EmbedderTest::TearDown();
43 } 43 }
44 44
45 v8::Isolate* isolate() { return m_pIsolate; } 45 v8::Isolate* isolate() { return m_pIsolate; }
(...skipping 15 matching lines...) Expand all
61 FXJSErr error; 61 FXJSErr error;
62 CFX_WideString wsInfo; 62 CFX_WideString wsInfo;
63 CFX_WideString wsScript(kScript); 63 CFX_WideString wsScript(kScript);
64 int sts = FXJS_Execute(isolate(), nullptr, kScript, wcslen(kScript), &error); 64 int sts = FXJS_Execute(isolate(), nullptr, kScript, wcslen(kScript), &error);
65 EXPECT_EQ(0, sts); 65 EXPECT_EQ(0, sts);
66 66
67 v8::Local<v8::Object> This = FXJS_GetThisObj(isolate()); 67 v8::Local<v8::Object> This = FXJS_GetThisObj(isolate());
68 v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred"); 68 v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred");
69 EXPECT_TRUE(fred->IsNumber()); 69 EXPECT_TRUE(fred->IsNumber());
70 } 70 }
OLDNEW
« fpdfsdk/src/javascript/JS_Runtime.cpp ('K') | « fpdfsdk/src/jsapi/fxjs_v8.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698