Posts

Showing posts from 2015

Confine DOM injected content from any existing web page styles

Problem statement:  Extensions generally add some UI components to existing web pages. Those components which you create thru contentScripts get influenced by the webpage css styles. Their appearance is therefore not guaranteed and sometimes compromised. This becomes an important problem: -  if you inject complex UI (sidebar/toolbar based addons for example) -  if you target many websites (broad permissions) -  if page structure and styles vary frequently for the sites you target. Solutions - solution 0: I have seen people setting every possible attribute for all their addon UI elements in gigantic stylesheets to prevent any potential influence. Pros:   simple Cons:  tedious and cumbersome. - solution 1: inject an iframe (portable across all browsers) Pros: isolate also from CSP perspective. JS UI libraries can be used without side-effect. Cons:  complexify the architecture of the addon since it introduces a new agent to handle the iframe. Communication between the vario