executeAsyncJavascript can cause crashes #105

detro opened this Issue Oct 18, 2012 · 0 comments


None yet

1 participant

detro commented Oct 18, 2012

The following test crashes PhantomJS:

    public void shouldBeAbleToExecuteMultipleAsyncScriptsSequentiallyWithNavigation() {
        WebDriver d = getDriver();
        d.manage().timeouts().setScriptTimeout(0, TimeUnit.MILLISECONDS);

        Number numericResult = (Number) ((JavascriptExecutor) d).executeAsyncScript(
                "arguments[arguments.length - 1](123);");
        assertEquals(123, numericResult.intValue());

        String stringResult = (String) ((JavascriptExecutor) d).executeAsyncScript(
                "arguments[arguments.length - 1]('abc');");
        assertEquals("abc", stringResult);

        // Verify that a future navigation does not cause the driver to have problems.

This is an issue in PhantomJS, but needs deep investigation to be addressed.

@detro detro added a commit that referenced this issue Nov 4, 2012
@detro Found the root cause of many crashes.
The method "QObject.signalname.disconnect(fund)" has issues.
Sometimes DOESN'T disconnect the Signal for real, even if it says it did.
This causes the "onShotCallbacks" (i.e. "onLoastStarted", "onLoadFinished"…)
fire again after they have been already consumed and disconnected.
The Qt MetaObject tries to invoke them, and causes a crash (as the actual pointer to the SLOT is actually gone).

Hence, I have made a workaround.
Callback handlers for those events are registered only
when the page is created: after that I add/remove
my own "OneShotCallbacks", using the actual
callback handlers as proxy to those.

Fixes multiple issues: #105, #113, #111, #109,
@detro detro closed this Nov 4, 2012
@detro detro added 1.2.0 and removed 1.x labels May 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment