#62085 closed enhancement (fixed)
HTML API: Stop counting no-op seek operations against the quota.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 6.7 |
Component: | HTML API | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
The HTML Tag Processor limits how many times seek()
may be called. This is in place to guard against accidental infinite loops introduced by code which might bounce between bookmarks in an unintentional cycle.
Some code might call seek()
on a bookmark where the internal cursor already is. Since a seek to the current locations involves essentially no processing, and is less likely to be the result of an unseen cycle, the HTML Tag Processor should ignore these calls against the quota.
Change History (12)
This ticket was mentioned in PR #7399 on WordPress/wordpress-develop by @dmsnell.
8 months ago
#2
- Keywords has-patch has-unit-tests added
Trac ticket: Core-62085
#3
@
8 months ago
I don't know. It seems like this may be doing too much to attempt to prevent a developer from committing a basic logic error in their code.
#4
@
7 months ago
- Milestone changed from 6.7 to 6.8
With 6.7 Beta 1 releasing in a few hours, this is being moved to 6.8
given recent momentum towards a resolution.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 months ago
#6
@
3 months ago
- Milestone changed from 6.8 to Future Release
As per today's bug scrub:
Hello @dmsnell @westonruter, how can we move this towards a resolution? Or should we close it as wontfix/maybelater for now?
Moving to Future Release pending a decision.
#7
@
3 months ago
I think this is still relevant. To avoid reaching the seek quota, I'm currently having to keep track of whether the cursor is moved:
https://github.com/WordPress/performance/blob/6459571471b26aee4f63f00e2ba9dfe6f5ce2f39/plugins/optimization-detective/class-od-html-tag-processor.php#L237-L245
https://github.com/WordPress/performance/blob/6459571471b26aee4f63f00e2ba9dfe6f5ce2f39/plugins/optimization-detective/class-od-html-tag-processor.php#L324
This is so that the code only calls seek()
if it needs to move:
If, however, the cursor was already at the same location as the given bookmark, then seek()
should just be a no-op.
#8
@
3 months ago
I can confirm that with the patch applied that I can remove all cursor move counting that I had to do in Optimization Detective: https://github.com/WordPress/performance/pull/1861
#9
@
3 months ago
- Keywords commit added
- Owner set to westonruter
- Status changed from new to accepted
I move to commit this.
@westonruter commented on PR #7399:
3 months ago
#11
Committed in r59812.
After proposing this, I'm now wondering if it's wrong to open up the quote because I think it's also similarly likely that an accidental infinite loop could involve no-op seeks. Perhaps we want a different getter to report if the processor has moved from a bookmark?
cc: @westonruter @jonsurrell