summaryrefslogtreecommitdiff
path: root/fxjs/cjs_runtimestub.cpp
blob: 44bdbca8846ffc27dc866cbcb61b3d1b7fe4f92a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2015 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "fxjs/cjs_runtimestub.h"

#include "fxjs/cjs_event_context_stub.h"
#include "third_party/base/ptr_util.h"

CJS_RuntimeStub::CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv)
    : m_pFormFillEnv(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>();
  return m_pContext.get();
}

void CJS_RuntimeStub::ReleaseEventContext(IJS_EventContext* pContext) {}

CPDFSDK_FormFillEnvironment* CJS_RuntimeStub::GetFormFillEnv() const {
  return m_pFormFillEnv.Get();
}

#ifdef PDF_ENABLE_XFA
bool CJS_RuntimeStub::GetValueByNameFromGlobalObject(const ByteStringView&,
                                                     CFXJSE_Value*) {
  return false;
}

bool CJS_RuntimeStub::SetValueByNameInGlobalObject(const ByteStringView&,
                                                   CFXJSE_Value*) {
  return false;
}
#endif  // PDF_ENABLE_XFA

Optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
    const WideString& script) {
  return pdfium::nullopt;
}