MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / alert

Method alert

src/main/java/org/htmlunit/javascript/host/Window.java:269–283  ·  view source on GitHub ↗

The JavaScript function alert(). @param message the message

(final Object message)

Source from the content-addressed store, hash-verified

267 * @param message the message
268 */
269 @JsxFunction
270 public void alert(final Object message) {
271 // use Object as parameter and perform String conversion by ourself
272 // this allows to place breakpoint here and "see" the message object and its properties
273 final String stringMessage = JavaScriptEngine.toString(message);
274 final AlertHandler handler = getWebWindow().getWebClient().getAlertHandler();
275 if (handler == null) {
276 if (LOG.isWarnEnabled()) {
277 LOG.warn("window.alert(\"" + stringMessage + "\") no alert handler installed");
278 }
279 }
280 else {
281 handler.handleAlert(document_.getPage(), stringMessage);
282 }
283 }
284
285 /**
286 * Creates a base-64 encoded ASCII string from a string of binary data.

Callers

nothing calls this directly

Calls 8

toStringMethod · 0.95
getWebWindowMethod · 0.95
handleAlertMethod · 0.95
getAlertHandlerMethod · 0.80
getWebClientMethod · 0.65
isWarnEnabledMethod · 0.65
warnMethod · 0.65
getPageMethod · 0.65

Tested by

no test coverage detected