Difference between revisions of "Add an Infobar style warning for window resize/move"

From CDOT Wiki
Jump to: navigation, search
(Project Details)
(Project Details)
Line 17: Line 17:
  
 
== Project Details ==
 
== Project Details ==
 +
'''10/15/2008''' -
 +
FireWindowResizedEvent(nsIDOMDocument *aDoc);
 +
in nsGlobalWindow.cpp is coded. Tested and it works.
 +
I also fixed browser.js so that the notification occurs only once.
 +
 +
Javascript resizeTo and moveTo is also called resizeTo and moveTo in nsGlobalWindow.cpp, therefore I put the event where user blocks it.
 +
 +
Later I will call the event always, and depending on whether it was blocked or not, will give the option to unblock/allow resize.
 
'''10/13/2008''' -
 
'''10/13/2008''' -
 
* browser.js is complete, browser.xml should be complete. All that's left now is to know where to put the Fire event in cpp so that browser.xml receives the event call.
 
* browser.js is complete, browser.xml should be complete. All that's left now is to know where to put the Fire event in cpp so that browser.xml receives the event call.

Revision as of 00:16, 15 October 2008

Name of Project

Add an Infobar style warning for window resize/move
Bug Info: here

Description

Many (poorly behaved) web sites attempt to move and/or resize your browser window. It is possible to stop this behaviour (cf. dom.disable_window_move_resize) but it would be nice to have an infobar that informed the user that a web page attempted to move/resize the window, and allow it or ignore it (default). This behaviour is similar to the current Pop-up Blocker already present in Firefox. NOTE: it is not clear whether such a feature would be accepted in the tree or if this would need to be done as an extension.

Leader(s)

Project Contributor(s)

Project Details

10/15/2008 - FireWindowResizedEvent(nsIDOMDocument *aDoc); in nsGlobalWindow.cpp is coded. Tested and it works. I also fixed browser.js so that the notification occurs only once.

Javascript resizeTo and moveTo is also called resizeTo and moveTo in nsGlobalWindow.cpp, therefore I put the event where user blocks it.

Later I will call the event always, and depending on whether it was blocked or not, will give the option to unblock/allow resize. 10/13/2008 -

  • browser.js is complete, browser.xml should be complete. All that's left now is to know where to put the Fire event in cpp so that browser.xml receives the event call.

10/12/2008 -

Also remember there is a destroy event to remove the same eventListener

  • Then I can go into nsGlobalWindow.cpp and code the FireResizedEvent...

10/05/2008 -

  • nsEventDispatcher's nsEventDispatcher::DispatchDOMEvent() function needs to recognize our event, DOMWindowResized.
  • A similar idl file to define a DOMWindowResized event /dom/public/idl/events/nsIDOMPopupBlockedEvent.idl

10/01/2008 -

Okay, I believe here are the steps i need to do before I start coding an observer. One: I need to code a function to send an event call from C++ from | nsGlobalWindow much like the link shows.
This event will probably be named something like "DOMWindowResized".
In other words the following function is required:

FireBlockedWindowResize();

Similar to the pop-up blocked, it will fire an event which will be caught by the window object. In order to hook that event up though, I will need this line:

gBrowser.addEventListener("DOMWindowResized", gResizedWindowObserver.onWindowResized, false);

Then code gResizedWindowObserver to contain onWindowResized() which will initiate a notification window, along with all its required texts and menu options.

Now I need to know how to get the menu items to run a function to open preferences. But for release 0.1, I think the above should suffice.

09/28/2008 -

  • Correction to below... browser.xul is the user interface. It runs functions found in the browser.js file, which then grabs strings from the bundle_browser object in order to display the lines of text.

09/24/2008 -

  • I've found the place where infobar text is displayed, and how it is displayed.
    The text can actually be found in a file "\src\browser\base\content\browser.xul". This is what I will use to define a new set of text for a resize event.

    In the meantime I am still looking for a way to cause the resize event to display an infobar
  • bundle_browser is accessible within the browser object. It contains all the strings from browser.properties.
  • by utilizing bundle_browser.GetString("NameofString") you can retrieve the string stored
  • inside browser.properties, a %S signifies the browser name.

09/22/2008 -

  • It is possible to trigger the event simply by writing code that resizes the window (using SetPositionAndSize I believe?)

09/21/2008 -

  • Found two files which might have something to do with this:

dom\src\base\nsGlobalWindow.cpp
dom\src\base\nsGlobalWindow.h

I don't know how useful these files are yet.

  • \widget\public\nsGUIEvent.h contains details on the windows_resize event
  • The name of the event dealt with is called: nsSizeEvent, a class inherited from nsGUIEvent. A base event.

Project News / Updates

10/12/2008 -

  • Self Notes: Note these lines of code should be removed: 3137, 359, nsGlobalWindow

10/01/2008 -

  • Fresh Month, Fresh Updates, and more! Fresh plan!

09/29/2008 -

  • Bad news? Looks like I'll need to familiarize myself with the XPCOM API Reference if I want to be able to call Javascript code from the nsWindow.cpp..

09/21/2008 -

09/18/2008 -

  • Starting a Project Plan. Great idea Dave!

09/14/2008 -

  • Created Project page for this project. Its a good reason to keep yourself up to date on the weekly schedule!

Project Plans

09/25/2008 - What to expect for 0.1 release?

  • I hope to have a working infobar that displays whenever a site tries to resize the current window. Hopefully I'll have an allow option available. For future releases I will need to allow users to add sites to an exception list, and a way to set it to allow by default.

09/21/2008 -

  • Now that I know the name of the event, I need to find a way to cause it to trigger an infobar.
    But that's not all. These are probably the things I expect will need to be covered (from my viewpoint)
  • Changes to the infobar to accomodate this
  • An option to enable/disable the infobar from popping up in browser config (users know it as about:config)
  • Would be nice to know what else I'd need. Anyone with information please let me know
  • Reading Documentation on Mozilla's developer site. There's a lot to read: here

09/18/2008 -

  • First step would be to see how infobars work in Mozilla. I need to see what triggers one, how they are displayed as well as how they can be used. If they can alter the content on a page, that would be an interesting find also.
  • Would be a good idea to also look up what event handlers there are.

Links to keep

Set Inner Width function
Can Move Resize Windows function
FirePopupBlockedEvent()
Call to FirePopupBlockedEvent()
The place to add eventlisteners

Related Bugs

Bug 421172: Infobar for Offline Storage only displayed on page reload - Something to do with the infobar
Bug 186708: don't allow web sites to resize windows with toolbars (by default) - Looks kinda dead