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])) { |
2862 if (i >= length) | 2869 if (i >= length) |
2863 break; | 2870 break; |
2864 i++; | 2871 i++; |
2865 } | 2872 } |
2866 keyBegin = i; | 2873 keyBegin = i; |
2867 | 2874 |
2868 // skip to first separator | 2875 // skip to first separator |
2869 while (!isSeparator(buffer[i])) | 2876 while (!isSeparator(buffer[i])) { |
| 2877 error |= isInvalidSeparator(buffer[i]); |
2870 i++; | 2878 i++; |
| 2879 } |
2871 keyEnd = i; | 2880 keyEnd = i; |
2872 | 2881 |
2873 // skip to first '=', but don't skip past a ',' or the end of the string | 2882 // skip to first '=', but don't skip past a ',' or the end of the string |
2874 while (buffer[i] != '=') { | 2883 while (buffer[i] != '=') { |
| 2884 error |= isInvalidSeparator(buffer[i]); |
2875 if (buffer[i] == ',' || i >= length) | 2885 if (buffer[i] == ',' || i >= length) |
2876 break; | 2886 break; |
2877 i++; | 2887 i++; |
2878 } | 2888 } |
2879 | 2889 |
2880 // skip to first non-separator, but don't skip past a ',' or the end of
the string | 2890 // skip to first non-separator, but don't skip past a ',' or the end of
the string |
2881 while (isSeparator(buffer[i])) { | 2891 while (isSeparator(buffer[i])) { |
2882 if (buffer[i] == ',' || i >= length) | 2892 if (buffer[i] == ',' || i >= length) |
2883 break; | 2893 break; |
2884 i++; | 2894 i++; |
2885 } | 2895 } |
2886 valueBegin = i; | 2896 valueBegin = i; |
2887 | 2897 |
2888 // skip to first separator | 2898 // skip to first separator |
2889 while (!isSeparator(buffer[i])) | 2899 while (!isSeparator(buffer[i])) { |
| 2900 error |= isInvalidSeparator(buffer[i]); |
2890 i++; | 2901 i++; |
| 2902 } |
2891 valueEnd = i; | 2903 valueEnd = i; |
2892 | 2904 |
2893 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); | 2905 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); |
2894 | 2906 |
2895 String keyString = buffer.substring(keyBegin, keyEnd - keyBegin); | 2907 String keyString = buffer.substring(keyBegin, keyEnd - keyBegin); |
2896 String valueString = buffer.substring(valueBegin, valueEnd - valueBegin)
; | 2908 String valueString = buffer.substring(valueBegin, valueEnd - valueBegin)
; |
2897 callback(keyString, valueString, this, data); | 2909 callback(keyString, valueString, this, data); |
2898 } | 2910 } |
| 2911 if (error) |
| 2912 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(),
String()); |
2899 } | 2913 } |
2900 | 2914 |
2901 void Document::processViewport(const String& features, ViewportArguments::Type o
rigin) | 2915 void Document::processViewport(const String& features, ViewportArguments::Type o
rigin) |
2902 { | 2916 { |
2903 ASSERT(!features.isNull()); | 2917 ASSERT(!features.isNull()); |
2904 | 2918 |
2905 if (origin < m_viewportArguments.type) | 2919 if (origin < m_viewportArguments.type) |
2906 return; | 2920 return; |
2907 | 2921 |
2908 m_viewportArguments = ViewportArguments(origin); | 2922 m_viewportArguments = ViewportArguments(origin); |
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5204 { | 5218 { |
5205 return DocumentLifecycleNotifier::create(this); | 5219 return DocumentLifecycleNotifier::create(this); |
5206 } | 5220 } |
5207 | 5221 |
5208 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5222 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5209 { | 5223 { |
5210 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5224 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
5211 } | 5225 } |
5212 | 5226 |
5213 } // namespace WebCore | 5227 } // namespace WebCore |
OLD | NEW |