blob: db20281e447e8e2300ac953190cb218db20964fb [file] [log] [blame]
K. Moon832a6942022-10-31 20:11:31 +00001// Copyright 2014 The PDFium Authors
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07002// 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 Sinclaire0345a42017-10-30 20:20:42 +00007#include "fxjs/cjs_console.h"
Tom Sepez37458412015-10-06 11:33:46 -07008
Lei Zhang37935952024-02-16 04:39:56 +00009#include "core/fxcrt/span.h"
Dan Sinclaire0345a42017-10-30 20:20:42 +000010#include "fxjs/cjs_event_context.h"
Dan Sinclaire0345a42017-10-30 20:20:42 +000011#include "fxjs/cjs_object.h"
Tom Sepez221f0b32018-06-04 22:11:27 +000012#include "fxjs/js_define.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070013
Dan Sinclairc94a7932017-10-26 16:48:57 -040014const JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
15 {"hide", hide_static},
16 {"println", println_static},
Dan Sinclair909fa2d2017-12-12 01:53:28 +000017 {"show", show_static}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070018
Tom Sepezb4958712020-10-13 20:30:43 +000019uint32_t CJS_Console::ObjDefnID = 0;
Dan Sinclairf7435522018-02-05 22:27:22 +000020const char CJS_Console::kName[] = "console";
Dan Sinclair89d26c82017-10-26 12:21:28 -040021
Dan Sinclairef299532017-10-26 16:48:30 -040022// static
Tom Sepezb4958712020-10-13 20:30:43 +000023uint32_t CJS_Console::GetObjDefnID() {
Lei Zhangad1f7b42018-07-11 13:04:43 +000024 return ObjDefnID;
25}
26
27// static
Dan Sinclairbef4d3e2017-10-26 16:49:38 -040028void CJS_Console::DefineJSObjects(CFXJS_Engine* pEngine) {
Dan Sinclairf7435522018-02-05 22:27:22 +000029 ObjDefnID = pEngine->DefineObj(CJS_Console::kName, FXJSOBJTYPE_STATIC,
Dan Sinclair998fee32018-02-05 21:43:19 +000030 JSConstructor<CJS_Console>, JSDestructor);
Tom Sepez8b4ddeb2018-06-11 15:55:17 +000031 DefineMethods(pEngine, ObjDefnID, MethodSpecs);
Dan Sinclair89d26c82017-10-26 12:21:28 -040032}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070033
Tom Sepez36aae4f2018-06-04 19:44:37 +000034CJS_Console::CJS_Console(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
35 : CJS_Object(pObject, pRuntime) {}
Dan Sinclair998fee32018-02-05 21:43:19 +000036
Dan Sinclairf7435522018-02-05 22:27:22 +000037CJS_Console::~CJS_Console() = default;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070038
Tom Sepez3a6d0582018-08-17 19:28:52 +000039CJS_Result CJS_Console::clear(CJS_Runtime* pRuntime,
Tom Sepez90589d42023-11-01 18:24:30 +000040 pdfium::span<v8::Local<v8::Value>> params) {
Tom Sepez3a6d0582018-08-17 19:28:52 +000041 return CJS_Result::Success();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070042}
43
Tom Sepez3a6d0582018-08-17 19:28:52 +000044CJS_Result CJS_Console::hide(CJS_Runtime* pRuntime,
Tom Sepez90589d42023-11-01 18:24:30 +000045 pdfium::span<v8::Local<v8::Value>> params) {
Tom Sepez3a6d0582018-08-17 19:28:52 +000046 return CJS_Result::Success();
tsepez4cf55152016-11-02 14:37:54 -070047}
48
Tom Sepez90589d42023-11-01 18:24:30 +000049CJS_Result CJS_Console::println(CJS_Runtime* pRuntime,
50 pdfium::span<v8::Local<v8::Value>> params) {
Tom Sepez3a6d0582018-08-17 19:28:52 +000051 return CJS_Result::Success();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052}
53
Tom Sepez3a6d0582018-08-17 19:28:52 +000054CJS_Result CJS_Console::show(CJS_Runtime* pRuntime,
Tom Sepez90589d42023-11-01 18:24:30 +000055 pdfium::span<v8::Local<v8::Value>> params) {
Tom Sepez3a6d0582018-08-17 19:28:52 +000056 return CJS_Result::Success();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070057}