58 Commits

Author SHA1 Message Date
James Robinson
375d0f44e0 Remove client relationship between sky::Inspector{Front,Back}end
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
2015-01-09 14:50:39 -08:00
Elliott Sprehn
a25c88d9c6 console.error when using unknown attributes in templates.
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
2015-01-08 16:52:12 -08:00
Elliott Sprehn
6352ce5f7e Prevent expandos on all SkyElements.
Expandos make v8 sad, lets not allow them.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/835353004
2015-01-08 15:30:18 -08:00
Adam Barth
3b86add20e Flex the inside of the input control
We really need delegated focus from the container to the control, but this will
do for now.

TBR=esprehn@chromium.org

Review URL: https://codereview.chromium.org/844763004
2015-01-08 13:29:30 -08:00
Adam Barth
64a7d49358 Implement <sky-input>
This CL contains a basic input element.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/831353003
2015-01-08 13:22:00 -08:00
Eric Seidel
1ff137055e Move wm_flow off of views and onto Sky
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
2015-01-06 14:40:41 -08:00
Elliott Sprehn
6d61fe6ce8 Automate reflected properties in SkyElement.
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
2015-01-05 20:12:58 -08:00
Elliott Sprehn
84c4c1eb69 Improve the appearance of <sky-checkbox>
The unicode char never showed up for me, lets do what polymer does for
now.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/836723006
2015-01-05 14:28:16 -08:00
Elliott Sprehn
ceb4dbc927 Fix detached callback and add isAttached to SkyElements.
There was a typo in the name of the detached callback which is now fixed,
and also allow querying if an element is attached.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/806133003
2015-01-05 12:54:43 -08:00
Hans Muller
0333bd80a7 Mojo JS Bindings: Eliminate foo$ and Stub and Proxy class members
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
2015-01-05 12:46:09 -08:00
Elliott Sprehn
a897ad7053 Fix resource clean up in TemplateIterator.close()
I had forgotten to rename the properties here.

TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/829993004
2015-01-03 12:40:42 -08:00
Elliott Sprehn
213c093956 Add a basic SkyBinder test.
TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/831033002
2015-01-02 19:56:45 -08:00
Elliott Sprehn
1a21f72ed5 Switch to SkyBinder
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/master

TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/821353003
2015-01-02 19:42:13 -08:00
Elliott Sprehn
d3fbe58e94 Add shadowRootReady callback for SkyElement.
This is called right after stamping the template into the ShadowRoot.
This is a useful place to querySelector/getElementById for elements
inside the ShadowRoot.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/817053002
2014-12-19 14:01:49 -08:00
Elliott Sprehn
c7d8c77498 Add declarataive event handlers.
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
2014-12-19 13:10:16 -08:00
Eric Seidel
bdaf418370 Add super-basic sky widgets.
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
2014-12-18 13:01:43 -08:00
Eric Seidel
0b8c9cf3ac Use existing unicode.sky instead of re-inventing
I somehow missed this function the first time.

This is already tested by
tests/framework/xmlhttprequest/unicode-post.sky

R=esprehn@chromium.org
BUG=

Review URL: https://codereview.chromium.org/806043002
2014-12-17 12:11:42 -08:00
Elliott Sprehn
b3400475d5 Make SkyElement more classy.
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
2014-12-16 16:28:28 -08:00
Eric Seidel
a9776838ee Add POST support to XHR as well as .status and statusText support
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
2014-12-16 11:20:40 -08:00
Eric Seidel
1fb39d65dd Revert "Add POST support to XHR as well as .status and statusText support"
This reverts commit 5ef81d249b841f44c9593ffb0158d64c7e0febfc.

This appeared to make 5 XHR tests timeout.  Not sure why yet.
TBR=esprehn@chromium.org

