Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Improve trusted-replace-fetch-response — do not replace content if URL is set by Object.defineProperty #367

@AdamWr

Description

@AdamWr

Steps to reproduce:

  1. Add this rule:
example.org#%#//scriptlet('trusted-replace-fetch-response', 'ads', '', 'ad_url_test')
  1. Go to - https://example.org/
  2. Run in browser console:
(async () => {
  const e = '{"ads":true}';
  const l = btoa(e);
  const m = "data:application/json;base64," + l;
  const p = new Request(m);
  Object.defineProperty(p, "url", {
    get: function () {
      return "https://www.example.org/ad_url_test";
    }
  });
  const test = await fetch(p);
  const text = await test.text();
  if (!text.includes('ads')) {
    alert('adblock');
  }
})();

With current version of the scriptlet there will be an alert displayed, but it should not be and the content should not be replaced, because it's a data URL request (data:application/json;base64,...) with url set by Object.defineProperty.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions