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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 KURL url(blankURL(), value); | 56 KURL url(blankURL(), value); |
57 if (url.isValid()) { | 57 if (url.isValid()) { |
58 m_url = url; | 58 m_url = url; |
59 m_input = String(); | 59 m_input = String(); |
60 } else { | 60 } else { |
61 m_url = KURL(); | 61 m_url = KURL(); |
62 m_input = value; | 62 m_input = value; |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob) | 66 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, E
xceptionState& exceptionState) |
67 { | 67 { |
68 if (!executionContext || !blob) | 68 if (!executionContext || !blob) |
69 return String(); | 69 return String(); |
| 70 if (blob->hasBeenClosed()) { |
| 71 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile(
) ? "File" : "Blob") + " has been closed."); |
| 72 return String(); |
| 73 } |
70 return createPublicURL(executionContext, blob, blob->uuid()); | 74 return createPublicURL(executionContext, blob, blob->uuid()); |
71 } | 75 } |
72 | 76 |
73 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable, const String& uuid) | 77 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable, const String& uuid) |
74 { | 78 { |
75 KURL publicURL = BlobURL::createPublicURL(executionContext->securityOrigin()
); | 79 KURL publicURL = BlobURL::createPublicURL(executionContext->securityOrigin()
); |
76 if (publicURL.isEmpty()) | 80 if (publicURL.isEmpty()) |
77 return String(); | 81 return String(); |
78 | 82 |
79 executionContext->publicURLManager().registerURL(executionContext->securityO
rigin(), publicURL, registrable, uuid); | 83 executionContext->publicURLManager().registerURL(executionContext->securityO
rigin(), publicURL, registrable, uuid); |
(...skipping 13 matching lines...) Expand all Loading... |
93 | 97 |
94 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) | 98 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) |
95 { | 99 { |
96 if (!executionContext) | 100 if (!executionContext) |
97 return; | 101 return; |
98 | 102 |
99 executionContext->publicURLManager().revoke(uuid); | 103 executionContext->publicURLManager().revoke(uuid); |
100 } | 104 } |
101 | 105 |
102 } // namespace WebCore | 106 } // namespace WebCore |
OLD | NEW |