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

From CDOT Wiki
Jump to: navigation, search
(Project Details)
(Project Details)
 
(15 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
== Description ==
 
== 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.  
+
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.
  
 
== Releases ==
 
== Releases ==
 +
'''Version 1.0a''' <br />
 +
* This patch addresses a simple issue of placing all label required "text" into the properties/dtd files.
 +
* Addresses localization issues
 +
* Patch can be found on bugzilla <br />
 +
'''Version 1.0''' <br />
 +
* This patch is mostly changes to the code to make it work in the latest firefox repository
 +
* Changed the event number to 39. This number will need to be changed if 39 is taken later
 +
* Changed the order of the nsClassInfo.cpp declarations (leaving mine always at the bottom)
 +
* Fixed a number of issues where code conflicted with the newer code in the newer repository.
 +
'''Version 0.9''' <br />
 +
Use '''patch -p1 < InfobarFrontend0.9.txt''' for Front end code <br />
 +
USe '''patch -p1 < InfobarBackEnd0.9.txt''' for Back end code <br />
 +
'''Release Notes'''
 +
* In the Options, Content Tab:
 +
** Added a checkbox to options: Notify Move/Resize.  This governs the resizeWindow.show_infobar preference
 +
** Added Exceptions button beside it, which opens the permissions manager to add sites to the allow/block list
 +
* This patch ties all the work together and gives the features a fully accessible interface
 +
* Added one new test to Mochitest which tests the preference
 +
* Fixed a bug where there were two of the same preference names in about:config (pref was added to the wrong file)
 +
* Changed some variable naming conventions (in nsGlobalWindow.cpp is isAbsolute)
 +
* Fixed a bug where isAbsolute is flipped when sent from nsGlobalWindow.cpp
 +
* Added a confirmation to "Allow Once", and it shows the x and y coordinates as well as the command being blocked
 +
** Reason being users weren't able to see what parameters were blocked.
 +
** To allow users some freedom and knowledge about what the blocked command was before allowing it
 +
* Fixed a bug where javascript can crash if you called "Edit options", because it was missing a try and catch block
 +
Bug can be found in the bug info above<br />
 
'''Version 0.8:''' <br />
 
'''Version 0.8:''' <br />
 
Use '''patch -1 < InfobarFrontend0.8.txt''' for Front end code <br />
 
Use '''patch -1 < InfobarFrontend0.8.txt''' for Front end code <br />
Line 123: Line 149:
  
 
== Project Details ==
 
== Project Details ==
 +
'''09/04/2009''' -
 +
* Removed "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." from project description
 +
* Awaiting for review
 +
'''07/04/2009''' -
 +
* Apologies for the long break:
 +
* Made a fix to the patch: Removed text strings and placed in a properties file.
 +
* Update can be found on bug
 +
'''04/25/2009''' -
 +
* After some many many rebuilds and weird Assertion errors fixed...
 +
* Release 1.0! Its here!! Its here!!!
 +
'''04/24/2009''' -
 +
* Fixed a huge array of problems migrating to the latest version of firefox
 +
** Merged all code with kdiff3 (several conflicts)
 +
** Event number changed from 4000 back to 39 (instead of 36)
 +
** Reordered nsClassInfo.cpp (was throwing constructor errors at me)
 +
** Fixed a bug where the event type was mismatching causing no actual data to be passed
 +
'''04/23/2009''' -
 +
* Changed Event number to 4000 (cause 36 is used in the latest version of FireFox)
 +
* This number will be changed when this patch is official (to a more stable number)
 +
'''04/17/2009''' -
 +
* Video Tutorial for 0.9: http://www.youtube.com/watch?v=pOtZs4k54jg
 +
'''04/11/2009''' -
 +
* Not entirely related to the project, yesterday and today was spent on poster.
 +
* Releasing 0.9 as well.
 +
* The details can be found above.
 
'''04/09/2009''' -
 
'''04/09/2009''' -
 
* Added one new test to Mochitest testing resizeWindow.show_infobar
 
* Added one new test to Mochitest testing resizeWindow.show_infobar
Line 128: Line 179:
 
* Changed some variable names to better reflect their usage
 
* Changed some variable names to better reflect their usage
 
** warningLabel changed to warningLabelKey seeing how this is a key
 
** warningLabel changed to warningLabelKey seeing how this is a key
 +
** isByCommand changed to isAbsolute in nsGlobalWindow.cpp
 +
** fixed a bug where moveTo and moveBy was flipped around when using allowOnce
 +
* Deleted "showEditDialog()" from browser.js gResizedWindowObserver
 +
* Added a confirmation dialog to "allow once", with the x and y / command type info
 +
** That way users can choose to see if they want the window resized/moved.
 +
** And they can see if the numbers are okay first before they click accept.
 
'''04/08/2009''' -
 
'''04/08/2009''' -
 
* Added options to "Content.xul" to open exceptions, and to display the resize/move infobar.
 
* Added options to "Content.xul" to open exceptions, and to display the resize/move infobar.

Latest revision as of 14:14, 24 September 2009

Name of Project

Add an Infobar style warning for window resize/move
New Bug Info: here
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.

Releases

Version 1.0a

  • This patch addresses a simple issue of placing all label required "text" into the properties/dtd files.
  • Addresses localization issues
  • Patch can be found on bugzilla

Version 1.0

  • This patch is mostly changes to the code to make it work in the latest firefox repository
  • Changed the event number to 39. This number will need to be changed if 39 is taken later
  • Changed the order of the nsClassInfo.cpp declarations (leaving mine always at the bottom)
  • Fixed a number of issues where code conflicted with the newer code in the newer repository.

Version 0.9
Use patch -p1 < InfobarFrontend0.9.txt for Front end code
USe patch -p1 < InfobarBackEnd0.9.txt for Back end code
Release Notes

  • In the Options, Content Tab:
    • Added a checkbox to options: Notify Move/Resize. This governs the resizeWindow.show_infobar preference
    • Added Exceptions button beside it, which opens the permissions manager to add sites to the allow/block list
  • This patch ties all the work together and gives the features a fully accessible interface
  • Added one new test to Mochitest which tests the preference
  • Fixed a bug where there were two of the same preference names in about:config (pref was added to the wrong file)
  • Changed some variable naming conventions (in nsGlobalWindow.cpp is isAbsolute)
  • Fixed a bug where isAbsolute is flipped when sent from nsGlobalWindow.cpp
  • Added a confirmation to "Allow Once", and it shows the x and y coordinates as well as the command being blocked
    • Reason being users weren't able to see what parameters were blocked.
    • To allow users some freedom and knowledge about what the blocked command was before allowing it
  • Fixed a bug where javascript can crash if you called "Edit options", because it was missing a try and catch block

Bug can be found in the bug info above
Version 0.8:
Use patch -1 < InfobarFrontend0.8.txt for Front end code
Release Notes

  • Mochitest added, replaces the test.html used.
  • There are 28 tests total.
  • This test is mostly a test from the browser end.

This will be uploaded to the bug above
Version 0.7:
Use patch -1 < InfobarBackend0.7.txt for Back end code
Use patch -1 < InfobarFrontend0.7.txt for Front end code
You may find my patches in my bug info above:
Release Notes:

  • Fixed a compilation error in the locales makefile that was overlooked last patch
  • Events are now fired regardless if the uri is stored in permissionmanager or not
  • Renamed several labels and menu options
  • Removed a lot of whitespace/80 line column problems in front end code
  • Removed extra text in browser.dtd
  • Removed "Do not show infobar", "Allow sites to move/resize window", "Disable Sites moving/resizing window" options from the infobar
  • Removed 4 functions from gWindowResizedObserver

Version 0.6:
Use patch -1 < InfobarBackend0.6.txt for Back end code (events)
Use patch -1 < InfobarFrontend0.6.txt for Front end code (UI)
Media:InfobarBackend0.6.zip
Media:InfobarFrontend0.6.zip
Release Notes:

  • Fixed all lines with more than 80 chars (moved em to next line!) in the backend code.
  • Added new backend code: Checks a URI for its permissions and capacity before firing event.
  • Allows URIs with "Allow_Action" to bypass "CanMoveResizeWindow()" function
  • Added new in UI, permissions management for move/resizes.
  • New menu items in the Infobar: Always Allow, Always Deny. Adds the current URI into the permissions management
  • Removed resizedWindow.xul. We don't need it... really.

Version 0.5:
Use patch -1 < InfobarBackend0.5.txt for Back end
Use patch -1 < InfobarFrontend0.5.txt for Front end code
You can find my patch at my bug release above. Release Notes:

  • Fixed all spurious white space changes
  • Fixed all extra unwanted lines
  • Removed any problematic tabbing and fixed the format
  • Removed all extra white spaces after lines of code (so that the line ends right where the semi colons are)
  • Merged the two events nsDOMWindowMoveEvent and nsDOMWindowResizeEvent into nsDOMWindowMoveResizeEvent
  • Deleted nsDOMWindowResizeEvent from code
  • Altered all User Interfaces to interact with the new event
  • Splitted patch between Backend (Events, and cpp code) versus Frontend (User interface, event captures)

Version 0.4: Media:InfobarPatch0.4.zip

Use patch -1 < Infobar0.4.txt
Release 4 Notes:

  • Two new events were created, including their files
    • nsIDOMWindowMoveEvent.idl and nsIDOMWindowResizeEvent.idl
    • nsDOMWindowMoveEvent.h and nsDOMWindowMoveEvent.cpp
    • nsDOMWindowResizeEvent.h and nsDOMWindowResizeEvent.cpp
    • Two new class events created: nsWindowMoveEvent, nsWindowResizeEvent
  • These two events keeps information on whether the command is a moveBy/resizeBy, and their x and y parameters
  • Infobar has been changed to use these two new events
  • New option added to Infobar upon display: Allow Once
  • Allow Once will close the infobar, and apply whatever the blocked command was ONCE. (Similar to popup's display popup feature)
  • Also added new localization labels to browser.dtd

Version 0.3: Media:InfobarPatch0.3.zip

This patch was made with Mercurial!
Use patch -p1 < InfobarPatch0.3.txt
Release 3 Notes:

  • Infobar is no longer displayed all the time
  • A new preference window now to replace Advanced Javascript settings in the infobar
  • Windows Move / Window Resized has two different labels, it paves the ground for when the new event arrives (Which I will work on even after this course is over)
  • The preference can be turned off in about:config but I did not add it to Javascript settings
  • All code tabs have been removed, replaced with spaces
  • A new property, resizeReport was implemented so that the infobar does not interfere with pageReport
  • A new event for move events was created
  • New functions for browser.js, most of the functions were rewritten to remove crap which wasn't needed after some changes
  • Most of the properties have been moved to the dtd localization files
  • Browser-sets.inc 's broadcasters have been removed.
  • Menuitem labels are not defined in the xul file anymore, they have been defined in browser.dtd
  • A new option: Disableinfobar added to the menu. At the moment it toggles (between disable, and turn on), it will be changed in the future
  • An area to add urls to, which should theoretically bypass the javascript property check if a site is added (to be implemented). At the moment, the interface is there, but lacks functionality.

Version 0.2 Fixed: Media:InfobarPatch0.2.zip

This patch was made with Mercurial!
Look below to see how to patch this.

  • Note: This patch is the same as 0.2, with changes as reviewed by Gavin Sharp in bug 459614.


Version 0.2: Media:InfobarPatch0_2.zip

This patch was made with Mercurial!
Use patch -p1 < InfobarPatch0_2.txt
Release 2 notes:
Now your javascript settings do not need to disable move/resize window for the infobar to pop up. The infobar's options are working normally. Allow will turn on move/resize window, where as Disable will turn it off. Edit Options will display the Advanced Javascript options directly.

Version 0.1: Media:InfobarPatch.zip

This patch was made with Mercurial!
Use patch -p1 < InfobarPatch.txt
Release 1 notes:
Whenever a site attempts to resize your window, if and only if your javascript settings is set to disable javascripts from resizing your window would an infobar pop up. The allow / edit options does not work here, but an infobar IS displayed when a site attempts to move/resize your window.
Make sure in options->javascript options->allow move/resize is disabled

Leader(s)

Project Contributor(s)

  • David Humphrey (Seriously!)
  • Patrick Lam (Wrote resize html, FIRST patch tester)
  • Irina Sh. (Told me about resizeBy() and moveBy())
  • Jason Tarka (Thanks for testing my patch)
  • Scott Lunel (Yes, I know the Infobar was annoying =P)

Media

01/22/2008 -

Project Details

09/04/2009 -

  • Removed "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." from project description
  • Awaiting for review

07/04/2009 -

  • Apologies for the long break:
  • Made a fix to the patch: Removed text strings and placed in a properties file.
  • Update can be found on bug

04/25/2009 -

  • After some many many rebuilds and weird Assertion errors fixed...
  • Release 1.0! Its here!! Its here!!!

04/24/2009 -

  • Fixed a huge array of problems migrating to the latest version of firefox
    • Merged all code with kdiff3 (several conflicts)
    • Event number changed from 4000 back to 39 (instead of 36)
    • Reordered nsClassInfo.cpp (was throwing constructor errors at me)
    • Fixed a bug where the event type was mismatching causing no actual data to be passed

04/23/2009 -

  • Changed Event number to 4000 (cause 36 is used in the latest version of FireFox)
  • This number will be changed when this patch is official (to a more stable number)

04/17/2009 -

04/11/2009 -

  • Not entirely related to the project, yesterday and today was spent on poster.
  • Releasing 0.9 as well.
  • The details can be found above.

04/09/2009 -

  • Added one new test to Mochitest testing resizeWindow.show_infobar
  • Added try/catch block to addEntry URI (So it doesn't throw an exception)
  • Changed some variable names to better reflect their usage
    • warningLabel changed to warningLabelKey seeing how this is a key
    • isByCommand changed to isAbsolute in nsGlobalWindow.cpp
    • fixed a bug where moveTo and moveBy was flipped around when using allowOnce
  • Deleted "showEditDialog()" from browser.js gResizedWindowObserver
  • Added a confirmation dialog to "allow once", with the x and y / command type info
    • That way users can choose to see if they want the window resized/moved.
    • And they can see if the numbers are okay first before they click accept.

04/08/2009 -

  • Added options to "Content.xul" to open exceptions, and to display the resize/move infobar.
  • Changed preferences.properties to reflect other exceptions types
  • Removed resizedWindow preference from firefox.js, and added to all.js

03/31/2009 -

  • Released 0.8 release for "Front End"
  • This patch contains a Mochitest specifically for replacing manual testing.

03/29/2009 -

  • Bug caused by an unsafe check for an existing infobar, and removing a null infobar.
  • Further testing continues
  • Replaced all removeNotificationByValue with removeAllNotifications(immediate) in test
  • removeNotificationByValue might have been conflicting with the code in browser.js which gets by value

03/28/2009 -

  • Discovered a bug with Mochitest test_bug413792.html which caused the infobar to become invisible

03/27/2009 -

  • Wrote the beginning of a mochitest
  • Changed access key of edit options, it was conflicting with Options

03/12/2009 -

  • Removed fillResizeList, removed "onpopupshowing"
  • Removed all text related to the above
  • Since Allow / Disable is gone, a and d access keys are freed. Reapplied to Allow/Deny (on options)
  • Fixed most lines greater than 80 columns in the frontend patch
  • Removed unwanted white space changes in frontend patch (previously only backend was done)
  • Changed label texts for better descriptions.
  • Removed resizeWindow.dtd from jar.mn in locales (Previous bug unfound!)
  • Allow Once is now the top menu choice (rearranged)

03/11/2009 -

  • The event is thrown now regardless of permissions.
  • However, the permissions still work in effect on nsGlobalWindow.cpp
  • So now even if the permissions states that a site can resize/can't resize, a user can still capture the event.
  • Removed "Disable Infobar option" from the menu
  • Removed Add/Disable disable_window_move_resize options
  • fillResizeList is currently empty

02/19/2009 -

  • Removed some code in browser.js which is no longer used (code which displayed even if disable_window_move_resize is off)
  • Fixed a bug where no matter what the command to trigger the infobar was, the infobar would say the page tried to "resize" the browser (now it says move, if a move command was used)
  • Removed all end white spaces after lines
  • Fixed all lines that were longer than 80 characters long in the backend
  • Released 0.6. Read release notes above!

02/18/2009 -

  • New file called resizedWindow.js created in browser/content/preferences/
  • Linked resizedWindow.xul with resizedWindow.js
  • To do: Code resizedWindow.js to insert permissions / load permissions from nsIPermissions.idl
  • Permissions will be loaded into a tree similar to the popup blocker
  • Added browser/content/preferences/resizedWindow.js to the folder's jar.mn
  • Changed resizeWindow.xul to follow the same size / look as other exceptions screens
  • Accesskeys have been changed to follow the regular keys in other option windows (similar feel throughout the entire app)
  • Temporarily removed the checkbox in resizedWindow.xul. I plan to add it to advanced javascript settings instead
  • resizedWindow.xul should strictly be for allow/denied sites only
  • And I realized xul is not even required, I can use permissions.xul entirely Good learning experience though!
  • Discarded resizedwindow.xul :(
  • discarded resizedWindow.dtd and js :(
  • browser.js calls permissions.xul with a new permission type (moveResize)
  • added new strings to permissions.properties: moveresizepermissiontext and moveresizepermissiontitle
  • Added a new function to nsGlobalWindow.cpp isSiteAllowedOrBlocked() which returns the permission/capacity of a URI
    • if its 0, it means it doesn't exist in the preference
  • Changed the moveTo, moveBy, resizeTo, resizeBy codes to use isSiteAllowedOrBlocked()
  • The code now completely ignores any blocks unless its a frame object (which can't be resized no matter what) if it is on the Allow list
  • and all denies are automatically denied regardless of situation

02/16/2009 -

  • Lots of research to do: Regarding preferences and xul objects

02/15/2009 -

  • Long break from OSD due to other courses
  • Read jst's review. Fixed some naming conventions and naming licenses
  • Changed isBy parameter to isAbsolute
  • Changed paramX and paramY to plain x and y
  • Removed case NS_WINDOWMOVERESIZE_EVENT from DuplicateData()
  • Removed some old comments on Window Move and Resize events, replaced with comments on one event
  • Changed code in nsGlobalWindow.cpp so that infobar does not appear when isFrame() is true
  • Added FireWindowMoveResize() function to nsGlobalWindow class, and declared it as a non static member function

02/06/2009 -

  • Patches released: InfobarBackend0.5.txt | InfobarFrontend0.5.txt
    • Refer to patch release details for further information
  • Tested splitting patch between backend and frontend.
  • Patches can be done from their root directories. (A LOT shorter!)
    • Backend: hg diff -p -U 8 ./dom ./content/events ./widget/public > InfobarBackend0.5.txt
    • Frontend: hg diff -p -U 8 ./browser ./toolkit/content/widgets > InfobarFrontend0.5.txt

02/01/2009 -

  • Fixed several white space changes in code / patch
  • Used JST Review to do changes prior to releasing an actual patch
    • In progress: Changing problems: Ignoring lines longer than 80 characters for now
  • There is apparently no way around the "if (nsnull == it)" statement when creating a new event. We have to compare whether the pointer to the new event is null or not, but we can't use NULL. Thus, ns_null is our only way.

01/30/2009 -

  • Fixed the tabbing and indentations of browser.js
  • Shortened Name of event thrown from nsGlobal.cpp so code isn't over 80 columns long
  • Converted several new files created to Unix format (hope this eliminates the windows endline characters)

01/29/2009 -

  • Event works. New event nsWindowMoveResizeEvent is now the only event thrown during a resize/move event

01/28/2009 -

  • browser.xml changed to accept just one event
  • browser.js updated to changes on browser.xml: uses the new parameter to check if command is resize or move
  • Mostly fixing compile errors

01/27/2009 -

  • Started work on nsWindowMoveEvent. This event has been renamed nsWindowMoveResizeEvent.
    • New Parameter: isMove: To specify whether this is a move or a resize command
    • Changed moveX and moveY to paramX and paramY
    • Changed Init
  • In progress: Changing nsGUIEvent.h, changing all files with WindowMove to WindowMoveResize, changing idl, h, cpp files
  • Removed FireWindowResizedEvent() in nsGlobalWindow.cpp and renamed FireWindowMovedEvent to FireWindowMoveResizeEvent()
  • Next: Removed nsIDOMWindowResizeEvent from the code, including its implementations
  • Deleted nsWindowResizeEvent from nsGUIEvent.h
  • Currently fixing nsGlobalWindow.cpp's calls to reflect the new FireWindowMoveResizeEvent();

01/26/2009 -

  • Received some feedback from jst, thanks to David
  • 0.5 release will focus mostly on combining the two events into one event (Yay!)
  • and... to fix all the indentations.
  • This will take me the rest of the week, then I'm going to try and see about splitting the patch between UI and Backend.

01/22/2009 -

  • Blog page about the entire project can be found here

01/21/2009 -

  • Patch 0.4 released!
  • Read above to see what has changed

01/21/2009 -

  • Added new menu option on browser.xul (menuitem) called "Allow Once"
    • Calls gWindowObserver's allowOnce() function when selected
    • Added new dtd localization text in browser.dtd for the new menuitem
  • Fixed a bug where nsWindowResizeEvent would constantly return 0,0 as the x,y (signature of getResizeX/Y())

01/20/2009 -

  • Split FireWindowResizedEvent() into two functions:
    • FireWindowMovedEvent() and FireWindowResizedEvent()
  • Fixed a linker error where the declarations were different from definitions
  • Removed parameter "isMoveBy" from FireWindowResizedEvent()
  • Updated browser.xml
  • OnWindowResized and OnWindowMoved updated to contain an object details, containing details of the command sent.

01/19/2009 -

  • nsDOMWindowMoveEvent.cpp and nsDOMWindowResizeEvent.cpp compiles!!!!!
  • nsGUIEvent.h's classes added public to all members of nsWindowMoveEvent and nsWindowResizeEvent
  • creation function's error changed
  • Now to test if these events can be captured!
  • Added two includes to nsGlobalWindow.cpp: #include "nsDOMWindowMoveEvent.h" and "nsDOMWindowResizeEvent.h"
  • Changed FireWindowResizeEvent to use the the new events

01/18/2009 -

  • Work resumes.
  • First event to be created will be WindowMove
  • Two files added to makefile.in in Content/events
  • in content/events/public/nsIPrivateDOM.h, two lines added:
  • IMPORTANT nsGUIEvent.h is where to define an actual ns"EventName"Event class.
    • Added a class definition for nsWindowResizeEvent and nsWindowMoveEvent
    • Move event is 36, resize event is 37. (NS_WINDOWMOVE_EVENT, NS_WINDOWRESIZE_EVENT)
  • Also give it a structtype. The prototypes can be found in the same file.
  • nsDOMEvent.cpp should have a reference to it as well. Check file.

12/05/2008 -

  • Patch 0.3 released, work continues though.

12/05/2008 -

  • Attempting to add an event to 0.3... seeing how this works out:
  • Event name will be WindowMove/WindowResize Event, therefore... nsWindowMove/WindowResizeEvent, and the interface to it will be nsIWindowMove/WindowResizeEvent
    • Line 1294 in nsDOMClassInfo.cpp added the definition class info
    • Line 3537 in nsDOMClassInfo.cpp added map definition
    • Line 671 in nsEventDispatcher.cpp added createEvent if statement... move code in later releases
    • Two new files: both in dom/public/idl/events/
      • nsIDOMWindowMoveEvent.idl
      • nsIDOMWindowResizeEvent.idl
    • Makefile in dom/public/idl/events added the above files
  • Created four implementation files
    • nsDOMWindowMoveEvent.h / nsDOMWindowMoveEvent.cpp
    • nsDOMWindowResizeEvent.h / nsDOMWindowResizeEvent.cpp

12/03/2008 -

  • IMPORTANT: Where everything is located on this patch is here! Link to Blog
  • Changed FireWindowResizedEvent to contain a new parameter: PRBool isMove
    • If isMove is true, it fires a DOMWindowMoved event rather than Resized so that the infobar will know the difference.
    • As a result, several changes also need to be made to browser.xml and browser.js, as well as their localization files
  • Browser.xml added a new eventlistener for DOMWindowMoved
    • new method: onWindowMoved
    • new parameter added to siteResizedWindow: isMove
    • new event dispatched: DOMSiteMovedWindow
  • Browser.js adds a new eventlistener for DOMSiteMovedWindow
    • new function in gResizedWindowObserver: onWindowMove
    • changed onWindowResized and onWindowMoved to call a new function: prepareInfobar
  • Browser.properties with new text for moving

11/30/2008 -

  • Adding a new preference window / DTD file for the preferences window:
    • Modified two jar.nm files, one for xul and one for dtd. The new preferences window is called resizeWindow.xul
    • It contains an area to add sites that would bypass the "resizing" block. Not implemented yet. Probably won't be for 0.3
    • I need a way to add this to advanced-javascript without it looking weird. Any ideas would be nice, on where to add it =)
  • Added a preference to disable the infobar.
  • Added a new option upon infobar displayed to disable the infobar
  • Removed broadcasters for menu items, added oncommand directly to the menuitems themselves
  • Removed a ton of code from browser.js that was really just extra uneeded and bulky code. Wow!

11/29/2008 -

  • Altered removeCurrentNotification() to removeNotification(notification) where notification = a notification returned by value.
    This is to prevent any possibilities of removing the wrong notification.
  • browser.js' windowResizedObserver changed to not alter labels (as labels are now defined in XUL)
  • All menuitems have their labels/accesskeys added to DTD
  • Access keys added to DTD file (from Browser-sets.inc) DTD file name: browser.dtd
  • Changed the notification to occur only if javascript resize is disabled
  • Removed all Tabs and replaced it with spaces
  • Added new property, to try and divert the possibility of collision with pageReport. (resizeReport)
  • Removed a LOT of unwanted code (based on review by Gavin)

11/24/2008 -

  • New bug to follow: here

11/11/2008 -

  • Edit Options now opens Advanced Javascript settings window right away.
  • The infobar is displayed whether Move/Resize option is enabled or disabled
  • The infobar also has its text rewritten, and has an allow / disable option
  • Allow will turn Move/Resize option on
  • Disable will do the other
  • Depending on whether the setting is on/off, Allow or Disable will show. The other will be hidden
  • Now I will look into making an event that accepts the type of resizing done, and allow the user to select whether or not they want it to be resized or not.
  • This might require a custom event.

11/09/2008 -

  • Blog has been updated with 0.2 release plans, as well as Project Plans section below.
  • Changed text of options displayed when window resized

11/04/2008 -

  • Scott Lunel has helped me with making my code into an extension rather than the tree. Thank you!

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

01/13/2009 -

  • 700 Begins here!

11/29/2008 -

  • Version 0.2 Fixed released

11/11/2008 -

  • Version 0.2 released

10/17/2008 -

  • Version 0.1 released

10/16/2008 -

  • Release 0.1a for testing is available

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

01/13/2008 - OSD700'

  • Beginning OSD700, time to get started again
  • For 0.4 release, main focus is the events.
  • The events will probably take me all the way to 0.4, due to its large amount of coding

11/09/2008 - What to expect for 0.2 release?

  • I'll need the allow / edit options to work.
  • Also, the infobar must be displayed even if the setting for javascript moving/resizing is enabled.
  • Although its rarely un-noticeable, even if its a slight move it would be nice to show that the website HAS actually moved it.
  • Therefore, the infobar needs two specific outcomes. Whether you have it enabled, or disabled, and what menu items will be displayed as a result. This also means the option will be "Allow" or "Disable" depending on what the current settings are.
  • The allow function should also allow the current website to do its resizing, meaning it needs to refresh the page's resize and actually resize the window (whether it'd be just this time, or always)
  • Would be wonderful to have an option that instantly opens the javascript options window too.

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

Contributions

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