Closed Bug 1663002 Opened 5 years ago Closed 5 years ago

Firefox continue run async code even if page is reloaded or stopped

Categories

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

79 Branch
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: kes-kes, Unassigned, NeedInfo)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

The code is:

btnPayment.append( document.createTextNode( 'Проводка' ) );
btnPayment.addEventListener( 'click', ( e ) => {
  var rows =  data_table[1].getSelectedRows();
  if( rows.length == 0 ) { return }
  var data;
  if( rows[0].getCell('oper_new').getValue() ) { data =  false; }
  else { data =  true; }

  rows.forEach(function(item){
    if( item.getCell('oper_new').getValue() == data ) { return }
    if( item.getData().document_type != 'Usage' ) { return }
    ajax_query( "PUT", "/api/operations/Document/" +item.getData().id, { oper_new: data },{
      async  : false,
      success: function( data ) {
        item.update( data );
      }
    });
  });
});

When I press button I requests are made to server. I stop page and want to reload it. I go to address bar and press enter

Actual results:

The page is reloaded but old queries from foreach loop continue to work

Expected results:

Script code which is run from old page (different page) should be stopped, killed and cleared.

When I input new url into address bar (despite on it is equal to old it is new, because I just input it into address bar) I do not expect side effect from old requests.
This page MUST BE completely new.

Probably here is security issue. If one site makes closure with big timeout, 10min.
This timeout is kept in this tab. For this time user could gone from initial page to some different. And when time tick is come the code from different page is executed.

I mean old code is executed on new page

Olli, is this something you can look at?

Group: firefox-core-security → dom-core-security
Component: Untriaged → DOM: Core & HTML
Flags: needinfo?(bugs)
Product: Firefox → Core

Eugen, could you perhaps attach a minimal testcase using 'Attach new file'?

Flags: needinfo?(bugs) → needinfo?(kes-kes)
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE

Probably later... =(

Flags: needinfo?(kes-kes)
Flags: needinfo?(kes-kes)
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: