Error in sdk/ui/frame/view.html

Hi,

I’ve a problem to get rid of an error, that’s caused by an underlying SDK file.

When I add an “sdk/ui/frame” object to an “sdk/ui/toolbar” object in my add-on this error occurs:

The character encoding of the HTML document was not declared. The
document will render with garbled text in some browser configurations if
the document contains characters from outside the US-ASCII range. The
character encoding of the page must be declared in the document or in
the transfer protocol. view.html

The file “view.html” is located here: “resource://gre/modules/commonjs/sdk/ui/frame/view.html”

And it seems this file is not well declared with full html code and doctype.

How could I prevent this error, because my add-on won’t get a full review with errors.

Kind regards,
uepselon

You can declare the character encoding of a document using a meta node (inside the head node):

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

resource://gre/modules/commonjs/sdk/ui/frame/view.html does not declare the encoding. Since this is part of the SDK and not the addon, it should not affect the review.

<script>
// HACK: This is not an ideal way to deliver chrome messages
// to a innef frame content but seems only way that would
// make `event.source` an this (outer frame) window.
window.onmessage = function(event) {
  var frame = document.querySelector("iframe");
  var content = frame.contentWindow;
  // If message is posted from chrome it has no `event.source`.
  if (event.source === null)
    content.postMessage(event.data, "*");
};

@jorgev I know that, but this should be inserted into the view.html from the SDK.

@desktopd Does this mean, I could request a full review again and mention that this an SDK error case?

Possibly, but I’m not an AMO reviewer. You can file a bug against SDK, which is however in maintenance-only mode. It looks like a minor problem in this very case since no non-ASCII characters are involved, so it may not be worth a fix.

If it’s a warning being thrown from within SDK code, you should just mention that in the Notes to Reviewers and request full review again.