Opened on 09/04/2017 at 08:09:38 AM

Closed on 09/05/2017 at 10:17:42 PM

Last modified on 09/14/2017 at 12:35:00 PM

#5616 closed change (fixed)

Pass runAt="document_start" to tabs.insertCSS

Reported by: mjethani Assignee: mjethani
Priority: P2 Milestone: Adblock-Plus-1.13.4-for-Chrome-Opera
Module: Platform Keywords:
Cc: sebastian, trev Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29535555/

Description

Background

tabs.insertCSS injects the code into the page on document_idle by default, when the document and all its resources have been loaded. In many cases this can be too late. This delay is technically unnecessary and leads to a bad user experience.

The API takes a runAt parameter, which can be set to document_start to inject the code at the earliest.

Thanks to Raymond Hill for reporting this.

What to change

Pass the runAt parameter to tabs.insertCSS with the value set to document_start.

Attachments (0)

Change History (5)

comment:1 Changed on 09/04/2017 at 08:20:00 AM by mjethani

Here's how to test this.

First, save this JavaScript code to a file called generate.js:

// generate.js
for (let i = 0; i < 1000000; i++)
{
  console.log("window.a" + Math.floor((Math.random() * 1000000)) +
              " = " + Math.random());
}

Then run it with Node.js like so:

node generate.js > test.js

This should generate a ~34 MB JavaScript source file called test.js.

Create an HTML file called test.html with the following contents:

<h1>ANNOYING AD!!!<h1>
<script src="test.js"></script>

Upload test.html and test.js to a web server. Add the filter ##h1. Finally, access the page test.html in the browser over HTTP(S).

The text "ANNOYING AD!!!" should be hidden as soon as the page starts loading.

comment:2 Changed on 09/04/2017 at 08:22:51 AM by mjethani

  • Review URL(s) modified (diff)

comment:3 Changed on 09/05/2017 at 01:54:09 AM by abpbot

A commit referencing this issue has landed:
Issue 5616 - Pass runAt=document_start to tabs.insertCSS

comment:4 Changed on 09/05/2017 at 10:17:42 PM by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-next
  • Priority changed from Unknown to P2
  • Ready set
  • Resolution set to fixed
  • Status changed from new to closed

comment:5 Changed on 09/14/2017 at 12:35:00 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. Heading is hidden as page starts loading as described.

1.13.3.1838
Chrome 49 / 61 / Windows 7
Opera 36 / 47 / Windows 7

ABP 2.99.0.1838beta
Firefox 50 / 55 / Windows 7

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from mjethani.
 
Note: See TracTickets for help on using tickets.