Closed Bug 808705 Opened 12 years ago Closed 12 years ago

Private browsing pb.activate() / pb.deactivate() no longer work

Categories

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

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: canuckistani, Unassigned)

Details

We added a deprecation message to the use of these apis, but the apis *should still work* for the time being. Instead, using this code calls to these methods actually fail on Firefox 16:

https://builder.addons.mozilla.org/package/160251/latest/

[JavaScript Error: "pb-deprecation-example: DEPRECATED: require("private-browsing").activate and require("private-browsing").deactivate is deprecated.
Traceback (most recent call last):
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/api-utils/lib/timer.js", line 32, in notify
    callback.apply(null, args);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/addon-kit/lib/widget.js", line 851, in null
    self._widget._onEvent(EVENTS[e.type], null, self.node);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/addon-kit/lib/widget.js", line 431, in WidgetView__onEvent
    this._baseWidget._onEvent(type, this._public);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/addon-kit/lib/widget.js", line 282, in _onEvent
    this._emit(type, eventData);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/api-utils/lib/events.js", line 123, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/api-utils/lib/events.js", line 153, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/pb-deprecation-example/lib/main.js", line 12, in null
    pb.deactivate();
  File "resource://jid0-w4lju08wkgqynkglmzb7soqnasu-at-jetpack/addon-kit/lib/private-browsing.js", line 28, in deactivate
    exports.deactivate = function deactivate() setMode(false);
"]
The docs currently say:

The activate and deactivate methods are now deprecated. They will continue to work until version 1.13 of the SDK. From version 1.13 onwards they will still exist but will have no effect when called. 

https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/private-browsing.html
The test code should be:

        if (pb.isActive) {
            pb.deactivate();
        }
        else {
            pb.activate();
        }

This seems to work for me.
Status: NEW → UNCONFIRMED
Ever confirmed: false
d'oh, pre-coffee.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.