|
261 | 261 |
|
262 | 262 | computeChildPolicy({url, contextUrl}, sender) {
|
263 | 263 | let {tab, frameId} = sender;
|
264 |
| - let cookieStoreId = (tab)? tab.cookieStoreId : "default"; |
265 |
| - var policy = ns.policy; |
266 |
| - debug("computing policy", cookieStoreId, ns.contextStore); |
267 |
| - if ( |
268 |
| - cookieStoreId && |
269 |
| - !cookieStoreId.toLowerCase().includes("default") && //exclude firefox-default |
270 |
| - ns.contextStore && |
271 |
| - ns.contextStore.policies.hasOwnProperty(cookieStoreId) |
272 |
| - ) { |
273 |
| - policy = ns.contextStore.policies[cookieStoreId]; |
| 264 | + let tabId = tab ? tab.id : -1; |
| 265 | + let topUrl; |
| 266 | + if (frameId === 0) { |
| 267 | + topUrl = url; |
| 268 | + } else if (tab) { |
| 269 | + if (!tab.url) tab = TabCache.get(tabId); |
| 270 | + if (tab) topUrl = tab.url; |
274 | 271 | }
|
275 |
| - debug("chose policy", policy); |
| 272 | + if (!topUrl) topUrl = url; |
| 273 | + if (!contextUrl) contextUrl = topUrl; |
| 274 | + |
| 275 | + let cookieStoreId = sender.cookieStoreId ? sender.cookieStoreId : tab.cookieStoreId; |
| 276 | + let policy = ns.getPolicy(cookieStoreId); |
276 | 277 | let {isTorBrowser} = ns.local;
|
277 | 278 | if (!policy) {
|
278 | 279 | console.log("Policy is null, initializing: %o, sending fallback.", ns.initializing);
|
|
285 | 286 | };
|
286 | 287 | }
|
287 | 288 |
|
288 |
| - let tabId = tab ? tab.id : -1; |
289 |
| - let topUrl; |
290 |
| - if (frameId === 0) { |
291 |
| - topUrl = url; |
292 |
| - } else if (tab) { |
293 |
| - if (!tab.url) tab = TabCache.get(tabId); |
294 |
| - if (tab) topUrl = tab.url; |
295 |
| - } |
296 |
| - if (!topUrl) topUrl = url; |
297 |
| - if (!contextUrl) contextUrl = topUrl; |
298 |
| - |
299 | 289 | if (Sites.isInternal(url) || !ns.isEnforced(tabId)) {
|
300 | 290 | policy = null;
|
301 | 291 | }
|
|
0 commit comments