[ 
https://issues.apache.org/jira/browse/CB-9208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14592299#comment-14592299
 ] 

Grant Patterson commented on CB-9208:
-------------------------------------

Experimenting more, I'm thinking it isn't about which kind of page load this 
is, but a timing issue. If I create a timeout for my executeScript() call, the 
callback is executed if the delay is 300ms, but not if the delay is 30ms. That 
makes some sense: I can always call executeScript() on an in-app browser 
instance, but if it's transitioning from one page to the next, there's a sort 
of race condition: on which page should the js be executed? Nevertheless, it 
still seems strange to me that the callback would be simply dropped, especially 
when the code is still executed. And indeed, there must be some strange 
interaction with the location hash, since in that case there isn't a new page 
anyway, just a different section, so is it really a new context at all?

> InAppBrowser.executeScript interacts strangely with location.hash
> -----------------------------------------------------------------
>
>                 Key: CB-9208
>                 URL: https://issues.apache.org/jira/browse/CB-9208
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin InAppBrowser
>    Affects Versions: 5.0.0
>         Environment: iOS
>            Reporter: Grant Patterson
>
> In my "loadstart" event handler I call executeScript() with a callback. Here 
> is what I see:
> actual page change: script runs, callback runs
> window.location.assign(same page, new hash): nothing runs
> click anchor link e.g. href=#newsection: nothing runs
> set location.hash = newhash: script runs; callback does not
> The last case is the strangest to me. The script runs just fine in this case 
> but the callback with the result never happens.
> I'm not sure under what conditions a URL fragment change should trigger the 
> "loadstart" event; I would say it should be always, and that does not appear 
> to be the case. That is probably a bug.
> Worse, though, is running the script but not triggering its callback. This 
> could leave some task half-done: the in-app-browser window has had a state 
> change, but the code outside the in-app-browser never hears back about it. 
> That is almost certainly a bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to