Skip to content

Conversation

@aslushnikov
Copy link
Contributor

This patch teaches Page.addScriptTag and Page.addStyleTag to throw
an error when blocked by CSP.

References #1229.

This patch teaches Page.addScriptTag and Page.addStyleTag to throw
an error when blocked by CSP.

References puppeteer#1229.
@aslushnikov aslushnikov changed the title DevTools: Page.addScriptTagshould throw when blocked by CSP DevTools: Page.addScriptTag should throw when blocked by CSP Apr 6, 2018
@aslushnikov aslushnikov changed the title DevTools: Page.addScriptTag should throw when blocked by CSP feat(Page): Page.addScriptTag should throw when blocked by CSP Apr 6, 2018
});
return script;
document.head.appendChild(script);
return promise;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

await promise;
return script;

Makes this a bit easier to read. I missed that we were returning the script at first.

const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(content));
const promise = new Promise((res, rej) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above.

@aslushnikov aslushnikov merged commit 846c080 into puppeteer:master Apr 6, 2018
@aslushnikov aslushnikov deleted the addscriptag-throws-on-csp branch May 9, 2018 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants