update to 25.2 rc2, depend on the latest webkit (#1375834)

This commit is contained in:
Jan Synacek 2017-02-27 10:36:59 +01:00
parent 54f4bcd0bd
commit 1116d1bc15
6 changed files with 317 additions and 379 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@
/emacs-25.1-rc1.tar.xz /emacs-25.1-rc1.tar.xz
/emacs-25.1-rc2.tar.xz /emacs-25.1-rc2.tar.xz
/emacs-25.1.tar.xz /emacs-25.1.tar.xz
/emacs-25.2-rc2.tar.xz

View File

@ -1,274 +0,0 @@
Backport the following upstream patches:
http://git.savannah.gnu.org/cgit/emacs.git/patch/?id=9afea93ed536fb9110ac62b413604cf4c4302199
http://git.savannah.gnu.org/cgit/emacs.git/patch/?id=71ca4f6a43bad06192cbc4bb8c7a2d69c179b7b0
http://git.savannah.gnu.org/cgit/emacs.git/patch/?id=1047496722a58ef5b736dae64d32adeb58c5055c
http://git.savannah.gnu.org/cgit/emacs.git/patch/?id=96ac0c3ebce825e60595794f99e703ec8302e240
http://git.savannah.gnu.org/cgit/emacs.git/patch/?id=43986d16fb6ad78a627250e14570ea70bdb1f23a
Resolves: #1398718
commit 9afea93ed536fb9110ac62b413604cf4c4302199
Author: Eli Zaretskii <eliz@gnu.org>
Date: Sun Oct 23 16:54:00 2016 +0300
Attempt to catch reads from a buffer that is relocated
* src/xml.c (parse_region): Add assertion to ensure buffer text is
not relocated while libxml2 is reading it. (Bug#24764)
diff --git a/src/xml.c b/src/xml.c
index b1175d1..1ef84bd 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -181,6 +181,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url,
Lisp_Object result = Qnil;
const char *burl = "";
ptrdiff_t istart, iend, istart_byte, iend_byte;
+ unsigned char *buftext;
xmlCheckVersion (LIBXML_VERSION);
@@ -200,18 +201,24 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url,
burl = SSDATA (base_url);
}
+ buftext = BYTE_POS_ADDR (istart_byte);
if (htmlp)
- doc = htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
+ doc = htmlReadMemory ((char *)buftext,
iend_byte - istart_byte, burl, "utf-8",
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
HTML_PARSE_NOBLANKS);
else
- doc = xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
+ doc = xmlReadMemory ((char *)buftext,
iend_byte - istart_byte, burl, "utf-8",
XML_PARSE_NONET|XML_PARSE_NOWARNING|
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
+ /* If the assertion below fails, malloc was called inside the above
+ libxml2 functions, and ralloc.c caused relocation of buffer text,
+ so we could have read from unrelated memory. */
+ eassert (buftext == BYTE_POS_ADDR (istart_byte));
+
if (doc != NULL)
{
Lisp_Object r = Qnil;
commit 71ca4f6a43bad06192cbc4bb8c7a2d69c179b7b0
Author: Eli Zaretskii <eliz@gnu.org>
Date: Sun Oct 23 19:52:56 2016 +0300
Avoid relocating buffers while libxml2 reads its text
* src/xml.c (parse_region) [REL_ALLOC]: Freeze the ralloc arena
while libxml2 reads the current buffer's text. (Bug#24764)
diff --git a/src/xml.c b/src/xml.c
index 1ef84bd..612b16c 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -202,6 +202,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url,
}
buftext = BYTE_POS_ADDR (istart_byte);
+#ifdef REL_ALLOC
+ /* Prevent ralloc.c from relocating the current buffer while libxml2
+ functions below read its text. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
if (htmlp)
doc = htmlReadMemory ((char *)buftext,
iend_byte - istart_byte, burl, "utf-8",
@@ -214,6 +219,9 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url,
XML_PARSE_NONET|XML_PARSE_NOWARNING|
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
/* If the assertion below fails, malloc was called inside the above
libxml2 functions, and ralloc.c caused relocation of buffer text,
so we could have read from unrelated memory. */
commit 1047496722a58ef5b736dae64d32adeb58c5055c
Author: Eli Zaretskii <eliz@gnu.org>
Date: Mon Oct 24 16:59:34 2016 +0300
Another fix for using pointer to buffer text
* src/search.c (Freplace_match): Move the call to BYTE_POS_ADDR
after the call to xpalloc, to avoid the danger of buffer text
relocation after its address was taken. (Bug#24358)
diff --git a/src/search.c b/src/search.c
index 5c04916..f8acd40 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2640,6 +2640,7 @@ since only regular expressions have distinguished subexpressions. */)
const unsigned char *add_stuff = NULL;
ptrdiff_t add_len = 0;
ptrdiff_t idx = -1;
+ ptrdiff_t begbyte;
if (str_multibyte)
{
@@ -2702,11 +2703,10 @@ since only regular expressions have distinguished subexpressions. */)
set up ADD_STUFF and ADD_LEN to point to it. */
if (idx >= 0)
{
- ptrdiff_t begbyte = CHAR_TO_BYTE (search_regs.start[idx]);
+ begbyte = CHAR_TO_BYTE (search_regs.start[idx]);
add_len = CHAR_TO_BYTE (search_regs.end[idx]) - begbyte;
if (search_regs.start[idx] < GPT && GPT < search_regs.end[idx])
move_gap_both (search_regs.start[idx], begbyte);
- add_stuff = BYTE_POS_ADDR (begbyte);
}
/* Now the stuff we want to add to SUBSTED
@@ -2719,6 +2719,11 @@ since only regular expressions have distinguished subexpressions. */)
add_len - (substed_alloc_size - substed_len),
STRING_BYTES_BOUND, 1);
+ /* We compute this after the call to xpalloc, because that
+ could cause buffer text be relocated when ralloc.c is used. */
+ if (idx >= 0)
+ add_stuff = BYTE_POS_ADDR (begbyte);
+
/* Now add to the end of SUBSTED. */
if (add_stuff)
{
commit 96ac0c3ebce825e60595794f99e703ec8302e240
Author: Eli Zaretskii <eliz@gnu.org>
Date: Mon Oct 24 21:37:20 2016 +0300
Yet another fix for using pointers into buffer text
* src/search.c (boyer_moore): Update pointers to buffer text
after call to set_search_regs. (Bug#24358)
diff --git a/src/search.c b/src/search.c
index f8acd40..b50e7f0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2014,13 +2014,20 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
cursor += dirlen - i - direction; /* fix cursor */
if (i + direction == 0)
{
- ptrdiff_t position, start, end;
+ ptrdiff_t position, start, end, cursor_off;
cursor -= direction;
position = pos_byte + cursor - p2 + ((direction > 0)
? 1 - len_byte : 0);
+ /* set_search_regs might call malloc, which could
+ cause ralloc.c relocate buffer text. We need to
+ update pointers into buffer text due to that. */
+ cursor_off = cursor - p2;
set_search_regs (position, len_byte);
+ p_limit = BYTE_POS_ADDR (limit);
+ p2 = BYTE_POS_ADDR (pos_byte);
+ cursor = p2 + cursor_off;
if (NILP (Vinhibit_changing_match_data))
{
commit 43986d16fb6ad78a627250e14570ea70bdb1f23a
Author: Noam Postavsky <npostavs@gmail.com>
Date: Mon Oct 24 21:22:07 2016 -0400
Inhibit buffer relocation during regex searches
* src/search.c (looking_at_1, fast_looking_at, search_buffer): Prevent
relocation of buffer contents during calls to re_search_2. This ensures
the pointers into buffer text won't be invalidated by
r_alloc_sbrk (called from malloc with configurations where
REL_ALLOC=yes).
diff --git a/src/search.c b/src/search.c
index fa5ac44..15504be 100644
--- a/src/search.c
+++ b/src/search.c
@@ -308,12 +308,20 @@ looking_at_1 (Lisp_Object string, bool posix)
re_match_object = Qnil;
+#ifdef REL_ALLOC
+ /* Prevent ralloc.c from relocating the current buffer while
+ searching it. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2,
PT_BYTE - BEGV_BYTE,
(NILP (Vinhibit_changing_match_data)
? &search_regs : NULL),
ZV_BYTE - BEGV_BYTE);
immediate_quit = 0;
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
if (i == -2)
matcher_overflow ();
@@ -561,8 +569,16 @@ fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte,
buf = compile_pattern (regexp, 0, Qnil, 0, multibyte);
immediate_quit = 1;
+#ifdef REL_ALLOC
+ /* Prevent ralloc.c from relocating the current buffer while
+ searching it. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
len = re_match_2 (buf, (char *) p1, s1, (char *) p2, s2,
pos_byte, NULL, limit_byte);
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
immediate_quit = 0;
return len;
@@ -1213,6 +1229,12 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
}
re_match_object = Qnil;
+#ifdef REL_ALLOC
+ /* Prevent ralloc.c from relocating the current buffer while
+ searching it. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
+
while (n < 0)
{
ptrdiff_t val;
@@ -1254,6 +1276,9 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
else
{
immediate_quit = 0;
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return (n);
}
n++;
@@ -1296,11 +1321,17 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
else
{
immediate_quit = 0;
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return (0 - n);
}
n--;
}
immediate_quit = 0;
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return (pos);
}
else /* non-RE case */

View File

@ -1,94 +0,0 @@
commit 1dd54e3eef7543720eff161457677a35fae2435c
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue Oct 11 13:06:42 2016 -0700
Work around Samba bug with ':' in symlink contents
* src/filelock.c (current_lock_owner): When reading the contents
of a lock, treat the UTF-8 for U+F022 as if it were ':' (Bug#24656).
diff --git a/src/filelock.c b/src/filelock.c
index a2e1df9..d4dfc1d 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -72,8 +72,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Normally use a symbolic link to represent a lock.
The strategy: to lock a file FN, create a symlink .#FN in FN's
- directory, with link data `user@host.pid'. This avoids a single
- mount (== failure) point for lock files.
+ directory, with link data USER@HOST.PID:BOOT. This avoids a single
+ mount (== failure) point for lock files. The :BOOT is omitted if
+ the boot time is not available.
When the host in the lock data is the current host, we can check if
the pid is valid with kill.
@@ -102,13 +103,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
This is compatible with the locking scheme used by Interleaf (which
has contributed this implementation for Emacs), and was designed by
- Ethan Jacobson, Kimbo Mundy, and others.
-
- --karl@cs.umb.edu/karl@hq.ileaf.com.
+ Karl Berry, Ethan Jacobson, Kimbo Mundy, and others.
On some file systems, notably those of MS-Windows, symbolic links
- do not work well, so instead of a symlink .#FN -> 'user@host.pid',
- the lock is a regular file .#FN with contents 'user@host.pid'. To
+ do not work well, so instead of a symlink .#FN -> USER@HOST.PID:BOOT,
+ the lock is a regular file .#FN with contents USER@HOST.PID:BOOT. To
establish a lock, a nonce file is created and then renamed to .#FN.
On MS-Windows this renaming is atomic unless the lock is forcibly
acquired. On other systems the renaming is atomic if the lock is
@@ -289,8 +288,8 @@ enum { MAX_LFINFO = 8 * 1024 };
typedef struct
{
- /* Location of '@', '.', ':' in USER. If there's no colon, COLON
- points to the end of USER. */
+ /* Location of '@', '.', and ':' (or equivalent) in USER. If there's
+ no colon or equivalent, COLON points to the end of USER. */
char *at, *dot, *colon;
/* Lock file contents USER@HOST.PID with an optional :BOOT_TIME
@@ -548,7 +547,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
if (!dot)
return -1;
- /* The PID is everything from the last `.' to the `:'. */
+ /* The PID is everything from the last '.' to the ':' or equivalent. */
if (! c_isdigit (dot[1]))
return -1;
errno = 0;
@@ -556,7 +555,8 @@ current_lock_owner (lock_info_type *owner, char *lfname)
if (errno == ERANGE)
pid = -1;
- /* After the `:', if there is one, comes the boot time. */
+ /* After the ':' or equivalent, if there is one, comes the boot time. */
+ char *boot = owner->colon + 1;
switch (owner->colon[0])
{
case 0:
@@ -564,10 +564,19 @@ current_lock_owner (lock_info_type *owner, char *lfname)
lfinfo_end = owner->colon;
break;
+ case '\357':
+ /* Treat "\357\200\242" (U+F022 in UTF-8) as if it were ":".
+ This works around a bug in Samba, which can mistakenly
+ transliterate ':' to U+F022 in symlink contents (Bug#24656).
+ See <https://bugzilla.redhat.com/show_bug.cgi?id=1271407#c8>. */
+ if (! (boot[0] == '\200' && boot[1] == '\242'))
+ return -1;
+ boot += 2;
+ /* Fall through. */
case ':':
- if (! c_isdigit (owner->colon[1]))
+ if (! c_isdigit (boot[0]))
return -1;
- boot_time = strtoimax (owner->colon + 1, &lfinfo_end, 10);
+ boot_time = strtoimax (boot, &lfinfo_end, 10);
break;
default:

303
emacs-xwidget.patch Normal file
View File

@ -0,0 +1,303 @@
commit d781662873f228b110a128f7a2b6583a4d5e0a3a
Author: Ricardo Wurmus <rekado@elephly.net>
Date: Tue Oct 25 23:00:35 2016 -0700
xwidget: Use WebKit2 API
* configure.ac: Check for webkit2gtk-4.0.
* src/xwidget.c: Adjust to use WebKit2 API.
* lisp/xwidget.el (xwidget-webkit-callback): Adjust matches for
`xwidget-event-type'.
diff --git a/configure.ac b/configure.ac
index 998ff52..46fd434 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2630,8 +2630,8 @@ if test "$with_xwidgets" != "no"; then
test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none" ||
AC_MSG_ERROR([xwidgets requested but gtk3 not used.])
- WEBKIT_REQUIRED=1.4.0
- WEBKIT_MODULES="webkitgtk-3.0 >= $WEBKIT_REQUIRED"
+ WEBKIT_REQUIRED=2.12
+ WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
HAVE_XWIDGETS=$HAVE_WEBKIT
test $HAVE_XWIDGETS = yes ||
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 7a0ca8b..1bae6bb 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -187,7 +187,7 @@ XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
"error: callback called for xwidget with dead buffer")
(with-current-buffer (xwidget-buffer xwidget)
(let* ((strarg (nth 3 last-input-event)))
- (cond ((eq xwidget-event-type 'document-load-finished)
+ (cond ((eq xwidget-event-type 'load-changed)
(xwidget-log "webkit finished loading: '%s'"
(xwidget-webkit-get-title xwidget))
;;TODO - check the native/internal scroll
@@ -196,8 +196,7 @@ XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
(rename-buffer (format "*xwidget webkit: %s *"
(xwidget-webkit-get-title xwidget)))
(pop-to-buffer (current-buffer)))
- ((eq xwidget-event-type
- 'navigation-policy-decision-requested)
+ ((eq xwidget-event-type 'decide-policy)
(if (string-match ".*#\\(.*\\)" strarg)
(xwidget-webkit-show-id-or-named-element
xwidget
diff --git a/src/xwidget.c b/src/xwidget.c
index f5f4da0..78349a8 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -98,13 +98,7 @@ along with GNU Emacs. If not, see <http
#include <wchar.h>
-#include <webkit/webkitwebview.h>
-#include <webkit/webkitwebplugindatabase.h>
-#include <webkit/webkitwebplugin.h>
-#include <webkit/webkitglobals.h>
-#include <webkit/webkitwebnavigationaction.h>
-#include <webkit/webkitdownload.h>
-#include <webkit/webkitwebpolicydecision.h>
+#include <webkit2/webkit2.h>
static struct xwidget *
allocate_xwidget (void)
@@ -50,34 +47,16 @@ allocate_xwidget_view (void)
static struct xwidget_view *xwidget_view_lookup (struct xwidget *,
struct window *);
-static void webkit_document_load_finished_cb (WebKitWebView *, WebKitWebFrame *,
- gpointer);
-static gboolean webkit_download_cb (WebKitWebView *, WebKitDownload *, gpointer);
+static void webkit_view_load_changed_cb (WebKitWebView *,
+ WebKitLoadEvent,
+ gpointer);
+static gboolean webkit_download_cb (WebKitWebContext *, WebKitDownload *, gpointer);
static gboolean
-webkit_mime_type_policy_typedecision_requested_cb (WebKitWebView *,
- WebKitWebFrame *,
- WebKitNetworkRequest *,
- gchar *,
- WebKitWebPolicyDecision *,
- gpointer);
-
-static gboolean
-webkit_new_window_policy_decision_requested_cb (WebKitWebView *,
- WebKitWebFrame *,
- WebKitNetworkRequest *,
- WebKitWebNavigationAction *,
- WebKitWebPolicyDecision *,
- gpointer);
-
-static gboolean
-webkit_navigation_policy_decision_requested_cb (WebKitWebView *,
- WebKitWebFrame *,
- WebKitNetworkRequest *,
- WebKitWebNavigationAction *,
- WebKitWebPolicyDecision *,
- gpointer);
-
+webkit_decide_policy_cb (WebKitWebView *,
+ WebKitPolicyDecision *,
+ WebKitPolicyDecisionType,
+ gpointer);
DEFUN ("make-xwidget",
@@ -168,29 +147,17 @@ Returns the newly constructed xwidget, or nil if construction fails. */)
if (EQ (xw->type, Qwebkit))
{
g_signal_connect (G_OBJECT (xw->widget_osr),
- "document-load-finished",
- G_CALLBACK (webkit_document_load_finished_cb), xw);
+ "load-changed",
+ G_CALLBACK (webkit_view_load_changed_cb), xw);
- g_signal_connect (G_OBJECT (xw->widget_osr),
- "download-requested",
+ g_signal_connect (G_OBJECT (webkit_web_context_get_default ()),
+ "download-started",
G_CALLBACK (webkit_download_cb), xw);
g_signal_connect (G_OBJECT (xw->widget_osr),
- "mime-type-policy-decision-requested",
- G_CALLBACK
- (webkit_mime_type_policy_typedecision_requested_cb),
- xw);
-
- g_signal_connect (G_OBJECT (xw->widget_osr),
- "new-window-policy-decision-requested",
- G_CALLBACK
- (webkit_new_window_policy_decision_requested_cb),
- xw);
-
- g_signal_connect (G_OBJECT (xw->widget_osr),
- "navigation-policy-decision-requested",
+ "decide-policy",
G_CALLBACK
- (webkit_navigation_policy_decision_requested_cb),
+ (webkit_decide_policy_cb),
xw);
}
@@ -284,81 +251,83 @@ store_xwidget_event_string (struct xwidget *xw, const char *eventname,
kbd_buffer_store_event (&event);
}
-/* TODO deprecated, use load-status. */
void
-webkit_document_load_finished_cb (WebKitWebView *webkitwebview,
- WebKitWebFrame *arg1,
- gpointer data)
+webkit_view_load_changed_cb (WebKitWebView *webkitwebview,
+ WebKitLoadEvent load_event,
+ gpointer data)
{
- struct xwidget *xw = g_object_get_data (G_OBJECT (webkitwebview),
- XG_XWIDGET);
-
- store_xwidget_event_string (xw, "document-load-finished", "");
+ switch (load_event) {
+ case WEBKIT_LOAD_FINISHED:
+ {
+ struct xwidget *xw = g_object_get_data (G_OBJECT (webkitwebview),
+ XG_XWIDGET);
+ store_xwidget_event_string (xw, "load-changed", "");
+ break;
+ }
+ default:
+ break;
+ }
}
gboolean
-webkit_download_cb (WebKitWebView *webkitwebview,
+webkit_download_cb (WebKitWebContext *webkitwebcontext,
WebKitDownload *arg1,
gpointer data)
{
- struct xwidget *xw = g_object_get_data (G_OBJECT (webkitwebview),
+ WebKitWebView *view = webkit_download_get_web_view(arg1);
+ WebKitURIRequest *request = webkit_download_get_request(arg1);
+ struct xwidget *xw = g_object_get_data (G_OBJECT (view),
XG_XWIDGET);
- store_xwidget_event_string (xw, "download-requested",
- webkit_download_get_uri (arg1));
+
+ store_xwidget_event_string (xw, "download-started",
+ webkit_uri_request_get_uri(request));
return FALSE;
}
static gboolean
-webkit_mime_type_policy_typedecision_requested_cb (WebKitWebView *webView,
- WebKitWebFrame *frame,
- WebKitNetworkRequest *request,
- gchar *mimetype,
- WebKitWebPolicyDecision *policy_decision,
- gpointer user_data)
+webkit_decide_policy_cb (WebKitWebView *webView,
+ WebKitPolicyDecision *decision,
+ WebKitPolicyDecisionType type,
+ gpointer user_data)
{
- /* This function makes webkit send a download signal for all unknown
- mime types. TODO: Defer the decision to Lisp, so that it's
- possible to make Emacs handle mime text for instance. */
- if (!webkit_web_view_can_show_mime_type (webView, mimetype))
+ switch (type) {
+ case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
+ /* This function makes webkit send a download signal for all unknown
+ mime types. TODO: Defer the decision to Lisp, so that it's
+ possible to make Emacs handle mime text for instance. */
{
- webkit_web_policy_decision_download (policy_decision);
- return TRUE;
+ WebKitResponsePolicyDecision *response =
+ WEBKIT_RESPONSE_POLICY_DECISION (decision);
+ if (!webkit_response_policy_decision_is_mime_type_supported (response))
+ {
+ webkit_policy_decision_download (decision);
+ return TRUE;
+ }
+ else
+ return FALSE;
+ break;
}
- else
+ case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
+ case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
+ {
+ WebKitNavigationPolicyDecision *navigation_decision =
+ WEBKIT_NAVIGATION_POLICY_DECISION (decision);
+ WebKitNavigationAction *navigation_action =
+ webkit_navigation_policy_decision_get_navigation_action (navigation_decision);
+ WebKitURIRequest *request =
+ webkit_navigation_action_get_request (navigation_action);
+
+ struct xwidget *xw = g_object_get_data (G_OBJECT (webView), XG_XWIDGET);
+ store_xwidget_event_string (xw, "decide-policy",
+ webkit_uri_request_get_uri (request));
+ return FALSE;
+ break;
+ }
+ default:
return FALSE;
+ }
}
-static gboolean
-webkit_new_window_policy_decision_requested_cb (WebKitWebView *webView,
- WebKitWebFrame *frame,
- WebKitNetworkRequest *request,
- WebKitWebNavigationAction *navigation_action,
- WebKitWebPolicyDecision *policy_decision,
- gpointer user_data)
-{
- struct xwidget *xw = g_object_get_data (G_OBJECT (webView), XG_XWIDGET);
- webkit_web_navigation_action_get_original_uri (navigation_action);
-
- store_xwidget_event_string (xw, "new-window-policy-decision-requested",
- webkit_web_navigation_action_get_original_uri
- (navigation_action));
- return FALSE;
-}
-
-static gboolean
-webkit_navigation_policy_decision_requested_cb (WebKitWebView *webView,
- WebKitWebFrame *frame,
- WebKitNetworkRequest *request,
- WebKitWebNavigationAction *navigation_action,
- WebKitWebPolicyDecision *policy_decision,
- gpointer user_data)
-{
- struct xwidget *xw = g_object_get_data (G_OBJECT (webView), XG_XWIDGET);
- store_xwidget_event_string (xw, "navigation-policy-decision-requested",
- webkit_web_navigation_action_get_original_uri
- (navigation_action));
- return FALSE;
-}
/* For gtk3 offscreen rendered widgets. */
static gboolean
@@ -599,8 +568,13 @@ DEFUN ("xwidget-webkit-execute-script",
{
WEBKIT_FN_INIT ();
CHECK_STRING (script);
- webkit_web_view_execute_script (WEBKIT_WEB_VIEW (xw->widget_osr),
- SSDATA (script));
+ // TODO: provide callback function to do something with the return
+ // value! This allows us to get rid of the title hack.
+ webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (xw->widget_osr),
+ SSDATA (script),
+ NULL, /*cancellable*/
+ NULL, /*callback*/
+ NULL /*user data*/);
return Qnil;
}

View File

@ -4,12 +4,13 @@
Summary: GNU Emacs text editor Summary: GNU Emacs text editor
Name: emacs Name: emacs
Epoch: 1 Epoch: 1
Version: 25.1 Version: 25.2
Release: 4%{?dist} Release: 0.1.rc2%{?dist}
License: GPLv3+ and CC0-1.0 License: GPLv3+ and CC0-1.0
URL: http://www.gnu.org/software/emacs/ URL: http://www.gnu.org/software/emacs/
Group: Applications/Editors Group: Applications/Editors
Source0: ftp://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz #Source0: ftp://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz
Source0: ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-%{version}-rc2.tar.xz
Source1: emacs.desktop Source1: emacs.desktop
Source3: dotemacs.el Source3: dotemacs.el
Source4: site-start.el Source4: site-start.el
@ -25,10 +26,8 @@ Patch1: emacs-spellchecker.patch
# Fix for default PDF viewer bug #971162 # Fix for default PDF viewer bug #971162
Patch2: emacs-pdf-default.patch Patch2: emacs-pdf-default.patch
Patch3: emacs-system-crypto-policies.patch Patch3: emacs-system-crypto-policies.patch
# rhbz#1271407 (upstreamed) # http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d781662873f228b110a128f7a2b6583a4d5e0a3a
Patch4: emacs-samba.patch Patch4: emacs-xwidget.patch
# rhbz#1398718 (upstreamed)
Patch5: emacs-auctex-compilation.patch
BuildRequires: atk-devel BuildRequires: atk-devel
BuildRequires: cairo-devel BuildRequires: cairo-devel
@ -69,7 +68,7 @@ BuildRequires: desktop-file-utils
BuildRequires: libacl-devel BuildRequires: libacl-devel
BuildRequires: gtk3-devel BuildRequires: gtk3-devel
BuildRequires: webkitgtk3-devel BuildRequires: webkitgtk4-devel
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python3-devel BuildRequires: python3-devel
@ -171,8 +170,7 @@ packages that add functionality to Emacs.
%patch1 -p1 -b .spellchecker %patch1 -p1 -b .spellchecker
%patch2 -p1 -b .pdf-default.patch %patch2 -p1 -b .pdf-default.patch
%patch3 -p1 -b .system-crypto-policies %patch3 -p1 -b .system-crypto-policies
%patch4 -p1 -b .samba %patch4 -p1
%patch5 -p1 -b .auctex-compilation
autoconf autoconf
# We prefer our emacs.desktop file # We prefer our emacs.desktop file
@ -453,6 +451,10 @@ update-desktop-database &> /dev/null || :
%dir %{_datadir}/emacs/site-lisp/site-start.d %dir %{_datadir}/emacs/site-lisp/site-start.d
%changelog %changelog
* Mon Feb 27 2017 Jan Synáček <jsynacek@redhat.com> - 25.2-0.1-rc2
- update to 25.2 rc2
- depend on the latest webkit (#1375834)
* Wed Feb 01 2017 Stephen Gallagher <sgallagh@redhat.com> - 25.1-4 * Wed Feb 01 2017 Stephen Gallagher <sgallagh@redhat.com> - 25.1-4
- Add missing %%license macro - Add missing %%license macro

View File

@ -1 +1 @@
4f3d42fb22823a659e16bfa89078a74c emacs-25.1.tar.xz SHA512 (emacs-25.2-rc2.tar.xz) = 95e1b127beec5a6c8c5b54545b489e28d8c31051d82d6603ec8907b3cdfddd8a16a3b00287932bf8d69babfce44aa464236593bcb4e20864c823830f32f7be49