OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 if (equalIgnoringCase(nameAttributeValue, "referrer")) { | 545 if (equalIgnoringCase(nameAttributeValue, "referrer")) { |
546 handleMetaReferrer(contentAttributeValue, documentParameters, cssScanner
); | 546 handleMetaReferrer(contentAttributeValue, documentParameters, cssScanner
); |
547 } | 547 } |
548 } | 548 } |
549 | 549 |
550 // This method returns true for script source strings which will likely use | 550 // This method returns true for script source strings which will likely use |
551 // document.write to insert an external script. These scripts will be flagged | 551 // document.write to insert an external script. These scripts will be flagged |
552 // for evaluation via the DocumentWriteEvaluator, so it also dismisses scripts | 552 // for evaluation via the DocumentWriteEvaluator, so it also dismisses scripts |
553 // that will likely fail evaluation. These includes scripts that are too long, | 553 // that will likely fail evaluation. These includes scripts that are too long, |
554 // have looping constructs, or use non-determinism. | 554 // have looping constructs, or use non-determinism. Note that flagging occurs |
| 555 // even when the experiment is off, to ensure fair comparison between experiment |
| 556 // and control groups. |
555 bool TokenPreloadScanner::shouldEvaluateForDocumentWrite(const String& source) | 557 bool TokenPreloadScanner::shouldEvaluateForDocumentWrite(const String& source) |
556 { | 558 { |
557 // The maximum length script source that will be marked for evaluation to | 559 // The maximum length script source that will be marked for evaluation to |
558 // preload document.written external scripts. | 560 // preload document.written external scripts. |
559 const int kMaxLengthForEvaluating = 1024; | 561 const int kMaxLengthForEvaluating = 1024; |
560 | 562 |
561 return m_documentParameters->doDocumentWritePreloadScanning | 563 return m_documentParameters->doDocumentWritePreloadScanning |
562 && source.length() <= kMaxLengthForEvaluating | 564 && source.length() <= kMaxLengthForEvaluating |
563 && source.find("document.write") != WTF::kNotFound | 565 && source.find("document.write") != WTF::kNotFound |
564 && (source.findIgnoringASCIICase("<sc") != WTF::kNotFound | 566 && (source.findIgnoringASCIICase("<sc") != WTF::kNotFound |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 733 } |
732 | 734 |
733 preloader->takeAndPreload(requests); | 735 preloader->takeAndPreload(requests); |
734 } | 736 } |
735 | 737 |
736 CachedDocumentParameters::CachedDocumentParameters(Document* document) | 738 CachedDocumentParameters::CachedDocumentParameters(Document* document) |
737 { | 739 { |
738 ASSERT(isMainThread()); | 740 ASSERT(isMainThread()); |
739 ASSERT(document); | 741 ASSERT(document); |
740 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); | 742 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); |
741 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame()
&& document->frame()->isMainFrame() && RuntimeEnabledFeatures::documentWriteEval
uatorEnabled(); | 743 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame()
&& document->frame()->isMainFrame(); |
742 defaultViewportMinWidth = document->viewportDefaultMinWidth(); | 744 defaultViewportMinWidth = document->viewportDefaultMinWidth(); |
743 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); | 745 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); |
744 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); | 746 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); |
745 referrerPolicy = ReferrerPolicyDefault; | 747 referrerPolicy = ReferrerPolicyDefault; |
746 } | 748 } |
747 | 749 |
748 } // namespace blink | 750 } // namespace blink |
OLD | NEW |