Commit Graph

4696 Commits

Author SHA1 Message Date
David Glasser
cd8bd67ff8 Fix a few exceptions in the oplog observe driver
First exception: _runQuery didn't check to see if it was stopped after
running the query, which could lead to this harmless error:

Exception in defer callback: TypeError: Cannot call method 'clear' of null
    at _.extend._publishNewResults (packages/mongo-livedata/oplog_observe_driver.js:749)
    at _.extend._runQuery (packages/mongo-livedata/oplog_observe_driver.js:657)
    at packages/mongo-livedata/oplog_observe_driver.js:615
    at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
    at packages/meteor/timers.js:6
    at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108)

Second exception: _fetchModifiedDocuments thought that it should only be
in FETCHING in a certain case, but QUERYING is also OK. This is also
harmless since the correct behavior is to end the deferred routine.

Exception in defer callback: Error: phase in fetchModifiedDocuments: QUERYING
    at packages/mongo-livedata/oplog_observe_driver.js:435
    at packages/mongo-livedata/oplog_observe_driver.js:16
    at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
    at packages/meteor/timers.js:6
    at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108)
2014-07-29 10:18:40 -07:00
David Greenspan
452ae36c68 Change how Blaze.render,toHTML infer parentView
If you call UI.renderWithData, say, from an event handler, you may be unpleasantly surprised if it gets Blaze.currentView as its parentView (where Blaze.currentView is based on the template where the event handler is defined).  On the other hand, showdown/template-integration.js takes advantage of the fact that Blaze.toHTML in render() is infers the parentView from Blaze.currentView.  So only infer currentView as parent while in the view’s render().

This change should only affect apps and packages that use Blaze.render, Blaze.toHTML, UI.render, or UI.renderWithData.
2014-07-28 16:28:16 -07:00
David Greenspan
75c30ef073 Fix scope of UI.contentBlock argument
Eric Dobbertin’s bug
2014-07-28 12:23:54 -07:00
Emily Stark
1b866b729d Try window.opener first in OAuth popup, then localStorage.
We've occasionally seen weird configurations of IE where localStorage
isn't shared between same-origin windows, so trying window.opener first
is safer.
2014-07-25 17:24:32 -07:00
Emily Stark
0f1e310a10 Test return value and argument of this.autorun 2014-07-25 16:19:47 -07:00
Emily Stark
1ac501784a Add test for this.autorun 2014-07-25 15:05:38 -07:00
David Greenspan
416b0170d7 Simplify UI.dynamic 2014-07-25 15:01:00 -07:00
David Greenspan
0cc2624c59 Fix #2339 (dynamic attributes on textareas) 2014-07-25 14:23:44 -07:00
Emily Stark
c715613e48 Add sketchy fallback for flaky window.close() in OAuth popup.
Using an onerror event handler looks like the only semi-reliable way to
be able to close the popup in iOS Chrome, even though it's almost
certainly a bug that this works. We'll replace it soon with
redirect-based OAuth.
2014-07-25 14:11:39 -07:00
David Greenspan
adeb649bf6 Fix Blaze.currentView in event handlers
with test
2014-07-25 13:57:47 -07:00
Emily Stark
abbf3c78fa shrinkwrap update 2014-07-25 08:20:33 -07:00
Emily Stark
631e9aab73 Update canonicalizeHtml for 0fd348a.
Makes tests pass in IE8. Maybe 0fd348a should have been used <!--IE-->
as the placeholder?
2014-07-24 22:21:46 -07:00
David Greenspan
fa28ac2cbc Add template instance “this.autorun”
Needs docs
2014-07-24 18:34:34 -07:00
David Greenspan
f0fd348afe Don’t use empty text node placeholders in IE 8
It’s a long story.  See comment.
2014-07-24 18:30:43 -07:00
Emily Stark
78d08b5537 Revert part of "Test that reverting df2820 fixed #2275."
This reverts commit c05ae240af EXCEPT for
the "fetch in observe" test, which I'm leaving in because we still want
a test for #2275.

