OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2834 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; | 2834 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; |
2835 frameLoader->stopAllLoaders(); | 2835 frameLoader->stopAllLoaders(); |
2836 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's | 2836 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's |
2837 // intent, we must navigate away from the possibly partially-rendered do cument to a location that | 2837 // intent, we must navigate away from the possibly partially-rendered do cument to a location that |
2838 // doesn't inherit the parent's SecurityOrigin. | 2838 // doesn't inherit the parent's SecurityOrigin. |
2839 frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), S ecurityOrigin::urlWithUniqueSecurityOrigin(), String()); | 2839 frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), S ecurityOrigin::urlWithUniqueSecurityOrigin(), String()); |
2840 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, req uestIdentifier); | 2840 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, req uestIdentifier); |
2841 } | 2841 } |
2842 } | 2842 } |
2843 | 2843 |
2844 static bool isInvalidSeparator(UChar c) | |
2845 { | |
2846 return c == ';'; | |
2847 } | |
2848 | |
2844 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't. | 2849 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't. |
2845 static bool isSeparator(UChar c) | 2850 static bool isSeparator(UChar c) |
2846 { | 2851 { |
2847 return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ' ,' || c == '\0'; | 2852 return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ' ,' || c == '\0'; |
2848 } | 2853 } |
2849 | 2854 |
2850 void Document::processArguments(const String& features, void* data, ArgumentsCal lback callback) | 2855 void Document::processArguments(const String& features, void* data, ArgumentsCal lback callback) |
2851 { | 2856 { |
2857 bool error = false; | |
2858 | |
2852 // Tread lightly in this code -- it was specifically designed to mimic Win I E's parsing behavior. | 2859 // Tread lightly in this code -- it was specifically designed to mimic Win I E's parsing behavior. |
2853 int keyBegin, keyEnd; | 2860 int keyBegin, keyEnd; |
2854 int valueBegin, valueEnd; | 2861 int valueBegin, valueEnd; |
2855 | 2862 |
2856 int i = 0; | 2863 int i = 0; |
2857 int length = features.length(); | 2864 int length = features.length(); |
2858 String buffer = features.lower(); | 2865 String buffer = features.lower(); |
2859 while (i < length) { | 2866 while (i < length) { |
2860 // skip to first non-separator, but don't skip past the end of the strin g | 2867 // skip to first non-separator, but don't skip past the end of the strin g |
2861 while (isSeparator(buffer[i])) { | 2868 while (isSeparator(buffer[i])) { |
2869 error |= isInvalidSeparator(buffer[i]); | |
rune
2013/08/20 11:36:59
This will never do anything since isSeparator is n
| |
2862 if (i >= length) | 2870 if (i >= length) |
2863 break; | 2871 break; |
2864 i++; | 2872 i++; |
2865 } | 2873 } |
2866 keyBegin = i; | 2874 keyBegin = i; |
2867 | 2875 |
2868 // skip to first separator | 2876 // skip to first separator |
2869 while (!isSeparator(buffer[i])) | 2877 while (!isSeparator(buffer[i])) { |
2878 error |= isInvalidSeparator(buffer[i]); | |
2870 i++; | 2879 i++; |
2880 } | |
2871 keyEnd = i; | 2881 keyEnd = i; |
2872 | 2882 |
2873 // skip to first '=', but don't skip past a ',' or the end of the string | 2883 // skip to first '=', but don't skip past a ',' or the end of the string |
2874 while (buffer[i] != '=') { | 2884 while (buffer[i] != '=') { |
2885 error |= isInvalidSeparator(buffer[i]); | |
2875 if (buffer[i] == ',' || i >= length) | 2886 if (buffer[i] == ',' || i >= length) |
2876 break; | 2887 break; |
2877 i++; | 2888 i++; |
2878 } | 2889 } |
2879 | 2890 |
2880 // skip to first non-separator, but don't skip past a ',' or the end of the string | 2891 // skip to first non-separator, but don't skip past a ',' or the end of the string |
2881 while (isSeparator(buffer[i])) { | 2892 while (isSeparator(buffer[i])) { |
2893 error |= isInvalidSeparator(buffer[i]); | |
rune
2013/08/20 11:36:59
This will never do anything since isSeparator is n
| |
2882 if (buffer[i] == ',' || i >= length) | 2894 if (buffer[i] == ',' || i >= length) |
2883 break; | 2895 break; |
2884 i++; | 2896 i++; |
2885 } | 2897 } |
2886 valueBegin = i; | 2898 valueBegin = i; |
2887 | 2899 |
2888 // skip to first separator | 2900 // skip to first separator |
2889 while (!isSeparator(buffer[i])) | 2901 while (!isSeparator(buffer[i])) { |
2902 error |= isInvalidSeparator(buffer[i]); | |
2890 i++; | 2903 i++; |
2904 } | |
2891 valueEnd = i; | 2905 valueEnd = i; |
2892 | 2906 |
2893 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); | 2907 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); |
2894 | 2908 |
2895 String keyString = buffer.substring(keyBegin, keyEnd - keyBegin); | 2909 String keyString = buffer.substring(keyBegin, keyEnd - keyBegin); |
2896 String valueString = buffer.substring(valueBegin, valueEnd - valueBegin) ; | 2910 String valueString = buffer.substring(valueBegin, valueEnd - valueBegin) ; |
2897 callback(keyString, valueString, this, data); | 2911 callback(keyString, valueString, this, data); |
2898 } | 2912 } |
2913 if (error) | |
2914 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(), String()); | |
2899 } | 2915 } |
2900 | 2916 |
2901 void Document::processViewport(const String& features, ViewportArguments::Type o rigin) | 2917 void Document::processViewport(const String& features, ViewportArguments::Type o rigin) |
2902 { | 2918 { |
2903 ASSERT(!features.isNull()); | 2919 ASSERT(!features.isNull()); |
2904 | 2920 |
2905 if (origin < m_viewportArguments.type) | 2921 if (origin < m_viewportArguments.type) |
2906 return; | 2922 return; |
2907 | 2923 |
2908 m_viewportArguments = ViewportArguments(origin); | 2924 m_viewportArguments = ViewportArguments(origin); |
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5204 { | 5220 { |
5205 return DocumentLifecycleNotifier::create(this); | 5221 return DocumentLifecycleNotifier::create(this); |
5206 } | 5222 } |
5207 | 5223 |
5208 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5224 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5209 { | 5225 { |
5210 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); | 5226 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); |
5211 } | 5227 } |
5212 | 5228 |
5213 } // namespace WebCore | 5229 } // namespace WebCore |
OLD | NEW |