TextResource has its encoding and different encodings result in different text content.
However, MemoryCache doesn't check the encoding when reusing TextResource, so:
1. Request 1 with encoding A is sent. TextResource 1 with encoding A is created and added to MemoryCache.
2. Request 2 with encoding B is sent. MemoryCache returns TextResource 1 for Request 2, while the encodings are different. Thus Request 2 gets the text with encoding A, which is wrong.
Test (Script):
external/wpt/html/semantics/scripting-1/the-script-element/script-charset-02.html (currently has -expected.txt which contains FAIL)
Comment 1 by hirosh...@chromium.org
, Jun 13 2017