Bug 11042

Summary: navigationController is borked
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, ap, beidson, cdumez, ggaren, mitz, tonikitoo
Priority: P3    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   

Description Eric Seidel (no email) 2006-09-26 01:21:56 PDT
navigationController is borked

Trying to use it just hangs DRT.

See attached test case:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="400" width="400">
<style type="text/css">
  circle { fill: maroon; }
  a:visited circle { fill: green; }
</style>
<script type="text/javascript">
  <![CDATA[
    if (window.layoutTestController) {
      layoutTestController.waitUntilDone();
      navigationController.evalAfterBackForwardNavigation("layoutTestController.notiftyDone()");
    }
  ]]>
</script>
<a xlink:href="002.xml" xlink:type="simple"><circle cx="200" cy="200" r="100" fill="red"/></a>
</svg>
Comment 1 Eric Seidel (no email) 2006-09-26 01:22:46 PDT
Hum.. maybe it was my use of "notiftyDone" instead of notifyDone... I'll have to check.
Comment 2 Eric Seidel (no email) 2006-09-27 13:39:07 PDT
Even after fixing my typo, the test still seems to hang.
Comment 3 mitz 2006-09-28 04:01:53 PDT
The script is executing again as a result of loading the test again (DRT doesn't use the back/forward cache), so evalAfterBackForwardNavigation is getting called repeatedly without ever finishing.

I think you can patch NavigationController to prevent this kind of "reentrancy" - simply don't do anything in -evaluateWebScript:afterBackForwardNavigation: if pendingAction != None. (You'll also need to reset the pendingAction from runTest() in case the previous test bailed before completing).

(I was wondering how all the other tests that use navigationController don't loop endlessly, and found only one such test, which is currently disabled. When enabled it also loops).
Comment 4 Ahmad Saleem 2023-09-16 15:29:08 PDT
I think Comment 03 is referring to following code snippet:

Link - https://github.com/WebKit/WebKit/blob/c58d1fdfb592147cbe5dc6cc04add73c405be63c/Tools/DumpRenderTree/mac/NavigationController.m#L67

- (void)evaluateWebScript:(NSString *)script afterBackForwardNavigation:(NSString *)navigation
{
    // Allow both arguments to be optional
    if (![script isKindOfClass:[NSString class]])
        script = @"";
    if (![navigation isKindOfClass:[NSString class]])
        navigation = @"about:blank";
    
    [self setPendingScript:script];
    [self setPendingRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:navigation]]];
    pendingAction = Load;
}


______

I haven't tried this test locally but don't know whether it is available in our tree or not but just wanted to share latest stuff to see whether we need to do anything or not.

CCing - @Alexey - since I don't know who would be right person to look into it to fix or close it.
Comment 5 Alexey Proskuryakov 2023-09-18 08:13:07 PDT
Yes, we do have navigationController in DumpRenderTree. But not in WebKitTestRunner.

And it is still true that there is only one test attempting to use it, and it's skipped. Can probably as well delete the test and the code after all these years.