This commit made it an error to start an observeChanges from within an
observeChanges callback for the same collection, but it turns out that
this is actually a somewhat common thing to do (for example, nested
'each'). Instead, we'll leave things the way they were pre-0.8.2: you
can start an observeChanges from within an observeChanges callback, but
it'll be subtly buggy in that you won't get synchronous 'added'
callbacks. This issue is described in #2315, along with the fact that
insert/update/remove/resumeObservers won't run their affected observe
callbacks if they are called from within a task on the collection's
queue. Eventually we'll implement the full fix (which relaxes the
requirement that insert/update/remove run all their callbacks before
returning) described in #2315.
2014-07-21 10:56:08 -07:00
Emily Stark
d3eae5a2e8 Make a trivial change to oauth to force new package version.
Linux build of rc0's oauth package seems to have disappeared from s3, so
forcing a new oauth version to be published.
2014-07-20 21:16:33 -07:00
David Greenspan
0ba651a79b Don’t create Connection until livedata test runs
for “livedata - publisher errors”
2014-07-17 19:10:54 -07:00
David Glasser
8e005cadd3 Fix oplog error "Buffer inexplicably empty"
We were violating the contract "buffer is never empty in STEADY phase
unless everything matching fits into published", which is maintained by
_removeBuffered, by moving something from _unpublishedBuffer without
going through _removeBuffered.

Specifically, if we had already set _safeAppendToBuffer to
false (because we knew of some matching document below buffer) and did a
modification to a document in buffer, we could leave buffer empty
without triggering a repoll.

Fixes #2274.
2014-07-16 20:13:25 -07:00
David Greenspan
c8d7821deb Uncommitted change for 2e191e0 2014-07-16 16:28:54 -07:00
David Glasser
c05ae240af Test that reverting df2820 fixed #2275.
Make some instances of #2315 into errors instead of silent early
returns.

Specifically, observeChanges calls (with added or addedBefore callbacks)
from within another observeChanges callback on the same collection will
be unable to differentiate between initial and later added/addedBefore
calls, which is serious enough to be an error (see #2315 for details).

We don't currently think that the other effect of #2315 (where observe
callbacks triggered by insert/remove/update/resumeObservers will not
occur before those methods return, if they are called reentrantly) is
problematic enough to deserve this sort of error.
2014-07-16 16:07:18 -07:00
David Glasser
61667d6d94 Revert "Only do one query for forEach/count in Deps"
This reverts commit df2820ffd9.
2014-07-16 16:07:18 -07:00
David Greenspan
2e191e0b09 Add regression tests for d56d9da
Make sure inclusions with one path segment like “..” and “foo” (where foo is in the data context) don’t cause the enclosing template to re-render when the data context changes.
2014-07-16 15:06:20 -07:00
David Greenspan
31fc5b0887 Add textarea parse tests
Test for bugs reported by Andrew and Vincent, concerning parsing of dynamic attributes and contents of textarea.
2014-07-16 14:04:12 -07:00
David Greenspan
88acf81b08 Log fewer “no heartbeat” messages in tests
Don’t log them for stub streams.

In livedata_connection, fire the onConnected callback *after* we have set up the stream, so we don’t set up a stream that has just been disconnected!
2014-07-15 18:22:43 -07:00
Emily Stark
87688f1a19 Clean up stream disconnect tests.
Make sure we always call the `expect` function, even if we fail. That
gives us a nice failure message instead of "Async batch timed out".

Make sure we close the stream in each test if we fail. Previously, in
some IEs, a "basic disconnect" timeout without closing the stream seems
to cause a somewhat random subset of other tests to time out or
fail. (Possibly a per-domain connection limit?)
2014-07-15 18:01:39 -07:00
David Greenspan
8e93519f5c Make test-in-browser show current client test 2014-07-15 17:10:46 -07:00
David Greenspan
01d538fc37 Prevent error in console when running tests 2014-07-15 16:45:32 -07:00
David Greenspan
4f15a3d702 Fix Parties on IE9 by not using parentElement
Using parentElement instead of parentNode was probably a typo.  I didn’t even know there was an Element#parentElement alongside Node#parentNode in the DOM, but apparently there is, and apparently IE 9 supports it, but for some reason it doesn’t work.

The lesson is: never use parentElement on a DOM node.  Use parentNode and be done with it.
2014-07-15 15:33:09 -07:00
David Greenspan
b5cbca980e Throw errors in {{foo bar}}, foo not a function
Fix the “simpler helper” test and expand the cases where we detect that “foo” is missing or not a function (e.g. is a scalar property of the data context).
2014-07-15 14:20:44 -07:00
Emily Stark
2a382cfb8c Update canonicalizeHtml list of DOMRange/DOMBackend element properties.
Fixes "ui hooks - nested domrange" test in IE8.
2014-07-15 13:33:00 -07:00
Emily Stark
12c60075a2 Fix parentNode check to decide whether to call a moveElement UI hook.
IE8 sets an element's `parentNode` to an HTMLDocument at funny times
even when the element hasn't been added to the DOM (like if you add a
child to the element), so a check for falsey sometimes misleads us into
thinking that the element is in the DOM when it's not (and thus calling
a moveElement UI hook for an element that was never inserted).

