1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.performance;
16
17 import org.apache.commons.logging.Log;
18 import org.apache.commons.logging.LogFactory;
19 import org.htmlunit.corejs.javascript.Scriptable;
20 import org.htmlunit.javascript.HtmlUnitScriptable;
21 import org.htmlunit.javascript.JavaScriptEngine;
22 import org.htmlunit.javascript.configuration.JsxClass;
23 import org.htmlunit.javascript.configuration.JsxConstant;
24 import org.htmlunit.javascript.configuration.JsxConstructor;
25 import org.htmlunit.javascript.configuration.JsxFunction;
26 import org.htmlunit.javascript.configuration.JsxGetter;
27
28
29
30
31
32
33
34 @JsxClass
35 public class PerformanceNavigation extends HtmlUnitScriptable {
36
37 private static final Log LOG = LogFactory.getLog(PerformanceNavigation.class);
38
39
40 @JsxConstant
41 public static final int TYPE_NAVIGATE = 0;
42
43
44 @JsxConstant
45 public static final int TYPE_RELOAD = 1;
46
47
48 @JsxConstant
49 public static final int TYPE_BACK_FORWARD = 2;
50
51
52 @JsxConstant
53 public static final int TYPE_RESERVED = 255;
54
55
56
57
58 @JsxConstructor
59 public void jsConstructor() {
60
61 }
62
63
64
65
66
67 @JsxGetter
68 public int getType() {
69 return TYPE_NAVIGATE;
70 }
71
72
73
74
75
76 @JsxGetter
77 public int getRedirectCount() {
78 return 0;
79 }
80
81
82
83
84
85 @JsxFunction
86 public Scriptable toJSON() {
87 final Scriptable json = JavaScriptEngine.newObject(getParentScope());
88 json.put("type", json, getType());
89 json.put("redirectCount", json, getRedirectCount());
90
91 return json;
92 }
93
94 }