Project

General

Profile

« Previous | Next » 

Revision dcfc78b0

Added by jahoti about 2 years ago

Stop using the nonce consistently for a URL

Nonces are now randomly generated, either in the page (for non-HTTP(S) pages)
or by a background module which stores them by tab and frame IDs. In order to
support the increased variance in nonce-generating methods and allow them to
be loaded from the background, handle_page_actions is now invoked separately
according to (non-)blocking mechanism.

View differences:

content/page_actions.js
7 7

  
8 8
/*
9 9
 * IMPORTS_START
10
 * IMPORT CONNECTION_TYPE
11 10
 * IMPORT browser
12 11
 * IMPORT report_script
13 12
 * IMPORT report_settings
......
55 54
    report_script(script_text);
56 55
}
57 56

  
58
function handle_page_actions(script_nonce) {
57
function handle_page_actions(script_nonce, port) { // Add port as an argument so we can "pre-receive" a nonce in main.js
59 58
    document.addEventListener("DOMContentLoaded", document_loaded);
60
    port = browser.runtime.connect({name : CONNECTION_TYPE.PAGE_ACTIONS});
61 59
    port.onMessage.addListener(handle_message);
62 60
    port.postMessage({url: document.URL});
63 61

  

Also available in: Unified diff