binding: Introduces ExceptionToPromiseScope.

ExceptionState is now a scope-like object, and guarantees
that an exception is automatically thrown at destruction.
ExceptionToPromiseScope similarly guarantees to return
a reject promise instead of throwing an exception.

A new Jinja2 filter "format_remove_duplicates" helps
write a template more easily without caring duplicates.
    {% if A_enabled %}
    ScriptState* scriptState = ...;
    A(scriptState);
    {% endif %}
    {% if B_enabled %}
    ScriptState* scriptState = ...;
    B(scriptState);
    {% endif %}
produces two lines of definitions of |scriptState|,
however, format_remove_duplicates removes the duplicates.

Jinja2 macro "propagate_error_with_exception_state" is no
longer necessary, because ExceptionState and
ExceptionToPromiseScope automatically throws an exception
or returns a reject promise appropriately.

This CL alone does not fix crbug.com/627309 , but the CL
makes it easy to fix the issue.

BUG=627309

Review-Url: https://codereview.chromium.org/2301993002
Cr-Commit-Position: refs/heads/master@{#418513}
30 files changed