@@ -1450,40 +1450,38 @@ private void setHandlerForJavaScript(final String eventName, final Object handle
1450
1450
}
1451
1451
1452
1452
/**
1453
- * To be called when the property detection fails in normal scenarios.
1454
- *
1455
- * @param name the name
1456
- * @return the found object, or {@link Scriptable#NOT_FOUND}
1453
+ * {@inheritDoc}
1457
1454
*/
1458
- public Object getWithFallback (final String name ) {
1459
- Object result = NOT_FOUND ;
1460
-
1455
+ @ Override
1456
+ protected Object getWithPreemption (final String name ) {
1461
1457
final DomNode domNode = getDomNodeOrNull ();
1462
- if (domNode != null ) {
1458
+ if (domNode == null ) {
1459
+ return NOT_FOUND ;
1460
+ }
1463
1461
1464
- // May be attempting to retrieve a frame by name.
1465
- final HtmlPage page = (HtmlPage ) domNode .getPage ();
1466
- result = getFrameWindowByName (page , name );
1467
1462
1468
- if (result == NOT_FOUND ) {
1469
- result = getElementsByName (page , name );
1463
+ // May be attempting to retrieve a frame by name.
1464
+ final HtmlPage page = (HtmlPage ) domNode .getPage ();
1465
+ Object result = getFrameWindowByName (page , name );
1470
1466
1471
- if (result == NOT_FOUND ) {
1472
- // May be attempting to retrieve element by ID (try map-backed operation again instead of XPath).
1473
- try {
1474
- final HtmlElement htmlElement = page .getHtmlElementById (name );
1475
- result = getScriptableFor (htmlElement );
1476
- }
1477
- catch (final ElementNotFoundException e ) {
1478
- result = NOT_FOUND ;
1479
- }
1467
+ if (result == NOT_FOUND ) {
1468
+ result = getElementsByName (page , name );
1469
+
1470
+ if (result == NOT_FOUND ) {
1471
+ // May be attempting to retrieve element by ID (try map-backed operation again instead of XPath).
1472
+ try {
1473
+ final HtmlElement htmlElement = page .getHtmlElementById (name );
1474
+ result = getScriptableFor (htmlElement );
1475
+ }
1476
+ catch (final ElementNotFoundException e ) {
1477
+ result = NOT_FOUND ;
1480
1478
}
1481
1479
}
1480
+ }
1482
1481
1483
- if (result instanceof Window ) {
1484
- final WebWindow webWindow = ((Window ) result ).getWebWindow ();
1485
- result = getProxy (webWindow );
1486
- }
1482
+ if (result instanceof Window ) {
1483
+ final WebWindow webWindow = ((Window ) result ).getWebWindow ();
1484
+ result = getProxy (webWindow );
1487
1485
}
1488
1486
1489
1487
return result ;
0 commit comments