Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMException.cpp

Issue 1576283003: Have HTMLMediaElement::play() return a Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments and cancel tasks Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 30
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 static const struct CoreException { 35 static const struct CoreException {
36 const char* const name; 36 const char* const name;
37 const char* const message; 37 const char* const message;
38 const int code; 38 const int code;
39 } coreExceptions[] = { 39 } coreExceptions[] = {
40 // This list must be kept in sync with the one in ExceptionCode.h
40 { "IndexSizeError", "Index or size was negative, or greater than the allowed value.", 1 }, 41 { "IndexSizeError", "Index or size was negative, or greater than the allowed value.", 1 },
41 { "HierarchyRequestError", "A Node was inserted somewhere it doesn't belong. ", 3 }, 42 { "HierarchyRequestError", "A Node was inserted somewhere it doesn't belong. ", 3 },
42 { "WrongDocumentError", "A Node was used in a different document than the on e that created it (that doesn't support it).", 4 }, 43 { "WrongDocumentError", "A Node was used in a different document than the on e that created it (that doesn't support it).", 4 },
43 { "InvalidCharacterError", "The string contains invalid characters.", 5 }, 44 { "InvalidCharacterError", "The string contains invalid characters.", 5 },
44 { "NoModificationAllowedError", "An attempt was made to modify an object whe re modifications are not allowed.", 7 }, 45 { "NoModificationAllowedError", "An attempt was made to modify an object whe re modifications are not allowed.", 7 },
45 { "NotFoundError", "An attempt was made to reference a Node in a context whe re it does not exist.", 8 }, 46 { "NotFoundError", "An attempt was made to reference a Node in a context whe re it does not exist.", 8 },
46 { "NotSupportedError", "The implementation did not support the requested typ e of object or operation.", 9 }, 47 { "NotSupportedError", "The implementation did not support the requested typ e of object or operation.", 9 },
47 { "InUseAttributeError", "An attempt was made to add an attribute that is al ready in use elsewhere.", 10 }, 48 { "InUseAttributeError", "An attempt was made to add an attribute that is al ready in use elsewhere.", 10 },
48 { "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable.", 11 }, 49 { "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable.", 11 },
49 { "SyntaxError", "An invalid or illegal string was specified.", 12 }, 50 { "SyntaxError", "An invalid or illegal string was specified.", 12 },
(...skipping 24 matching lines...) Expand all
74 { "PathExistsError", "An attempt was made to create a file or directory wher e an element already exists.", 0 }, 75 { "PathExistsError", "An attempt was made to create a file or directory wher e an element already exists.", 0 },
75 76
76 // SQL 77 // SQL
77 { "DatabaseError", "The operation failed for some reason related to the data base.", 0 }, 78 { "DatabaseError", "The operation failed for some reason related to the data base.", 0 },
78 79
79 // Web Crypto 80 // Web Crypto
80 { "OperationError", "The operation failed for an operation-specific reason", 0 }, 81 { "OperationError", "The operation failed for an operation-specific reason", 0 },
81 82
82 // Push API 83 // Push API
83 { "PermissionDeniedError", "User or security policy denied the request.", 0 }, 84 { "PermissionDeniedError", "User or security policy denied the request.", 0 },
85
86 // Used by HTML and Media Session API.
87 { "NotAllowedError", "The request is not allowed by the user agent or the pl atform in the current context.", 0 },
88
89 // Please add new entries at the end of this list to guarantee any ordering
90 // expectations.
84 }; 91 };
85 92
86 static const CoreException* getErrorEntry(ExceptionCode ec) 93 static const CoreException* getErrorEntry(ExceptionCode ec)
87 { 94 {
88 size_t tableSize = WTF_ARRAY_LENGTH(coreExceptions); 95 size_t tableSize = WTF_ARRAY_LENGTH(coreExceptions);
89 size_t tableIndex = ec - IndexSizeError; 96 size_t tableIndex = ec - IndexSizeError;
90 97
91 return tableIndex < tableSize ? &coreExceptions[tableIndex] : 0; 98 return tableIndex < tableSize ? &coreExceptions[tableIndex] : 0;
92 } 99 }
93 100
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 { 155 {
149 const CoreException* entry = getErrorEntry(ec); 156 const CoreException* entry = getErrorEntry(ec);
150 ASSERT(entry); 157 ASSERT(entry);
151 if (!entry) 158 if (!entry)
152 return "Unknown error."; 159 return "Unknown error.";
153 160
154 return entry->message; 161 return entry->message;
155 } 162 }
156 163
157 } // namespace blink 164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698