Closed Bug 888262 Opened 11 years ago Closed 11 years ago

page-mod does not attach to window/utils open()

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: thomas, Unassigned)

Details

Attachments

(1 file)

Attached file window-utils.zip
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0 (Beta/Release)
Build ID: 2013051000

Steps to reproduce:

See attached example:
- create page-mod for a page of the addon e.g. "popup.html"
- use window/utils -> open(data.url('popup.html'));


Actual results:

- content script is not attached to popup.html


Expected results:

Try same example with require('sdk/windows').browserWindows.open()
-> content script gets attached
Here also the coding:

1. with sdk/windows:

var data = require('sdk/self').data;
var windows = require('sdk/windows').browserWindows;
var pageMod = require("sdk/page-mod");

pageMod.PageMod({
  include: data.url('popup.html'),
  contentScript: 'console.log("cs injected")',
  contentScriptWhen: 'start'
});

windows.open({url: data.url('popup.html')});

-> result: "cs injected" logged to console

2. with sdk/window/utils

var data = require('sdk/self').data;
var {open} = require('sdk/window/utils');
var pageMod = require("sdk/page-mod");

pageMod.PageMod({
  include: data.url('popup.html'),
  contentScript: 'console.log("cs injected")',
  contentScriptWhen: 'start'
});

open(data.url('popup.html'));

-> result: nothing logged to console
Use a tab, this is intentional, and soon the `use window/utils -> open(data.url('popup.html'));` steo will be disabled, see bug 840314
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
s/steo/step(In reply to Erik Vold [:erikvold] [:ztatic] from comment #2)
> Use a tab, this is intentional, and soon the `use window/utils ->
> open(data.url('popup.html'));` steo will be disabled, see bug 840314

s/steo/step
I want to open a password dialog in a new browser window.

With tabs.open({url: data.url(url),inNewWindow: true}) I'm not able to pass any features like width, location, menubar, modal etc.

Is there a way to achieve this with the Addon SDK?
(In reply to toberndo from comment #4)
> I want to open a password dialog in a new browser window.
> 
> With tabs.open({url: data.url(url),inNewWindow: true}) I'm not able to pass
> any features like width, location, menubar, modal etc.
> 
> Is there a way to achieve this with the Addon SDK?

the password manager is a chrome: uri so you should use `require('sdk/window/utils').open()` to open that, but page-mods do not work on these top level windows, so you'd have to use require('sdk/deprecated/window-utils').WindowTracker` for to make mods to the page.
(In reply to toberndo from comment #4)
> I want to open a password dialog in a new browser window.
> 
> With tabs.open({url: data.url(url),inNewWindow: true}) I'm not able to pass
> any features like width, location, menubar, modal etc.
> 
> Is there a way to achieve this with the Addon SDK?

Also it's better to ask these questions in the google group https://groups.google.com/forum/#!forum/mozilla-labs-jetpack otherwise they may not be answered, and you may not get the best answer.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: