diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-29 21:16:42 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-29 21:16:42 +0000 |
commit | 2dd06eb37dd9cb31746b1ab7e9ed306b2a12a3b7 (patch) | |
tree | e1b482089168e98337a267294391f3b8011ee9d7 /fxjs | |
parent | 007daeb3fbd9ace2c1cbdf85d0fa98ebfa00163c (diff) | |
download | pdfium-2dd06eb37dd9cb31746b1ab7e9ed306b2a12a3b7.tar.xz |
Make IJS_Runtime::AsCJSRuntime be XFA-only
Since it is only called from the XFA side.
Change-Id: I6e34b39bb0c28db9b367215fae0285acafa22c14
Reviewed-on: https://pdfium-review.googlesource.com/c/44810
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjs_runtime.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_runtime.h | 2 | ||||
-rw-r--r-- | fxjs/cjs_runtimestub.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_runtimestub.h | 3 | ||||
-rw-r--r-- | fxjs/ijs_runtime.h | 2 |
5 files changed, 12 insertions, 11 deletions
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp index 5364571919..50349158cb 100644 --- a/fxjs/cjs_runtime.cpp +++ b/fxjs/cjs_runtime.cpp @@ -127,10 +127,6 @@ void CJS_Runtime::DefineJSObjects() { CJS_Annot::DefineJSObjects(this); } -CJS_Runtime* CJS_Runtime::AsCJSRuntime() { - return this; -} - IJS_EventContext* CJS_Runtime::NewEventContext() { m_EventContextArray.push_back(pdfium::MakeUnique<CJS_EventContext>(this)); return m_EventContextArray.back().get(); @@ -187,6 +183,10 @@ WideString ChangeObjName(const WideString& str) { return sRet; } +CJS_Runtime* CJS_Runtime::AsCJSRuntime() { + return this; +} + bool CJS_Runtime::GetValueByNameFromGlobalObject(const ByteStringView& utf8Name, CFXJSE_Value* pValue) { v8::Isolate::Scope isolate_scope(GetIsolate()); diff --git a/fxjs/cjs_runtime.h b/fxjs/cjs_runtime.h index 99dbd0d443..687fdee454 100644 --- a/fxjs/cjs_runtime.h +++ b/fxjs/cjs_runtime.h @@ -30,7 +30,6 @@ class CJS_Runtime final : public IJS_Runtime, ~CJS_Runtime() override; // IJS_Runtime - CJS_Runtime* AsCJSRuntime() override; IJS_EventContext* NewEventContext() override; void ReleaseEventContext(IJS_EventContext* pContext) override; CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override; @@ -52,6 +51,7 @@ class CJS_Runtime final : public IJS_Runtime, v8::Local<v8::Value> MaybeCoerceToNumber(v8::Local<v8::Value> value); #ifdef PDF_ENABLE_XFA + CJS_Runtime* AsCJSRuntime() override; bool GetValueByNameFromGlobalObject(const ByteStringView& utf8Name, CFXJSE_Value* pValue) override; bool SetValueByNameInGlobalObject(const ByteStringView& utf8Name, diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp index 44bdbca884..53ca17c2cb 100644 --- a/fxjs/cjs_runtimestub.cpp +++ b/fxjs/cjs_runtimestub.cpp @@ -14,10 +14,6 @@ CJS_RuntimeStub::CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv) CJS_RuntimeStub::~CJS_RuntimeStub() = default; -CJS_Runtime* CJS_RuntimeStub::AsCJSRuntime() { - return nullptr; -} - IJS_EventContext* CJS_RuntimeStub::NewEventContext() { if (!m_pContext) m_pContext = pdfium::MakeUnique<CJS_EventContextStub>(); @@ -31,6 +27,10 @@ CPDFSDK_FormFillEnvironment* CJS_RuntimeStub::GetFormFillEnv() const { } #ifdef PDF_ENABLE_XFA +CJS_Runtime* CJS_RuntimeStub::AsCJSRuntime() { + return nullptr; +} + bool CJS_RuntimeStub::GetValueByNameFromGlobalObject(const ByteStringView&, CFXJSE_Value*) { return false; diff --git a/fxjs/cjs_runtimestub.h b/fxjs/cjs_runtimestub.h index 779a67579e..b4bb2dd8f0 100644 --- a/fxjs/cjs_runtimestub.h +++ b/fxjs/cjs_runtimestub.h @@ -21,12 +21,13 @@ class CJS_RuntimeStub final : public IJS_Runtime { explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv); ~CJS_RuntimeStub() override; - CJS_Runtime* AsCJSRuntime() override; + // IJS_Runtime: IJS_EventContext* NewEventContext() override; void ReleaseEventContext(IJS_EventContext* pContext) override; CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override; #ifdef PDF_ENABLE_XFA + CJS_Runtime* AsCJSRuntime() override; bool GetValueByNameFromGlobalObject(const ByteStringView&, CFXJSE_Value*) override; bool SetValueByNameInGlobalObject(const ByteStringView&, diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h index 781e86c576..19f3c63e44 100644 --- a/fxjs/ijs_runtime.h +++ b/fxjs/ijs_runtime.h @@ -52,13 +52,13 @@ class IJS_Runtime { virtual ~IJS_Runtime(); - virtual CJS_Runtime* AsCJSRuntime() = 0; virtual IJS_EventContext* NewEventContext() = 0; virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0; virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0; virtual Optional<JS_Error> ExecuteScript(const WideString& script) = 0; #ifdef PDF_ENABLE_XFA + virtual CJS_Runtime* AsCJSRuntime() = 0; virtual bool GetValueByNameFromGlobalObject(const ByteStringView& utf8Name, CFXJSE_Value* pValue) = 0; virtual bool SetValueByNameInGlobalObject(const ByteStringView& utf8Name, |