gecko/dom/cache/test/mochitest/mirror.sjs
Ehsan Akhgari db9a1f6dab Bug 1143959 - Set the journal mode and foreign key pragmas for all DBActions; r=bkelly
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'.
2015-03-17 08:18:28 -04:00

6 lines
214 B
JavaScript

function handleRequest(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.setHeader("Mirrored", request.getHeader("Mirror"));
response.write(request.getHeader("Mirror"));
}