Closed Bug 1143959 Opened 5 years ago Closed 5 years ago

Set the journal mode and foreign key pragmas for all DBActions

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: ehsan, Assigned: ehsan)

References

Details

Attachments

(1 file)

Before this patch, we would only set these pragmas as part of CreateSchema
which runs in SetupAction.  This meant that the connection used to perform
other DBActions would not have had these pragmas applied.  As a result,
sqlite would not honor foreign keys on such connections, so the cascade
delete rules responsible for deleting rows from request_headers and
response_headers would not get executed when DBSchema::CachePut deleted the
old entry before adding a new one.

The test in the patch demonstrates how this could result in an observable
breakage.  Before this patch, the response headers stored in the cache for
the overwritten entry would reflect both `Mirrored: `foo' and `Mirrored: bar'
headers, which means that attempting to get this header on the cached
response would return the first entry, `foo'.
Assignee: nobody → ehsan
Comment on attachment 8578354 [details] [diff] [review]
Set the journal mode and foreign key pragmas for all DBActions

Review of attachment 8578354 [details] [diff] [review]:
-----------------------------------------------------------------

Wow, I suck.  Nice find!
Attachment #8578354 - Flags: review?(bkelly) → review+
https://hg.mozilla.org/mozilla-central/rev/08ad099d72ab
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.