Overview
Comment: | [fx] use objects for communication with SharedWorker (normalization) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | fx | we_sw |
Files: | files | file ages | folders |
SHA3-256: |
8f064f32f6d5cc4fac05e579c31b2f7a |
User & Date: | olr on 2017-08-11 11:06:36 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-11
| ||
11:18 | [fx] initialize only once the grammar checker Leaf check-in: dc16695aca user: olr tags: fx, we_sw | |
11:06 | [fx] use objects for communication with SharedWorker (normalization) check-in: 8f064f32f6 user: olr tags: fx, we_sw | |
07:49 | [fx] fix previous commit check-in: e95b59c0d0 user: olr tags: fx, webext_sharedworker | |
Changes
Modified gc_lang/fr/webext/background.js from [b961377700] to [fa08e42297].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | + - - + + + + - + - - + - - + + - - + + + - - - + + + - + + + + - + - - - - - + + - + - + - + - + - + - + | //let xGCEWorker = new Worker("gce_worker.js"); let xGCESharedWorker = new SharedWorker(browser.extension.getURL("gce_sharedworker.js")); let xGCEWorker = xGCESharedWorker.port; xGCEWorker.onmessage = function (e) { // https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent try { let {sActionDone, result, dInfo, bError} = e.data; |
︙ |
Modified gc_lang/fr/webext/content_scripts/communicate.js from [f425809667] to [56d12bd29b].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + | console.log("[Iframe] [worker]"); console.log(xGCEWorker); //xGCEWorker.port.start(); //console.log("Content script [port started]"); |
︙ |
Modified gc_lang/fr/webext/content_scripts/modify_page.js from [639403006b] to [5573d033c2].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - - - - - - + + + + + + + | /* * Pour effectuer différent action sur la page en cours */ function receivedMessageFromIframe (oEvent) { if (typeof oEvent.data.SharedWorker !== "undefined") { console.log('[Web] received (from iframe (Sharedworker)):', oEvent); |
︙ | |||
45 46 47 48 49 50 51 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + | try { //La frame est chargé on envoie l'initialisation du Sharedworker console.log('[Web] Initialise the worker :s'); console.log('[Web] Domaine ext: '+browser.extension.getURL("")); xFrameContent.postMessage({sPath: browser.extension.getURL(""), sPage: location.origin.trim("/")}, browser.extension.getURL("")); //Un petit test pour débogage ;) console.log('[Web] Test the worker :s'); |
︙ | |||
136 137 138 139 140 141 142 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + - + | createTFPanel(xTextArea); }; xToolbar.appendChild(xTFButton); let xLxgButton = document.createElement("div"); xLxgButton.textContent = "Analyser"; xLxgButton.style = sButtonStyle; xLxgButton.onclick = function() { |
︙ | |||
182 183 184 185 186 187 188 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - | function createLxgPanel (xTextArea) { console.log("Analyse"); } function createGCPanel (xTextArea) { console.log("Correction grammaticale"); |
︙ |
Modified gc_lang/fr/webext/gce_sharedworker.js from [deea68b2b7] to [a479ff2c47].
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + + + + + + + + + + + + + + + + + - + - + - - + + - - + - + - + - + - + - + - + - + - + - + - + - + - + + - + - + + - - + + - + - + + - + - + + - - + + + - - + + + - + - + + - + - + + - + - + + - + - + + - + - + + - + - + + - + | /* Message Event Object https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent */ let xPort = null; function createResponse (sActionDone, result, dInfo, bError=false) { return { "sActionDone": sActionDone, "result": result, // can be of any type "dInfo": dInfo, "bError": bError }; } function createErrorResult (e, sDescr="no description") { return { "sType": "error", "sDescription": sDescr, "sMessage": e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message }; } |
Modified gc_lang/fr/webext/manifest.json from [a125616a8e] to [c15e1717eb].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + | "scripts": [ "background.js" ] }, "content_scripts": [ { "matches": ["*://*/*"], |
︙ |
Modified gc_lang/fr/webext/panel/main.js from [2915144b90] to [43657f7f5c].
︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | + - + + - + + + + + | /* Messages received */ function handleMessage (oMessage, xSender, sendResponse) { console.log(xSender); console.log(oMessage.sCommand); switch(oMessage.sCommand) { case "show_tokens": console.log("show tokens"); addParagraphOfTokens(oMessage.oResult); break; |
︙ |