Context:
- Playwright Version: 1.2.0
- Operating System: Linux ubuntu-20.04
- Node.js version: 16
- Browser: Firefox
- Extra: Run via Github Action off the Docker image provided by Playwright
Code Snippet
It’s a full test suite that’s causing problems, and ONLY on CI, so it’s pretty difficult to provide a short code snippet here. This Github Action run however shows the bug happening! https://github.com/shopcanal/e2e-tests/runs/5673001933?check_suite_focus=true.
It’s from this (public) PR: shopcanal/e2e-tests#46.
Basically, the PR is trying to fix flaky tests + reenable testing with Firefox, but fails because of NS_ERROR_NET_TIMEOUT
from Firefox, among other issues.
Describe the bug
Randomly (differs every run of the tests), some portion of the tests will fail on Firefox with an error from page.goto
, just stating NS_ERROR_NET_TIMEOUT
. This appears to be an error internal to Firefox, and probably is a 408, from what I can gather from Google.
Locally on macOS, I can’t get Firefox tests to fail with this error. It seems to be only happening on the Linux device Github Actions uses to run their tests. I don’t know how to capture a trace remotely from Github Actions otherwise I would! This is what the output of the tests looks like.
The logIntoSupplier
function is called from test.beforeEach
and just awaits clearing cookies from context, then tries to open a login page with await page.goto
and fill in username/password. These tests are hanging on the goto
before it ever gets to a page. I’m really stumped as to why this would be happening only in Firefox, and very consistently
With test retries on, this problem is sorta fixed, since a rerun solves it, but that’s clearly just a bandaid for flaky behavior. This seems like a bug, and not user error, but I’d be happy to be proven wrong! Thanks!
1) [firefox] › tests/supplier/navigation.spec.ts:89:3 › Supplier Navigation › can navigate to Proposals from Overview
page.goto: NS_ERROR_NET_TIMEOUT
=========================== logs ===========================
navigating to "https://develop.shopcanal.com/login?next=/supplier", waiting until "load"
============================================================
15 | */
16 | test.beforeEach(async ({ page, context }) => {
> 17 | await logIntoSupplier(page, context);
| ^
18 | });
19 |
20 | test('renders the SUP Overview page', async ({ page }) => {
at logIn (/github/workspace/helpers/login.ts:31:16)
at /github/workspace/tests/supplier/navigation.spec.ts:17:5
2) [firefox] › tests/supplier/navigation.spec.ts:156:3 › Supplier Navigation › can navigate to external FAQs via dropdown
page.goto: NS_ERROR_NET_TIMEOUT
=========================== logs ===========================
navigating to "https://develop.shopcanal.com/login?next=/supplier", waiting until "load"
============================================================
15 | */
16 | test.beforeEach(async ({ page, context }) => {
> 17 | await logIntoSupplier(page, context);
| ^
18 | });
19 |
20 | test('renders the SUP Overview page', async ({ page }) => {
at logIn (/github/workspace/helpers/login.ts:31:16)
at /github/workspace/tests/supplier/navigation.spec.ts:17:5
The following tables list errors that can occur when calling various Mozilla APIs. Each error is listed by its name and an error code in parentheses. An error will typically be displayed on the error console, but can be captured using a try-catch block in JavaScript. These constants can be accessed through Components.results. For example, by using Components.results.NS_ERROR_NOT_INITIALIZED
General Errors
The following errors are general and can occur when using any component.
- NS_ERROR_NOT_INITIALIZED (0xC1F30001)
- An attempt was made to use a component or object which has not yet been initialized. These components usually provide an initialization method, often called
Init
, which must be called before other methods are used. - NS_ERROR_ALREADY_INITIALIZED (0xC1F30002)
- An attempt is made to initialize a component or object again which has already been initialized.
- NS_ERROR_NOT_IMPLEMENTED (0x80004001)
- This error is caused by methods which are not implemented. This could occur because the implementation has not yet been written, or because the component intentionally does not support the desired feature.
- NS_ERROR_NO_INTERFACE (0x80004002)
- An attempt was made to call QueryInterface to retrieve an interface which an object does not support.
- NS_ERROR_NULL_POINTER (0x80004003)
- An error occurred because a value was set to null when this was not expected.
- NS_ERROR_ABORT (0x80004004)
- This error indicates that an operation failed and the caller should abort whatever action is being performed. This typically will occur if an operation could not complete properly.
- NS_ERROR_FAILURE (0x80004005)
- This is the most general of all the errors and occurs for all errors for which a more specific error code does not apply.
- NS_ERROR_UNEXPECTED (0x8000FFFF)
- An operation did not complete due to a condition which was not expected. This error occurred rather than continuing.
- NS_ERROR_OUT_OF_MEMORY (0x8007000E)
- This error occurs when there is not enough memory available to carry out an operation, or an error occurred trying to allocate memory.
- NS_ERROR_ILLEGAL_VALUE (0x80070057)
- An argument supplied to a method was not valid, for instance a null value was supplied as an argument which does not allow null values, or a value was out of range.
- NS_ERROR_NO_AGGREGATION (0x80040110)
- Â
- NS_ERROR_NOT_AVAILABLE (0x80040111)
- An operation could not be completed because some other necessary component or resource was not available.
- NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154)
- Returned when a service could not be found.
- NS_ERROR_FACTORY_REGISTER_AGAIN (0x80040155)
- This error is returned when registering a component and the registration should try registering again later.
- NS_ERROR_FACTORY_NOT_LOADED (0x800401f8)
- Â
- NS_ERROR_FACTORY_EXISTS (0xC1F30100)
- Â
- NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT (0xC1F30101)
- Â
- NS_ERROR_PROXY_INVALID_IN_PARAMETER (0x80010010)
- Â
- NS_ERROR_PROXY_INVALID_OUT_PARAMETER (0x80010011)
- Â
- NS_ERROR_CANNOT_CONVERT_DATA (0x80460001)
- Â
- NS_ERROR_OBJECT_IS_IMMUTABLE (0x80460002)
- Â
- NS_ERROR_LOSS_OF_SIGNIFICANT_DATA (0x80460003)
- Â
- NS_ERROR_ILLEGAL_DURING_SHUTDOWN (0x8046001E)
- Many operations cannot be performed once the application is being shutdown. This error will occur in this situation.
File Errors
The following table lists the errors that could occur when using files. While these errors can occur when using the file APIs, they can also occur with other components that use files.
- NS_ERROR_FILE_UNRECOGNIZED_PATH (0x80520001)
- This error occurs when an attempt is made to set a path that isn’t valid for the platform. For example, if a character in the path is not valid for a filename. In addition, this error may occur when a relative path is supplied to a method that expects an absolute path and vice versa.
- NS_ERROR_FILE_UNRESOLVABLE_SYMLINK (0x80520002)
- An attempt was made to access a symbolic link to a file or directory which does not exist.
- NS_ERROR_FILE_EXECUTION_FAILED (0x80520003)
- An attempt to launch or execute a file failed because the file is not executable.
nsIFile.isExecutable()
may be used to check if a file is executable. - NS_ERROR_FILE_UNKNOWN_TYPE (0x80520004)
- An call was made to
nsIFile.create()
with an invalid type. Only NORMAL_FILE_TYPE and DIRECTORY_TYPE are allowed. - NS_ERROR_FILE_DESTINATION_NOT_DIR (0x80520005)
- An attempt was made to copy or move a file to a destination that is not a directory.
- NS_ERROR_FILE_TARGET_DOES_NOT_EXIST (0x80520006)
- An attempt was made to reference a file that does not exist for copy/move, checking its size, etc.
- NS_ERROR_FILE_COPY_OR_MOVE_FAILED (0x80520007)
- A call to
nsIFile.copyTo()
ornsIFile.moveTo()
failed. - NS_ERROR_FILE_ALREADY_EXISTS (0x80520008)
- An attempt was made to create a file that already exists.
- NS_ERROR_FILE_INVALID_PATH (0x80520009)
- This error occurs when an attempt is made to use a path that isn’t valid for the platform.
- NS_ERROR_FILE_DISK_FULL (0x8052000A)
- This error will occur if attempting to write to a disk that is full.
- NS_ERROR_FILE_CORRUPTED (0x8052000B)
- Indicates that an attempt was made to open or access a file that has been corrupted, or that the format of a file is unknown. This error might occur if a previous attempt to write to the file had failed. This error may be returned by various components that use files to indicate that necessary files are not in an expected format.
- NS_ERROR_FILE_NOT_DIRECTORY (0x8052000C)
- This error will occur if an attempt was made to perform an operation on a file that is only valid for a directory. This error can be caused by the
directoryEntries
nsIFile.Attributes attribute. - NS_ERROR_FILE_IS_DIRECTORY (0x8052000D)
- This error will occur if an attempt was made to perform an operation on a directory that is only valid for files.
- NS_ERROR_FILE_IS_LOCKED (0x8052000E)
- This error indicates that a file cannot be accessed because it is locked, typically because the file is already being used by another application.
- NS_ERROR_FILE_TOO_BIG (0x8052000F)
- This error occurs when
nsIFile.createUnique()
cannot create a file with a unique filename. This indicates that too many files have been created already. - NS_ERROR_FILE_NO_DEVICE_SPACE (0x80520010)
- Â
- NS_ERROR_FILE_NAME_TOO_LONG (0x80520011)
- Indicates that a file name or path is larger than the platform can handle.
- NS_ERROR_FILE_NOT_FOUND (0x80520012)
- An attempt was made to access a file that does not exist. Use
nsIFile.exists()
to check if the file exists beforehand. - NS_ERROR_FILE_READ_ONLY (0x80520013)
- An attempt was made to create or write to a file or directory that is read only. This might happen if the file is not writable, the directory containing the file is not writable or the disk is write protected. Use
nsIFile.isWritable()
to check if the file can be written to. - NS_ERROR_FILE_DIR_NOT_EMPTY (0x80520014)
- When calling
nsIFile.remove()
on a directory and the ‘recursive’ argument to this method is false, this error will occur if the directory is not empty. - NS_ERROR_FILE_ACCESS_DENIED (0x80520015)
- An operation was not performed on a file because the file cannot be accessed, typically because the permissions set for the file do not allow the operation.
Stream Errors
- NS_BASE_STREAM_CLOSED (0x80470002)
- This error occurs when an operation is performed on a stream that has already been closed.
- NS_BASE_STREAM_OSERROR (0x80470003)
- This error occurs when an operating system error occurs. Currently, this error only occurs when a file stream is closed.
- NS_BASE_STREAM_ILLEGAL_ARGS (0x80470004)
- Â
- NS_BASE_STREAM_NO_CONVERTER (0x80470005)
- Â
- NS_BASE_STREAM_BAD_CONVERSION (0x80470006)
- This error occurs when the component
nsIStringBundleService
has been set with a badly encoded property file. Try using UTF-8 encoding instead. SeensIStringBundle
. - NS_BASE_STREAM_WOULD_BLOCK (0x80470007)
- This error occurs when an attempt is made to read from a non blocking stream yet there is not enough data available to read without waiting for more.
Document and Node Errors
The following errors can occur when using documents, nodes and elements.
- NS_ERROR_DOM_INDEX_SIZE_ERR (0x80530001)
- An attempt was made to adjust the value of a text node using an index that was out of range.
- NS_ERROR_DOM_DOMSTRING_SIZE_ERR (0x80530002)
- An attempt was made to create a string larger than is supported.
- NS_ERROR_DOM_HIERARCHY_REQUEST_ERR (0x80530003)
- A node was inserted into a location where it cannot go. For instance, a node cannot be inserted into a descendant of itself.
- NS_ERROR_DOM_WRONG_DOCUMENT_ERR (0x80530004)
- An operation was performed on a document involving a node that was created in a different document. The
document.importNode
method may need to be used to import the node into the document first. - NS_ERROR_DOM_INVALID_CHARACTER_ERR (0x80530005)
- An invalid character was used in a tag or attribute name.
- NS_ERROR_DOM_NO_DATA_ALLOWED_ERR (0x80530006)
- Â
- NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR (0x80530007)
- This error can occur when an attempt is made to modify an aspect of an object that cannot be changed.
- NS_ERROR_DOM_NOT_FOUND_ERR (0x80530008)
- A node was not found. For example, an attempt was made to use the
element.insertBefore
method to insert a node before one that is not a child. - NS_ERROR_DOM_NOT_SUPPORTED_ERR (0x80530009)
- The operation is not supported.
- NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR (0x8053000A)
- Â
- NS_ERROR_DOM_INVALID_STATE_ERR (0x8053000B)
- An attempt was made to use an object which is no longer usable.
- NS_ERROR_DOM_SYNTAX_ERR (0x8053000C)
- An attribute value or property was set to an invalid value.
- NS_ERROR_DOM_INVALID_MODIFICATION_ERR (0x8053000D)
- An attempt was made to modify the type of the attribute.
- NS_ERROR_DOM_NAMESPACE_ERR (0x8053000E)
- A namespace was not valid. For instance, this error can occur when an invalid character was used in a namespace URI.
- NS_ERROR_DOM_INVALID_ACCESS_ERR (0x8053000F)
- A attempt was made to access a value that was not allowed.
- NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR (0x805C0001)
- The boundary points of a range are invalid.
- NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR (0x805C0002)
- The container of an boundary point of a range is being set to either a node of an invalid type or a node with an ancestor of an invalid type.
- NS_ERROR_DOM_VALIDATION_ERR (0x805300 16)
- Â
- NS_ERROR_DOM_TYPE_MISMATCH_ERR (0x805300 17)
- Â
- NS_ERROR_DOM_SVG_WRONG_TYPE_ERR (0x805F0000)
- Â
- NS_ERROR_DOM_SVG_INVALID_VALUE_ERR (0x805F0001)
- Â
- NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE (0x805F0002)
- A matrix could not be computed.
- NS_ERROR_DOM_INVALID_EXPRESSION_ERR (0x805B0033)
- Â
- NS_ERROR_DOM_TYPE_ERR (0x805B0034)
- Â
- NS_ERROR_DOM_SECURITY_ERR (0x805303E8)
- Â
- NS_ERROR_DOM_SECMAN_ERR (0x805303E9)
- Â
- NS_ERROR_DOM_WRONG_TYPE_ERR (0x805303EA)
- Â
- NS_ERROR_DOM_NOT_OBJECT_ERR (0x805303EB)
- Â
- NS_ERROR_DOM_NOT_XPC_OBJECT_ERR (0x805303EC)
- Â
- NS_ERROR_DOM_NOT_NUMBER_ERR (0x805303ED)
- Â
- NS_ERROR_DOM_NOT_BOOLEAN_ERR (0x805303EE)
- Â
- NS_ERROR_DOM_NOT_FUNCTION_ERR (0x805303EF)
- Â
- NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR (0x805303F0)
- Â
- NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN (0x805303F1)
- Â
- NS_ERROR_DOM_PROP_ACCESS_DENIED (0x805303F2)
- Â
- NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED (0x805303F3)
- Â
- NS_ERROR_DOM_BAD_URI (0x805303F4)
- Â
- NS_ERROR_DOM_RETVAL_UNDEFINED (0x805303F5)
- Â
- NS_ERROR_DOM_QUOTA_REACHED (0x805303F6)
- An attempt was made to add data into the local or global storage for a given domain that would exceed the amount allowed for that domain.
- NS_ERROR_DOM_FILE_NOT_FOUND_ERR (0x80650000)
- File was not found.
- NS_ERROR_DOM_FILE_NOT_READABLE_ERR (0x80650001)
- File could not be read.
Network Errors
The following errors can occur when creating connections over the network, or when reading or writing data.
NS_BINDING_FAILED
(0x804B0001)- Â
NS_BINDING_ABORTED
(0x804B0002)- The asynchronous request failed because it was aborted by some user action.
NS_BINDING_REDIRECTED
(0x804B0003)- The asynchronous request has been «redirected» to a different async request. (for example, an HTTP redirect occurred). This error code is used with load groups to notify the load group observer when a request in the load group is redirected to another request.
NS_BINDING_RETARGETED
(0x804B0004)- The asynchronous request has been «retargeted» to a different «handler.» This error code is used with load groups to notify the load group observer when a request in the load group is removed from the load group and added to a different load group.
NS_ERROR_MALFORMED_URI
(0x804B000A)- The URI is malformed.
NS_ERROR_ALREADY_CONNECTED
(0x804B000B)- The connection is already established. XXX currently unused — consider removing.
NS_ERROR_NOT_CONNECTED
(0x804B000C)- The connection does not exist. XXX currently unused — consider removing.
NS_ERROR_CONNECTION_REFUSED
(0x804B000D)- Â
NS_ERROR_NET_TIMEOUT
(0x804B000E)- Â
NS_ERROR_IN_PROGRESS
(0x804B000F)- The requested action could not be completed while the object is busy. Implementations of
nsIChannel.asyncOpen()
will commonly return this error if the channel has already been opened (and has not yet been closed). NS_ERROR_OFFLINE
(0x804B0010)- Â
NS_ERROR_NO_CONTENT
(0x804B0011)- Returned from
nsIChannel.asyncOpen()
to indicate that OnDataAvailable will not be called because there is no content available. This is used by helper app style protocols (for example, mailto). NS_ERROR_UNKNOWN_PROTOCOL
(0x804B0012)- The URI scheme corresponds to an unknown protocol handler.
NS_ERROR_PORT_ACCESS_NOT_ALLOWED
(0x804B0013)- Â
NS_ERROR_NET_RESET
(0x804B0014)- Â
NS_ERROR_FTP_LOGIN
(0x804B0015)- Â
NS_ERROR_FTP_CWD
(0x804B0016)- Â
NS_ERROR_FTP_PASV
(0x804B0017)- Â
NS_ERROR_FTP_PWD
(0x804B0018)- Â
NS_ERROR_NOT_RESUMABLE
(0x804B0019)- Â
NS_ERROR_INVALID_CONTENT_ENCODING
(0x804B001B)- The content encoding of the source document was incorrect, for example returning a plain HTML document advertised as
Content-Encoding: gzip
NS_ERROR_FTP_LIST
(0x804B001C)- Â
NS_ERROR_UNKNOWN_HOST
(0x804B001E)- Â
NS_ERROR_REDIRECT_LOOP
(0x804B001F)- Â
NS_ERROR_ENTITY_CHANGED
(0x804B0020)- Â
NS_ERROR_UNKNOWN_PROXY_HOST
(0x804B002A)- Â
NS_ERROR_UNKNOWN_SOCKET_TYPE
(0x804B0033)- Â
NS_ERROR_SOCKET_CREATE_FAILED
(0x804B0034)- Â
NS_ERROR_CACHE_KEY_NOT_FOUND
(0x804B003D)- Â
NS_ERROR_CACHE_DATA_IS_STREAM
(0x804B003E)- Â
NS_ERROR_CACHE_DATA_IS_NOT_STREAM
(0x804B003F)- Â
NS_ERROR_CACHE_WAIT_FOR_VALIDATION
(0x804B0040)- Â
NS_ERROR_CACHE_ENTRY_DOOMED
(0x804B0041)- Â
NS_ERROR_CACHE_READ_ACCESS_DENIED
(0x804B0042)- Â
NS_ERROR_CACHE_WRITE_ACCESS_DENIED
(0x804B0043)- Â
NS_ERROR_CACHE_IN_USE
(0x804B0044)- Â
NS_ERROR_DOCUMENT_NOT_CACHED
(0x804B0046)- Â
NS_ERROR_NET_INTERRUPT
(0x804B0047)- Â
NS_ERROR_PROXY_CONNECTION_REFUSED
(0x804B0048)- Â
NS_ERROR_ALREADY_OPENED
(0x804B0049)- Returned from
nsIChannel.asyncOpen()
when trying to open the channel again (reopening is not supported). NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY
(0x804B0022)- While parsing for the first component of a header field using syntax such as that for
Content-Disposition
orContent-Type
, the first component was found to be empty.
JavaScript Errors
These errors typically occur when interfacing between JavaScript and native code, or to XPCOM components.
- NS_ERROR_XPC_NOT_ENOUGH_ARGS (0x80570001)
- Â
- NS_ERROR_XPC_NEED_OUT_OBJECT (0x80570002)
- Â
- NS_ERROR_XPC_CANT_SET_OUT_VAL (0x80570003)
- Â
- NS_ERROR_XPC_NATIVE_RETURNED_FAILURE (0x80570004)
- Â
- NS_ERROR_XPC_CANT_GET_INTERFACE_INFO (0x80570005)
- Â
- NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO (0x80570006)
- Â
- NS_ERROR_XPC_CANT_GET_METHOD_INFO (0x80570007)
- Â
- NS_ERROR_XPC_UNEXPECTED (0x80570008)
- Â
- NS_ERROR_XPC_BAD_CONVERT_JS (0x80570009)
- Â
- NS_ERROR_XPC_BAD_CONVERT_NATIVE (0x8057000A)
- Â
- NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF (0x8057000B)
- Â
- NS_ERROR_XPC_BAD_OP_ON_WN_PROTO (0x8057000C)
- Â
- NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN (0x8057000D)
- Â
- NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN (0x8057000E)
- Â
- NS_ERROR_XPC_CANT_WATCH_WN_STATIC (0x8057000F)
- Â
- NS_ERROR_XPC_CANT_EXPORT_WN_STATIC (0x80570010)
- Â
- NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED (0x80570011)
- Â
- NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED (0x80570012)
- Â
- NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE (0x80570013)
- Â
- NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE (0x80570014)
- Â
- NS_ERROR_XPC_CI_RETURNED_FAILURE (0x80570015)
- Â
- NS_ERROR_XPC_GS_RETURNED_FAILURE (0x80570016)
- Â
- NS_ERROR_XPC_BAD_CID (0x80570017)
- Â
- NS_ERROR_XPC_BAD_IID (0x80570018)
- Â
- NS_ERROR_XPC_CANT_CREATE_WN (0x80570019)
- Â
- NS_ERROR_XPC_JS_THREW_EXCEPTION (0x8057001A)
- Â
- NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT (0x8057001B)
- Â
- NS_ERROR_XPC_JS_THREW_JS_OBJECT (0x8057001C)
- Â
- NS_ERROR_XPC_JS_THREW_NULL (0x8057001D)
- Â
- NS_ERROR_XPC_JS_THREW_STRING (0x8057001E)
- Â
- NS_ERROR_XPC_JS_THREW_NUMBER (0x8057001F)
- Â
- NS_ERROR_XPC_JAVASCRIPT_ERROR (0x80570020)
- Â
- NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS (0x80570021)
- Â
- NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY (0x80570022)
- Â
- NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY (0x80570023)
- Â
- NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY (0x80570024)
- Â
- NS_ERROR_XPC_CANT_GET_ARRAY_INFO (0x80570025)
- Â
- NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING (0x80570026)
- Â
- NS_ERROR_XPC_SECURITY_MANAGER_VETO (0x80570027)
- Â
- NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE (0x80570028)
- Â
- NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS (0x80570029)
- Â
- NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT (0x8057002A)
- Â
- NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT (0x8057002B)
- Â
- NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE (0x8057002C)
- Â
- NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD (0x8057002D)
- Â
- NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE (0x8057002E)
- Â
- NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED (0x8057002F)
- Â
- NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED (0x80570030)
- Â
- NS_ERROR_XPC_BAD_ID_STRING (0x80570031)
- Â
- NS_ERROR_XPC_BAD_INITIALIZER_NAME (0x80570032)
- Â
- NS_ERROR_XPC_HAS_BEEN_SHUTDOWN (0x80570033)
- Â
- NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN (0x80570034)
- Â
- NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL (0x80570035)
- Â
- NS_ERROR_XPC_COM_UNKNOWN (0x80570036)
- Â
- NS_ERROR_XPC_COM_ERROR (0x80570037)
- Â
- NS_ERROR_XPC_COM_INVALID_CLASS_ID (0x80570038)
- Â
- NS_ERROR_XPC_COM_CREATE_FAILED (0x80570039)
- Â
- NS_ERROR_XPC_IDISPATCH_NOT_ENABLED (0x8057003A)
- Â
XPath Errors
Errors that can occur when using XPath expressions.
- NS_ERROR_XPATH_PARSE_FAILURE (0x80600002)
- Â
- NS_ERROR_XPATH_UNKNOWN_FUNCTION (0x80600005)
- Â
- NS_ERROR_XPATH_BAD_ARGUMENT_COUNT (0x8060000D)
- Â
- NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION (0x8060000E)
- Â
- NS_ERROR_XPATH_PAREN_EXPECTED (0x8060000F)
- Â
- NS_ERROR_XPATH_INVALID_AXIS (0x80600010)
- Â
- NS_ERROR_XPATH_NO_NODE_TYPE_TEST (0x80600011)
- Â
- NS_ERROR_XPATH_BRACKET_EXPECTED (0x80600012)
- Â
- NS_ERROR_XPATH_INVALID_VAR_NAME (0x80600013)
- Â
- NS_ERROR_XPATH_UNEXPECTED_END (0x80600014)
- Â
- NS_ERROR_XPATH_OPERATOR_EXPECTED (0x80600015)
- Â
- NS_ERROR_XPATH_UNCLOSED_LITERAL (0x80600016)
- Â
- NS_ERROR_XPATH_BAD_COLON (0x80600017)
- Â
- NS_ERROR_XPATH_BAD_BANG (0x80600018)
- Â
- NS_ERROR_XPATH_ILLEGAL_CHAR (0x80600019)
- Â
- NS_ERROR_XPATH_BINARY_EXPECTED (0x8060001A)
- Â
- NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED (0x8060001C)
- Â
- NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE (0x8060001D)
- Â
XSLT Errors
Errors that can occur when using XSLT.
- NS_ERROR_XSLT_PARSE_FAILURE (0x80600001)
- Â
- NS_ERROR_XSLT_ALREADY_SET (0x80600003)
- Â
- NS_ERROR_XSLT_EXECUTION_FAILURE (0x80600004)
- Â
- NS_ERROR_XSLT_BAD_RECURSION (0x80600006)
- Â
- NS_ERROR_XSLT_BAD_VALUE (0x80600007)
- Â
- NS_ERROR_XSLT_NODESET_EXPECTED (0x80600008)
- Â
- NS_ERROR_XSLT_ABORTED (0x80600009)
- Â
- NS_ERROR_XSLT_NETWORK_ERROR (0x8060000A)
- Â
- NS_ERROR_XSLT_WRONG_MIME_TYPE (0x8060000B)
- Â
- NS_ERROR_XSLT_LOAD_RECURSION (0x8060000C)
- Â
- NS_ERROR_XSLT_LOAD_BLOCKED_ERROR (0x8060001B)
- Â
- NS_ERROR_XSLT_BAD_NODE_NAME (0x8060001E)
- Â
- NS_ERROR_XSLT_VAR_ALREADY_SET (0x8060001F)
- Â
Miscellaneous Errors
Other errors that can occur.
- NS_ERROR_PLUGINS_PLUGINSNOTCHANGED (0x804C03E8)
- Â
- NS_ERROR_PLUGIN_DISABLED (0x804C03E9)
- Â
- NS_ERROR_UCONV_NOCONV (0x80500001)
- Â
- NS_ERROR_UDEC_ILLEGALINPUT (0x8050000E)
- Â
- NS_IMAGELIB_ERROR_FAILURE (0x80540005)
- Â
- NS_IMAGELIB_ERROR_NO_DECODER (0x80540006)
- Â
- NS_IMAGELIB_ERROR_NOT_FINISHED (0x80540007)
- Â
- NS_IMAGELIB_ERROR_LOAD_ABORTED (0x80540008)
- Â
- NS_ERROR_WONT_HANDLE_CONTENT (0x805D0001)
- Â
- MOZ_ERROR_STORAGE_ERROR (0x80630001)
- Â
- NS_ERROR_SCHEMAVALIDATOR_NO_SCHEMA_LOADED (0x80640001)
- Â
- NS_ERROR_SCHEMAVALIDATOR_NO_DOM_NODE_SPECIFIED (0x80640002)
- Â
- NS_ERROR_SCHEMAVALIDATOR_NO_TYPE_FOUND (0x80640003)
- Â
- NS_ERROR_SCHEMAVALIDATOR_TYPE_NOT_FOUND (0x80640004)
- Â
Note: there are other errors in these files:
gfx/public/nsIDeviceContext.h
base/public/nsNetError.h
parser/htmlparser/public/nsIParser.h
layout/base/nsLayoutErrors.h
profile/public/nsIProfileInternal.idl
security/manager/ssl/public/nsICMSMessageErrors.idl
directory/xpcom/base/public/nsILDAPErrors.idl
content/base/public/nsContentErrors.h
See also
- Mozilla Error Lookup lets you quickly look up the error name by its code in different formats.
- Components.results
Document Tags and Contributors
Contributors to this page:
wbamberg,
mdnwebdocs-bot,
glasserc,
zephyrus00jp,
Sheppy,
mattflaschen,
kscarfone,
BenB,
trevorh,
MatrixFrog,
aurelien.requiem,
JohnST,
Brettz9,
Souqueta,
Nickolay,
Waldo,
Enn
Last updated by:
wbamberg,
Apr 19, 2019, 8:05:49 PM
The following tables list errors that can occur when calling various Mozilla APIs. Each error is listed by its name and an error code in parentheses. An error will typically be displayed on the error console, but can be captured using a try-catch block in JavaScript. These constants can be accessed through Components.results. For example, by using Components.results.NS_ERROR_NOT_INITIALIZED
General Errors
The following errors are general and can occur when using any component.
- NS_ERROR_NOT_INITIALIZED (0xC1F30001)
- An attempt was made to use a component or object which has not yet been initialized. These components usually provide an initialization method, often called
Init
, which must be called before other methods are used. - NS_ERROR_ALREADY_INITIALIZED (0xC1F30002)
- An attempt is made to initialize a component or object again which has already been initialized.
- NS_ERROR_NOT_IMPLEMENTED (0x80004001)
- This error is caused by methods which are not implemented. This could occur because the implementation has not yet been written, or because the component intentionally does not support the desired feature.
- NS_ERROR_NO_INTERFACE (0x80004002)
- An attempt was made to call QueryInterface to retrieve an interface which an object does not support.
- NS_ERROR_NULL_POINTER (0x80004003)
- An error occurred because a value was set to null when this was not expected.
- NS_ERROR_ABORT (0x80004004)
- This error indicates that an operation failed and the caller should abort whatever action is being performed. This typically will occur if an operation could not complete properly.
- NS_ERROR_FAILURE (0x80004005)
- This is the most general of all the errors and occurs for all errors for which a more specific error code does not apply.
- NS_ERROR_UNEXPECTED (0x8000FFFF)
- An operation did not complete due to a condition which was not expected. This error occurred rather than continuing.
- NS_ERROR_OUT_OF_MEMORY (0x8007000E)
- This error occurs when there is not enough memory available to carry out an operation, or an error occurred trying to allocate memory.
- NS_ERROR_ILLEGAL_VALUE (0x80070057)
- An argument supplied to a method was not valid, for instance a null value was supplied as an argument which does not allow null values, or a value was out of range.
- NS_ERROR_NO_AGGREGATION (0x80040110)
- NS_ERROR_NOT_AVAILABLE (0x80040111)
- An operation could not be completed because some other necessary component or resource was not available.
- NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154)
- Returned when a service could not be found.
- NS_ERROR_FACTORY_REGISTER_AGAIN (0x80040155)
- This error is returned when registering a component and the registration should try registering again later.
- NS_ERROR_FACTORY_NOT_LOADED (0x800401f8)
- NS_ERROR_FACTORY_EXISTS (0xC1F30100)
- NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT (0xC1F30101)
- NS_ERROR_PROXY_INVALID_IN_PARAMETER (0x80010010)
- NS_ERROR_PROXY_INVALID_OUT_PARAMETER (0x80010011)
- NS_ERROR_CANNOT_CONVERT_DATA (0x80460001)
- NS_ERROR_OBJECT_IS_IMMUTABLE (0x80460002)
- NS_ERROR_LOSS_OF_SIGNIFICANT_DATA (0x80460003)
- NS_ERROR_ILLEGAL_DURING_SHUTDOWN (0x8046001E)
- Many operations cannot be performed once the application is being shutdown. This error will occur in this situation.
File Errors
The following table lists the errors that could occur when using files. While these errors can occur when using the file APIs, they can also occur with other components that use files.
- NS_ERROR_FILE_UNRECOGNIZED_PATH (0x80520001)
- This error occurs when an attempt is made to set a path that isn’t valid for the platform. For example, if a character in the path is not valid for a filename. In addition, this error may occur when a relative path is supplied to a method that expects an absolute path and vice versa.
- NS_ERROR_FILE_UNRESOLVABLE_SYMLINK (0x80520002)
- An attempt was made to access a symbolic link to a file or directory which does not exist.
- NS_ERROR_FILE_EXECUTION_FAILED (0x80520003)
- An attempt to launch or execute a file failed because the file is not executable.
nsIFile.isExecutable()
may be used to check if a file is executable. - NS_ERROR_FILE_UNKNOWN_TYPE (0x80520004)
- An call was made to
nsIFile.create()
with an invalid type. Only NORMAL_FILE_TYPE and DIRECTORY_TYPE are allowed. - NS_ERROR_FILE_DESTINATION_NOT_DIR (0x80520005)
- An attempt was made to copy or move a file to a destination that is not a directory.
- NS_ERROR_FILE_TARGET_DOES_NOT_EXIST (0x80520006)
- An attempt was made to reference a file that does not exist for copy/move, checking its size, etc.
- NS_ERROR_FILE_COPY_OR_MOVE_FAILED (0x80520007)
- A call to
nsIFile.copyTo()
ornsIFile.moveTo()
failed. - NS_ERROR_FILE_ALREADY_EXISTS (0x80520008)
- An attempt was made to create a file that already exists.
- NS_ERROR_FILE_INVALID_PATH (0x80520009)
- This error occurs when an attempt is made to use a path that isn’t valid for the platform.
- NS_ERROR_FILE_DISK_FULL (0x8052000A)
- This error will occur if attempting to write to a disk that is full.
- NS_ERROR_FILE_CORRUPTED (0x8052000B)
- Indicates that an attempt was made to open or access a file that has been corrupted, or that the format of a file is unknown. This error might occur if a previous attempt to write to the file had failed. This error may be returned by various components that use files to indicate that necessary files are not in an expected format.
- NS_ERROR_FILE_NOT_DIRECTORY (0x8052000C)
- This error will occur if an attempt was made to perform an operation on a file that is only valid for a directory. This error can be caused by the
directoryEntries
nsIFile.Attributes attribute. - NS_ERROR_FILE_IS_DIRECTORY (0x8052000D)
- This error will occur if an attempt was made to perform an operation on a directory that is only valid for files.
- NS_ERROR_FILE_IS_LOCKED (0x8052000E)
- This error indicates that a file cannot be accessed because it is locked, typically because the file is already being used by another application.
- NS_ERROR_FILE_TOO_BIG (0x8052000F)
- This error occurs when
nsIFile.createUnique()
cannot create a file with a unique filename. This indicates that too many files have been created already. - NS_ERROR_FILE_NO_DEVICE_SPACE (0x80520010)
- NS_ERROR_FILE_NAME_TOO_LONG (0x80520011)
- Indicates that a file name or path is larger than the platform can handle.
- NS_ERROR_FILE_NOT_FOUND (0x80520012)
- An attempt was made to access a file that does not exist. Use
nsIFile.exists()
to check if the file exists beforehand. - NS_ERROR_FILE_READ_ONLY (0x80520013)
- An attempt was made to create or write to a file or directory that is read only. This might happen if the file is not writable, the directory containing the file is not writable or the disk is write protected. Use
nsIFile.isWritable()
to check if the file can be written to. - NS_ERROR_FILE_DIR_NOT_EMPTY (0x80520014)
- When calling
nsIFile.remove()
on a directory and the ‘recursive’ argument to this method is false, this error will occur if the directory is not empty. - NS_ERROR_FILE_ACCESS_DENIED (0x80520015)
- An operation was not performed on a file because the file cannot be accessed, typically because the permissions set for the file do not allow the operation.
Stream Errors
- NS_BASE_STREAM_CLOSED (0x80470002)
- This error occurs when an operation is performed on a stream that has already been closed.
- NS_BASE_STREAM_OSERROR (0x80470003)
- This error occurs when an operating system error occurs. Currently, this error only occurs when a file stream is closed.
- NS_BASE_STREAM_ILLEGAL_ARGS (0x80470004)
- NS_BASE_STREAM_NO_CONVERTER (0x80470005)
- NS_BASE_STREAM_BAD_CONVERSION (0x80470006)
- This error occurs when the component
nsIStringBundleService
has been set with a badly encoded property file. Try using UTF-8 encoding instead. SeensIStringBundle
. - NS_BASE_STREAM_WOULD_BLOCK (0x80470007)
- This error occurs when an attempt is made to read from a non blocking stream yet there is not enough data available to read without waiting for more.
Document and Node Errors
The following errors can occur when using documents, nodes and elements.
- NS_ERROR_DOM_INDEX_SIZE_ERR (0x80530001)
- An attempt was made to adjust the value of a text node using an index that was out of range.
- NS_ERROR_DOM_DOMSTRING_SIZE_ERR (0x80530002)
- An attempt was made to create a string larger than is supported.
- NS_ERROR_DOM_HIERARCHY_REQUEST_ERR (0x80530003)
- A node was inserted into a location where it cannot go. For instance, a node cannot be inserted into a descendant of itself.
- NS_ERROR_DOM_WRONG_DOCUMENT_ERR (0x80530004)
- An operation was performed on a document involving a node that was created in a different document. The
document.importNode
method may need to be used to import the node into the document first. - NS_ERROR_DOM_INVALID_CHARACTER_ERR (0x80530005)
- An invalid character was used in a tag or attribute name.
- NS_ERROR_DOM_NO_DATA_ALLOWED_ERR (0x80530006)
- NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR (0x80530007)
- This error can occur when an attempt is made to modify an aspect of an object that cannot be changed.
- NS_ERROR_DOM_NOT_FOUND_ERR (0x80530008)
- A node was not found. For example, an attempt was made to use the
element.insertBefore
method to insert a node before one that is not a child. - NS_ERROR_DOM_NOT_SUPPORTED_ERR (0x80530009)
- The operation is not supported.
- NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR (0x8053000A)
- NS_ERROR_DOM_INVALID_STATE_ERR (0x8053000B)
- An attempt was made to use an object which is no longer usable.
- NS_ERROR_DOM_SYNTAX_ERR (0x8053000C)
- An attribute value or property was set to an invalid value.
- NS_ERROR_DOM_INVALID_MODIFICATION_ERR (0x8053000D)
- An attempt was made to modify the type of the attribute.
- NS_ERROR_DOM_NAMESPACE_ERR (0x8053000E)
- A namespace was not valid. For instance, this error can occur when an invalid character was used in a namespace URI.
- NS_ERROR_DOM_INVALID_ACCESS_ERR (0x8053000F)
- A attempt was made to access a value that was not allowed.
- NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR (0x805C0001)
- The boundary points of a range are invalid.
- NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR (0x805C0002)
- The container of an boundary point of a range is being set to either a node of an invalid type or a node with an ancestor of an invalid type.
- NS_ERROR_DOM_VALIDATION_ERR (0x805300 16)
- NS_ERROR_DOM_TYPE_MISMATCH_ERR (0x805300 17)
- NS_ERROR_DOM_SVG_WRONG_TYPE_ERR (0x805F0000)
- NS_ERROR_DOM_SVG_INVALID_VALUE_ERR (0x805F0001)
- NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE (0x805F0002)
- A matrix could not be computed.
- NS_ERROR_DOM_INVALID_EXPRESSION_ERR (0x805B0033)
- NS_ERROR_DOM_TYPE_ERR (0x805B0034)
- NS_ERROR_DOM_SECURITY_ERR (0x805303E8)
- NS_ERROR_DOM_SECMAN_ERR (0x805303E9)
- NS_ERROR_DOM_WRONG_TYPE_ERR (0x805303EA)
- NS_ERROR_DOM_NOT_OBJECT_ERR (0x805303EB)
- NS_ERROR_DOM_NOT_XPC_OBJECT_ERR (0x805303EC)
- NS_ERROR_DOM_NOT_NUMBER_ERR (0x805303ED)
- NS_ERROR_DOM_NOT_BOOLEAN_ERR (0x805303EE)
- NS_ERROR_DOM_NOT_FUNCTION_ERR (0x805303EF)
- NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR (0x805303F0)
- NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN (0x805303F1)
- NS_ERROR_DOM_PROP_ACCESS_DENIED (0x805303F2)
- NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED (0x805303F3)
- NS_ERROR_DOM_BAD_URI (0x805303F4)
- NS_ERROR_DOM_RETVAL_UNDEFINED (0x805303F5)
- NS_ERROR_DOM_QUOTA_REACHED (0x805303F6)
- An attempt was made to add data into the local or global storage for a given domain that would exceed the amount allowed for that domain.
- NS_ERROR_DOM_FILE_NOT_FOUND_ERR (0x80650000)
- File was not found.
- NS_ERROR_DOM_FILE_NOT_READABLE_ERR (0x80650001)
- File could not be read.
Network Errors
The following errors can occur when creating connections over the network, or when reading or writing data.
NS_BINDING_FAILED
(0x804B0001)NS_BINDING_ABORTED
(0x804B0002)- The asynchronous request failed because it was aborted by some user action.
NS_BINDING_REDIRECTED
(0x804B0003)- The asynchronous request has been «redirected» to a different async request. (for example, an HTTP redirect occurred). This error code is used with load groups to notify the load group observer when a request in the load group is redirected to another request.
NS_BINDING_RETARGETED
(0x804B0004)- The asynchronous request has been «retargeted» to a different «handler.» This error code is used with load groups to notify the load group observer when a request in the load group is removed from the load group and added to a different load group.
NS_ERROR_MALFORMED_URI
(0x804B000A)- The URI is malformed.
NS_ERROR_ALREADY_CONNECTED
(0x804B000B)- The connection is already established. XXX currently unused — consider removing.
NS_ERROR_NOT_CONNECTED
(0x804B000C)- The connection does not exist. XXX currently unused — consider removing.
NS_ERROR_CONNECTION_REFUSED
(0x804B000D)NS_ERROR_NET_TIMEOUT
(0x804B000E)NS_ERROR_IN_PROGRESS
(0x804B000F)- The requested action could not be completed while the object is busy. Implementations of
nsIChannel.asyncOpen()
will commonly return this error if the channel has already been opened (and has not yet been closed). NS_ERROR_OFFLINE
(0x804B0010)NS_ERROR_NO_CONTENT
(0x804B0011)- Returned from
nsIChannel.asyncOpen()
to indicate that OnDataAvailable will not be called because there is no content available. This is used by helper app style protocols (for example, mailto). NS_ERROR_UNKNOWN_PROTOCOL
(0x804B0012)- The URI scheme corresponds to an unknown protocol handler.
NS_ERROR_PORT_ACCESS_NOT_ALLOWED
(0x804B0013)NS_ERROR_NET_RESET
(0x804B0014)NS_ERROR_FTP_LOGIN
(0x804B0015)NS_ERROR_FTP_CWD
(0x804B0016)NS_ERROR_FTP_PASV
(0x804B0017)NS_ERROR_FTP_PWD
(0x804B0018)NS_ERROR_NOT_RESUMABLE
(0x804B0019)NS_ERROR_INVALID_CONTENT_ENCODING
(0x804B001B)- The content encoding of the source document was incorrect, for example returning a plain HTML document advertised as
Content-Encoding: gzip
NS_ERROR_FTP_LIST
(0x804B001C)NS_ERROR_UNKNOWN_HOST
(0x804B001E)NS_ERROR_REDIRECT_LOOP
(0x804B001F)NS_ERROR_ENTITY_CHANGED
(0x804B0020)NS_ERROR_UNKNOWN_PROXY_HOST
(0x804B002A)NS_ERROR_UNKNOWN_SOCKET_TYPE
(0x804B0033)NS_ERROR_SOCKET_CREATE_FAILED
(0x804B0034)NS_ERROR_CACHE_KEY_NOT_FOUND
(0x804B003D)NS_ERROR_CACHE_DATA_IS_STREAM
(0x804B003E)NS_ERROR_CACHE_DATA_IS_NOT_STREAM
(0x804B003F)NS_ERROR_CACHE_WAIT_FOR_VALIDATION
(0x804B0040)NS_ERROR_CACHE_ENTRY_DOOMED
(0x804B0041)NS_ERROR_CACHE_READ_ACCESS_DENIED
(0x804B0042)NS_ERROR_CACHE_WRITE_ACCESS_DENIED
(0x804B0043)NS_ERROR_CACHE_IN_USE
(0x804B0044)NS_ERROR_DOCUMENT_NOT_CACHED
(0x804B0046)NS_ERROR_NET_INTERRUPT
(0x804B0047)NS_ERROR_PROXY_CONNECTION_REFUSED
(0x804B0048)NS_ERROR_ALREADY_OPENED
(0x804B0049)- Returned from
nsIChannel.asyncOpen()
when trying to open the channel again (reopening is not supported). NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY
(0x804B0022)- While parsing for the first component of a header field using syntax such as that for Content-Disposition: or Content-Type:, the first component was found to be empty.
JavaScript Errors
These errors typically occur when interfacing between JavaScript and native code, or to XPCOM components.
- NS_ERROR_XPC_NOT_ENOUGH_ARGS (0x80570001)
- NS_ERROR_XPC_NEED_OUT_OBJECT (0x80570002)
- NS_ERROR_XPC_CANT_SET_OUT_VAL (0x80570003)
- NS_ERROR_XPC_NATIVE_RETURNED_FAILURE (0x80570004)
- NS_ERROR_XPC_CANT_GET_INTERFACE_INFO (0x80570005)
- NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO (0x80570006)
- NS_ERROR_XPC_CANT_GET_METHOD_INFO (0x80570007)
- NS_ERROR_XPC_UNEXPECTED (0x80570008)
- NS_ERROR_XPC_BAD_CONVERT_JS (0x80570009)
- NS_ERROR_XPC_BAD_CONVERT_NATIVE (0x8057000A)
- NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF (0x8057000B)
- NS_ERROR_XPC_BAD_OP_ON_WN_PROTO (0x8057000C)
- NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN (0x8057000D)
- NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN (0x8057000E)
- NS_ERROR_XPC_CANT_WATCH_WN_STATIC (0x8057000F)
- NS_ERROR_XPC_CANT_EXPORT_WN_STATIC (0x80570010)
- NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED (0x80570011)
- NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED (0x80570012)
- NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE (0x80570013)
- NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE (0x80570014)
- NS_ERROR_XPC_CI_RETURNED_FAILURE (0x80570015)
- NS_ERROR_XPC_GS_RETURNED_FAILURE (0x80570016)
- NS_ERROR_XPC_BAD_CID (0x80570017)
- NS_ERROR_XPC_BAD_IID (0x80570018)
- NS_ERROR_XPC_CANT_CREATE_WN (0x80570019)
- NS_ERROR_XPC_JS_THREW_EXCEPTION (0x8057001A)
- NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT (0x8057001B)
- NS_ERROR_XPC_JS_THREW_JS_OBJECT (0x8057001C)
- NS_ERROR_XPC_JS_THREW_NULL (0x8057001D)
- NS_ERROR_XPC_JS_THREW_STRING (0x8057001E)
- NS_ERROR_XPC_JS_THREW_NUMBER (0x8057001F)
- NS_ERROR_XPC_JAVASCRIPT_ERROR (0x80570020)
- NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS (0x80570021)
- NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY (0x80570022)
- NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY (0x80570023)
- NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY (0x80570024)
- NS_ERROR_XPC_CANT_GET_ARRAY_INFO (0x80570025)
- NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING (0x80570026)
- NS_ERROR_XPC_SECURITY_MANAGER_VETO (0x80570027)
- NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE (0x80570028)
- NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS (0x80570029)
- NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT (0x8057002A)
- NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT (0x8057002B)
- NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE (0x8057002C)
- NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD (0x8057002D)
- NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE (0x8057002E)
- NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED (0x8057002F)
- NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED (0x80570030)
- NS_ERROR_XPC_BAD_ID_STRING (0x80570031)
- NS_ERROR_XPC_BAD_INITIALIZER_NAME (0x80570032)
- NS_ERROR_XPC_HAS_BEEN_SHUTDOWN (0x80570033)
- NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN (0x80570034)
- NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL (0x80570035)
- NS_ERROR_XPC_COM_UNKNOWN (0x80570036)
- NS_ERROR_XPC_COM_ERROR (0x80570037)
- NS_ERROR_XPC_COM_INVALID_CLASS_ID (0x80570038)
- NS_ERROR_XPC_COM_CREATE_FAILED (0x80570039)
- NS_ERROR_XPC_IDISPATCH_NOT_ENABLED (0x8057003A)
XPath Errors
Errors that can occur when using XPath expressions.
- NS_ERROR_XPATH_PARSE_FAILURE (0x80600002)
- NS_ERROR_XPATH_UNKNOWN_FUNCTION (0x80600005)
- NS_ERROR_XPATH_BAD_ARGUMENT_COUNT (0x8060000D)
- NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION (0x8060000E)
- NS_ERROR_XPATH_PAREN_EXPECTED (0x8060000F)
- NS_ERROR_XPATH_INVALID_AXIS (0x80600010)
- NS_ERROR_XPATH_NO_NODE_TYPE_TEST (0x80600011)
- NS_ERROR_XPATH_BRACKET_EXPECTED (0x80600012)
- NS_ERROR_XPATH_INVALID_VAR_NAME (0x80600013)
- NS_ERROR_XPATH_UNEXPECTED_END (0x80600014)
- NS_ERROR_XPATH_OPERATOR_EXPECTED (0x80600015)
- NS_ERROR_XPATH_UNCLOSED_LITERAL (0x80600016)
- NS_ERROR_XPATH_BAD_COLON (0x80600017)
- NS_ERROR_XPATH_BAD_BANG (0x80600018)
- NS_ERROR_XPATH_ILLEGAL_CHAR (0x80600019)
- NS_ERROR_XPATH_BINARY_EXPECTED (0x8060001A)
- NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED (0x8060001C)
- NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE (0x8060001D)
XSLT Errors
Errors that can occur when using XSLT.
- NS_ERROR_XSLT_PARSE_FAILURE (0x80600001)
- NS_ERROR_XSLT_ALREADY_SET (0x80600003)
- NS_ERROR_XSLT_EXECUTION_FAILURE (0x80600004)
- NS_ERROR_XSLT_BAD_RECURSION (0x80600006)
- NS_ERROR_XSLT_BAD_VALUE (0x80600007)
- NS_ERROR_XSLT_NODESET_EXPECTED (0x80600008)
- NS_ERROR_XSLT_ABORTED (0x80600009)
- NS_ERROR_XSLT_NETWORK_ERROR (0x8060000A)
- NS_ERROR_XSLT_WRONG_MIME_TYPE (0x8060000B)
- NS_ERROR_XSLT_LOAD_RECURSION (0x8060000C)
- NS_ERROR_XSLT_LOAD_BLOCKED_ERROR (0x8060001B)
- NS_ERROR_XSLT_BAD_NODE_NAME (0x8060001E)
- NS_ERROR_XSLT_VAR_ALREADY_SET (0x8060001F)
Miscellaneous Errors
Other errors that can occur.
- NS_ERROR_PLUGINS_PLUGINSNOTCHANGED (0x804C03E8)
- NS_ERROR_PLUGIN_DISABLED (0x804C03E9)
- NS_ERROR_UCONV_NOCONV (0x80500001)
- NS_ERROR_UDEC_ILLEGALINPUT (0x8050000E)
- NS_IMAGELIB_ERROR_FAILURE (0x80540005)
- NS_IMAGELIB_ERROR_NO_DECODER (0x80540006)
- NS_IMAGELIB_ERROR_NOT_FINISHED (0x80540007)
- NS_IMAGELIB_ERROR_LOAD_ABORTED (0x80540008)
- NS_ERROR_WONT_HANDLE_CONTENT (0x805D0001)
- MOZ_ERROR_STORAGE_ERROR (0x80630001)
- NS_ERROR_SCHEMAVALIDATOR_NO_SCHEMA_LOADED (0x80640001)
- NS_ERROR_SCHEMAVALIDATOR_NO_DOM_NODE_SPECIFIED (0x80640002)
- NS_ERROR_SCHEMAVALIDATOR_NO_TYPE_FOUND (0x80640003)
- NS_ERROR_SCHEMAVALIDATOR_TYPE_NOT_FOUND (0x80640004)
Note: there are other errors in these files:
gfx/public/nsIDeviceContext.h
base/public/nsNetError.h
parser/htmlparser/public/nsIParser.h
layout/base/nsLayoutErrors.h
profile/public/nsIProfileInternal.idl
security/manager/ssl/public/nsICMSMessageErrors.idl
directory/xpcom/base/public/nsILDAPErrors.idl
content/base/public/nsContentErrors.h
See also
- Mozilla Error Lookup lets you quickly look up the error name by its code in different formats.
- Components.results
Document Tags and Contributors
Contributors to this page:
zephyrus00jp,
Sheppy,
mattflaschen,
kscarfone,
BenB,
trevorh,
MatrixFrog,
aurelien.requiem,
JohnST,
Brettz9,
Souqueta,
Nickolay,
Waldo,
Enn
Last updated by:
zephyrus00jp,
May 7, 2015, 12:53:00 PM
On my host machine, I can navigate to grooveshark.com and play music. In my VMWare VM I can’t get the grooveshark.com home page to load. Firefox displays a «too long to respond» message and IE gives the «cannot display page» message. Grooveshark worked in the VM at one time, but it stopped a while back. How do I get grooveshark to work in the VM?
asked May 17, 2011 at 13:14
Can you get to any website?
I would recommend looking in network settings and trying to make sure it is both connected and set to either bridged or NAT.
answered May 17, 2011 at 13:43
William HilsumWilliam Hilsum
116k19 gold badges181 silver badges265 bronze badges
1
You maybe have a problem with the Flash version that is installed in the VM, or Flash settings, or cookies.
From The new Grooveshark has display problems!
If you’re having a problem with
Grooveshark’s display (saved music not
loading, themes not appearing, white
screen, blank screen, side bar),
follow these steps and see if they
resolve your problem.
- Make sure that you have the latest version of Flash installed
(http://get.adobe.com/flashplayer).- Test grooveshark.com in another web browser.
- In your web browser, try Tools -> Options -> Privacy and then check
Accept Cookies from sites.- Turn off any Flashblock extensions.
- Restore your browser’s normal zoom level.
You should also verify Flash settings on the Online Settings Manager and also on the Local Settings Manager, by comparing them between the physical and virtual machines. Here is how to access the local settings :
To access the local Flash Player
Settings Manager that is native to
your operating system:
- Windows: click Start > Settings > Control Panel > Flash Player
- Macintosh: System Preferences (under Other) click Flash Player
- Linux Gnome: System > Preferences > Adobe Flash Player
- Linux KDE: System Settings > Adobe Flash Player
answered May 20, 2011 at 6:12
harrymcharrymc
431k30 gold badges495 silver badges876 bronze badges
2
I’d comment, but not enough reputation yet. I think more info is needed here…
- Check the status of VMWare Tools. Are they running in your guest?
- Are you able to access any other websites? [you answered yes in a comment]
-
Can you post a tracert to the following hosts:
grooveshark.com www.grooveshark.com static.a.gs-cdn.net
static.a.gs-cdn.net
is the Canadian Grooveshark content provider. For some reason I’m not able to access the American one right now, so you’ll need to check which host you hit (or are trying to hit).
answered May 19, 2011 at 20:48
CodeblingCodebling
7241 gold badge6 silver badges19 bronze badges
9
- Почтовый клиент Mozilla Thunderbird
- Об анализаторе PVS-Studio
- Сборка и проверка Thunderbird
- Предупреждения анализатора
- Подозрительные условия
- Проблемы с указателями
- Ошибки copy-paste
- Неопределенное поведение
- Предупреждения с функциями
- Прочие предупреждения
- Заключение
В этой статье хочу рассказать о проверке проекта Mozilla Thunderbird статическим анализатором PVS-Studio. Пользуясь Thunderbird, я иногда сталкивался с зависаниями и странным поведением программы. Возможно, нам удастся найти хотя бы некоторые причины этого в исходном коде. Приглашаю посмотреть, какие ошибки могут прятаться в таком популярном проекте.
Почтовый клиент Mozilla Thunderbird
Mozilla Thunderbird — бесплатная кроссплатформенная свободно распространяемая программа для работы с электронной почтой и группами новостей, разработанная компанией Mozilla Foundation. Основными преимуществами использования Thunderbird считаются простота и гибкость программы. Пользователь сам может настроить интерфейс, меняя, добавляя или удаляя кнопки. В добавок к этому поддерживается установка расширений и новых тем оформлений. Программа может использовать цифровые подписи, шифрование сообщений и проверку сертификатов.
Об анализаторе PVS-Studio
PVS-Studio — статический анализатор кода для С и С++ программ. PVS-Studio предоставляется как плагин к системе разработки Visual Studio, но может быть использован и через утилиту Standalone. Эта утилита имеет функцию мониторинга, которая отслеживает вызовы компилятора и передает нужные файлы анализатору. Таким образом PVS-Studio не зависит от сборочной системы проекта.
Инструмент прост в использовании, поэтому вместо многих слов, лучше скачать и попробовать демонстрационную версию на своем собственном коде.
Сборка и проверка Thunderbird
Mozilla имеет свою собственную сборочную систему. Инструкцию, описывающую основные шаги для сборки проекта можно найти здесь. Сама сборка сделана максимально удобно для пользователя. Mozilla предоставляет бинарный инсталлятор всех необходимых для установки под windows утилит, например, 7zip, msys, mercurial и т.п.
Проверка была осуществлена с помощью упомянутой выше системы мониторинга вызовов компилятора, которой обладает утилита Standalone, входящая в комплект PVS-Studio.
Предупреждения анализатора
Thunderbird является крупным проектом и использует множество сторонних библиотек. Большинство предупреждений пришлось именно на их код. Для статьи я постарался отсеять эти предупреждения и оставить только те, которые выдавались на исходный код почтовой программы.
Кроме того, для описания багов в проектах Mozilla есть страница с описанием ключевых слов. Среди них можно найти такие как coverity, klocwork, valgrind и clang-anazyler. Похоже, что эти средства анализа кода уже используются в Mozilla. Так что будет интересно посмотреть на то, что не заметили эти анализаторы.
Подозрительные условия
Предупреждение PVS-Studio: V501 There are identical sub-expressions ‘aStatus == NS_ERROR_OFFLINE’ to the left and to the right of the ‘||’ operator. nsdocshell.cpp 7606
nsresult
nsDocShell::EndPageLoad(nsresult aStatus, ....)
{
if(....)
{
....
}
else if (aStatus == NS_ERROR_NET_TIMEOUT ||
....
aStatus == NS_ERROR_OFFLINE ||
aStatus == NS_ERROR_MALWARE_URI ||
aStatus == NS_ERROR_PHISHING_URI ||
aStatus == NS_ERROR_UNWANTED_URI ||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
aStatus == NS_ERROR_REMOTE_XUL ||
aStatus == NS_ERROR_OFFLINE ||
....)
}
Этот код содержит лишнюю проверку «NS_ERROR_OFFLINE». Список значений, на которые нужно проверить переменную ‘aStatus’ большой, поэтому легко можно ошибиться и случайно продублировать проверку. Вторым вариантом может быть то, что программист после копирования вставлял одну и ту же строчку, чтобы не переписывать одинаковую часть, и забыл поменять название константы «NS_ERROR_OFFLINE». В таком случае в коде не хватает одной нужной проверки.
Предупреждение PVS-Studio: V590 Consider inspecting the ‘type != (1) && type == (2)’ expression. The expression is excessive or contains a misprint. nswindowsregkey.cpp 313
#define REG_SZ ( 1 )
#define REG_EXPAND_SZ ( 2 )
#define REG_MULTI_SZ ( 7 )
NS_IMETHODIMP
nsWindowsRegKey::ReadStringValue(const nsAString& aName,
nsAString& aResult)
{
....
if (type != REG_SZ &&
type == REG_EXPAND_SZ &&
type == REG_MULTI_SZ)
{
return NS_ERROR_FAILURE;
}
....
}
Условие «type == REG_EXPAND_SZ && type == REG_MULTI_SZ» всегда ложно, так как одна переменная не может иметь два значения одновременно. Как результат, функция никогда не вернет статус ошибки NS_ERROR_FAILURE.
Предупреждение PVS-Studio: V616 The ‘eBorderStyle_none’ named constant with the value of 0 is used in the bitwise operation. nswindow.cpp 2318
enum nsBorderStyle
{
eBorderStyle_none = 0,
....
}
NS_IMETHODIMP nsWindow::SetNonClientMargins(....)
{
if (!mIsTopWidgetWindow ||
mBorderStyle & eBorderStyle_none)
return NS_ERROR_INVALID_ARG;
....
}
При проверке условия используется константа со значением 0, которая участвует в побитовой операции «И» с переменной. Результатом операции, разумеется, тоже будет ноль. Таким образом условие не зависит от переменной «mBorderStyle».
Подобное предупреждение:
- V616 The ‘nsIDocShell::BUSY_FLAGS_NONE’ named constant with the value of 0 is used in the bitwise operation. presentationcallbacks.cpp 105
Предупреждение PVS-Studio: V646 Consider inspecting the application’s logic. It’s possible that ‘else’ keyword is missing. nsnativethemewin.cpp 924
nsresult
nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
uint8_t aWidgetType,
int32_t& aPart,
int32_t& aState)
{
....
{
....
if (!aFrame) {
aState = TS_NORMAL;
} else {
if (GetCheckedOrSelected(aFrame, !isCheckbox)) {
inputState = CHECKED;
} if (isCheckbox && GetIndeterminate(aFrame)) {
inputState = INDETERMINATE;
}
....
} ....
}
Возможно, что перед последним «if» пропущено слово else. Код к текущем виде подразумевает, что могут выполниться оба условия if, и тогда значение «CHECKED» в переменной «inputState» будет изменено на «INDETERMINATE». Если бы в этом коде выполнялось либо одно условие, либо другое, то логичней было бы использовать «if — else», как во внешней конструкции.
Еще одна похожая конструкция располагается здесь:
- V646 Consider inspecting the application’s logic. It’s possible that ‘else’ keyword is missing. debugger.cpp 4794
Предупреждение PVS-Studio: V713 The pointer mHTMLEditor was utilized in the logical expression before it was verified against nullptr in the same logical expression. nshtmleditrules.cpp 6593
nsHTMLEditor* mHTMLEditor;
nsresult
nsHTMLEditRules::SplitParagraph(...)
{
if (mHTMLEditor->IsTextNode(child) ||
!mHTMLEditor ||
mHTMLEditor->IsContainer(child))
....
}
Функция «SplitParagraph» в своей проверке содержит ошибочный порядок аргументов. Если в данном коде указатель mHTMLEditor будет нулевым, то перед обнаружением этого он уже будет разыменован, что приведет к неопределенному поведению. Чтобы исправить код, нужно поменять местами «!mHTMLEditor» и «mHTMLEditor->IsTextNode(child)».
Две аналогичных ошибки располагаются здесь:
- V713 The pointer mHTMLEditor was utilized in the logical expression before it was verified against nullptr in the same logical expression. nshtmleditrules.cpp 7392
- V713 The pointer mHTMLEditor was utilized in the logical expression before it was verified against nullptr in the same logical expression. nshtmleditrules.cpp 7413
Предупреждение PVS-Studio: V522 Dereferencing of the null pointer ‘aStyleValues’ might take place. sdnaccessible.cpp 252
STDMETHODIMP sdnAccessible::get_computedStyle(
BSTR __RPC_FAR* aStyleProperties,
BSTR __RPC_FAR* aStyleValues,
unsigned short __RPC_FAR* aNumStyleProperties)
{
if (!aStyleProperties || aStyleValues || !aNumStyleProperties)
return E_INVALIDARG;
....
aStyleValues[realIndex] = ::SysAllocString(value.get());
....
}
Как говорится, заметь проказника.
Анализатор обнаружил разыменование нулевого указателя. При проверке программист забыл поставить «!» перед «aStyleValues». Дальнейший код получает управление только тогда, когда этот указатель будет равен нулю, и приводит к его разыменованию.
Предупреждение PVS-Studio: V547 Expression is always false. Probably the ‘||’ operator should be used here. nsmsgdbview.cpp 3014
class NS_NO_VTABLE nsMsgViewCommandType
{
enum
{
....
junk = 27,
unjunk = 28,
....
};
};
nsresult nsMsgDBView::
ApplyCommandToIndices(nsMsgViewCommandTypeValue command, ....)
{
....
if ((command == nsMsgViewCommandType::junk) &&
(command == nsMsgViewCommandType::unjunk))
....
}
Код, соответствующий блоку if никогда не будет выполняться, поскольку переменная command не может одновременно иметь два значения. Более логичным здесь кажется использование оператора «ИЛИ» — «||».
Проблемы с указателями
Предупреждение PVS-Studio: V579 The HashBytes function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the second argument. nsdisplaylist.h 929
struct AnimatedGeometryRootLookup
{
....
PLDHashNumber Hash() const
{
return mozilla::HashBytes(this, sizeof(this));
}
....
}
Анализатор счел подозрительным, что в функцию «HashBytes» первым аргументом передается указатель, а вторым — размер указателя. Если поискать в исходных файлах по названию функции, то в файле «hashfunctions.h» можно найти следующий комментарий:
/* Utilities for hashing. */
/*
* This file exports functions for hashing data down
* to a 32-bit value, including:
....
* - HashBytes Hash a byte array of known length.
....
*/
Комментарий подсказывает, что вторым аргументом должен быть размер объекта, располагающегося по указателю. Скорее всего правильный код должен выглядеть так:
return mozilla::HashBytes(this, sizeof(*this));
Перейдем к следующему предупреждению.
Предупреждение PVS-Studio: V611 The memory was allocated using ‘new’ operator but was released using the ‘free’ function. Consider inspecting operation logics behind the ‘instanceData’ variable. nptest.cpp 971
NPError NPP_New(....)
{
....
InstanceData* instanceData = new InstanceData;
....
free(instanceData);
....
}
Ошибка заключается в том, что память выделяется с помощью оператора «new», а освобождается с помощью «free». Функция «free» не вызывает деструктор объекта, располагающегося по этому указателю. Это значит, что если объект содержал в себе еще указатели с выделенной памятью, то она не будет освобождена и произойдет утечка.
Да и вообще так делать нельзя. Подобный код приводит к неопределенному поведению программы.
Предупреждение PVS-Studio: V614 Potentially uninitialized pointer ‘hOldFont’ used. progressui_win.cpp 168
static void InitDialog(....)
{
....
HFONT hInfoFont, hOldFont;
hInfoFont = (HFONT)SendMessage(hWndInfo, WM_GETFONT, 0, 0);
if (hInfoFont)
hOldFont = (HFONT)SelectObject(hDCInfo, hInfoFont);
....
if (hOldFont)
SelectObject(hDCInfo, hOldFont);
....
}
Если функция «SendMessage» вернет ноль, то результат следующей проверки будет false, а значит переменная hOldFont не будет инициализирована. Переменная будет иметь случайное значение, которое может быть не равно нулю. Если оно не равно 0, то это случайное значение будет передано в функцию SelectObject.
Еще одна подобная ситуация может возникнуть здесь:
- V614 Potentially uninitialized pointer ‘queryD3DKMTStatistics’ used. gfxwindowsplatform.cpp 206
Ошибки copy-paste
Предупреждение PVS-Studio: V517 The use of ‘if (A) {…} else if (A) {…}’ pattern was detected. There is a probability of logical error presence. Check lines: 1060, 1062. nsstylestruct.cpp 1060
nsStyleClipPath::nsStyleClipPath(const nsStyleClipPath& aSource)
{
if (aSource.mType == NS_STYLE_CLIP_PATH_URL) {
SetURL(aSource.mURL);
} else if (aSource.mType == NS_STYLE_CLIP_PATH_SHAPE) {
SetBasicShape(aSource.mBasicShape, aSource.mSizingBox);
} else if (aSource.mType == NS_STYLE_CLIP_PATH_SHAPE) {
SetSizingBox(aSource.mSizingBox);
}
}
Блок «if — else if» содержит повторяющуюся проверку на равенство, вызванную copy-paste методом. Это означает, что последняя часть кода, соответствующая второй проверке на «NS_STYLE_CLIP_PATH_SHAPE», никогда не будет выполнена.
Предупреждение PVS-Studio: V523 The ‘then’ statement is equivalent to the ‘else’ statement. mozspelli18nmanager.cpp 34
NS_IMETHODIMP
mozSpellI18NManager::GetUtil(mozISpellI18NUtil **_retval, ....)
{
....
nsAutoString lang;
....
if(lang.EqualsLiteral("en"))
{
*_retval = new mozEnglishWordUtils;
}
else
{
*_retval = new mozEnglishWordUtils;
}
NS_IF_ADDREF(*_retval);
return NS_OK;
}
Анализатор обратил внимание на то, что блокам if и else соответствуют одинаковые действия. Это может быть ошибкой при копировании, лишним условием или просто недописанным кодом. Так или иначе в данном виде условие не имеет смысла.
Еще несколько подобных ошибок:
- V523 The ‘then’ statement is equivalent to the ‘else’ statement. jemalloc.c 6504
- V523 The ‘then’ statement is equivalent to the ‘else’ statement. nsnativethemewin.cpp 1007
- V523 The ‘then’ statement is equivalent to the ‘else’ statement. msgmapihook.cpp 677
Неопределенное поведение
Предупреждение PVS-Studio: V595 The ‘aParent’ pointer was utilized before it was verified against nullptr. Check lines: 511, 518. nsgenericdomdatanode.cpp 511
#define NS_ADDREF(_ptr)
(_ptr)->AddRef()
nsresult
nsGenericDOMDataNode::BindToTree(nsIContent* aParent, ....)
{
....
ShadowRoot*
parentContainingShadow = aParent->GetContainingShadow();
....
if (aParent)
{
if (!GetParent())
{
NS_ADDREF(aParent);
}
mParent = aParent;
}
....
}
Проверка указателя «aParent» подсказывает, что он может быть нулевым. Это значит, что при первом его разыменовании, которое происходит до проверки, мы рискуем получить неопределенное поведение.
Предупреждение V595 является одним из самых распространенных среди проверяемых проектов, и Thunderbird — не исключение. Всего анализатор выдал 95 предупреждений, касающихся непосредственно кода Thunderbird.
Предупреждение PVS-Studio: V610 Undefined behavior. Check the shift operator ‘<<‘. The left operand ‘~0L’ is negative. nsprotocolproxyservice.cpp 336
static void
proxy_MaskIPv6Addr(PRIPv6Addr &addr, uint16_t mask_len)
{
....
addr.pr_s6_addr32[3] = PR_htonl(
PR_ntohl(addr.pr_s6_addr32[3]) & (~0L << (128 - mask_len)));
....
}
Когда один из параметров смещения влево является отрицательным числом, поведение не определено. Вот что сказано об этом в стандарте:
The shift operators << and >> group left-to-right. shift-expression << additive-expression, shift-expression >> additive-expression
The operands shall be of integral or unscoped enumeration type and integral promotions are performed. 1. The type of the result is that of the promoted left operand. The behavior is undefined if the right operand is negative, or greater than or equal to the length in bits of the promoted left operand. 2. … If E1 has an unsigned type, the value of the result is E1 * 2^E2, reduced modulo one more than the maximum value representable in the result type. Otherwise, if E1 has a signed type and non-negative value, and E1*2^E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. …
Еще 3 случая неопределенного поведения:
- V610 Undefined behavior. Check the shift operator ‘<<‘. The left operand ‘~0L’ is negative. nsprotocolproxyservice.cpp 341
- V610 Undefined behavior. Check the shift operator ‘<<‘. The left operand ‘~0L’ is negative. nsprotocolproxyservice.cpp 347
- V610 Undefined behavior. Check the shift operator ‘<<‘. The left operand ‘~0L’ is negative. nsprotocolproxyservice.cpp 354
Предупреждения с функциями
Предупреждение PVS-Studio: V597 The compiler could delete the ‘memset’ function call, which is used to flush ‘ctx’ object. The RtlSecureZeroMemory() function should be used to erase the private data. gmploader.cpp 166
bool GMPLoaderImpl::Load(....)
{
SHA256Context ctx;
....
// Overwrite all data involved in calculation as it could
//potentially identify the user, so there's no chance a GMP
//can read it and use it for identity tracking.
memset(&ctx, 0, sizeof(ctx));
....
}
Здесь анализатор обратил внимание, что вызов функции ‘memset’ может быть удалён. Так как переменная ‘ctx’ в дальнейшем не используется, компилятор имеет полное право при оптимизации убрать вызов «memset». В Windows можно воспользоваться функцией «RtlSecureZeroMemory».
Предупреждение PVS-Studio: V530 The return value of function ‘getenv’ is required to be utilized. nswindowswmain.cpp 134
int wmain(int argc, WCHAR **argv)
{
....
// Force creation of the multibyte _environ variable.
getenv("PATH");
int result = main(argc, argvConverted, _environ);
....
}
Здесь мы имеем дело с вызовом функции «getenv», результат которой не используется и даже не записывается в переменную. Вот как описана эта функция на сайте cplusplus.com.
Retrieves a C-string containing the value of the environment variable whose name is specified as argument. If the requested variable is not part of the environment list, the function returns a null pointer.
Использование «getenv» в таком виде бессмысленно и только смущает при чтении кода.
Прочие предупреждения
Предупреждение PVS-Studio: V609 Divide by zero. Denominator range [0..8]. ionbuilder.cpp 10922
static inline size_t UnboxedTypeSize(JSValueType type)
{
switch (type) {
....
default: return 0;
}
}
MInstruction*IonBuilder::loadUnboxedProperty(size_t offset,
JSValueType unboxedType, ....)
{
size_t index = offset / UnboxedTypeSize(unboxedType);
....
}
Так как функция «UnboxedTypeSize» может вернуть ноль, то потенциально мы имеем дело с делением на ноль. Если в функцию «UnboxedTypeSize» будет передан новый тип, то она вернёт дефолтное нулевое значение, что приведёт к возникновению исключительной ситуации. Лучше перестраховаться и добавить проверку перед делением.
Еще одно потенциальное деление на ноль:
- V609 Divide by zero. Denominator range [0..8]. ionbuilder.cpp 11844
Предупреждение PVS-Studio: V621 Consider inspecting the ‘for’ operator. It’s possible that the loop will be executed incorrectly or won’t be executed at all. nsmsgdbfolder.cpp 4501
NS_IMETHODIMP
nsMsgDBFolder::GetDisplayRecipients(bool *displayRecipients)
{
....
// There's one FCC folder for sent mail, and one for sent news
nsIMsgFolder *fccFolders[2];
int numFccFolders = 0;
for (int i = 0; i < numFccFolders; i++)
{
....
}
....
}
Анализатором было найдено подозрительное место, в котором цикл не проходит ни одной итерации. Причиной этого является переменная «numFccFolders», значение которой равно нулю. Возможно, это присваивание сделано с какой-то целью, но также возможно, что это опечатка. Комментарий и объявление указателя выше подсказывают, что переменная должна иметь значение 2.
Предупреждение PVS-Studio: V678 An object is used as an argument to its own method. Consider checking the first actual argument of the ‘Assign’ function. nsgenerichtmlelement.h 411
class nsGenericHTMLElement : public nsGenericHTMLElementBase,
public nsIDOMHTMLElement
{
....
NS_IMETHOD GetItemId(nsAString& aId) final override {
nsString id;
GetItemId(id);
aId.Assign(aId);
return NS_OK;
}
....
}
Само по себе использование объекта «aId» как аргумента в своем же методе не является ошибкой. Но этот код подозрителен тем, что в функции используется переменная с похожим названием «id». Это наводит на мысль, что здесь содержится опечатка и аргументом функции «aId.Assign» должна быть переменная «id».
Предупреждение PVS-Studio: V670 The uninitialized class member ‘mWorkerConnection’ is used to initialize the ‘mWorkerStatements’ member. Remember that members are initialized in the order of their declarations inside a class. domstoragedbthread.cpp 50
DOMStorageDBThread::DOMStorageDBThread()
: mWorkerStatements(mWorkerConnection)
, ....
{}
class DOMStorageDBThread final : public DOMStorageDBBridge
{
private:
....
StatementCache mWorkerStatements; // <=line 304
....
nsCOMPtr<mozIStorageConnection> mWorkerConnection; // <=line 309
....
}
При использовании списка инициализации следует помнить об одном нюансе: переменные инициализируется в том порядке, в каком они объявлены в классе, а порядок в списке инициализации значения не имеет. В этом коде переменная «mWorkerStatements» инициализируется объектом «mWorkerConnection» другого класса. Но на момент инициализации для этого объекта еще не был вызван конструктор, так как в классе он объявлен позже, чем переменная «mWorkerStatements». Чтобы исправить это, достаточно поменять местами объявление этих двух объектов в классе.
В этом классе прячется еще одна такая же ошибка:
- V670 The uninitialized class member ‘mReaderConnection’ is used to initialize the ‘mReaderStatements’ member. Remember that members are initialized in the order of their declarations inside a class. domstoragedbthread.cpp 51
Заключение
Подводя итог хочу заметить, что PVS-Studio нашел много подозрительных мест в проекте Mozilla Thunderbird. Большинство из них относятся к сторонним библиотекам. Тем не менее и в самом Thunderbird нашлись интересные ошибки.
Написать большой проект без ошибок не под силу даже самым опытным и внимательным программистам. Для таких целей и существуют статические анализаторы кода. Их использование поможет вам сэкономить время на поиск старых ошибок и не допустить новых. Предлагаю попробовать PVS-Studio на вашем проекте: http://www.viva64.com/ru/pvs-studio/download/.
Присылаем лучшие статьи раз в месяц