blob: 1b0d81d82416e422a00a04124224bd1abca4bc6f [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclairf766ad22016-03-14 13:51:24 -04007#include "fpdfsdk/javascript/console.h"
Tom Sepez37458412015-10-06 11:33:46 -07008
Dan Sinclair3ebd1212016-03-09 09:59:23 -05009#include <vector>
10
Dan Sinclairf766ad22016-03-14 13:51:24 -040011#include "fpdfsdk/javascript/JS_Define.h"
12#include "fpdfsdk/javascript/JS_EventHandler.h"
13#include "fpdfsdk/javascript/JS_Object.h"
14#include "fpdfsdk/javascript/JS_Value.h"
Tom Sepezd6ae2af2017-02-16 11:49:55 -080015#include "fpdfsdk/javascript/cjs_event_context.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070016
Tom Sepez04557b82017-02-16 09:43:10 -080017JSConstSpec CJS_Console::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070018
Tom Sepez04557b82017-02-16 09:43:10 -080019JSPropertySpec CJS_Console::PropertySpecs[] = {{0, 0, 0}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020
Tom Sepez04557b82017-02-16 09:43:10 -080021JSMethodSpec CJS_Console::MethodSpecs[] = {{L"clear", clear_static},
22 {L"hide", hide_static},
23 {L"println", println_static},
24 {L"show", show_static},
25 {0, 0}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070026
Nico Weber9d8ec5a2015-08-04 13:00:21 -070027IMPLEMENT_JS_CLASS(CJS_Console, console)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070028
Nico Weber9d8ec5a2015-08-04 13:00:21 -070029console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
30
31console::~console() {}
32
Tom Sepezb1670b52017-02-16 17:01:00 -080033bool console::clear(CJS_Runtime* pRuntime,
tsepez4cf55152016-11-02 14:37:54 -070034 const std::vector<CJS_Value>& params,
35 CJS_Value& vRet,
36 CFX_WideString& sError) {
37 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070038}
39
Tom Sepezb1670b52017-02-16 17:01:00 -080040bool console::hide(CJS_Runtime* pRuntime,
tsepez4cf55152016-11-02 14:37:54 -070041 const std::vector<CJS_Value>& params,
42 CJS_Value& vRet,
43 CFX_WideString& sError) {
44 return true;
45}
46
Tom Sepezb1670b52017-02-16 17:01:00 -080047bool console::println(CJS_Runtime* pRuntime,
Lei Zhang945fdb72015-11-11 10:18:16 -080048 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070049 CJS_Value& vRet,
50 CFX_WideString& sError) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070051 if (params.size() < 1) {
tsepez4cf55152016-11-02 14:37:54 -070052 return false;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070053 }
tsepez4cf55152016-11-02 14:37:54 -070054 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070055}
56
Tom Sepezb1670b52017-02-16 17:01:00 -080057bool console::show(CJS_Runtime* pRuntime,
tsepez4cf55152016-11-02 14:37:54 -070058 const std::vector<CJS_Value>& params,
59 CJS_Value& vRet,
60 CFX_WideString& sError) {
61 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070062}