1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.event;
16
17 import org.htmlunit.corejs.javascript.Scriptable;
18 import org.htmlunit.corejs.javascript.ScriptableObject;
19 import org.htmlunit.javascript.JavaScriptEngine;
20 import org.htmlunit.javascript.configuration.JsxClass;
21 import org.htmlunit.javascript.configuration.JsxConstructor;
22 import org.htmlunit.javascript.configuration.JsxGetter;
23
24
25
26
27
28
29
30
31 @JsxClass
32 public class PopStateEvent extends Event {
33
34 private Object state_;
35
36
37
38
39 public PopStateEvent() {
40 super("");
41 }
42
43
44
45
46 @Override
47 @JsxConstructor
48 public void jsConstructor(final String type, final ScriptableObject details) {
49 super.jsConstructor(type, details);
50
51 if (details != null && !JavaScriptEngine.isUndefined(details)) {
52 state_ = details.get("state");
53 }
54 }
55
56
57
58
59
60
61
62
63 public PopStateEvent(final EventTarget target, final String type, final Object state) {
64 super(target, type);
65 state_ = state;
66 }
67
68
69
70
71
72 @JsxGetter
73 public Object getState() {
74 return state_;
75 }
76
77
78
79
80 @Override
81 public void put(final String name, final Scriptable start, final Object value) {
82 if (!"state".equals(name)) {
83 super.put(name, start, value);
84 }
85 }
86 }