зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1320179) for causing merge conflicts a=backout
Backed out changeset b8aa677f7452 (bug 1320179) Backed out changeset 9e2f77570128 (bug 1320179) Backed out changeset 470d8143b350 (bug 1320179) Backed out changeset ea4f1b3cc7b1 (bug 1320179)
This commit is contained in:
Родитель
06dfd98d7d
Коммит
1f91b9d155
|
@ -929,7 +929,6 @@ CARGO_BUILD = env $(rustflags_override) \
|
|||
CLANG_PATH=$(MOZ_CLANG_PATH) \
|
||||
PKG_CONFIG_ALLOW_CROSS=1 \
|
||||
RUST_BACKTRACE=1 \
|
||||
MOZ_TOPOBJDIR=$(topobjdir) \
|
||||
$(CARGO) build $(cargo_build_flags)
|
||||
|
||||
ifdef RUST_LIBRARY_FILE
|
||||
|
|
|
@ -524,7 +524,6 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
'.h',
|
||||
'.inc',
|
||||
'.py',
|
||||
'.rs',
|
||||
)
|
||||
tier = 'export' if any(f.endswith(export_suffixes) for f in obj.outputs) else 'misc'
|
||||
self._no_skip[tier].add(backend_file.relobjdir)
|
||||
|
|
|
@ -200,7 +200,7 @@
|
|||
LOGLEVEL_DFATAL = LOGLEVEL_FATAL
|
||||
#endif
|
||||
+
|
||||
+#ifdef _WIN32
|
||||
+#ifdef ERROR
|
||||
+ // ERROR is defined as 0 on some windows builds, so `GOOGLE_LOG(ERROR, ...)`
|
||||
+ // expands into `GOOGLE_LOG(0, ...)` which then expands into
|
||||
+ // `someGoogleLogging(LOGLEVEL_0, ...)`. This is not ideal, because the
|
||||
|
@ -208,10 +208,6 @@
|
|||
+ // `someGoogleLogging(LOGLEVEL_ERROR, ...)` instead. The workaround to get
|
||||
+ // everything building is to simply define LOGLEVEL_0 as LOGLEVEL_ERROR and
|
||||
+ // move on with our lives.
|
||||
+ //
|
||||
+ // We also define ERROR the same way that the Windows SDK does for
|
||||
+ // consistency.
|
||||
+#define ERROR 0
|
||||
+ , LOGLEVEL_0 = LOGLEVEL_ERROR
|
||||
+#endif
|
||||
};
|
||||
|
|
|
@ -588,7 +588,7 @@ enum LogLevel {
|
|||
LOGLEVEL_DFATAL = LOGLEVEL_FATAL
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef ERROR
|
||||
// ERROR is defined as 0 on some windows builds, so `GOOGLE_LOG(ERROR, ...)`
|
||||
// expands into `GOOGLE_LOG(0, ...)` which then expands into
|
||||
// `someGoogleLogging(LOGLEVEL_0, ...)`. This is not ideal, because the
|
||||
|
@ -596,10 +596,6 @@ enum LogLevel {
|
|||
// `someGoogleLogging(LOGLEVEL_ERROR, ...)` instead. The workaround to get
|
||||
// everything building is to simply define LOGLEVEL_0 as LOGLEVEL_ERROR and
|
||||
// move on with our lives.
|
||||
//
|
||||
// We also define ERROR the same way that the Windows SDK does for
|
||||
// consistency.
|
||||
#define ERROR 0
|
||||
, LOGLEVEL_0 = LOGLEVEL_ERROR
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -307,7 +307,6 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"geckoservo 0.0.1",
|
||||
"mp4parse_capi 0.7.1",
|
||||
"nserror 0.1.0",
|
||||
"nsstring 0.1.0",
|
||||
"rust_url_capi 0.0.1",
|
||||
"webrender_bindings 0.1.0",
|
||||
|
@ -440,13 +439,6 @@ name = "nom"
|
|||
version = "1.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "nserror"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nsstring 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nsstring"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -305,7 +305,6 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"geckoservo 0.0.1",
|
||||
"mp4parse_capi 0.7.1",
|
||||
"nserror 0.1.0",
|
||||
"nsstring 0.1.0",
|
||||
"rust_url_capi 0.0.1",
|
||||
"webrender_bindings 0.1.0",
|
||||
|
@ -434,13 +433,6 @@ name = "nom"
|
|||
version = "1.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "nserror"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nsstring 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nsstring"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -9,7 +9,6 @@ description = "Shared Rust code for libxul"
|
|||
geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
|
||||
mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" }
|
||||
webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true }
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ extern crate geckoservo;
|
|||
|
||||
extern crate mp4parse_capi;
|
||||
extern crate nsstring;
|
||||
extern crate nserror;
|
||||
extern crate rust_url_capi;
|
||||
#[cfg(feature = "quantum_render")]
|
||||
extern crate webrender_bindings;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -9,17 +9,35 @@
|
|||
#include "nsString.h"
|
||||
#include "prerror.h"
|
||||
|
||||
// Get the GetErrorNameInternal method
|
||||
#include "ErrorNamesInternal.h"
|
||||
namespace {
|
||||
|
||||
struct ErrorEntry
|
||||
{
|
||||
nsresult value;
|
||||
const char * name;
|
||||
};
|
||||
|
||||
#undef ERROR
|
||||
#define ERROR(key, val) {key, #key}
|
||||
|
||||
const ErrorEntry errors[] = {
|
||||
#include "ErrorList.h"
|
||||
};
|
||||
|
||||
#undef ERROR
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
void
|
||||
GetErrorName(nsresult rv, nsACString& name)
|
||||
{
|
||||
if (const char* errorName = GetErrorNameInternal(rv)) {
|
||||
name.AssignASCII(errorName);
|
||||
return;
|
||||
for (size_t i = 0; i < ArrayLength(errors); ++i) {
|
||||
if (errors[i].value == rv) {
|
||||
name.AssignASCII(errors[i].name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool isSecurityError = NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_SECURITY;
|
||||
|
@ -64,15 +82,3 @@ GetErrorName(nsresult rv, nsACString& name)
|
|||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
extern "C" {
|
||||
|
||||
// This is an extern "C" binding for the GetErrorName method which is used by
|
||||
// the nsresult rust bindings in xpcom/rust/nserror.
|
||||
void
|
||||
Gecko_GetErrorName(nsresult aRv, nsACString& aName)
|
||||
{
|
||||
GetErrorName(aRv, aName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,9 +43,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
|||
XPIDL_MODULE = 'xpcom_base'
|
||||
|
||||
EXPORTS += [
|
||||
'!ErrorList.h',
|
||||
'!ErrorNamesInternal.h',
|
||||
'CodeAddressService.h',
|
||||
'ErrorList.h',
|
||||
'nsAgg.h',
|
||||
'nsAlgorithm.h',
|
||||
'nsAutoPtr.h',
|
||||
|
@ -166,16 +165,6 @@ UNIFIED_SOURCES += [
|
|||
'nsWeakReference.cpp',
|
||||
]
|
||||
|
||||
GENERATED_FILES += [
|
||||
"error_list.rs",
|
||||
"ErrorList.h",
|
||||
"ErrorNamesInternal.h",
|
||||
]
|
||||
|
||||
GENERATED_FILES["ErrorList.h"].script = "ErrorList.py:error_list_h"
|
||||
GENERATED_FILES["ErrorNamesInternal.h"].script = "ErrorList.py:error_names_internal_h"
|
||||
GENERATED_FILES["error_list.rs"].script = "ErrorList.py:error_list_rs"
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Linux':
|
||||
SOURCES += [
|
||||
'LinuxUtils.cpp',
|
||||
|
|
|
@ -16,10 +16,135 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* To add error code to your module, you need to do the following:
|
||||
*
|
||||
* 1) Add a module offset code. Add yours to the bottom of the list
|
||||
* right below this comment, adding 1.
|
||||
*
|
||||
* 2) In your module, define a header file which uses one of the
|
||||
* NE_ERROR_GENERATExxxxxx macros. Some examples below:
|
||||
*
|
||||
* #define NS_ERROR_MYMODULE_MYERROR1 NS_ERROR_GENERATE(NS_ERROR_SEVERITY_ERROR,NS_ERROR_MODULE_MYMODULE,1)
|
||||
* #define NS_ERROR_MYMODULE_MYERROR2 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MYMODULE,2)
|
||||
* #define NS_ERROR_MYMODULE_MYERROR3 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MYMODULE,3)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Standard Module Offset Code. Each Module should identify a unique number
|
||||
* and then all errors associated with that module become offsets from the
|
||||
* base associated with that module id. There are 16 bits of code bits for
|
||||
* each module.
|
||||
*/
|
||||
|
||||
#define NS_ERROR_MODULE_XPCOM 1
|
||||
#define NS_ERROR_MODULE_BASE 2
|
||||
#define NS_ERROR_MODULE_GFX 3
|
||||
#define NS_ERROR_MODULE_WIDGET 4
|
||||
#define NS_ERROR_MODULE_CALENDAR 5
|
||||
#define NS_ERROR_MODULE_NETWORK 6
|
||||
#define NS_ERROR_MODULE_PLUGINS 7
|
||||
#define NS_ERROR_MODULE_LAYOUT 8
|
||||
#define NS_ERROR_MODULE_HTMLPARSER 9
|
||||
#define NS_ERROR_MODULE_RDF 10
|
||||
#define NS_ERROR_MODULE_UCONV 11
|
||||
#define NS_ERROR_MODULE_REG 12
|
||||
#define NS_ERROR_MODULE_FILES 13
|
||||
#define NS_ERROR_MODULE_DOM 14
|
||||
#define NS_ERROR_MODULE_IMGLIB 15
|
||||
#define NS_ERROR_MODULE_MAILNEWS 16
|
||||
#define NS_ERROR_MODULE_EDITOR 17
|
||||
#define NS_ERROR_MODULE_XPCONNECT 18
|
||||
#define NS_ERROR_MODULE_PROFILE 19
|
||||
#define NS_ERROR_MODULE_LDAP 20
|
||||
#define NS_ERROR_MODULE_SECURITY 21
|
||||
#define NS_ERROR_MODULE_DOM_XPATH 22
|
||||
/* 23 used to be NS_ERROR_MODULE_DOM_RANGE (see bug 711047) */
|
||||
#define NS_ERROR_MODULE_URILOADER 24
|
||||
#define NS_ERROR_MODULE_CONTENT 25
|
||||
#define NS_ERROR_MODULE_PYXPCOM 26
|
||||
#define NS_ERROR_MODULE_XSLT 27
|
||||
#define NS_ERROR_MODULE_IPC 28
|
||||
#define NS_ERROR_MODULE_SVG 29
|
||||
#define NS_ERROR_MODULE_STORAGE 30
|
||||
#define NS_ERROR_MODULE_SCHEMA 31
|
||||
#define NS_ERROR_MODULE_DOM_FILE 32
|
||||
#define NS_ERROR_MODULE_DOM_INDEXEDDB 33
|
||||
#define NS_ERROR_MODULE_DOM_FILEHANDLE 34
|
||||
#define NS_ERROR_MODULE_SIGNED_JAR 35
|
||||
#define NS_ERROR_MODULE_DOM_FILESYSTEM 36
|
||||
#define NS_ERROR_MODULE_DOM_BLUETOOTH 37
|
||||
#define NS_ERROR_MODULE_SIGNED_APP 38
|
||||
#define NS_ERROR_MODULE_DOM_ANIM 39
|
||||
#define NS_ERROR_MODULE_DOM_PUSH 40
|
||||
#define NS_ERROR_MODULE_DOM_MEDIA 41
|
||||
#define NS_ERROR_MODULE_URL_CLASSIFIER 42
|
||||
/* ErrorResult gets its own module to reduce the chance of someone accidentally
|
||||
defining an error code matching one of the ErrorResult ones. */
|
||||
#define NS_ERROR_MODULE_ERRORRESULT 43
|
||||
|
||||
/* NS_ERROR_MODULE_GENERAL should be used by modules that do not
|
||||
* care if return code values overlap. Callers of methods that
|
||||
* return such codes should be aware that they are not
|
||||
* globally unique. Implementors should be careful about blindly
|
||||
* returning codes from other modules that might also use
|
||||
* the generic base.
|
||||
*/
|
||||
#define NS_ERROR_MODULE_GENERAL 51
|
||||
|
||||
/**
|
||||
* @name Severity Code. This flag identifies the level of warning
|
||||
*/
|
||||
|
||||
#define NS_ERROR_SEVERITY_SUCCESS 0
|
||||
#define NS_ERROR_SEVERITY_ERROR 1
|
||||
|
||||
#include "ErrorList.h"
|
||||
/**
|
||||
* @name Mozilla Code. This flag separates consumers of mozilla code
|
||||
* from the native platform
|
||||
*/
|
||||
|
||||
#define NS_ERROR_MODULE_BASE_OFFSET 0x45
|
||||
|
||||
/* Helpers for defining our enum, to be undef'd later */
|
||||
#define SUCCESS_OR_FAILURE(sev, module, code) \
|
||||
((uint32_t)(sev) << 31) | \
|
||||
((uint32_t)(module + NS_ERROR_MODULE_BASE_OFFSET) << 16) | \
|
||||
(uint32_t)(code)
|
||||
#define SUCCESS(code) \
|
||||
SUCCESS_OR_FAILURE(NS_ERROR_SEVERITY_SUCCESS, MODULE, code)
|
||||
#define FAILURE(code) \
|
||||
SUCCESS_OR_FAILURE(NS_ERROR_SEVERITY_ERROR, MODULE, code)
|
||||
|
||||
/**
|
||||
* @name Standard return values
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
enum class nsresult : uint32_t
|
||||
{
|
||||
#undef ERROR
|
||||
#define ERROR(key, val) key = val
|
||||
#include "ErrorList.h"
|
||||
#undef ERROR
|
||||
};
|
||||
|
||||
/*
|
||||
* enum classes don't place their initializers in the global scope, so we need
|
||||
* constants for compatibility with old code.
|
||||
*/
|
||||
const nsresult
|
||||
#define ERROR(key, val) key = nsresult::key
|
||||
#include "ErrorList.h"
|
||||
#undef ERROR
|
||||
;
|
||||
|
||||
#undef SUCCESS_OR_FAILURE
|
||||
#undef SUCCESS
|
||||
#undef FAILURE
|
||||
|
||||
/**
|
||||
* @name Standard Error Handling Macros
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
[package]
|
||||
name = "nserror"
|
||||
version = "0.1.0"
|
||||
authors = ["Michael Layzell <michael@thelayzells.com>"]
|
||||
license = "MPL-2.0"
|
||||
description = "Rust bindings to xpcom nsresult and NS_ERROR_ values"
|
||||
|
||||
[dependencies]
|
||||
nsstring = { path = "../nsstring" }
|
|
@ -1,62 +0,0 @@
|
|||
extern crate nsstring;
|
||||
|
||||
use nsstring::{nsCString, nsACString};
|
||||
|
||||
/// The type of errors in gecko. This type is currently a type alias, rather
|
||||
/// than a newtype, in order to conform to the C ABI. In future versions of rust
|
||||
/// which support RFC #1758 or similar we may be able to use
|
||||
/// `#[repr(transparent)]` to get a better API for using nsresult.
|
||||
///
|
||||
/// The most unfortunate thing about this current implementation is that `u32`
|
||||
/// and `nsresult` unify.
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type nsresult = u32;
|
||||
|
||||
/// An extension trait which is intended to add methods to `nsresult` types.
|
||||
/// Unfortunately, due to ABI issues, this trait is implemented on all u32
|
||||
/// types. These methods are meaningless on non-nsresult values.
|
||||
pub trait NsresultExt {
|
||||
fn failed(self) -> bool;
|
||||
fn succeeded(self) -> bool;
|
||||
fn to_result(self) -> Result<nsresult, nsresult>;
|
||||
|
||||
/// Get a printable name for the nsresult error code. This function returns
|
||||
/// a nsCString<'static>, which implements `Display`.
|
||||
fn error_name(self) -> nsCString<'static>;
|
||||
}
|
||||
|
||||
impl NsresultExt for nsresult {
|
||||
fn failed(self) -> bool {
|
||||
(self >> 31) != 0
|
||||
}
|
||||
|
||||
fn succeeded(self) -> bool {
|
||||
!self.failed()
|
||||
}
|
||||
|
||||
fn to_result(self) -> Result<nsresult, nsresult> {
|
||||
if self.failed() {
|
||||
Err(self)
|
||||
} else {
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
||||
fn error_name(self) -> nsCString<'static> {
|
||||
let mut cstr = nsCString::new();
|
||||
unsafe {
|
||||
Gecko_GetErrorName(self, &mut *cstr);
|
||||
}
|
||||
cstr
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn Gecko_GetErrorName(rv: nsresult, cstr: *mut nsACString);
|
||||
}
|
||||
|
||||
mod error_list {
|
||||
include!(concat!(env!("MOZ_TOPOBJDIR"), "/xpcom/base/error_list.rs"));
|
||||
}
|
||||
|
||||
pub use error_list::*;
|
Загрузка…
Ссылка в новой задаче