Skip to content

Commit 631fd54

Browse files
committed
Update to Chrome 51.0.2704.103 / CEF 3.2704.1432.g60b3718...
It builds fine, but there is an error when running (Issue cztomczak#231). Use prebuilt binaries from Spotify automated builds. Changes in API that break backward compatibility: * Remove 'accept_lang' arg in JavascriptDialogHandler.OnJavascriptDialog() * Remove LifespanHandler.RunModal() Other changes in API: * Add Browser.TryCloseBrowser()
1 parent eea3d8c commit 631fd54

File tree

142 files changed

+4210
-1407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+4210
-1407
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
__NOTES__:
99
* Repository rewritten on 2016-02-15 to reduce its size.
1010
Please clone it again.
11-
* Master branch is a work in progress. When building use the cefpython31
12-
branch.
11+
* Master branch is a work in progress. The last stable release
12+
is in the cefpython31 branch.
1313

1414
Table of contents:
1515
* [Introduction](#introduction)
1616
* [Compatibility](#compatibility)
1717
* [Downloads](#downloads)
1818
* [Support](#support)
19+
* [Changes in API during updates](#changes-in-api-during-updates)
1920
* [Donate](#donate)
2021

2122

@@ -49,6 +50,7 @@ On Win/Mac you can install from PyPI using this command:
4950
__New releases RSS/Atom feed__
5051
To be notified of new releases subscribe to this [Atom feed](https://github.com/cztomczak/cefpython/releases.atom).
5152

53+
5254
## Support
5355

5456
* API docs are in the [docs/api/](docs/api/) directory
@@ -58,6 +60,16 @@ To be notified of new releases subscribe to this [Atom feed](https://github.com/
5860
* Please do not ask questions in the Issue Tracker
5961

6062

63+
## Changes in API during updates
64+
65+
CEF Python depends on CEF and API breaks are inevitable when updating
66+
to a newer CEF. When updating cefpython to a new version go to the
67+
[GitHub Releases](https://github.com/cztomczak/cefpython/releases) page
68+
and check release notes for all the releases that appeared between
69+
your old version and the new version. Look for lists named
70+
"Changes in API that break backward compatibility".
71+
72+
6173
## Donate
6274

6375
If you would like to support general CEF Python development efforts by making a donation see the [Donations](../../wiki/Donations) wiki page.

docs/api/API-index.md

Lines changed: 281 additions & 281 deletions
Large diffs are not rendered by default.

docs/api/Browser.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Table of contents:
6868
* [StopLoad](#stopload)
6969
* [StopFinding](#stopfinding)
7070
* [ToggleFullscreen](#togglefullscreen)
71+
* [TryCloseBrowser](#tryclosebrowser)
7172
* [WasResized](#wasresized)
7273
* [WasHidden](#washidden)
7374

@@ -126,8 +127,7 @@ information.
126127
| --- | --- |
127128
| __Return__ | bool |
128129

129-
Explicitly close the developer tools window if one exists for this browser
130-
instance.
130+
Explicitly close the associated DevTools browser, if any.
131131

132132

133133
### ExecuteFunction
@@ -706,7 +706,13 @@ Change the zoom level to the specified value. Specify 0.0 to reset the zoom leve
706706
| --- | --- |
707707
| __Return__ | void |
708708

709-
Open developer tools in a popup window.
709+
Open developer tools (DevTools) in its own browser. The DevTools browser
710+
will remain associated with this browser. If the DevTools browser is
711+
already open then it will be focused, in which case the |windowInfo|,
712+
|client| and |settings| parameters will be ignored. If |inspect_element_at|
713+
is non-empty then the element at the specified (x,y) location will be
714+
inspected. The |windowInfo| parameter will be ignored if this browser is
715+
wrapped in a CefBrowserView.
710716

711717

712718
### StartDownload
@@ -749,6 +755,16 @@ Switch between fullscreen mode / windowed mode. To check whether in fullscreen m
749755
This function is Windows-only.
750756

751757

758+
### TryCloseBrowser
759+
760+
Helper for closing a browser. Call this method from the top-level window
761+
close handler. Internally this calls CloseBrowser(false) if the close has
762+
not yet been initiated. This method returns false while the close is
763+
pending and true after the close has completed. See CloseBrowser() and
764+
CefLifeSpanHandler::DoClose() documentation for additional usage
765+
information. This method must be called on the browser process UI thread.
766+
767+
752768
### WasResized
753769

754770
| | |

docs/api/JavascriptDialogHandler.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,32 @@ pressed. The |userInput| value should be specified for prompt dialogs.
4343
| --- | --- |
4444
| browser | [Browser](Browser.md) |
4545
| origin_url | str |
46-
| accept_lang | str |
4746
| dialog_type | int |
4847
| message_text | str |
4948
| default_prompt_text | str |
5049
| callback | JavascriptDialogCallback |
5150
| suppress_message[0] | bool& |
5251
| __Return__ | bool |
5352

54-
Called to run a JavaScript dialog. If |origin_url| and |accept_lang| are
55-
non-empty they can be passed to the CefFormatUrlForSecurityDisplay function
56-
to retrieve a secure and user-friendly display string. The
57-
|default_prompt_text| value will be specified for prompt dialogs only. Set
58-
|suppress_message| to true and return false to suppress the message
59-
(suppressing messages is preferable to immediately executing the callback
60-
as this is used to detect presumably malicious behavior like spamming alert
61-
messages in onbeforeunload). Set |suppress_message| to false and return
62-
false to use the default implementation (the default implementation will
63-
show one modal dialog at a time and suppress any additional dialog requests
64-
until the displayed dialog is dismissed). Return true if the application
65-
will use a custom dialog or if the callback has been executed immediately.
66-
Custom dialogs may be either modal or modeless. If a custom dialog is used
67-
the application must execute |callback| once the custom dialog is
68-
dismissed.
69-
70-
The `dialog_type` param may be one of:
71-
```
72-
cefpython.JSDIALOGTYPE_ALERT
73-
cefpython.JSDIALOGTYPE_CONFIRM
74-
cefpython.JSDIALOGTYPE_PROMPT
75-
```
53+
Called to run a JavaScript dialog. If |origin_url| is non-empty it can be
54+
passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure
55+
and user-friendly display string. The |default_prompt_text| value will be
56+
specified for prompt dialogs only. Set |suppress_message| to true and
57+
return false to suppress the message (suppressing messages is preferable to
58+
immediately executing the callback as this is used to detect presumably
59+
malicious behavior like spamming alert messages in onbeforeunload). Set
60+
|suppress_message| to false and return false to use the default
61+
implementation (the default implementation will show one modal dialog at a
62+
time and suppress any additional dialog requests until the displayed dialog
63+
is dismissed). Return true if the application will use a custom dialog or
64+
if the callback has been executed immediately. Custom dialogs may be either
65+
modal or modeless. If a custom dialog is used the application must execute
66+
|callback| once the custom dialog is dismissed.
67+
68+
The `dialog_type` constants available in the cefpython module:
69+
* JSDIALOGTYPE_ALERT
70+
* JSDIALOGTYPE_CONFIRM
71+
* JSDIALOGTYPE_PROMPT
7672

7773

7874
### OnBeforeUnloadJavascriptDialog

docs/api/LifespanHandler.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Table of contents:
1212
* [Callbacks](#callbacks)
1313
* [OnBeforePopup](#onbeforepopup)
1414
* [_OnAfterCreated](#_onaftercreated)
15-
* [RunModal](#runmodal)
1615
* [DoClose](#doclose)
1716
* [OnBeforeClose](#onbeforeclose)
1817

@@ -52,7 +51,9 @@ popup browser optionally modify |windowInfo|, |client|, |browserSettings| and
5251
browser return true. The |client| and |settings| values will default to the
5352
source browser's values. If the |no_javascript_access| value is set to
5453
false the new browser will not be scriptable and may not be hosted in the
55-
same renderer process as the source browser.
54+
same renderer process as the source browser. Any modifications to
55+
|windowInfo| will be ignored if the parent browser is wrapped in a
56+
CefBrowserView.
5657

5758
Note that if you return True and create the popup window yourself, then
5859
the popup window and parent window will not be able to script each other.
@@ -79,23 +80,12 @@ There will be no "window.opener" property available in the popup window.
7980
| browser | [Browser](Browser.md) |
8081
| __Return__ | void |
8182

82-
Called after a new browser is created.
83+
Called after a new browser is created. This callback will be the first
84+
notification that references |browser|.
8385

8486
This callback will be executed during browser creation, thus you must call [cefpython](cefpython.md).SetGlobalClientCallback() to use it. The callback name was prefixed with "`_`" to distinguish this special behavior.
8587

8688

87-
### RunModal
88-
89-
| Parameter | Type |
90-
| --- | --- |
91-
| browser | [Browser](Browser.md) |
92-
| __Return__ | bool |
93-
94-
Called when a modal window is about to display and the modal loop should
95-
begin running. Return false to use the default modal loop implementation or
96-
true to use a custom implementation.
97-
98-
9989
### DoClose
10090

10191
| Parameter | Type |
@@ -125,7 +115,6 @@ See complete description of this callback in [cef_life_span_handler.h]
125115

126116
Called just before a browser is destroyed. Release all references to the
127117
browser object and do not attempt to execute any methods on the browser
128-
object after this callback returns. If this is a modal window and a custom
129-
modal loop implementation was provided in RunModal() this callback should
130-
be used to exit the custom modal loop. See DoClose() documentation for
118+
object after this callback returns. This callback will be the last
119+
notification that references |browser|. See DoClose() documentation for
131120
additional usage information.

docs/api/LoadHandler.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Table of contents:
3333
Called when the loading state has changed. This callback will be executed
3434
twice. Once when loading is initiated either programmatically or by user
3535
action, and once when loading is terminated due to completion, cancellation
36-
of failure.
36+
of failure. It will be called before any calls to OnLoadStart and after all
37+
calls to OnLoadError and/or OnLoadEnd.
3738

3839

3940
### OnLoadStart
@@ -48,8 +49,8 @@ Called when the browser begins loading a frame. The |frame| value will
4849
never be empty -- call the IsMain() method to check if this frame is the
4950
main frame. Multiple frames may be loading at the same time. Sub-frames may
5051
start or continue loading after the main frame load has ended. This method
51-
may not be called for a particular frame if the load request for that frame
52-
fails. For notification of overall browser load status use
52+
will always be called for all frames irrespective of whether the request
53+
completes successfully. For notification of overall browser load status use
5354
[DisplayHandler](DisplayHandler.md).`OnLoadingStateChange` instead.
5455

5556

@@ -76,7 +77,8 @@ never be empty -- call the IsMain() method to check if this frame is the
7677
main frame. Multiple frames may be loading at the same time. Sub-frames may
7778
start or continue loading after the main frame load has ended. This method
7879
will always be called for all frames irrespective of whether the request
79-
completes successfully.
80+
completes successfully. For notification of overall browser load status use
81+
OnLoadingStateChange instead.
8082

8183
This event behaves like window.onload, it waits for all the content to load (e.g. images), there is currently no callback for a DOMContentLoaded event, see [Issue #32](../issues/32).
8284

docs/api/ResourceHandler.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ returns false. If the response length is known set `responseLengthOut[0]`
5858
to a positive value and ReadResponse() will be called until it returns
5959
false or the specified number of bytes have been read. Use the |response|
6060
object to set the mime type, http status code and other optional header
61-
values. To redirect the request to a new URL set `redirectUrlOut[0]` to the new url.
61+
values. To redirect the request to a new URL set `redirectUrlOut[0]` to the new
62+
URL. If an error occured while setting up the request you can call
63+
SetError() on |response| to indicate the error condition.
6264

6365

6466
### ReadResponse

src/browser.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cdef PyBrowser GetPyBrowserById(int browserId):
2323
cdef PyBrowser GetPyBrowser(CefRefPtr[CefBrowser] cefBrowser):
2424
global g_pyBrowsers
2525
if <void*>cefBrowser == NULL or not cefBrowser.get():
26+
# noinspection PyUnresolvedReferences
2627
Debug("GetPyBrowser(): returning None")
2728
return None
2829

@@ -36,10 +37,12 @@ cdef PyBrowser GetPyBrowser(CefRefPtr[CefBrowser] cefBrowser):
3637

3738
for identifier, pyBrowser in g_pyBrowsers.items():
3839
if not pyBrowser.cefBrowser.get():
40+
# noinspection PyUnresolvedReferences
3941
Debug("GetPyBrowser(): removing an empty CefBrowser reference, "
4042
"browserId=%s" % identifier)
4143
del g_pyBrowsers[identifier]
4244

45+
# noinspection PyUnresolvedReferences
4346
Debug("GetPyBrowser(): creating new PyBrowser, browserId=%s" % browserId)
4447
pyBrowser = PyBrowser()
4548
pyBrowser.cefBrowser = cefBrowser
@@ -84,11 +87,14 @@ cdef void RemovePyBrowser(int browserId) except *:
8487
# This is the last browser remaining.
8588
if g_sharedRequestContext.get():
8689
# A similar release is done in Shutdown and CloseBrowser.
90+
# noinspection PyUnresolvedReferences
8791
Debug("RemovePyBrowser: releasing shared request context")
8892
g_sharedRequestContext.Assign(NULL)
93+
# noinspection PyUnresolvedReferences
8994
Debug("del g_pyBrowsers[%s]" % browserId)
9095
del g_pyBrowsers[browserId]
9196
else:
97+
# noinspection PyUnresolvedReferences
9298
Debug("RemovePyBrowser() FAILED: browser not found, id = %s" \
9399
% browserId)
94100

@@ -183,7 +189,7 @@ cdef class PyBrowser:
183189
# NOTE: OnAfterCreated not included as it must be set using
184190
# cefpython.SetGlobalClientCallback().
185191
self.allowedClientCallbacks += ["OnBeforePopup",
186-
"RunModal", "DoClose", "OnBeforeClose"]
192+
"DoClose", "OnBeforeClose"]
187193
# RenderHandler
188194
self.allowedClientCallbacks += ["GetRootScreenRect",
189195
"GetViewRect", "GetScreenPoint", "GetScreenInfo",
@@ -561,6 +567,9 @@ cdef class PyBrowser:
561567
cpdef py_bool IsMouseCursorChangeDisabled(self):
562568
return self.GetCefBrowserHost().get().IsMouseCursorChangeDisabled()
563569

570+
cpdef py_bool TryCloseBrowser(self):
571+
return self.GetCefBrowserHost().get().TryCloseBrowser()
572+
564573
cpdef py_void WasResized(self):
565574
self.GetCefBrowserHost().get().WasResized()
566575

0 commit comments

Comments
 (0)