-
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(full-page-screenshot): get the MAX_TEXTURE_SIZE from the browser #11847
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f19d171
core(full-page-screenshot): determine the MAX_TEXTURE_SIZE from the b…
paulirish 09b4027
Update lighthouse-core/gather/gatherers/full-page-screenshot.js
paulirish ce7680a
set fallback. destroy for gc
paulirish ab9de8c
use driver.evaluate()
paulirish 8c61f9d
drop c8 ignore thang
paulirish 3e9a9a8
use fn name instead
paulirish 93d36fc
Merge remote-tracking branch 'origin/master' into maxtexturesize
paulirish 17f7f04
lint
paulirish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,12 @@ const maxTextureSizeMock = 1024 * 8; | |
*/ | ||
function createMockDriver({contentSize, screenSize, screenshotData}) { | ||
return { | ||
evaluateAsync: async function(code) { | ||
if (code === 'window.innerWidth') { | ||
return contentSize.width; | ||
} | ||
if (code.includes('MAX_TEXTURE_SIZE')) { | ||
return maxTextureSizeMock; | ||
} | ||
if (code.includes('document.documentElement.clientWidth')) { | ||
evaluate: async function(fn) { | ||
if (fn.name === 'resolveNodes') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this so much nicer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fn.name is pretty tight. :) good call. |
||
return {}; | ||
} if (fn.name === 'getMaxTextureSize') { | ||
return maxTextureSizeMock; | ||
} else if (fn.name === 'getObservedDeviceMetrics') { | ||
return { | ||
width: screenSize.width, | ||
height: screenSize.height, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
curious why a page function and not local to this module?
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.
mostly because theres a lot of ways in which PFs are very diff than node code and so i'd like to ideally have all PFs live in separate files.
eslint-env browser
instead of our current handcrafted/* global window document Node ShadowRoot */
list.--
but until all are migrated there i'll just place new ones in pf.js. thats my thinking.
i don't care a lot about this particular case tho.
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.
Funny, I have the exact opposite thinking. Not speaking to the idea at all, but if we are currently doing "all page functions local if possible", we should keep doing that until we change how we structure things, instead of starting a transitionary thing w/o any discussion.
fwiw i like your bullet points
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.
word.
well... looking at the fn's in pf.js, there already are plenty that are one-offs used by gatherrunner & driver. oh and a singleuse for iframe-elements! :)