OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Motorola Mobility Inc. | 3 * Copyright (C) 2012 Motorola Mobility Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
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 25 matching lines...) Expand all Loading... |
36 #include "core/html/PublicURLManager.h" | 36 #include "core/html/PublicURLManager.h" |
37 #include "platform/blob/BlobURL.h" | 37 #include "platform/blob/BlobURL.h" |
38 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
39 #include "wtf/MainThread.h" | 39 #include "wtf/MainThread.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& exceptionSta
te) | 43 DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& exceptionSta
te) |
44 { | 44 { |
45 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
46 if (!base.isValid()) | 46 if (!base.isValid()) { |
47 exceptionState.throwDOMException(SyntaxError, "Invalid base URL"); | 47 exceptionState.throwDOMException(SyntaxError, "Invalid base URL"); |
| 48 return; |
| 49 } |
48 | 50 |
49 m_url = KURL(base, url); | 51 m_url = KURL(base, url); |
50 if (!m_url.isValid()) | 52 if (!m_url.isValid()) { |
51 exceptionState.throwDOMException(SyntaxError, "Invalid URL"); | 53 exceptionState.throwDOMException(SyntaxError, "Invalid URL"); |
| 54 return; |
| 55 } |
| 56 DOMURLUtils::update(this); |
52 } | 57 } |
53 | 58 |
54 void DOMURL::setInput(const String& value) | 59 void DOMURL::setInput(const String& value) |
55 { | 60 { |
56 KURL url(blankURL(), value); | 61 KURL url(blankURL(), value); |
57 if (url.isValid()) { | 62 if (url.isValid()) { |
58 m_url = url; | 63 m_url = url; |
59 m_input = String(); | 64 m_input = String(); |
60 } else { | 65 } else { |
61 m_url = KURL(); | 66 m_url = KURL(); |
62 m_input = value; | 67 m_input = value; |
63 } | 68 } |
| 69 DOMURLUtils::update(this); |
64 } | 70 } |
65 | 71 |
66 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob) | 72 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob) |
67 { | 73 { |
68 if (!executionContext || !blob) | 74 if (!executionContext || !blob) |
69 return String(); | 75 return String(); |
70 return createPublicURL(executionContext, blob); | 76 return createPublicURL(executionContext, blob); |
71 } | 77 } |
72 | 78 |
73 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable) | 79 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable) |
(...skipping 11 matching lines...) Expand all Loading... |
85 { | 91 { |
86 if (!executionContext) | 92 if (!executionContext) |
87 return; | 93 return; |
88 | 94 |
89 KURL url(KURL(), urlString); | 95 KURL url(KURL(), urlString); |
90 MemoryCache::removeURLFromCache(executionContext, url); | 96 MemoryCache::removeURLFromCache(executionContext, url); |
91 executionContext->publicURLManager().revoke(url); | 97 executionContext->publicURLManager().revoke(url); |
92 } | 98 } |
93 | 99 |
94 } // namespace WebCore | 100 } // namespace WebCore |
OLD | NEW |