| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 return TextResourceDecoder::create(m_mimeType, String()); | 66 return TextResourceDecoder::create(m_mimeType, String()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 inline void TextResourceDecoderBuilder::setupEncoding(TextResourceDecoder* decod
er, Document* document) | 69 inline void TextResourceDecoderBuilder::setupEncoding(TextResourceDecoder* decod
er, Document* document) |
| 70 { | 70 { |
| 71 LocalFrame* frame = document->frame(); | 71 LocalFrame* frame = document->frame(); |
| 72 LocalFrame* parentFrame = 0; | 72 LocalFrame* parentFrame = 0; |
| 73 if (frame && frame->tree().parent() && frame->tree().parent()->isLocalFrame(
)) | 73 if (frame && frame->tree().parent() && frame->tree().parent()->isLocalFrame(
)) |
| 74 parentFrame = frame->tree().parent(); | 74 parentFrame = toLocalFrame(frame->tree().parent()); |
| 75 | 75 |
| 76 if (!m_encoding.isEmpty()) | 76 if (!m_encoding.isEmpty()) |
| 77 decoder->setEncoding(m_encoding.string(), m_encodingWasChosenByUser ? Te
xtResourceDecoder::UserChosenEncoding : TextResourceDecoder::EncodingFromHTTPHea
der); | 77 decoder->setEncoding(m_encoding.string(), m_encodingWasChosenByUser ? Te
xtResourceDecoder::UserChosenEncoding : TextResourceDecoder::EncodingFromHTTPHea
der); |
| 78 | 78 |
| 79 // Set the hint encoding to the parent frame encoding only if | 79 // Set the hint encoding to the parent frame encoding only if |
| 80 // the parent and the current frames share the security origin. | 80 // the parent and the current frames share the security origin. |
| 81 // We impose this condition because somebody can make a child frameg63 | 81 // We impose this condition because somebody can make a child frameg63 |
| 82 // containing a carefully crafted html/javascript in one encoding | 82 // containing a carefully crafted html/javascript in one encoding |
| 83 // that can be mistaken for hintEncoding (or related encoding) by | 83 // that can be mistaken for hintEncoding (or related encoding) by |
| 84 // an auto detector. When interpreted in the latter, it could be | 84 // an auto detector. When interpreted in the latter, it could be |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 return decoder.release(); | 101 return decoder.release(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void TextResourceDecoderBuilder::clear() | 104 void TextResourceDecoderBuilder::clear() |
| 105 { | 105 { |
| 106 if (!m_encodingWasChosenByUser) | 106 if (!m_encodingWasChosenByUser) |
| 107 m_encoding = nullAtom; | 107 m_encoding = nullAtom; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } | 110 } |
| OLD | NEW |