-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(page-functions): don't try to clone a ShadowRoot #9079
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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.
Thanks so much for jumping on this @NickolasBenakis!
Do you think you could add a test case and remove the package-lock.json
?
A good test case would be adding error-prone element from the bug report to our accessibility smoke test HTML.
yarn smoke a11y
should fail without your fix, and pass with it! 🎉
const match = clone.outerHTML.match(reOpeningTag); | ||
return (match && match[0]) || ''; | ||
} catch (error) { | ||
return element.localName; |
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.
return element.localName; | |
return `<${element.localName}>`; |
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.
just to match the expected output of this function under normal conditions
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.
Thanks a lot for the feedback @patrickhulce .
I 'll remove it , my bad.
I am checking the a11y tester case now, I 've never done this before :)
But I am trying to figure out
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.
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.
That's expected :)
Steps:
- Run
yarn smoke a11y
, it should pass (you've already done this ✅) - Temporarily comment out your fix
- Add an error-prone element inside a11y_tester.html
- Run
yarn smoke a11y
, it should fail - Uncomment your fix
- Run
yarn smoke a11y
, it should pass - Commit the changes! 🎉
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.
you mean something like this?
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.
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.
meh either way,
I run the test with npm run test
and it crashes...
well :'(
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.
I meant something like
it('should handle dom nodes that cannot be inspected', () => {
const element = dom.createElement('div');
element.cloneNode = () => { throw new Erorr('oops!') };
assert.equal(pageFunctions.getOuterHTMLSnippet(element), '<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.
@patrickhulce I commited the test case :)
const reOpeningTag = /^[\s\S]*?>/; | ||
const match = clone.outerHTML.match(reOpeningTag); | ||
return (match && match[0]) || ''; | ||
} catch (error) { |
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.
} catch (error) { | |
} catch (_) { |
we name our unused variables _
:)
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
Codecov Report
@@ Coverage Diff @@
## master #9079 +/- ##
==========================================
- Coverage 91.43% 91.42% -0.02%
==========================================
Files 291 291
Lines 9917 9917
==========================================
- Hits 9068 9067 -1
- Misses 849 850 +1
Continue to review full report at Codecov.
|
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.
LGTM, thanks @NickolasBenakis!
@hoten want to take a look at this for another pair of eyes? I'm somewhat biased on some of these parts :)
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
Just updating the CLA |
Co-Authored-By: Brendan Kenny <bckenny@gmail.com>
Co-Authored-By: Brendan Kenny <bckenny@gmail.com>
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
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.
LGTM! Good to go when the build is green.
Thanks for sticking with this, @NickolasBenakis!
My pleasure... |
Summary
This PR fixes the #9048 issue .
It is a bug fix.