javascript - How can my Add-on SDK content script interact with a website page script? -



javascript - How can my Add-on SDK content script interact with a website page script? -

in sdk add-on, i'd

call function in page script export, read (get), write (set) or manipulate variable or property in page script export new function or override existing function in page script or post custom event page page script can hear for.

how can add-on sdk content script communicate website?

there multitude of ways interact page scripts, mutual of covered in official documentation, including of ways listed in question.

please read "interacting page scripts".

however, should pointed out interacting page scripts in secure fashion can hard. particularly aware unsafewindow called unsafe reason:

be careful using unsafewindow: can't rely on of properties or functions being, or doing, expect. of them, setters , getters, have been redefined page script. don't utilize unless trust page, , careful.

also, unsafewindow isn't supported api, removed or changed in future version of sdk.

reading info or executing functions of unsafewindow safe in sense cannot straight lead code execution in (your content script) security context. javascript engine compartments create sure of that.

but true must never trust info coming website. expect code throw, denial-of-service unexpected infinite loops or similar. , never ever explicitly or implicitly evaluate code in context of content script.

also, never think can trust website, it own website. websites can compromised (hacked), owners can alter in future, info changed en route (active man-in-the-middle attacks), or add-on have modified it, etc.

javascript firefox firefox-addon firefox-addon-sdk

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -