diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-05-02 13:00:46 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-02 13:00:46 -0400 | 
| commit | c4ea9321dcffbda9004461a7b0027cf5c893f3c0 (patch) | |
| tree | d42693165e657bd038d037ac65d61dbc99d59dcf /ext/fg/js/document.js | |
| parent | 51032d1eca04820a80f34dfd511a927c55975c1f (diff) | |
Validate document nodes before use (#493)
* Validate document.body before use in loadScripts
This also fixes an issue where reject wasn't being passed to loadScriptSentinel.
* Validate document nodes before use in _getSiteColor
* Validate document.body before use in _getViewport
* Validate document.body before use in setContentScale
* Validate document.body before use in docImposterCreate
Diffstat (limited to 'ext/fg/js/document.js')
| -rw-r--r-- | ext/fg/js/document.js | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js index 3b4cc28f..6103c7c5 100644 --- a/ext/fg/js/document.js +++ b/ext/fg/js/document.js @@ -28,6 +28,9 @@ function docSetImposterStyle(style, propertyName, value) {  }  function docImposterCreate(element, isTextarea) { +    const body = document.body; +    if (body === null) { return [null, null]; } +      const elementStyle = window.getComputedStyle(element);      const elementRect = element.getBoundingClientRect();      const documentRect = document.documentElement.getBoundingClientRect(); @@ -78,7 +81,7 @@ function docImposterCreate(element, isTextarea) {      }      container.appendChild(imposter); -    document.body.appendChild(container); +    body.appendChild(container);      // Adjust size      const imposterRect = imposter.getBoundingClientRect(); |