The comments about PL_DHashTableLookup in nsContentList.cpp aren't quite
correct -- Add() can OOM even if the looked-for key is already in the table.
More generally, they don't seem worth correcting, so I just removed them.
--HG--
extra : rebase_source : c2509f39876471a7948cb3a50dd041702fbc903f
Because PL_DHashTableLookup() never returns null, GetInfoForFile() features not
one but *two* can-never-fail null checks on its result.
Having said that, the code as written works, at least for non-zero-sized files,
because |entry->mFileSize| will always be zero if the lookup fails (thanks to
PLDHashTable always being zeroed at construction, and |mMap| using
PL_DHashClearEntryStub which also zeroes).
But for zero-sized files the current code will act like they don't exist. Maybe
this can't happen in practice, but it seems dangerous and so I've changed it so
the new code will treat zero-sized files just like non-zero-sized files.
--HG--
extra : rebase_source : c617862c23babb1726480faff771a8dfe586bfa1
The BUSY check is merely useless, because BUSY is always true for a non-null
entry returned by PL_DHashTableAdd.
The FREE check is downright dangerous because it dereferences |entry| and
PL_DHashTableAdd() returns nullptr on OOM. A null check makes more sense here.
--HG--
extra : rebase_source : bbafb351b9a700724004916801fd9ef9415fb031
Currently nsHostResolver.cpp uses PL_DHashTableLookup() and fails to use
PL_DHASH_ENTRY_IS_{FREE,BUSY} on the result the way it should. However, I think
it gets away with this because it always does this on the result:
if (!he || !he->rec) { /* do stuff with |he->rec| */ }
The |!he| test is useless and always fails, but the |!he->rec| does the right
thing because (a) entry storage is always zeroed when the table is created, (b)
HostDB_ClearEntry() zeroes the |rec| field (via NS_RELEASE). So unused entries
always have a null |rec| field.
Furthermore, |he->rec| is never zero in a used entry because HostDB_InitEntry
always assigns it with a nsHostRecord assigned with infallible new in
nsHostRecord::Create (and there are existing assertions to this effect).
All this means that when this patch switches PL_DHashTableLookup to
PL_DHashTableSearch it can drop the |!he->rec| test and just do this:
if (!he) { /* do stuff with |he->rec| */ }
Finally, there's a comment about HostDB_InitEntry failing which is bogus
because HostDB_InitEntry cannot fail. This patch fixes that too.
--HG--
extra : rebase_source : ded6f8ff404cb160d89bbe7deeb3b863249bdb94
It feels safer to use a function with a new name, rather than just changing the
behaviour of the existing function.
For most of these cases the PL_DHashTableLookup() result was checked with
PL_DHASH_ENTRY_IS_{FREE,BUSY} so the conversion was easy. A few of them
preceded that check with a useless null check, but the intent of these was
still easy to determine.
I'll do the trickier ones in subsequent patches.
--HG--
extra : rebase_source : ab37a7a30be563861ded8631771181aacf054fd4
Because (a) this is how it's usually done, (b) it allows static_cast<> instead
of reinterpret_cast<>, and (c) it will make subsequent patches easier.
--HG--
extra : rebase_source : 76e67d4b6ec0e5dc898a8214b6a6b562f9e08380
This ensures that the cookie service can know which cookie database
to query from. This is a gross hack, please see the discussion on
the bug as to why we did this.
We do not want to traverse inside native anonymous elements, but we
should still be able to skip over generated content, to avoid getting
stuck on such images.
The caret movement code already handles unselectable text frames if we
happen to land in the middle of one in nsTextFrame::PeekOffsetCharacter/Word.
However, when performing frame traversal to find the next frame to jump
to, we don't remember if we skipped over an unselectable frame, which causes
us to jump one offset too much when the caret is on the boundary of
selectable and unselectable content. The test cases demonstrate the
scenario. Note that an <img alt=foo> is implemented by adding a
generated content to the inline frame representing it, so as far as
the caret movement code is concerned, both test cases are treated similarly.
Note that we need to do this only when moving the selection, and not
when extending it. We are adding an aExtend argument to
nsPeekOffsetStruct's constructor in order to be able to special case
that.
TabParents now register for the MozUpdateWindowPos event on the chrome
TopWindowRoot. When the window is moved, the OS widget calls WindowMoved on
its listener (the nsWebShellWindow), which sends a MozUpdateWindowPos
event.
PuppetWidget::WidgetToScreenOffset now reports proper widget screen location. Previously, in the content process, all widgets were defined to be located at the screen origin. This also repairs mac e10s OOP plugin coordinate calculations that would be broken by this change.