Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: Source/core/html/parser/BackgroundHTMLParser.cpp

Issue 1235563004: Apply meta tag referrer policy for preloaded requests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix conflicting policies test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 232 {
233 TextPosition position = TextPosition(m_input.current().currentLine() , m_input.current().currentColumn()); 233 TextPosition position = TextPosition(m_input.current().currentLine() , m_input.current().currentColumn());
234 234
235 if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenR equest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { 235 if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenR equest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) {
236 xssInfo->m_textPosition = position; 236 xssInfo->m_textPosition = position;
237 m_pendingXSSInfos.append(xssInfo.release()); 237 m_pendingXSSInfos.append(xssInfo.release());
238 } 238 }
239 239
240 CompactHTMLToken token(m_token.get(), TextPosition(m_input.current() .currentLine(), m_input.current().currentColumn())); 240 CompactHTMLToken token(m_token.get(), TextPosition(m_input.current() .currentLine(), m_input.current().currentColumn()));
241 241
242 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads); 242 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads, &m_preloadedReferrerPolicy);
243 simulatedToken = m_treeBuilderSimulator.simulate(token, m_tokenizer. get()); 243 simulatedToken = m_treeBuilderSimulator.simulate(token, m_tokenizer. get());
244 244
245 // Break chunks before a script tag is inserted and flag the chunk a s starting a script 245 // Break chunks before a script tag is inserted and flag the chunk a s starting a script
246 // so the main parser can decide if it should yield before processin g the chunk. 246 // so the main parser can decide if it should yield before processin g the chunk.
247 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { 247 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) {
248 sendTokensToMainThread(); 248 sendTokensToMainThread();
249 m_startingScript = true; 249 m_startingScript = true;
250 } 250 }
251 251
252 m_pendingTokens->append(token); 252 m_pendingTokens->append(token);
(...skipping 23 matching lines...) Expand all
276 276
277 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk); 277 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk);
278 chunk->preloads.swap(m_pendingPreloads); 278 chunk->preloads.swap(m_pendingPreloads);
279 chunk->xssInfos.swap(m_pendingXSSInfos); 279 chunk->xssInfos.swap(m_pendingXSSInfos);
280 chunk->tokenizerState = m_tokenizer->state(); 280 chunk->tokenizerState = m_tokenizer->state();
281 chunk->treeBuilderState = m_treeBuilderSimulator.state(); 281 chunk->treeBuilderState = m_treeBuilderSimulator.state();
282 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size()); 282 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size());
283 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); 283 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint();
284 chunk->tokens = m_pendingTokens.release(); 284 chunk->tokens = m_pendingTokens.release();
285 chunk->startingScript = m_startingScript; 285 chunk->startingScript = m_startingScript;
286 chunk->preloadedReferrerPolicy = m_preloadedReferrerPolicy;
286 m_startingScript = false; 287 m_startingScript = false;
287 288
288 m_scheduler->postLoadingTask( 289 m_scheduler->postLoadingTask(
289 FROM_HERE, 290 FROM_HERE,
290 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release()))); 291 new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBa ckgroundParser, AllowCrossThreadAccess(m_parser), chunk.release())));
291 292
292 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 293 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
293 } 294 }
294 295
295 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698