How to lazily load a network HTTP request or block and re-initiate when required in the Firefox extension?

I am working on a project in that we prioritize HTTP resource load requests. To reorder HTTP requests, we need to either delay the HTTP requests to send, or either cancel them, or re-initiate them later.

The following code snippet can be used to cancel an HTTP request in Firefox Extension.

observe: function(aSubject, aTopic, aData) {

  if (aTopic == 'http-on-modify-request') {

    .....

    aSubject.cancel(Components.results.NS_BINDING_ABORTED);

    ....

  }

}

But is there a way to delay (lazy loading resources) an HTTP request or re-initiate HTTP requests that were canceled while parsing a web page using the above code.

+4
source share
1

, . "" , ( ). . (), . , , /, , API ( , , HTTP- ).

, :

  • nsISupportsPriority / . , HTTP. , ( Firefox, ) API . .
  • nsIRequest.suspend()/.resume(), , , , , -, , . IIRC -, ( ).

. . , " " . ( ) , script ..

0

Source: https://habr.com/ru/post/1545532/


All Articles