mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 23:47:43 +01:00
Verify that libcef build revision and API/header revision match when initializing CEF (issue #431).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@386 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
c18ea9200d
commit
3f2735909a
@ -10,6 +10,7 @@
|
||||
'include/cef_nplugin.h',
|
||||
'include/cef_nplugin_capi.h',
|
||||
'include/cef_runnable.h',
|
||||
'include/cef_version.h',
|
||||
'include/cef_wrapper.h',
|
||||
'include/internal/cef_build.h',
|
||||
'include/internal/cef_export.h',
|
||||
|
@ -157,7 +157,9 @@ CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
||||
// 2.1 of RFC 1123. These URLs will be canonicalized to "scheme://host/path" in
|
||||
// the simplest case and "scheme://username:password@host:port/path" in the most
|
||||
// explicit case. For example, "scheme:host/path" and "scheme:///host/path" will
|
||||
// both be canonicalized to "scheme://host/path".
|
||||
// both be canonicalized to "scheme://host/path". The origin of a standard
|
||||
// scheme URL is the combination of scheme, host and port (i.e.,
|
||||
// "scheme://host:port" in the most explicit case).
|
||||
//
|
||||
// For non-standard scheme URLs only the "scheme:" component is parsed and
|
||||
// canonicalized. The remainder of the URL will be passed to the handler as-is.
|
||||
@ -165,8 +167,14 @@ CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
||||
// scheme URLs cannot be used as a target for form submission.
|
||||
//
|
||||
// If |is_local| is true (1) the scheme will be treated as local (i.e., with the
|
||||
// same security rules as those applied to "file" URLs). This means that normal
|
||||
// pages cannot link to or access URLs of this scheme.
|
||||
// same security rules as those applied to "file" URLs). Normal pages cannot
|
||||
// link to or access local URLs. Also, by default, local URLs can only perform
|
||||
// XMLHttpRequest calls to the same URL (origin + path) that originated the
|
||||
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
|
||||
// the same origin set the CefSettings.file_access_from_file_urls_allowed value
|
||||
// to true (1). To allow XMLHttpRequest calls from a local URL to all origins
|
||||
// set the CefSettings.universal_access_from_file_urls_allowed value to true
|
||||
// (1).
|
||||
//
|
||||
// If |is_display_isolated| is true (1) the scheme will be treated as display-
|
||||
// isolated. This means that pages cannot display these URLs unless they are
|
||||
@ -206,7 +214,7 @@ CEF_EXPORT int cef_clear_scheme_handler_factories();
|
||||
// Add an entry to the cross-origin access whitelist.
|
||||
//
|
||||
// The same-origin policy restricts how scripts hosted from different origins
|
||||
// (scheme + domain) can communicate. By default, scripts can only access
|
||||
// (scheme + domain + port) can communicate. By default, scripts can only access
|
||||
// resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes
|
||||
// (but no other schemes) can use the "Access-Control-Allow-Origin" header to
|
||||
// allow cross-origin requests. For example, https://source.example.com can make
|
||||
@ -225,9 +233,14 @@ CEF_EXPORT int cef_clear_scheme_handler_factories();
|
||||
// |source_origin| URL (like http://www.example.com) will be allowed access to
|
||||
// all resources hosted on the specified |target_protocol| and |target_domain|.
|
||||
// If |allow_target_subdomains| is true (1) access will also be allowed to all
|
||||
// subdomains of the target domain. This function may be called on any thread.
|
||||
// Returns false (0) if |source_origin| is invalid or the whitelist cannot be
|
||||
// accessed.
|
||||
// subdomains of the target domain.
|
||||
//
|
||||
// This function cannot be used to bypass the restrictions on local or display
|
||||
// isolated schemes. See the comments on CefRegisterCustomScheme for more
|
||||
// information.
|
||||
//
|
||||
// This function may be called on any thread. Returns false (0) if
|
||||
// |source_origin| is invalid or the whitelist cannot be accessed.
|
||||
///
|
||||
CEF_EXPORT int cef_add_cross_origin_whitelist_entry(
|
||||
const cef_string_t* source_origin, const cef_string_t* target_protocol,
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "browser_webkit_glue.h"
|
||||
#include "browser_webkit_init.h"
|
||||
#include "cef_context.h"
|
||||
#include "../version.h"
|
||||
#include "include/cef_version.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
@ -18,6 +19,13 @@
|
||||
|
||||
CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine()
|
||||
{
|
||||
int build_revision = cef_build_revision();
|
||||
if (build_revision != CEF_REVISION) {
|
||||
// The libcef build revision does not match the CEF API revision.
|
||||
DCHECK(FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cef_command_line_t* impl = cef_command_line_create();
|
||||
if(impl)
|
||||
return CefCommandLineCToCpp::Wrap(impl);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "include/cef.h"
|
||||
#include "include/cef_capi.h"
|
||||
#include "include/cef_version.h"
|
||||
#include "include/cef_nplugin.h"
|
||||
#include "include/cef_nplugin_capi.h"
|
||||
#include "cef_logging.h"
|
||||
@ -38,6 +39,11 @@
|
||||
#include "base/string_split.h"
|
||||
|
||||
|
||||
CEF_EXPORT int cef_build_revision()
|
||||
{
|
||||
return CEF_REVISION;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings)
|
||||
{
|
||||
CefSettings settingsObj;
|
||||
|
@ -9,8 +9,8 @@
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#include "include/cef_version.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "../version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
@ -39,8 +39,8 @@ END
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#include ""include/version.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""version.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "include/cef_capi.h"
|
||||
#include "include/cef_nplugin.h"
|
||||
#include "include/cef_nplugin_capi.h"
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef_dll/cpptoc/content_filter_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/domevent_listener_cpptoc.h"
|
||||
@ -38,6 +39,13 @@
|
||||
|
||||
bool CefInitialize(const CefSettings& settings)
|
||||
{
|
||||
int build_revision = cef_build_revision();
|
||||
if (build_revision != CEF_REVISION) {
|
||||
// The libcef build revision does not match the CEF API revision.
|
||||
DCHECK(FALSE);
|
||||
return false;
|
||||
}
|
||||
|
||||
return cef_initialize(&settings)?true:false;
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,9 @@ def format_translation_includes(body):
|
||||
"""
|
||||
result = ''
|
||||
|
||||
if body.find('cef_build_revision()') > 0:
|
||||
result += '#include "include/cef_version.h"\n'
|
||||
|
||||
# identify what CppToC classes are being used
|
||||
p = re.compile('([A-Za-z0-9_]{1,})CppToC')
|
||||
list = sorted(set(p.findall(body)))
|
||||
|
@ -15,7 +15,7 @@ RunAction(cef_dir, gyper)
|
||||
|
||||
print "\nGenerating CEF version header file..."
|
||||
gyper = [ 'python', 'tools/make_version_header.py',
|
||||
'--header', 'version.h',
|
||||
'--header', 'include/cef_version.h',
|
||||
'--version', '../chrome/VERSION' ]
|
||||
RunAction(cef_dir, gyper)
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
@echo off
|
||||
..\third_party\python_26\python.exe tools\make_version_header.py --header version.h --version ../chrome/VERSION
|
||||
..\third_party\python_26\python.exe tools\make_version_header.py --header include\cef_version.h --version ../chrome/VERSION
|
||||
|
@ -54,22 +54,65 @@ def write_svn_header(header, version):
|
||||
else:
|
||||
oldcontents = ''
|
||||
|
||||
newcontents = '// This file is generated by the make_version_header.py tool.\n'+\
|
||||
'#ifndef _VERSION_H\n'+\
|
||||
'#define _VERSION_H\n'+\
|
||||
'\n'+\
|
||||
year = get_year()
|
||||
|
||||
newcontents = '// Copyright (c) '+year+' Marshall A. Greenblatt. All rights reserved.\n'+\
|
||||
'//\n'+\
|
||||
'// Redistribution and use in source and binary forms, with or without\n'+\
|
||||
'// modification, are permitted provided that the following conditions are\n'+\
|
||||
'// met:\n'+\
|
||||
'//\n'+\
|
||||
'// * Redistributions of source code must retain the above copyright\n'+\
|
||||
'// notice, this list of conditions and the following disclaimer.\n'+\
|
||||
'// * Redistributions in binary form must reproduce the above\n'+\
|
||||
'// copyright notice, this list of conditions and the following disclaimer\n'+\
|
||||
'// in the documentation and/or other materials provided with the\n'+\
|
||||
'// distribution.\n'+\
|
||||
'// * Neither the name of Google Inc. nor the name Chromium Embedded\n'+\
|
||||
'// Framework nor the names of its contributors may be used to endorse\n'+\
|
||||
'// or promote products derived from this software without specific prior\n'+\
|
||||
'// written permission.\n'+\
|
||||
'//\n'+\
|
||||
'// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n'+\
|
||||
'// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n'+\
|
||||
'// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n'+\
|
||||
'// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n'+\
|
||||
'// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n'+\
|
||||
'// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n'+\
|
||||
'// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n'+\
|
||||
'// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n'+\
|
||||
'// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n'+\
|
||||
'// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n'+\
|
||||
'// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'+\
|
||||
'//\n'+\
|
||||
'// ---------------------------------------------------------------------------\n'+\
|
||||
'//\n'+\
|
||||
'// This file is generated by the make_version_header.py tool.\n'+\
|
||||
'//\n\n'+\
|
||||
'#ifndef _CEF_VERSION_H\n'+\
|
||||
'#define _CEF_VERSION_H\n\n'+\
|
||||
'#define CEF_REVISION ' + get_revision() + '\n'+\
|
||||
'#define COPYRIGHT_YEAR ' + get_year() + '\n'+\
|
||||
'\n'+\
|
||||
'#define COPYRIGHT_YEAR ' + year + '\n\n'+\
|
||||
'#define CHROME_VERSION_MAJOR ' + chrome['MAJOR'] + '\n'+\
|
||||
'#define CHROME_VERSION_MINOR ' + chrome['MINOR'] + '\n'+\
|
||||
'#define CHROME_VERSION_BUILD ' + chrome['BUILD'] + '\n'+\
|
||||
'#define CHROME_VERSION_PATCH ' + chrome['PATCH'] + '\n'+\
|
||||
'\n'+\
|
||||
'#define CHROME_VERSION_PATCH ' + chrome['PATCH'] + '\n\n'+\
|
||||
'#define DO_MAKE_STRING(p) #p\n'+\
|
||||
'#define MAKE_STRING(p) DO_MAKE_STRING(p)\n'+\
|
||||
'\n'+\
|
||||
'#endif\n'
|
||||
'#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\
|
||||
'#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\
|
||||
'#ifdef __cplusplus\n'+\
|
||||
'extern "C" {\n'+\
|
||||
'#endif\n\n'+\
|
||||
'#include "internal/cef_export.h"\n\n'+\
|
||||
'///\n'+\
|
||||
'// Returns the CEF build revision of the libcef library.\n'+\
|
||||
'///\n'+\
|
||||
'CEF_EXPORT int cef_build_revision();\n\n'+\
|
||||
'#ifdef __cplusplus\n'+\
|
||||
'}\n'+\
|
||||
'#endif\n\n'+\
|
||||
'#endif // APSTUDIO_HIDDEN_SYMBOLS\n\n'+\
|
||||
'#endif // _CEF_VERSION_H\n'
|
||||
if newcontents != oldcontents:
|
||||
write_file(header, newcontents)
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user