mirror of https://github.com/gorhill/uBlock.git
this fixes #1529: harden element picker styles against external changes
This commit is contained in:
parent
4284556188
commit
ebcafc8db2
|
@ -130,11 +130,11 @@ if ( window.top !== window ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pickerRoot = document.getElementById(vAPI.sessionId);
|
var pickerRoot = document.getElementById(vAPI.sessionId);
|
||||||
|
|
||||||
if ( pickerRoot ) {
|
if ( pickerRoot ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pickerStyle = null;
|
||||||
var svgOcean = null;
|
var svgOcean = null;
|
||||||
var svgIslands = null;
|
var svgIslands = null;
|
||||||
var svgRoot = null;
|
var svgRoot = null;
|
||||||
|
@ -902,6 +902,7 @@ var stopPicker = function() {
|
||||||
dialog.removeEventListener('click', onDialogClicked);
|
dialog.removeEventListener('click', onDialogClicked);
|
||||||
svgListening(false);
|
svgListening(false);
|
||||||
svgRoot.removeEventListener('click', onSvgClicked);
|
svgRoot.removeEventListener('click', onSvgClicked);
|
||||||
|
pickerStyle.parentNode.removeChild(pickerStyle);
|
||||||
pickerRoot.parentNode.removeChild(pickerRoot);
|
pickerRoot.parentNode.removeChild(pickerRoot);
|
||||||
pickerRoot.onload = null;
|
pickerRoot.onload = null;
|
||||||
pickerRoot =
|
pickerRoot =
|
||||||
|
@ -1042,6 +1043,13 @@ pickerRoot.style.cssText = [
|
||||||
''
|
''
|
||||||
].join('!important; ');
|
].join('!important; ');
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/1529
|
||||||
|
// In addition to inline styles, harden the element picker styles by using
|
||||||
|
// a dedicated style tag.
|
||||||
|
pickerStyle = document.createElement('style');
|
||||||
|
pickerStyle.textContent = '#' + pickerRoot.id + ' { ' + pickerRoot.style.cssText + ' }';
|
||||||
|
document.documentElement.appendChild(pickerStyle);
|
||||||
|
|
||||||
pickerRoot.onload = function() {
|
pickerRoot.onload = function() {
|
||||||
vAPI.shutdown.add(stopPicker);
|
vAPI.shutdown.add(stopPicker);
|
||||||
vAPI.messaging.send(
|
vAPI.messaging.send(
|
||||||
|
|
Loading…
Reference in New Issue