Closed Bug 1376154 Opened 7 years ago Closed 7 years ago

Make sure that the HTML5 parser translator Encoding-aware

Categories

(Core :: DOM: HTML Parser, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: emk, Assigned: hsivonen)

References

Details

Attachments

(2 files)

const Encoding* is a raw pointer, so we will have to make sure the translator will not drop the initialization the next time the parser is retranslated.
I tried to translate the parser and got the following error:
$ make translate
mkdir -p javaparser/bin && \
  find javaparser/src -name "*.java" | \
    xargs javac -encoding ISO-8859-1 -g -d javaparser/bin && \
  jar cf javaparser.jar -C javaparser/bin .
注意:javaparser\src\japa\parser\ASTParser.javaの操作は、未チェックまたは安全ではありません。
注意:詳細は、-Xlint:uncheckedオプションを指定して再コンパイルしてください。
mkdir -p htmlparser/bin && \
  find htmlparser/translator-src/nu/validator/htmlparser -name "*.java" | \
    xargs javac -cp javaparser.jar -g -d htmlparser/bin && \
  jar cfm translator.jar manifest.txt -C htmlparser/bin .
mkdir -p ../javasrc ; \
  java -jar translator.jar \
    htmlparser/src/nu/validator/htmlparser/impl \
    .. ../nsHtml5AtomList.h
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: ..\nsHtml5AtomList.h (指定されたファイルが見つかりません。)
        at nu.validator.htmlparser.cpptranslate.CppTypes.<init>(CppTypes.java:136)
        at nu.validator.htmlparser.cpptranslate.Main.main(Main.java:83)
Caused by: java.io.FileNotFoundException: ..\nsHtml5AtomList.h (指定されたファイルが見つかりません。)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at nu.validator.htmlparser.cpptranslate.CppTypes.ingestAtoms(CppTypes.java:143)
        at nu.validator.htmlparser.cpptranslate.CppTypes.<init>(CppTypes.java:131)
        ... 1 more
make: *** [translate] Error 1

Is this Makefile up-to-date? If not, how can I generate translate the parser?
Flags: needinfo?(hsivonen)
(In reply to Masatoshi Kimura [:emk] from comment #1)
> Is this Makefile up-to-date?

It's not. Sorry about that.

> If not, how can I generate translate the parser?

The argument ../nsHtml5AtomList.h (all occurrences) in the makefile needs to be replaced with ../../../dom/base/nsGkAtomList.h

Also, nsIUnicodeDecoder needs to be deleted from CppTypes.java if you land before bug 1366241.

As for the actual code change, it should be enough to add
// CPPONLY: this.mEncoding = null;
to the MetaScanner.java constructor. The field itself can continue to be declared in nsHtml5MetaScannerHSupplement.h.
Flags: needinfo?(hsivonen)
See Also: → 1377859
(In reply to Henri Sivonen (:hsivonen) from comment #2)
> The argument ../nsHtml5AtomList.h (all occurrences) in the makefile needs to
> be replaced with ../../../dom/base/nsGkAtomList.h

This is now bug 1377859.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attached patch Java changesSplinter Review
Attachment #8883007 - Flags: review?(wchen)
Attachment #8883007 - Flags: review?(wchen) → review+
Comment on attachment 8883006 [details]
Bug 1376154 - Preserve nsHtml5MetaScanner::mEncoding initialization when re-translating parser. .

https://reviewboard.mozilla.org/r/153974/#review159196
Attachment #8883006 - Flags: review?(wchen) → review+
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/df5692721953
Preserve nsHtml5MetaScanner::mEncoding initialization when re-translating parser. r=wchen.
https://hg.mozilla.org/projects/htmlparser/rev/0170c447a5d482d47c1cdf2167b14069d5df5d36
Mozilla bug 1376154 - Preserve nsHtml5MetaScanner::mEncoding initialization when re-translating parser. r=wchen.
https://hg.mozilla.org/mozilla-central/rev/df5692721953
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: