| 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(); |
| 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(); |
| 64 } | 70 } |
| 65 | 71 |
| 66 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, E
xceptionState& exceptionState) | 72 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, E
xceptionState& exceptionState) |
| 67 { | 73 { |
| 68 if (!executionContext || !blob) | 74 if (!executionContext || !blob) |
| 69 return String(); | 75 return String(); |
| 70 if (blob->hasBeenClosed()) { | 76 if (blob->hasBeenClosed()) { |
| 71 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile(
) ? "File" : "Blob") + " has been closed."); | 77 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile(
) ? "File" : "Blob") + " has been closed."); |
| 72 return String(); | 78 return String(); |
| 73 } | 79 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 } | 102 } |
| 97 | 103 |
| 98 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) | 104 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) |
| 99 { | 105 { |
| 100 if (!executionContext) | 106 if (!executionContext) |
| 101 return; | 107 return; |
| 102 | 108 |
| 103 executionContext->publicURLManager().revoke(uuid); | 109 executionContext->publicURLManager().revoke(uuid); |
| 104 } | 110 } |
| 105 | 111 |
| 112 void DOMURL::trace(Visitor* visitor) |
| 113 { |
| 114 DOMURLUtils::trace(visitor); |
| 115 } |
| 116 |
| 106 } // namespace WebCore | 117 } // namespace WebCore |
| OLD | NEW |