blob: d2cbb243b79088e16c24eed34de7d1b4316a7842 [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
Lei Zhangad1f7b42018-07-11 13:04:43 +000025int CJS_Console::GetObjDefnID() {
26 return ObjDefnID;
27}
28
29// static
Dan Sinclairbef4d3e2017-10-26 16:49:38 -040030void CJS_Console::DefineJSObjects(CFXJS_Engine* pEngine) {
Dan Sinclairf7435522018-02-05 22:27:22 +000031 ObjDefnID = pEngine->DefineObj(CJS_Console::kName, FXJSOBJTYPE_STATIC,
Dan Sinclair998fee32018-02-05 21:43:19 +000032 JSConstructor<CJS_Console>, JSDestructor);
Tom Sepez8b4ddeb2018-06-11 15:55:17 +000033 DefineMethods(pEngine, ObjDefnID, MethodSpecs);
Dan Sinclair89d26c82017-10-26 12:21:28 -040034}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070035
Tom Sepez36aae4f2018-06-04 19:44:37 +000036CJS_Console::CJS_Console(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
37 : CJS_Object(pObject, pRuntime) {}
Dan Sinclair998fee32018-02-05 21:43:19 +000038
Dan Sinclairf7435522018-02-05 22:27:22 +000039CJS_Console::~CJS_Console() = default;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070040
Dan Sinclairf7435522018-02-05 22:27:22 +000041CJS_Return CJS_Console::clear(CJS_Runtime* pRuntime,
42 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000043 return CJS_Return();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070044}
45
Dan Sinclairf7435522018-02-05 22:27:22 +000046CJS_Return CJS_Console::hide(CJS_Runtime* pRuntime,
47 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000048 return CJS_Return();
tsepez4cf55152016-11-02 14:37:54 -070049}
50
Dan Sinclairf7435522018-02-05 22:27:22 +000051CJS_Return CJS_Console::println(
52 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}
56
Dan Sinclairf7435522018-02-05 22:27:22 +000057CJS_Return CJS_Console::show(CJS_Runtime* pRuntime,
58 const std::vector<v8::Local<v8::Value>>& params) {
Tom Sepez16999822018-06-08 18:23:05 +000059 return CJS_Return();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070060}