use of com.gargoylesoftware.htmlunit.javascript.host.WindowProxy in project htmlunit by HtmlUnit.
the class MessageEvent method jsConstructor.
/**
* JavaScript constructor.
*
* @param type the event type
* @param details the event details (optional)
*/
@Override
@JsxConstructor({ CHROME, EDGE, FF, FF_ESR })
public void jsConstructor(final String type, final ScriptableObject details) {
super.jsConstructor(type, details);
if (getBrowserVersion().hasFeature(EVENT_ONMESSAGE_DEFAULT_DATA_NULL)) {
data_ = null;
}
String origin = "";
String lastEventId = "";
if (details != null && !Undefined.isUndefined(details)) {
data_ = details.get("data");
final String detailOrigin = (String) details.get(HttpHeader.ORIGIN_LC);
if (detailOrigin != null) {
origin = detailOrigin;
}
final Object detailLastEventId = details.get("lastEventId");
if (detailLastEventId != null) {
lastEventId = Context.toString(detailLastEventId);
}
source_ = null;
final Object detailSource = details.get("source");
if (detailSource instanceof Window) {
source_ = (Window) detailSource;
} else if (detailSource instanceof WindowProxy) {
source_ = ((WindowProxy) detailSource).getDelegee();
}
ports_ = details.get("ports");
}
origin_ = origin;
lastEventId_ = lastEventId;
}
Aggregations