Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.
This repository was archived by the owner on May 30, 2023. It is now read-only.

onLongRunningScript and stopJavaScript do not work #12504

@ariya

Description

@ariya

This is a regression on master branch, as reported by @zackw on the mailing-list: https://groups.google.com/d/msg/phantomjs-dev/yW-rsf9AIbU/O19HH-we2LoJ.

Test code:

    function expect(val, exp) { 
        if (val !== exp) 
            console.log('FAIL: ' + val + ' !== ' + exp); 
    } 

    var page = require('webpage').create(); 
    var longRunningScriptCalled = false; 
    var loadStatus; 

    page.onLongRunningScript = function() { 
        page.stopJavaScript(); 
        longRunningScriptCalled = true; 
    }; 
    page.onError = function (msg, trace) { 
        console.log('ERROR: ' + msg); 
    }; 

    page.open('data:text/html,' + 
              '<script>function forever() { while(true) {} }</script>' + 
              '<body onload="forever();"></body>', 
              function(status) { loadStatus = status; }); 

    setTimeout(function() { 
        expect(loadStatus, 'success'); 
        expect(longRunningScriptCalled, true); 
        phantom.exit(0); 
    }, 5000); 

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions