Closed Bug 255332 Opened 20 years ago Closed 16 years ago

Warning: reference to undefined property Components.classes['@mozilla.org/winhooks;1']

Categories

(SeaMonkey :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
seamonkey2.0a1

People

(Reporter: timeless, Unassigned)

References

()

Details

Attachments

(2 obsolete files)

Warning: reference to undefined property
Components.classes['@mozilla.org/winhooks;1']
Source File: chrome://communicator/content/pref/platformPrefOverlay.xul
Line: 98

Steps:
1. don't build winhooks
2. run mozilla
3. open prefs

The code should use a try block, it could also be written:
if (("nsIWindowsHooks" in Components.interfaces) &&
    ("@mozilla.org/winhooks;1" in Components.classes))
try {
var winhooksService =
Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
parent.isTurboEnabled = winhooksService.isOptionEnabled("-turbo");
document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
} catch (e) {};

Each instance of code that checks for winhooks should be audited.

xpfe/browser/resources/content/navigator.js is ok
xpfe/communicator/resources/content/nsContextMenu.js is not ok
xpfe/components/prefwindow/resources/content/pref-winhooks.js is silly (it null
checks something which will not be null - an exception is throw instead...)
xpfe/components/prefwindow/resources/content/pref-advanced.xul is not ok
xpfe/components/winhooks/nsSetDefaultBrowser.js does not sound quite right
Attached patch Patch, try #1 (obsolete) — Splinter Review
Attached patch Patch try #2 (obsolete) — Splinter Review
Attachment #155919 - Attachment is obsolete: true
Attachment #155938 - Flags: review?(timeless)
Attachment #155938 - Flags: review?(timeless) → superreview?(neil.parkwaycc.co.uk)
Comment on attachment 155938 [details] [diff] [review]
Patch try #2

>-        var isWin = navigator.appVersion.indexOf("Windows") != -1;
>+        var isWin = (("nsIWindowsHooks" in Components.interfaces) && ("@mozilla.org/winhooks;1" in Components.classes));
Surely even timeless can't lose his windows hooks in between showing the
menuitem and clicking on it?
>-      var winhooks = Components.classes[ "@mozilla.org/winhooks;1" ].
>-                       getService(Components.interfaces.nsIWindowsHooks);
>+      if (("nsIWindowsHooks" in Components.interfaces) &&
>+          ("@mozilla.org/winhooks;1" in Components.classes)) {

>-      if (navigator.platform != "Win32") {
>+      if (navigator.platform != "Win32" || !(("nsIWindowsHooks" in Components.interfaces) &&
>+         ("@mozilla.org/winhooks;1" in Components.classes))) {
You don't need to test for Win32 here; other platforms won't have the winhooks
component.

>-      var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
>-      if (winhooksService) {
>-        parent.isTurboEnabled = winhooksService.isOptionEnabled("-turbo");
>-        document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
>+      if (("nsIWindowsHooks" in Components.interfaces) &&
>+          ("@mozilla.org/winhooks;1" in Components.classes)) {
How is timeless going to lose his windows hooks now? By stepping through with
Venkman?

>+      if (("nsIWindowsHooks" in Components.interfaces) &&
>+          ("@mozilla.org/winhooks;1" in Components.classes)) {
How does timeless manage to install winhooks/nsSetDefaultBrowser.js without the
rest of winhooks?

sr=me on what's left of the patch ;-)
Attachment #155938 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview-
ok, someone else can work on a patch ;-) (really), the problems of timeless are
"silly" :)
Product: Core → Mozilla Application Suite
Filter "spam" on "guifeatures-nobody-20080610".
Assignee: guifeatures → nobody
QA Contact: guifeatures
Component: XP Apps: GUI Features → UI Design
Will get fixed by new shell service ui.
Depends on: 441050
Attachment #155938 - Attachment is obsolete: true
I assume this is "R.Fixed" by bug 441050 and bug 364168.

Frank (, Neil), can you verify this resolution ?
And that there was nothing in the patch that would still be wanted.
Status: NEW → RESOLVED
Closed: 16 years ago
Component: UI Design → General
Depends on: 364168
QA Contact: ui-design → general
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.0alpha
Flags: in-testsuite-
gerv said wontfix is better.
Resolution: FIXED → WONTFIX
In theory you could morph this bug into the shell service equivalent - currently nsContextMenu assumes that the shell service exists on and only on Windows - but I think we're better off with a new bug.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: