Closed Bug 1438640 Opened 7 years ago Closed 7 years ago

Tracking Protection Stats js: remove mutation observer if possible

Categories

(Firefox for iOS :: General, enhancement)

Other
iOS
enhancement
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
fxios ? ---

People

(Reporter: garvan, Unassigned)

References

Details

Currently we use Focus iOS js for tracking protection stats, but we are interested in make some improvements based on this review: https://github.com/mozilla-mobile/firefox-ios/pull/3631#discussion_r168561189 """ @justindarc A couple things here: I'd like to see if we can just hijack HTMLScriptElement.prototype.src like we do for Image above? Does hijacking Image.prototype.src above actually work for appending <img>s to the DOM in all cases? i.e.: var img = document.createElement('img'); img.src = '/foo.jpg'; document.body.appendChild(img); If we do actually have to use a MutationObserver for <script> elements, we need to at least check for the existence of src before calling postMessage(). For instance, I think it's possible to append a <script> to the DOM that has inline JS. You can test those cases with this JSBin: http://output.jsbin.com/rahizoq """
See also https://bugzilla.mozilla.org/show_bug.cgi?id=1438639 Bug for automated test which will help when refactoring the JS
Another comment from the review is to use one mutation observer for both scripts and images.
Closing since we must rely on MO to do this.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.