This removes the client relationship between the sky::InspectorFrontend
and sky::InspectorBackend mojo interfaces. Instead, the two are now
unrelated (in the mojom) and just happen to be often used together.
The inspector service provides the InspectorFrontend interface to
connecting applications and optimistically tries to connect to the
InspectorBackend interface of applications that connect, in case they
want to receive messages. The front and back end interfaces are both
broadcast APIs, so no attempt is made to keep track of which binding
is which. If they did need to be correlated this could be easily
accomplished by allocating a new object to keep a
mojo::Binding<sky::InspectorFrontend> and the corresponding
sky::InspectorBackendPtr.
R=abarth@chromium.org, eseidel@chromium.org
Review URL: https://codereview.chromium.org/835463003
Log an error whenever an element has an unknown attribute in a template.
This means you can't use generic attributes like Polymer, but we
probably want to discourage that anyway since attribute selectors should
be avoided for most things.
R=ojan@chromium.org
Review URL: https://codereview.chromium.org/845523004
This is a proof of concept for replacing ui/views
code with Sky instead. erg says this will allow him
to delete 10s of thousands of LOC from mojo.
Mojo does not yet expose the current binary's URL:
https://docs.google.com/a/chromium.org/document/d/1AQ2y6ekzvbdaMF5WrUQmneyXJnke-MnYYL4Gz1AKDos
So I've worked around that by passing the url
of the binary via the helper script.
I discovered several bugs in the wm_flow code
including that it doesn't handle view resizes
(during embiggen). Related, I discovered that
every time a new window is made it drops the
connections to the embedded.cc app from the
previous window, since the ViewManagerDelegate
is incorrectly implemented as part of the
ApplicationDelegate on both app.cc and embedded.cc.
We'd need to split out a separate per-view object
in both of those apps to handle the
ViewManagerDelegate calls.
There are some changes to logging during loading
as well as the CopyToFile helper to have better
error reporting. I hit several issues early on trying
to get mojo to load the http: urls correctly, including
eventually running out of disk space on my /tmp
and mojo then silently failing to launch the app
(due to mojo never clearing its caches crbug.com/446302).
I had to re-write the mojo_demo.sh script in python
as well as split the sky_server handling code out of
skydb into a separate python module in order to cleanly
launch sky_server. We could use a separate server
if we wanted to but the primary benefit of sky_server
is that it sets up the proper url->disk mappings into
the generated file directories, etc.
BUG=443439
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/817573003
Now you can use the attributes attribute on <sky-element> that
accepts a set of name:type comma separated pairs to control
the reflected attributes. ex. attributes="size:number"
Each attribute creates a getter and a setter on the element that returns
the correct type and will coerce the string attribute values into the
right type. It also correctly hooks into the data binding system.
A new callback is added: {name}Changed(oldValue, newValue) which will
be invoked whenever the attribute with that name changes and gets the
correctly coerced type values. See the <sky-radio> or <sky-checkbox>
widgets for examples of using the new callback.
Number attributes default to 0, booleans to false, and strings to empty
string. There is no way provided to set a different default, for that you
can use hasAttribute in the created callback to conditionally set a value.
Don't just assign the property there otherwise you'll overwrite the value
from the parser.
Another behavior change from making this work is that now attributeChanged()
is called for each attribute, even when the element is created by the
parser.
Overall this allows a nice simplification to the <sky-button>,
<sky-radio> and <sky-checkbox> widgets.
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/836923002
Warning: this change will require Chrome changes. See
https://codereview.chromium.org/803173009/#msg6.
Added ProxyBindings and StubBindings methods that expose
bindings-related properties for generated Proxy and Stub classes
without risking name collisions.
Outgoing "in/out" interface valued parameters are now specified as
functions that are applied to the out value.
Note: the leading capital in the Proxy,StubBindings() methods is
unconventional. It seemed OK given their unusual role: they can be
viewed as transformers from "Foo" objects to "FooBindings" objects.
BUG=
R=esprehn@chromium.org
Review URL: https://codereview.chromium.org/803173009
SkyBinder is a rewrite of TemplateBinding.sky that uses classes and weak maps
and doesn't add expandos to any of the DOM objects.
It has a few differences from TemplateBinding.sky:
- null doesn't create instances in repeats.
- One time bindings are removed ([[ expr ]]), we'll add them back later.
- The bind attribute is removed.
The system is also less generic and is specialized to be used when
creating SkyElement instances.
The commit history that created SkyBinder can be found at:
https://github.com/esprehn/sky-binder/commits/masterTBR=ojan@chromium.org
Review URL: https://codereview.chromium.org/821353003
Now inside the <template> of a SkyElement you can use
on-eventName="method" on any element to add event listeners.
For example you can write <sky-button on-click="handleClick">
and then define handleClick(event) on the element class that
contains the button.
In adding this and tests I also realized that property bindings
were not setup on the initial call to bind(), which is now
fixed in this patch (See change to Node.prototype.bind).
R=eseidel@google.com, rafaelw@chromium.org
Review URL: https://codereview.chromium.org/812713005
Eventually we'll want to replace these with something
fancier like polymer, but this exercise helped us
find several bugs in the engine as well as
removed one more blocker from using Sky to
replace mojo/views usage in mojo/examples.
R=esprehn@chromium.org
BUG=443439
Review URL: https://codereview.chromium.org/809233002
The syntax for implementing a SkyElement is now:
<sky-element name="element-name">
<template>
<!-- template here -->
</template>
<script>
module.exports = class extends SkyElement {
attached() {
// ...
}
// .. methods here ..
}.register();
</script>
</sky-element>
The register() static method on SkyElement subclasses calls
document.registerElement() and returns the generated constructor.
It uses the parent <sky-element>'s name attribute to set the name
of the element.
R=rafaelw@chromium.org
Review URL: https://codereview.chromium.org/788943003
Also fixed all the XHR tests to actually run and work
I learned from elliot that the it function has to
take a "done" argument to be treated asynchronously.
My utf8 conversion is a hack, but we deleted
window.TextEncoder (it was a module) when we forked.
We could resurrect TextEncoder (and probably should)
but I've left that for a separate change.
I also augmented sky_server to have a special /echo_post
handler so we can test POST requests.
R=esprehn@chromium.org
BUG=
Committed: 5ef81d249b
Review URL: https://codereview.chromium.org/810523002
Also fixed all the XHR tests to actually run and work
I learned from elliot that the it function has to
take a "done" argument to be treated asynchronously.
My utf8 conversion is a hack, but we deleted
window.TextEncoder (it was a module) when we forked.
We could resurrect TextEncoder (and probably should)
but I've left that for a separate change.
I also augmented sky_server to have a special /echo_post
handler so we can test POST requests.
R=esprehn@chromium.org
BUG=
Review URL: https://codereview.chromium.org/810523002
This CL goes from this:
//mojo/services/public/cpp/network
//mojo/services/public/interfaces/network
to this:
//mojo/services/network/public/cpp
//mojo/services/network/public/interfaces
This CL also makes the Mojo-side changes required to roll this change into
Chromium.
TBR=beng
Review URL: https://codereview.chromium.org/789243002
Now when debugger is paused scope sections are properly populated with corresponding name:value pairs for all variables.
Eventually InjectedScript may become something like a regular Sky module but at the moment I don't see how to do this gracefully given that it is parametrised by InjectedScriptHost binding. So at the moment I just store it in "injectedScript" property on the global object,
BUG=435243
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/766683005
Moving this property to a getter lets the implementation of the object change
the value but prevents clients of the API from changing the value, which is the
expected behavior.
R=esprehn@chromium.org
Review URL: https://codereview.chromium.org/746953002
Unfortunately we don't yet have a way to walk into
imports, so this only is the first-level of the
source tree, but this is a huge step forward.
You can now click to set breakpoints, however
setting breakpoints crashes sky.
I had to fix Console.log to flush stdout
so that I could actually debug my timing-out test.
Also had to fix Chai to dump differences for deepEqual.
R=esprehn@chromium.org, abarth@chromium.org, esprhen@chromium.org
Review URL: https://codereview.chromium.org/732413004
The debugger can now correctly break on exceptions
and show the corresponding line in the inspector.
It correctly understands which scripts are internal
to sky and does not pause during them.
There is still a ton to make work here
(including stacktraces which I have not tested),
but basic functionality seems to work.
The current implementation is not smart enough to
unpause the inspector when the frontend disconnects.
BUG=434510,434513
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/727593004
- Don't stamp the template repeatedly when attaching.
- Don't use __proto__
- Store the template in an external map instead of a property on the prototype.
- Add a created() callback.
- Allow creating a SkyElement with no associated <template> or ShadowRoot.
R=rafaelw@chromium.org
Review URL: https://codereview.chromium.org/715203002
This will make it possible to connect a c++
inspector backend in addition to the JS one.
We lose the feature of running multiple inspector
servers in this patch, but we weren't using that feature
and could easily add it back if we plan to use it.
This patch has a *ton* of boilerplate code due
to crbug.com/431911, hopefully that will be fixed
soon and we can delete all the Impl nonsense.
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/710043004
Expose a Document constructor instead. This also exposes that
the TemplateBinding library might need more control over the
registration context for custom elements. For now we make all
documents share the same registration context.
R=ojan@chromium.org, abarth@chromium.org
Review URL: https://codereview.chromium.org/697363002
In mojom, there's a notion of a request/response pair. This CL teaches the JS
bindings not to GC a message pipe after a request has been issued but before
the response has been received.
R=hansmuller@chromium.org
Review URL: https://codereview.chromium.org/696373003
Previously we were using string concatenation to build up the directory
listing. Now we fetch some JSON from the server and use data binding to inflate
a directory listing.
This exmaple doesn't work yet because we're missing support for
template@repeat, but hopefully we'll get that soon.
Also, added support for setRequestHeader to XMLHttpRequest.
R=rafaelw@chromium.org
Review URL: https://codereview.chromium.org/688413005