Closed
Bug 294114
Opened 20 years ago
Closed 20 years ago
[FIX]Replace the DummyLayoutRequest with nsIDocument::BlockOnload
Categories
(Core :: Layout, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(3 files, 6 obsolete files)
28.73 KB,
patch
|
jst
:
superreview+
|
Details | Diff | Splinter Review |
1.38 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
8.06 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
I _think_ we can replace the dummy layout request with nsIDocument::BlockOnload.
The only hitch is that at the moment the dummy layout request has a nontrivial
Cancel() method -- calling Cancel() on it will actually cancel all reflow commands.
As biesi pointed out, this means that the user pressing the stop button at just
the right moment (while we have a dummy layout request posted) will actually
lose reflows that should have happened. So this looks like something we can do
without; just have to be a little careful with teardown.
![]() |
Assignee | |
Updated•20 years ago
|
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha
![]() |
Assignee | |
Comment 1•20 years ago
|
||
There may be more presshell code I can cut out (and more code elsewhere?) if I
make the nsIDocument api unblock async. That takes a bit more work in the
nsDocument code, though. Anyway, I'll see which way works out cleaner.
The reflow command cancelling stuff is gone on REFLOW_20050429_BRANCH, I think.
![]() |
Assignee | |
Comment 3•20 years ago
|
||
Excellent!
I did check, and if I just make the document-level unblocking happen async I can
remove the code I added for bug 281157 and company. Doing this in the document
should be much simpler, since I don't have to worry about the Destroy issues
presshell has and can simply hold a strong ref to the document and check for a
non-null mScriptGlobalObject if needed before messing around with the loadgroup.
darin, jst, does that seem reasonable?
![]() |
Assignee | |
Comment 4•20 years ago
|
||
Attachment #183662 -
Flags: superreview?(jst)
Attachment #183662 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 5•20 years ago
|
||
Attachment #183662 -
Attachment is obsolete: true
Attachment #183663 -
Flags: superreview?(jst)
Attachment #183663 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•20 years ago
|
Attachment #183662 -
Flags: superreview?(jst)
Attachment #183662 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 6•20 years ago
|
||
Attachment #183663 -
Attachment is obsolete: true
Attachment #183665 -
Flags: superreview?(jst)
Attachment #183665 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•20 years ago
|
Attachment #183663 -
Attachment is obsolete: false
Attachment #183663 -
Flags: superreview?(jst)
Attachment #183663 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•20 years ago
|
Summary: Replace the DummyLayoutRequest with nsIDocument::BlockOnload → [FIX]Replace the DummyLayoutRequest with nsIDocument::BlockOnload
I'm not sure why your changing nsIDocument's IID for a comment change.
The definitions of your two event handling callbacks in nsDocument.cpp need
PR_CALLBACK. They also probably shouldn't be member functions, since in theory
the calling conventions could be different. I think.
Should the early return in nsDocument::UnblockOnload have an NS_NOTREACHED?
Given the last change in nsPresShell, should the document have a check that it's
not firing onload while it is being destroyed? Or is there already such a check?
Actually, now that I understand the change, maybe it is worth changing the IID.
In your change to PresShell::Destroy, could you replace the removed code with an
assertion (!mDocumentOnloadBlocked) that CancelAllReflowCommands called
UnblockOnload?
Attachment #183665 -
Flags: review?(dbaron) → review+
![]() |
Assignee | |
Comment 9•20 years ago
|
||
> The definitions of your two event handling callbacks in nsDocument.cpp need
> PR_CALLBACK.
Done.
> They also probably shouldn't be member functions
We do this elsewhere, and I've asked people to make sure this patch works on
Windows...
> Should the early return in nsDocument::UnblockOnload have an NS_NOTREACHED?
Done.
> should the document have a check that it's not firing onload while it is being
> destroyed?
This is basically what the mScriptGlobalObject check in DoUnblockOnload is.
That makes sure we fire onload only if the document is the current document in
its docshell.
> In your change to PresShell::Destroy, could you replace the removed code
Done.
I think the IID change is worth it, since I'm changing the semantics of the
method in a pretty major way.
![]() |
Assignee | |
Comment 10•20 years ago
|
||
Attachment #183663 -
Attachment is obsolete: true
Attachment #183665 -
Attachment is obsolete: true
Attachment #193219 -
Flags: superreview?(jst)
![]() |
Assignee | |
Updated•20 years ago
|
Attachment #183665 -
Flags: superreview?(jst)
(In reply to comment #9)
> > They also probably shouldn't be member functions
>
> We do this elsewhere, and I've asked people to make sure this patch works on
> Windows...
It wasn't the Windows compiler I was worried about. It was conformance to the
C++ standard. Although the issue actually has nothing to do with being a member
function (it's just the issue of C++ vs. C linkage, which is sort of what I was
thinking when I wrote them comment, but I didn't say it correctly). And as far
as I can tell this violates the standard and a diagnostic is required of
conformant implementations, although I'm not anywhere near enough of an expert
to say that for sure. The only compiler I've actually seen give a diagnostic
for it was, I think, the Sun Workshop compiler. (But it was only a warning.)
And the actual fix for the problem would be to give the function type "C"
linkage, which is required since function types with different language linkages
are distinct types (and I haven't found any rule allowing implicit conversion
between them).
In theory, you should be able to fix this by just declaring the members in
nsDocument.h as
static PLHandleEventProc HandleOnloadBlockerEvent;
static PLDestroyEventProc DestroyOnloadBlockerEvent;
although I'm a little skeptical as to how portable that would be. If it's not
portable, the workaround would involve not using member functions.
That said, we *do* do this all over, but *as far as I can tell* a diagnostic is
required of implementations for this mistake.
![]() |
Assignee | |
Comment 13•20 years ago
|
||
Attachment #193219 -
Attachment is obsolete: true
Attachment #193244 -
Flags: superreview?(jst)
![]() |
Assignee | |
Updated•20 years ago
|
Attachment #193219 -
Flags: superreview?(jst)
![]() |
Assignee | |
Updated•20 years ago
|
Attachment #193244 -
Attachment is obsolete: true
Attachment #193244 -
Flags: superreview?(jst) → superreview-
![]() |
Assignee | |
Comment 14•20 years ago
|
||
Attachment #193245 -
Flags: superreview?(jst)
Comment 15•20 years ago
|
||
Comment on attachment 193245 [details] [diff] [review]
Er... this is the right diff
sr=jst
Attachment #193245 -
Flags: superreview?(jst) → superreview+
This whacked Tp pretty hard on btek, 930->970/960, and on luna, 880->930
![]() |
Assignee | |
Comment 17•20 years ago
|
||
My #1 culprit for that is having to get the event queue service and the current
event queue a bunch of times... I'll try to profile tomorrow morning to check
and to write up a patch to mitigate this problem in any case.
![]() |
Assignee | |
Comment 18•20 years ago
|
||
I landed this with r+sr=jst.
Attachment #193574 -
Flags: superreview+
Attachment #193574 -
Flags: review+
![]() |
Assignee | |
Comment 19•20 years ago
|
||
Attachment #193579 -
Flags: superreview?(jst)
Attachment #193579 -
Flags: review?(jst)
Comment 20•20 years ago
|
||
Comment on attachment 193579 [details] [diff] [review]
Something else that may help
- In nsDocument::PostUnblockOnloadEvent():
+ // If there is only one active request, then its our onload
+ // blocker; in that case we should fire onload as soon as our even
"event", even? :)
r+sr=jst
Attachment #193579 -
Flags: superreview?(jst)
Attachment #193579 -
Flags: superreview+
Attachment #193579 -
Flags: review?(jst)
Attachment #193579 -
Flags: review+
Might this have caused bug 305639, or am I way off?
![]() |
Assignee | |
Comment 22•20 years ago
|
||
The "something else that may help" patch didn't help Tp and hurt Tdhtml, so I
backed it out.
![]() |
Assignee | |
Comment 23•20 years ago
|
||
This makes us fire onload sync when we used to do it before... If the patch for
bug 294114 doesn't help, I'll try this.
Attachment #193579 -
Attachment is obsolete: true
Attachment #193602 -
Flags: superreview?(jst)
Attachment #193602 -
Flags: review?(jst)
![]() |
Assignee | |
Comment 24•20 years ago
|
||
Er, I meant for bug 305639.
Comment 25•20 years ago
|
||
Comment on attachment 193602 [details] [diff] [review]
Another attempt to restore prior behavior
r+sr=jst
Attachment #193602 -
Flags: superreview?(jst)
Attachment #193602 -
Flags: superreview+
Attachment #193602 -
Flags: review?(jst)
Attachment #193602 -
Flags: review+
![]() |
Assignee | |
Comment 26•20 years ago
|
||
OK, that last patch did the trick with fixing Tp. Marking fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 27•20 years ago
|
||
Could this have caused a jump in the reported memory leakage from balsa? See bug
305612.
![]() |
Assignee | |
Comment 28•20 years ago
|
||
Not very likely, since we leak none of the objects involved here.
Updated•7 years ago
|
Product: Core → Core Graveyard
Updated•7 years ago
|
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•