Closed Bug 878169 Opened 11 years ago Closed 7 years ago

Selection module says there is no selection when there is

Categories

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

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: evold, Unassigned)

References

Details

I'm trying to build a jetpack that adds a context menu to Edit a selection, so it uses the selection context, then opens a panel with the selection.html in a textarea, and when the panel closes I want to set selection.html = textarea.value

The add-on is here: https://github.com/erikvold/selection-modification-jetpack

I get the following error when I close the panel.  Even tho there is a selection, and the context-menu module still recognizes the selection b/c that menuitem still appears.

error: selection-modification-jetpack: An exception occurred.
Error: It isn't possible to change the selection, as there isn't currently a selection
resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/selection.js 250
Traceback (most recent call last):
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/timers.js", line 31, in notify
    callback.apply(null, args);
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/content/worker.js", line 111, in onContentEvent/<
    self._emit.apply(self, JSON.parse(args));
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/deprecated/events.js", line 123, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/deprecated/events.js", line 153, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/content/worker.js", line 223, in postMessage
    self._addonWorker._emit('message', data);
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/deprecated/events.js", line 123, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/deprecated/events.js", line 153, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://selection-modification-jetpack-at-erikvold-dot-com/selection-modification-jetpack/lib/main.js", line 25, in .onMessage/panel<.onMessage
    selection.html = val;
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/selection.js", line 66, in Selection<.html
    set html(value) { setSelection(HTML, value, this.rangeNumber); },
  File "resource://extensions.modules.selection-modification-jetpack-at-erikvold-dot-com.commonjs.path/sdk/selection.js", line 250, in setSelection
    throw new Error(ERR_CANNOT_CHANGE_SELECTION);
ugh this is weird, it's like using the context-menu reactivates the selection..
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.