Closed
Bug 652317
Opened 14 years ago
Closed 14 years ago
Investigate if calling MediaQueryListListener should push Cx to stack
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla6
| Tracking | Status | |
|---|---|---|
| firefox5 | --- | unaffected |
| status2.0 | --- | unaffected |
| status1.9.2 | --- | unaffected |
| status1.9.1 | --- | unaffected |
People
(Reporter: smaug, Assigned: dbaron)
References
Details
(Keywords: regression)
Attachments
(1 file, 1 obsolete file)
|
1.40 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Traditionally we have pushed JS Context to stack when calling
asynchronous-like callbacks (event listeners, timeout/interval callbacks, etc.)
Still not long ago that was required for security, but IIRC gal mentioned
that it might not be needed anymore.
But better make sure that is the case.
| Reporter | ||
Comment 1•14 years ago
|
||
... the newly added code
http://hg.mozilla.org/mozilla-central/annotate/de123d952abd/layout/base/nsPresContext.cpp#l1697
does not push context.
| Reporter | ||
Comment 2•14 years ago
|
||
Bug 393762 and Bug 383424 are the examples of problems what happened when
context wasn't pushed to stack.
| Assignee | ||
Comment 3•14 years ago
|
||
Sounds like we should just do it to match other code, and then if we clean stuff up it'll get removed.
| Assignee | ||
Comment 4•14 years ago
|
||
Pushing the inner window seems like the best option to me, given that these listeners were added via an API on window... does it seem right to you?
| Reporter | ||
Comment 5•14 years ago
|
||
Comment on attachment 527946 [details] [diff] [review]
patch
>- for (PRUint32 i = 0, i_end = notifyList.Length(); i != i_end; ++i) {
>- nsDOMMediaQueryList::HandleChangeData &d = notifyList[i];
>- d.listener->HandleChange(d.mql);
>+ if (!notifyList.IsEmpty()) {
>+ nsPIDOMWindow *win = mDocument->GetInnerWindow();
>+ nsCOMPtr<nsPIDOMEventTarget> et = do_QueryInterface(win);
>+ nsCxPusher pusher;
>+
>+ if (pusher.Push(et)) {
You need to actually push for each listener separately.
To optimize that, use RePush.
>+ for (PRUint32 i = 0, i_end = notifyList.Length(); i != i_end; ++i) {
>+ nsDOMMediaQueryList::HandleChangeData &d = notifyList[i];
>+ d.listener->HandleChange(d.mql);
>+ }
>+ } else {
>+ NS_NOTREACHED("could not push context");
It is "ok" if you can't push a context. Especially when you do
RePush for each listener. Some listener may actually kill the whole window and
the following listeners can't run in that case.
Attachment #527946 -
Flags: review?(Olli.Pettay) → review-
| Assignee | ||
Comment 6•14 years ago
|
||
Attachment #527957 -
Flags: review?(Olli.Pettay)
| Assignee | ||
Updated•14 years ago
|
Attachment #527946 -
Attachment is obsolete: true
| Reporter | ||
Comment 7•14 years ago
|
||
Comment on attachment 527957 [details] [diff] [review]
patch
Review of attachment 527957 [details] [diff] [review]:
Attachment #527957 -
Flags: review?(Olli.Pettay) → review+
| Assignee | ||
Comment 8•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Priority: -- → P2
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Comment 9•14 years ago
|
||
Until we have completed the work to remove the context stack its not optional to push onto it.
Comment 10•14 years ago
|
||
Hmm. Does this mean we need to do the same thing for mozRequestAnimationFrame callbacks?
| Assignee | ||
Comment 11•14 years ago
|
||
That's filed as bug 652401.
I *was* going to unhide this bug today since it was a bug that was only present in one nightly... but now I'm inclined to leave this hidden until bug 652401 is fixed on branches.
Updated•14 years ago
|
status-firefox5:
--- → unaffected
Updated•14 years ago
|
status1.9.1:
--- → unaffected
status1.9.2:
--- → unaffected
status2.0:
--- → unaffected
Keywords: regression
Updated•10 years ago
|
Group: core-security → core-security-release
Updated•10 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•