Firefox extension popup won't resize
Asked Answered
A

1

6

I'm working on porting an extension from Chrome to Firefox. The popup has several different sized elements which can be shown. The issue that I'm running into is when the elements are changed or the body is resized the 'window' that the popup is displayed in does not resize.

This issue doesn't seem to exist in chrome, does anyone know what I'm doing wrong or is this a bug in Firefox? I've included the code which changes the size of the body below, this works in chrome, but does not seem to work in Firefox.

$('body').ready(function(){
  $('body').animate({
    'width':500,
    'height':500
  },500); 
});

I've also tried this with $('body').css() in case animate() was the issue, neither work.

Additionally, if I add a background to the body and shrink it, then the background can be seen changing size without the containing window changing size.

Edit: Adding more information to clarify the issue

The extension is a WebExtension add-on (https://developer.mozilla.org/en-US/Add-ons/WebExtensions)

manifest.json

{
  "manifest_version": 2,
  "browser_action": {
    "default_popup": "popup.htm"
  },
  "description": "Example extension",
  "icons": {
    "128": "example.png"
  },
  "name": "Example Extension",
  "version": "1",
  "applications":{
    "gecko":{
      "id":"[email protected]"
    }
  }
}

popup.htm

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type=text/javascript src="js/jquery.js"></script>
    <script type=text/javascript src="js/popup.js"></script>
</head>
<style>
body{
  width:200px;
  height:200px;

  border:1px solid black;
}
</style>
<body>
  <button id=reset type=button>200x200px</button>
  <button id=shrink type=button>100x100px</button>
</body>
</html>

js/popup.js

$('body').ready(function (){
  $('#reset').bind('click',function(){
    $('body').css({
      width:200,
      height:200
    });
  });
  $('#shrink').bind('click',function(){
    $('body').css({
      width:100,
      height:100
    });
  });
});

When the above extension is loaded, the popup shows correctly with its initial size (200x200). However, when the body is resized, the popup's size is not updated. This same extension works as expected (popup resizes) within Chrome.

Arbiter answered 17/3, 2016 at 14:20 Comment(7)
Are you using WebExtensions?Marriageable
We need a full minimal reproducible example, not just the jQuerry code you are using to perform the resize. We need to see how the popup was created. We need to know what type of Firefox extension you are developing.Severity
I've added a more complete example that should help make my issue clearer.Arbiter
Are you sure that this is a Bootstrapped/restartless extension? The existence of a manifest.json file would imply that it is a WebExtensions add-on, not what would be termed a Bootstrapped add-on. Bootstrapped add-ons do not have manifest.json files unless you have created one for your own specific non-standard purpose.Severity
There may be some confusion because both WebExtensions and Add-on SDK extensions are functionally restartles (they do not require restart). However, they are not termed Bootstrapped or Restartless extensions. Yes, Mozilla could have done a better job at picking names for their different types of add-ons. They are this way because they developed over time, one after the other.Severity
Oh yeah, you're right. I had too many tabs open when I was looking at the different types. Good callArbiter
You should strongly keep in mind that "WebExtensions are currently in an experimental alpha state." That means a lot of things don't work, or don't work correctly yet.Severity
A
4

Well it looks like this is actually bug within Firefox which is being addressed

https://bugzilla.mozilla.org/show_bug.cgi?id=1215025

Arbiter answered 18/3, 2016 at 14:17 Comment(1)
Note that this is now VERIFIED FIXED for at least FF 50+Argentiferous

© 2022 - 2024 — McMap. All rights reserved.