Closed Bug 687273 Opened 13 years ago Closed 7 years ago

window.watch is null in Content Scripts

Categories

(Add-on SDK Graveyard :: General, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: OmerSadika, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Build ID: 20110902133214

Steps to reproduce:

I tried call to window.watch in content scripts.


Actual results:

Error in console error that watch is not a function.


Expected results:

The function should workws and run.
I tried the function in firebug console and it's works fine.
Just as a suggestion, try replacing "window" with "unsafeWindow" and see if it works.
Work's great.

But i think you have to add this to documention.

Thank you.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
It looks like window.watch should be available:

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/watch

So this seems like a real bug, perhaps in the way we wrap window objects.  cc:ing Alex for his thoughts.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WORKSFORME → ---
Object.wrap may not be relevant in our case.
Content script should not see/play with any JS value of the document.
It is the main reason why XrayWrappers doesn't expose this method.
But ... it would make sense to watch for JS attributes set by the content script itself.


Omer: Could you tell us what you would like to achieve with `watch`?
Assignee: nobody → poirot.alex
(Waiting on the answer to Alex's question before determining priority and whether this is a valid issue we should fix or invalid/wontfix.)
Whiteboard: [triage:followup]
What we decided in triage today was to just document that watch() does not work without using unsafeWindow.
Assignee: poirot.alex → nobody
Component: General → Documentation
QA Contact: general → documentation
Whiteboard: [triage:followup]
Priority: -- → P3
a page-mod author can create expandos on window though correct? so perhaps they would want to use window.watch for that..

If window.watch does exist though, then some authors may think it should be doing what unsafeWindow.watch will do for them..

If we do not decide to implement window.watch though, then perhaps we can improve the error message to include a suggestion to use unsafeWindow?
Component: Documentation → General
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: REOPENED → RESOLVED
Closed: 13 years ago7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.