]> git.wh0rd.org - tt-rss.git/commitdiff
Replace all setTimeout strings with functions
authorAnders Kaseorg <andersk@mit.edu>
Fri, 20 Jan 2017 18:13:31 +0000 (13:13 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Sat, 21 Jan 2017 21:52:27 +0000 (16:52 -0500)
This fixes a cross-site scripting vulnerability.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
js/feedlist.js
js/functions.js
js/prefs.js
js/tt-rss.js
js/viewfeed.js

index c98cfaab5941ed5f7c737bc4f07a7e74dd987d7e..e66a0c1b6a8017bd7fa7f0b589ad7b61573f70de 100644 (file)
@@ -198,7 +198,7 @@ function feedlist_init() {
                loading_set_progress(50);
 
                document.onkeydown = hotkey_handler;
-               setTimeout("hotkey_prefix_timeout()", 5*1000);
+               setTimeout(hotkey_prefix_timeout, 5*1000);
 
                if (!getActiveFeedId()) {
                        viewfeed({feed: -3});
index 384382554b62721b5def286c9a7829e9e7d6c2b0..63ff4121bb8c8fa56b326bd2794d5ebfb2aede20 100755 (executable)
@@ -668,7 +668,7 @@ function hotkey_prefix_timeout() {
                        Element.hide('cmdline');
                }
 
-               setTimeout("hotkey_prefix_timeout()", 1000);
+               setTimeout(hotkey_prefix_timeout, 1000);
 
        } catch  (e) {
                exception_error("hotkey_prefix_timeout", e);
@@ -1325,7 +1325,7 @@ function unsubscribeFeed(feed_id, title) {
                                                updateFeedList();
                                        } else {
                                                if (feed_id == getActiveFeedId())
-                                                       setTimeout("viewfeed({feed:-5})", 100);
+                                                       setTimeout(function() { viewfeed({feed:-5}) }, 100);
 
                                                if (feed_id < 0) updateFeedList();
                                        }
index 69e779d4505dfa8ddcc5e14b143a03c8cc9a0579..23d43f366d6433ccaab7f7e5131d400411f5a2d4 100755 (executable)
@@ -901,10 +901,10 @@ function init_second_stage() {
                if (method == 'editFeed') {
                        var param = getURLParam('methodparam');
 
-                       window.setTimeout('editFeed(' + param + ')', 100);
+                       window.setTimeout(function() { editFeed(param) }, 100);
                }
 
-               setTimeout("hotkey_prefix_timeout()", 5*1000);
+               setTimeout(hotkey_prefix_timeout, 5*1000);
 
        } catch (e) {
                exception_error("init_second_stage", e);
index 26982608e7d3c625f9e09899a2cb6d24179fcfdf..20e0fc5a9714b7b23d734b9c04b84f5de0a9e474 100644 (file)
@@ -159,7 +159,7 @@ function viewCurrentFeed(method) {
 function timeout() {
        if (getInitParam("bw_limit") != "1") {
                request_counters();
-               setTimeout("timeout()", 60*1000);
+               setTimeout(timeout, 60*1000);
        }
 }
 
@@ -654,7 +654,7 @@ function init_second_stage() {
 
                if (getInitParam("simple_update")) {
                        console.log("scheduling simple feed updater...");
-                       window.setTimeout("update_random_feed()", 30*1000);
+                       window.setTimeout(update_random_feed, 30*1000);
                }
 
        } catch (e) {
@@ -1130,7 +1130,7 @@ function update_random_feed() {
                        parameters: "op=rpc&method=updateRandomFeed",
                        onComplete: function(transport) {
                                handle_rpc_json(transport, true);
-                               window.setTimeout("update_random_feed()", 30*1000);
+                               window.setTimeout(update_random_feed, 30*1000);
                        } });
 
        } catch (e) {
index feb397157c04555269e357cc9519237e08decb71..007728a1004ca64c319e5f5e60d440b3b846b54c 100755 (executable)
@@ -2315,7 +2315,7 @@ function updateFloatingTitle(unread_only) {
 function catchupCurrentBatchIfNeeded() {
        if (catchup_id_batch.length > 0) {
                window.clearTimeout(catchup_timeout_id);
-               catchup_timeout_id = window.setTimeout('catchupBatchedArticles()', 1000);
+               catchup_timeout_id = window.setTimeout(catchupBatchedArticles, 1000);
 
                if (catchup_id_batch.length >= 10) {
                        catchupBatchedArticles();