Closed Bug 333430 Opened 19 years ago Closed 19 years ago

GUI updating during javascript exectution

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: lars, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060324 Ubuntu/dapper Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060324 Ubuntu/dapper Firefox/1.5.0.1 I am not sure to what extend the mozilla foundation is willing to take such a step, but I sense due to the upcoming use of javascript for real-time web applications these following suggestions are quite realistic. Firstly, the implemantations to be mentioned should be sufficient to write a specialized prompt() and alert() function in javascript, which atm is impossible. Javascript requires the possibility of adding infinite loops in order to allow those or similar extensions. Such loops however will under current conditions render the webpage unresponsive. This not only makes it impossible to write longer javascript functions which won't take time from the user. Therefore GUI reaction should be undepended from running javascript functions in order to allow pages to function in the moment js is running. Implementation As a usual implementation would affect currently working javascript's, which sometimes rely on the fact that the user interface is not updated momentarily, as well as create additional cpu time I suggest the use of an updating function updateui() or similar which would automatically syncronize the user interface with the current document status as well as react on user inputs made. The implementation should be formed such that function(){while(true) updateui()} would technically have the same effect as function(){} just with without ending of the function. Effects This extension to javascript should make it possible to more easily create javascript functions which do not conclude in a question whether the javascript should be stopped as well as interactive javascripts. Reproducible: Always
Summary: GUI updating → GUI updating during javascript exectution
Component: General → JavaScript Engine
Product: Firefox → Core
Version: unspecified → Trunk
Web developers can already do something like updateui(), using setTimeout.
setTimeout is not comparable because for an infinite loop a function would need to run function x ( data ) { if ( typeof data == 'undefined' ) { var data doaction ... } else { restore_data doaction } setTimeout ( function () x ( data ) , 0 ); } which is not a hack that would work for instance for prompts ( ) because, if a function prompt was made, it itself would need to return the value Implementation with uiupdate() function prompt ( question ) { show_question () while ( true ) { if ( answered () ) break uiupdate () } return answer () } var answer = prompt ( question ); value = doaction ( answer ) ..anything further... Implementation without uiupdate() function prompt ( question, action ) { show_question () prompt_handle ( action ) } function prompt_handle ( action ) { if ( answered ( ) ) action ( answer ) else setTimeout ( function () { prompt_handle ( action ) }, 0 ) } var answer = prompt ( question, function () { value = doaction () ..anything further... ) ); This easily gets more complicated, and virtually impossible in more complicated user interactions, for instance if another prompt was made the whole rest of the function would need to be padded into another one in order to work.
Assignee: nobody → general
QA Contact: general → general
Not a JS engine bug. Either INVALID because it asks for a violation of the script execution model, or a DOM bug to do some kind of updates from the existing execution callbacks, IMO. I'm gonna say INVALID, actually, but some Gecko 5.0 change to take advantage of the generator capabilities in JS1.7 could perhaps do something like this. Maybe. Given sufficient thrust.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Component: JavaScript Engine → DOM
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.