Review URL: https://codereview.chromium.org/808663002
2014-12-15 18:37:44 -08:00
Eric Seidel
6f33a75051 Add POST support to XHR as well as .status and statusText support
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
2014-12-15 16:09:51 -08:00
Eric Seidel
6bd317d504 Add responseType='arraybuffer' support to XHR
Also moved existing XHR tests from tests/services
to tests/framework to better match the location
of the XHR code itself.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/805503002
2014-12-12 12:03:50 -08:00
Colin Blundell
a450ba1353 Restructure public side of network service.
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
2014-12-10 16:28:40 +01:00
Elliott Sprehn
f1a6cd9799 Use a JS markup serializer.
This makes MarkupAccumulator and all related code into dead code.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/771093002
2014-12-02 10:09:35 -08:00
Yury Semikhatsky
b22d85f975 Populate scope sections with variable name/values
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
2014-11-27 21:00:06 +03:00
Elliott Sprehn
253b5bed74 Only allow one shadowRoot.
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/759663003
2014-11-26 13:54:14 -05:00
Adam Barth
a2aedc2d68 Move XMLHttpRequest#responseText to a getter
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
2014-11-21 00:09:50 -08:00
Adam Barth
1766fb0ba7 Hide XMLHttpRequest's private state using Symbol
It's not really hidden because you can reflect out the symbols, but this is a
start. We might use a WeakMap in the future if we really need hiding.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/753473002
2014-11-21 00:00:44 -08:00
Adam Barth
1b91a2db4e Convert xmlhttprequest.sky to use classes
R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/753453002
2014-11-20 23:27:53 -08:00
Yury Semikhatsky
e599443dc2 Don't send duplicate responses for debugger commands in Sky
This fixes following error in DevTools front-end:
"Protocol Error: the message with wrong id. "
and makes breakpoint persist between debugging sessions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/746453002
2014-11-20 20:17:18 +03:00
Eric Seidel
c04c091978 Make breakpoints not crash sky
They still don't work, but at least they don't crash.

TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/742583004
2014-11-18 17:39:21 -08:00
Eric Seidel
0ca1069cd4 Add support for Page.getResourceTree
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
2014-11-18 15:53:13 -08:00
Eric Seidel
593c8f8de3 Wire up more of the DebuggerAgent
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
2014-11-18 15:05:05 -08:00
Eric Seidel
a511ef074a Teach XHR how to handle relative urls.
Hixie says window.URL may not exist yet in the
sky specs, but I'm sure we'll need something like it.

R=ojan@chromium.org, abarth@chromium.org

Review URL: https://codereview.chromium.org/729913003
2014-11-18 11:15:56 -08:00
Elliott Sprehn
0ae7b5288f Improve SkyElement.
- 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
2014-11-12 12:32:39 -08:00
Eric Seidel
a1bf7bae10 Make it possible to have multiple InspectorBackends
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
2014-11-11 10:29:21 -08:00
Benjamin Lerman
2cdc639a09 Change mojo url to always use mojo:foo instead of mojo://foo
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/701933004
2014-11-06 17:23:18 +01:00
Rafael Weinstein
b492557ddf fix file-browser
R=eseidel@chromium.org, abarth
BUG=

Review URL: https://codereview.chromium.org/705683002
2014-11-04 15:21:57 -08:00
Elliott Sprehn
11b2b24722 Remove DOMImplementation.
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
2014-11-03 23:18:39 -08:00
Adam Barth
1d55401b57 Don't GC message pipes that have an in-flight request
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
2014-11-03 19:05:48 -08:00
Adam Barth
6002422526 Convert the directory listing to run on top of the platform
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
2014-11-03 12:53:38 -08:00
Adam Barth
4240a776a4 Replace <link rel="import"> with <import>
This CL is just a search-and-replace.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/694423002
2014-11-03 12:34:57 -08:00
Adam Barth
d07561b6cf Fix SkyElement
Adam broke this when trying to refactor it. This CL is just a partial revert of his
CL.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/689243003
2014-11-03 10:15:38 -08:00
Elliott Sprehn
5330701999 Remove Element#attributes.
We now implement getAttributes() such that it returns
a new set of Attr isntances on every call as well.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/697773002
2014-10-31 15:10:53 -07:00
Adam Barth
0b40ab943e Clean up SkyElement
There's no reason to wrap this script in an anonymous function. Sky modules
already run inside their own scope.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/692253002
2014-10-31 14:58:38 -07:00
Adam Barth
03114dfa7e Switch "html" Mojo modules to the Sky module system
These never really worked with HTML imports. This CL updates them to use a more
modern version of the Sky module system so we can delete the old this.exports
pattern.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/697723003
2014-10-31 14:46:40 -07:00
Rafael Weinstein
11130c9880 Minor tweaks to sky/framework/README.md 2014-10-31 14:41:52 -07:00
Rafael Weinstein
7f221ff756 add README.md
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/695963003
2014-10-31 14:37:32 -07:00
Rafael Weinstein
8279e8603b Add initial SkyElement & city-list example
BUG=
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/698653002
2014-10-31 12:29:42 -07:00
Adam Barth
e3d78d7306 Convert more this.exports to module.exports
TBR=esprehn@chromium.org

Review URL: https://codereview.chromium.org/685323003
2014-10-29 15:25:41 -07:00