Sync ephy's master

This commit is contained in:
jun7 2018-06-14 01:56:16 +09:00
parent d0ac830658
commit cd76ec7d11

View File

@ -182,44 +182,29 @@ ephy_uri_tester_is_matched (EphyUriTester *tester,
const char *page_uri, const char *page_uri,
gboolean whitelist) gboolean whitelist)
{ {
/* gpointer is_matched;
char *value;
*/
GHashTable *urlcache = tester->urlcache; GHashTable *urlcache = tester->urlcache;
if (whitelist) if (whitelist)
urlcache = tester->whitelisted_urlcache; urlcache = tester->whitelisted_urlcache;
/* Check cached URLs first. */ /* Check cached URLs first. */
/* if (g_hash_table_lookup_extended (urlcache, req_uri, NULL, &is_matched))
if ((value = g_hash_table_lookup (urlcache, req_uri))) return GPOINTER_TO_INT (is_matched);
return GPOINTER_TO_INT (value);
*/
char f;
if ((f = GPOINTER_TO_INT(g_hash_table_lookup(urlcache, req_uri))))
return f == 'T';
/* Look for a match either by key or by pattern. */ /* Look for a match either by key or by pattern. */
if (ephy_uri_tester_is_matched_by_key (tester, opts, req_uri, page_uri, whitelist)) { if (ephy_uri_tester_is_matched_by_key (tester, opts, req_uri, page_uri, whitelist)) {
/* g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("1"));
*/
g_hash_table_insert(urlcache, g_strdup(req_uri), GINT_TO_POINTER('T'));
return TRUE; return TRUE;
} }
/* Matching by pattern is pretty expensive, so do it if needed only. */ /* Matching by pattern is pretty expensive, so do it if needed only. */
if (ephy_uri_tester_is_matched_by_pattern (tester, req_uri, page_uri, whitelist)) { if (ephy_uri_tester_is_matched_by_pattern (tester, req_uri, page_uri, whitelist)) {
/*
g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE)); g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
*/
g_hash_table_insert(urlcache, g_strdup(req_uri), GINT_TO_POINTER('T'));
return TRUE; return TRUE;
} }
/* /* No match. */
g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (FALSE)); g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (FALSE));
*/
g_hash_table_insert(urlcache, g_strdup(req_uri), GINT_TO_POINTER('F'));
return FALSE; return FALSE;
} }