-
Notifications
You must be signed in to change notification settings - Fork 9.5k
core(dom): introduce safelySetHref #12796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl sg we're not losing much, just some tests lacking :)
…estricted-properties" This reverts commit a1b29a7.
@@ -85,32 +85,43 @@ describe('Page Functions', () => { | |||
|
|||
describe('get outer HTML snippets', () => { | |||
it('gets full HTML snippet', () => { | |||
assert.equal(pageFunctions.getOuterHTMLSnippet( | |||
dom.createElement('div', '', {id: '1', style: 'style'})), '<div id="1" style="style">'); | |||
const elem = dom.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, dom.js
in here. I even thought it looked "pretty handy" to have in here in the original review :)
I feel like it shouldn't be crossing out of the report anymore. Since it's equivalent to document.createElement()
calls now, do you mind cutting out dom.js
now?
|
||
beforeAll(async () => { | ||
assert = (await import('assert')).strict; | ||
jsdom = await import('jsdom'); | ||
pageFunctions = (await import('../../lib/page-functions.js')).default; | ||
DOM = (await import('../../../report/renderer/dom.js')).DOM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totally didnt notice the DOM usage here was trivial :P
safelySetHref
and change allelem.href
setters to use it. it ensures we don't set a link to ajavascript:evil()
url.safelySetBlobHref
. same kinda idea.attrs
method signature from createElement. it opens another vector towards accidentally setting href/src/etc to something bad. it was unlikely, but that syntactic sugar didn't really save us much. :)Relevant to cl/383899920 🔒