Skip to content

Conversation

@paulirish
Copy link
Member

  • introduce safelySetHref and change all elem.href setters to use it. it ensures we don't set a link to a javascript:evil() url.
  • add safelySetBlobHref. same kinda idea.
  • remove the bag of 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 🔒

@paulirish paulirish requested a review from a team as a code owner July 17, 2021 04:15
@paulirish paulirish requested review from patrickhulce and removed request for a team July 17, 2021 04:15
@google-cla google-cla bot added the cla: yes label Jul 17, 2021
Copy link
Collaborator

@patrickhulce patrickhulce left a 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 :)

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');
Copy link
Contributor

@brendankenny brendankenny Jul 19, 2021

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?

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;
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants