Skip to content

Commit 322389d

Browse files
committed
Fix build errors (#403)
Change cef.Request.Flags options.
1 parent b1769a5 commit 322389d

File tree

9 files changed

+83
-30
lines changed

9 files changed

+83
-30
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ webcache/
99
examples/screenshot.png
1010
examples/pyinstaller/build/
1111
examples/pyinstaller/dist/
12+
examples/GPUCache/
13+
examples/blob_storage/
14+
examples/webrtc_event_logs/
15+
unittests/GPUCache/
16+
unittests/blob_storage/
17+
unittests/webrtc_event_logs/

api/Request.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,20 @@ be removed and ignored.
166166

167167
Get the flags used in combination with WebRequest.
168168

169-
Available flags (access via `cefpython.Request.Flags["xxx"]`):
169+
Available flags below. Can be accessed via `cefpython.Request.Flags["xxx"]`.
170+
These flags are also defined as constants starting with "UR_FLAG_"
171+
in the cefpython module.requ
170172

171173
* **None** - Default behavior.
172-
* **SkipCache** - If set the cache will be skipped when handling the request.
173-
Setting this value is equivalent to specifying the "Cache-Control: no-cache"
174-
request header. Setting this value in combination with UR_FLAG_ONLY_FROM_CACHE
175-
will cause the request to fail.
176-
* **AllowCachedCredentials** - If set user name, password, and cookies may be
177-
sent with the request, and cookies may be saved from the response.
174+
* **SkipCache** - If set the cache will be skipped when handling the request. Setting this value is equivalent to specifying the "Cache-Control: no-cache" request header. Setting this value in combination with UR_FLAG_ONLY_FROM_CACHE will cause the request to fail.
175+
* **OnlyFromCache** - If set the request will fail if it cannot be served from the cache (or some equivalent local store). Setting this value is equivalent to specifying the "Cache-Control: only-if-cached" request header. Setting this value in combination with UR_FLAG_SKIP_CACHE will cause the request to fail.
176+
* **AllowStoredCredentials** - If set user name, password, and cookies may be sent with the request, and cookies may be saved from the response.
178177
* **ReportUploadProgress** - If set upload progress events will be generated when a request has a body.
179178
* **NoDownloadData** - If set the [WebRequestClient](WebRequestClient.md)::`OnDownloadData` method will not be called.
180179
* **NoRetryOn5xx** - If set 5xx redirect errors will be propagated to the observer instead of automatically re-tried. This currently only applies for requests originated in the browser process.
180+
* **StopOnRedirect** - If set 3XX responses will cause the fetch to halt immediately rather than continue through the redirect.
181+
182+
181183

182184

183185
### SetFlags

docs/Migration-guide.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Table of contents:
4343
* [v66+ Window transparency changes](#v66-window-transparency-changes)
4444
* [v66+ BrowserSettings.javascript_open_windows_disallowed option was removed](#v66-browsersettingsjavascript_open_windows_disallowed-option-was-removed)
4545
* [v66+ Threads removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE](#v66-threads-removed-tid_db-tid_process_launcher-tid_cache)
46+
* [v66+ cef.Request.Flags changed](#v66-cefrequestflags-changed)
4647

4748

4849

@@ -361,3 +362,17 @@ were removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE.
361362
New threads were added, see cefpython.[PostTask](../api/cefpython.md#posttask)
362363
description for a complete list of threads.
363364

365+
366+
## v66+ cef.Request.Flags changed
367+
368+
Flags removed:
369+
- AllowCachedCredentials
370+
371+
Flags added:
372+
- OnlyFromCache
373+
- AllowStoredCredentials
374+
- StopOnRedirect
375+
376+
See a complete list of flags in the description of
377+
cef.Request.[GetFlags](../api/Request.md#getflags) method.
378+

src/cef_v59..v66_changes.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ internal/cef_types.h
5353
- + Added threads: TID_FILE_BACKGROUND, TID_FILE_USER_VISIBLE
5454

5555

56+
+ cef_urlrequest.h
57+
- + cef_urlrequest_flags_t:
58+
- + Add: UR_FLAG_ONLY_FROM_CACHE, UR_FLAG_ALLOW_STORED_CREDENTIALS,
59+
UR_FLAG_STOP_ON_REDIRECT
60+
- + Remove: UR_FLAG_ALLOW_CACHED_CREDENTIALS
61+
62+
5663
NEW FEATURES
5764
------------
5865

@@ -133,9 +140,6 @@ cef_server.h
133140
- CefServer: a web server that supports HTTP and WebSocket requests
134141
- CefServerHandler
135142

136-
cef_urlrequest.h
137-
- ResponseWasCached
138-
139143
cef_v8.h
140144
- CefV8ArrayBufferReleaseCallback
141145
- CefV8Value new methods:

src/extern/cef/cef_types.pxd

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ cdef extern from "include/internal/cef_types.h":
124124
TID_UI,
125125
TID_FILE_BACKGROUND
126126
TID_FILE,
127-
TID_FILE_USER_VISIBLE
127+
TID_FILE_USER_VISIBLE,
128128
TID_FILE_USER_BLOCKING,
129129
TID_IO,
130130
TID_RENDERER
@@ -160,12 +160,14 @@ cdef extern from "include/internal/cef_types.h":
160160

161161
# WebRequest
162162
ctypedef enum cef_urlrequest_flags_t:
163-
UR_FLAG_NONE = 0,
164-
UR_FLAG_SKIP_CACHE = 1 << 0,
165-
UR_FLAG_ALLOW_CACHED_CREDENTIALS = 1 << 1,
166-
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
167-
UR_FLAG_NO_DOWNLOAD_DATA = 1 << 6,
168-
UR_FLAG_NO_RETRY_ON_5XX = 1 << 7,
163+
UR_FLAG_NONE = 0,
164+
UR_FLAG_SKIP_CACHE = 1 << 0,
165+
UR_FLAG_ONLY_FROM_CACHE = 1 << 1,
166+
UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 << 2,
167+
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
168+
UR_FLAG_NO_DOWNLOAD_DATA = 1 << 4,
169+
UR_FLAG_NO_RETRY_ON_5XX = 1 << 5,
170+
UR_FLAG_STOP_ON_REDIRECT = 1 << 6,
169171

170172
# CefListValue, CefDictionaryValue - types.
171173
ctypedef enum cef_value_type_t:

src/request.pyx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,35 @@
44

55
include "cefpython.pyx"
66

7+
# noinspection PyUnresolvedReferences
8+
cimport cef_types
9+
10+
# cef_urlrequest_flags_t
11+
UR_FLAG_NONE = cef_types.UR_FLAG_NONE
12+
UR_FLAG_SKIP_CACHE = cef_types.UR_FLAG_SKIP_CACHE
13+
UR_FLAG_ONLY_FROM_CACHE = cef_types.UR_FLAG_ONLY_FROM_CACHE
14+
UR_FLAG_ALLOW_STORED_CREDENTIALS = cef_types.UR_FLAG_ALLOW_STORED_CREDENTIALS
15+
UR_FLAG_REPORT_UPLOAD_PROGRESS = cef_types.UR_FLAG_REPORT_UPLOAD_PROGRESS
16+
UR_FLAG_NO_DOWNLOAD_DATA = cef_types.UR_FLAG_NO_DOWNLOAD_DATA
17+
UR_FLAG_NO_RETRY_ON_5XX = cef_types.UR_FLAG_NO_RETRY_ON_5XX
18+
UR_FLAG_STOP_ON_REDIRECT = cef_types.UR_FLAG_STOP_ON_REDIRECT
19+
20+
721
class Request:
22+
# TODO: autocomplete in PyCharm doesn't work for these flags
823
Flags = {
924
"None": cef_types.UR_FLAG_NONE,
1025
"SkipCache": cef_types.UR_FLAG_SKIP_CACHE,
11-
"AllowCachedCredentials": cef_types.UR_FLAG_ALLOW_CACHED_CREDENTIALS,
12-
"AllowCookies": 0, # keep for BC
26+
"OnlyFromCache": cef_types.UR_FLAG_ONLY_FROM_CACHE,
27+
"AllowCachedCredentials": 0, # keep dummy for BC
28+
"AllowStoredCredentials": cef_types.UR_FLAG_ALLOW_STORED_CREDENTIALS,
29+
"AllowCookies": 0, # keep dummy for BC
1330
"ReportUploadProgress": cef_types.UR_FLAG_REPORT_UPLOAD_PROGRESS,
14-
"ReportLoadTiming": 0, # keep for BC
15-
"ReportRawHeaders": 0, # keep for BC
31+
"ReportLoadTiming": 0, # keep dummy for BC
32+
"ReportRawHeaders": 0, # keep dummy for BC
1633
"NoDownloadData": cef_types.UR_FLAG_NO_DOWNLOAD_DATA,
1734
"NoRetryOn5xx": cef_types.UR_FLAG_NO_RETRY_ON_5XX,
35+
"StopOnRedirect": cef_types.UR_FLAG_STOP_ON_REDIRECT,
1836
}
1937

2038
def __init__(self):

src/subprocess/print_handler_gtk.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
#include <gtk/gtk.h>
1414
#include <gtk/gtkunixprint.h>
1515

16+
#include "include/base/cef_bind.h"
1617
#include "include/base/cef_logging.h"
1718
#include "include/base/cef_macros.h"
1819
#include "include/wrapper/cef_helpers.h"
20+
#include "include/wrapper/cef_closure_task.h"
1921

2022
namespace {
2123

src/subprocess/print_handler_gtk.patch

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git print_handler_gtk.cc print_handler_gtk.cc
2-
index 9a822b7a..cfccbaff 100644
2+
index 9a822b7a..18c8c1c4 100644
33
--- print_handler_gtk.cc
44
+++ print_handler_gtk.cc
5-
@@ -1,9 +1,12 @@
5+
@@ -1,22 +1,23 @@
66
+// COPIED from upstream "cef/tests/cefclient/browser/" directory
77
+// with minor modifications. See the .patch file in current directory.
88
+
@@ -16,18 +16,22 @@ index 9a822b7a..cfccbaff 100644
1616

1717
#include <vector>
1818

19-
@@ -14,10 +17,6 @@
19+
#include <gtk/gtk.h>
20+
#include <gtk/gtkunixprint.h>
21+
22+
+#include "include/base/cef_bind.h"
23+
#include "include/base/cef_logging.h"
2024
#include "include/base/cef_macros.h"
2125
#include "include/wrapper/cef_helpers.h"
22-
26+
-
2327
-#include "tests/cefclient/browser/root_window.h"
2428
-
2529
-namespace client {
26-
-
30+
+#include "include/wrapper/cef_closure_task.h"
31+
2732
namespace {
2833

29-
// CUPS Duplex attribute and values.
30-
@@ -431,10 +430,12 @@ struct ClientPrintHandlerGtk::PrintHandler {
34+
@@ -431,10 +432,12 @@ struct ClientPrintHandlerGtk::PrintHandler {
3135
// Returns the GtkWindow* for the browser. Will return NULL when using the
3236
// Views framework.
3337
GtkWindow* GetWindow() {
@@ -44,7 +48,7 @@ index 9a822b7a..cfccbaff 100644
4448
return NULL;
4549
}
4650

47-
@@ -626,5 +627,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler(
51+
@@ -626,5 +629,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler(
4852
DCHECK(it != print_handler_map_.end());
4953
return it->second;
5054
}

src/utils.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ g_browserProcessThreads = [
1919
TID_UI,
2020
TID_FILE_BACKGROUND,
2121
TID_FILE,
22-
TID_FILE_USER_VISIBLE
22+
TID_FILE_USER_VISIBLE,
2323
TID_FILE_USER_BLOCKING,
2424
TID_IO,
2525
]

0 commit comments

Comments
 (0)