blob: 02babea19e3a5dd18a5fac806b121c3f45711399 [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 Sinclaire0345a42017-10-30 20:20:42 +00007#include "fxjs/cjs_console.h"
Tom Sepez37458412015-10-06 11:33:46 -07008
Dan Sinclair3ebd1212016-03-09 09:59:23 -05009#include <vector>
10
Dan Sinclaire0345a42017-10-30 20:20:42 +000011#include "fxjs/cjs_event_context.h"
12#include "fxjs/cjs_eventhandler.h"
13#include "fxjs/cjs_object.h"
Tom Sepez221f0b32018-06-04 22:11:27 +000014#include "fxjs/js_define.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070015
Dan Sinclairc94a7932017-10-26 16:48:57 -040016const JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
17 {"hide", hide_static},
18 {"println", println_static},
Dan Sinclair909fa2d2017-12-12 01:53:28 +000019 {"show", show_static}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020
Dan Sinclairef299532017-10-26 16:48:30 -040021int CJS_Console::ObjDefnID = -1;
Dan Sinclairf7435522018-02-05 22:27:22 +000022const char CJS_Console::kName[] = "console";
Dan Sinclair89d26c82017-10-26 12:21:28 -040023
Dan Sinclairef299532017-10-26 16:48:30 -040024// static
Dan Sinclairbef4d3e2017-10-26 16:49:38 -040025void CJS_Console::DefineJSObjects(CFXJS_Engine* pEngine) {
Dan Sinclairf7435522018-02-05 22:27:22 +000026 ObjDefnID = pEngine->DefineObj(CJS_Console::kName, FXJSOBJTYPE_STATIC,
Dan Sinclair998fee32018-02-05 21:43:19 +000027 JSConstructor<CJS_Console>, JSDestructor);
Dan Sinclair909fa2d2017-12-12 01:53:28 +000028 DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
Dan Sinclair89d26c82017-10-26 12:21:28 -040029}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070030
Tom Sepez36aae4f2018-06-04 19:44:37 +000031CJS_Console::CJS_Console(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
32 : CJS_Object(pObject, pRuntime) {}
Dan Sinclair998fee32018-02-05 21:43:19 +000033
Dan Sinclairf7435522018-02-05 22:27:22 +000034CJS_Console::~CJS_Console() = default;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070035
Dan Sinclairf7435522018-02-05 22:27:22 +000036CJS_Return CJS_Console::clear(CJS_Runtime* pRuntime,
37 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000038 return CJS_Return();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070039}
40
Dan Sinclairf7435522018-02-05 22:27:22 +000041CJS_Return CJS_Console::hide(CJS_Runtime* pRuntime,
42 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000043 return CJS_Return();
tsepez4cf55152016-11-02 14:37:54 -070044}
45
Dan Sinclairf7435522018-02-05 22:27:22 +000046CJS_Return CJS_Console::println(
47 CJS_Runtime* pRuntime,
48 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000049 return CJS_Return();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070050}
51
Dan Sinclairf7435522018-02-05 22:27:22 +000052CJS_Return CJS_Console::show(CJS_Runtime* pRuntime,
53 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000054 return CJS_Return();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070055}