The corresponding check on `removeElementWithHooks` is okay, because if
the element's parentNode is an HTMLDocument, we won't find a ui hook to
call (unless you for some reason added ui hooks to the HTMLDocument).

Fixes "ui hooks" test in IE8.
2014-07-15 13:31:52 -07:00
David Greenspan
ab9cae6123 Fix Vincent’s textarea bug
Textarea would get same content as previous tag in a template, because the variable wasn’t cleared!

Needs test
2014-07-14 20:04:12 -07:00
Emily Stark
6112c2ddc1 Remove Array.prototype.slice.call on a NodeList.
It breaks in IE8.
2014-07-14 18:00:29 -07:00
David Greenspan
924f379870 Fix textarea HTML parsing
In modifying getContent, we neglected the fact that parseAttrs wraps arrays in HTML.Attrs.  Now we wrap arrays outside of parseAttrs near the code that modifies the attributes array for textarea contents.

Needs tests
2014-07-14 16:36:28 -07:00
Emily Stark
019736096b tinytest: don't pass msg.fields into _.has if it's falsey. 2014-07-14 15:28:03 -07:00
Emily Stark
8236854736 Use window.opener in OAuth flow only when localStorage doesn't work.
Move OAuth._endOfLoginResponse HTML/JS into asset instead of piecing it
together inline.

Fixes #2302.
2014-07-14 14:58:07 -07:00
Justin SB
c1795221ac Tolerate repeated test reports in tinytest
This fixes the status bar, which was otherwise double-counting repeated reports
2014-07-14 14:21:57 -07:00
Justin SB
2ac9da43f9 tinytest/run now returns immediatedly; sends a 'complete' record when finished
Otherwise the DDP call to tinytest/run was blocking client test execution,
in particular Accounts DDP calls won't run concurrently with another DDP call,
even if the first DDP call calls unblock.
2014-07-14 13:44:41 -07:00
David Greenspan
57465b00c2 Handle textarea edge case slightly more gracefully
and tests
2014-07-13 11:30:32 -07:00
David Greenspan
3b86b5c11f Suppress an error message from tests 2014-07-13 11:30:32 -07:00
Emily Stark
a186c961cf Add semicolon to OAuth end-of-login response 2014-07-11 16:18:41 -07:00
David Greenspan
d56d9daed9 Fix view.lookup to not take dependencies
The template compiler assumes that single-segment paths like {{foo}}, compiled into view.lookup(“foo”), don’t take dependencies, returning a function if there is anything reactive going on.  We violated that in the Blaze refactor, meaning that #with might re-render its contents when its argument changes!

Tests to add:
* UI.dynamic doesn’t re-create template when enclosing data context changes.
* UI.dynamic doesn’t re-create template when “data” argument changes
* Coverage for the “..” and “foo” cases in lookup.js

Tests to fix: “simple helper”
2014-07-11 08:29:07 -07:00
David Greenspan
c18ea3c721 Add view.renderCount 2014-07-11 08:29:07 -07:00
Zoltan Olah
ef70b6bfd2 Replaced process.nextTick with setImmediate in _SynchronousQueue 2014-07-10 16:31:12 -07:00
David Greenspan
e970d5381d Merge branch 'blaze-refactor' into devel
Conflicts:
	packages/spacebars-tests/template_tests.html
	packages/spacebars-tests/template_tests.js
	packages/ui/render.js
2014-07-10 16:29:20 -07:00
David Greenspan
750d2aa861 Fix compile output tests in Firefox 12 with Coffee 2014-07-10 14:02:14 -07:00
David Greenspan
3cc4e230ff More View comments 2014-07-10 14:01:34 -07:00
David Greenspan
2c3899f0e8 Have instantiateBody use Blaze.render per Arunoda 2014-07-09 17:31:38 -07:00
David Greenspan
3a2207a5c4 Add comment and fix indentation 2014-07-09 17:30:40 -07:00
Chris Mather
59d3e31e13 Fix Meteor._inherits to copy Parent static properties
Problem:
Static properties of the parent function ("class") were not copied to the child
function as expected. This is because the _.each underscore helper does not
propertly iterate over function properties.

Solution:
Don't use _.each to copy parent properties to the child function. Instead,
iterate directly and copy hasOwn properties to the child function.

An alternative solution is to make the _.each helper work properly with
functions in the underscore package.
2014-07-09 15:01:31 -07:00