blob: ee7bc7f2bb2cde7a8639b9258da648bb54e39fca [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"
Dan Sinclairf766ad22016-03-14 13:51:24 -040012#include "fpdfsdk/javascript/JS_Object.h"
13#include "fpdfsdk/javascript/JS_Value.h"
Tom Sepezd6ae2af2017-02-16 11:49:55 -080014#include "fpdfsdk/javascript/cjs_event_context.h"
dan sinclair8b6acdd2017-10-25 20:35:19 -040015#include "fpdfsdk/javascript/cjs_eventhandler.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 Sepez9b99b632017-02-21 15:05:57 -080021JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
22 {"hide", hide_static},
23 {"println", println_static},
24 {"show", show_static},
Tom Sepez04557b82017-02-16 09:43:10 -080025 {0, 0}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070026
Dan Sinclair4b172c42017-10-23 11:22:31 -040027IMPLEMENT_JS_CLASS(CJS_Console, 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
Dan Sinclair8f524d62017-10-25 13:30:31 -040033CJS_Return console::clear(CJS_Runtime* pRuntime,
34 const std::vector<v8::Local<v8::Value>>& params) {
35 return CJS_Return(true);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070036}
37
Dan Sinclair8f524d62017-10-25 13:30:31 -040038CJS_Return console::hide(CJS_Runtime* pRuntime,
39 const std::vector<v8::Local<v8::Value>>& params) {
40 return CJS_Return(true);
tsepez4cf55152016-11-02 14:37:54 -070041}
42
Dan Sinclair8f524d62017-10-25 13:30:31 -040043CJS_Return console::println(CJS_Runtime* pRuntime,
44 const std::vector<v8::Local<v8::Value>>& params) {
45 return CJS_Return(params.size() > 0);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070046}
47
Dan Sinclair8f524d62017-10-25 13:30:31 -040048CJS_Return console::show(CJS_Runtime* pRuntime,
49 const std::vector<v8::Local<v8::Value>>& params) {
50 return CJS_Return(true);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070051}