Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small images in private tabs displayed without favicons in Firefox 25.0a1 #85

Closed
Infocatcher opened this issue Aug 1, 2013 · 1 comment
Labels

Comments

@Infocatcher
Copy link
Owner

Error: invalid 'instanceof' operand doc.defaultView.ImageDocument
Source:

if(doc instanceof doc.defaultView.ImageDocument) {

This is side-effect of this fix: #56

Firefox 22:
view-source:chrome://browser/content/tabbrowser.xml

      <method name="useDefaultIcon">
        <parameter name="aTab"/>
        <body>
          <![CDATA[
            var browser = this.getBrowserForTab(aTab);
            var docURIObject = browser.contentDocument.documentURIObject;
            var icon = null;
            if (browser.contentDocument instanceof ImageDocument) {
              if (Services.prefs.getBoolPref("browser.chrome.site_icons")) {
                let sz = Services.prefs.getIntPref("browser.chrome.image_icons.max_size");
                try {
                  let req = browser.contentDocument.imageRequest;
                  if (req &&
                      req.image &&
                      req.image.width <= sz &&
                      req.image.height <= sz)
                    icon = browser.currentURI;
                } catch (e) { }
              }
            }

Firefox 25.0a1:

      <method name="useDefaultIcon">
        <parameter name="aTab"/>
        <body>
          <![CDATA[
            var browser = this.getBrowserForTab(aTab);
            var documentURI = browser.documentURI;
            var icon = null;

            if (browser.imageDocument) {
              if (Services.prefs.getBoolPref("browser.chrome.site_icons")) {
                let sz = Services.prefs.getIntPref("browser.chrome.image_icons.max_size");
                if (browser.imageDocument.width <= sz &&
                    browser.imageDocument.height <= sz) {
                  icon = browser.currentURI;
                }
              }
            }

view-source:chrome://global/content/bindings/browser.xml

      <property name="imageDocument"
                readonly="true">
        <getter>
          <![CDATA[
            var document = this.contentDocument;
            if (!document || !(document instanceof Ci.nsIImageDocument))
              return null;

            try {
                return {width: document.imageRequest.image.width, height: document.imageRequest.image.height };
            } catch (e) {}
            return null;
          ]]>
        </getter>
      </property>

So we should also checks for instanceof Ci.nsIImageDocument instead of instanceof ImageDocument.

@Infocatcher
Copy link
Owner Author

This caused by https://bugzilla.mozilla.org/show_bug.cgi?id=885177 "Make window.ImageDocument ChromeOnly".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant