Chrome App CSP violation after Dart/Polymer transform/compile to JavaScript - dart

Alright-- so there are a lot of similar questions regarding Polymer after dart2js. I am seemingly running into an issue that's specific to doing this but also running it as a Chrome app.
I have discovered that the outcome varies depending on the order of the transformers (which is expected).
Here's my results so far:
transformers:
- chrome
- polymer:
entry_points: web/example.html
csp: true
- $dart2js:
csp: true
This works great in browser but fails when run as a Chrome app.
Error: Uncaught TypeError: Cannot read property 'apply' of undefined (in the example.html_bootstrap.dart.js file)
From this point I am removing the chrome transformer because it's redundant.
Now I will switch the order of the transformers:
transformers:
- $dart2js:
csp: true
- polymer:
entry_points: web/example.html
csp: true
This fails when run in the browser.
Error: example.html_bootstrap.dart.js net::ERR_FILE_NOT_FOUND
This also fails when run as a Chrome app (with the same error).
Now I try to replicate what the guys on the CDE team are doing. Taking out the $dart2js transformer entirely.
https://github.com/dart-lang/chromedeveditor/blob/master/ide/pubspec.yaml
transformers:
- polymer:
entry_points: web/example.html
csp: true
This runs perfectly from the browser.
This fails when run as a Chrome app.
Error: blah blah violates CSP policy with unsafe-eval
Just to cover my bases I also tried this (fails CSP policy):
- chrome
- polymer:
entry_points: web/example.html
csp: true
and this (fails CSP policy):
- polymer:
entry_points: web/example.html
csp: true
- chrome

I think you can omit the chrome transformer when you use Polymer and $dart2js should be the last transformer.
csp_fixer is supposed to fix remaining issues.

Related

Can't run UI test for iOS on Bitrise

I'm following this tutorial using their own sample repository that I forked from GitHub: https://discuss.bitrise.io/t/how-to-do-calabash-uitesting-on-bitrise/361 I'm not doing anything special or anything different than the tutorial.
I managed to get the APK and Android UI test working using calabash. But for some reason the APP for iOS is not in the artifacts despite it says it built it and the UI tests (also with calabash) are failing.
Cucumber Features
1 scenario (1 failed)
4 steps (4 skipped)
Finished in 6m22.928s seconds
Expand All
Collapse All
Feature: Sample Feature
features/sample.feature:3
Scenario: Sample Scenario
Could not connect to the DeviceAgent service.
device: #<Simulator: iPhone 6 (11.4) FDAAB45E-52F1-4133-A02D-632AA6A9A369 x86_64>
url: http://127.0.0.1:27753/
To diagnose the problem tail the launcher log file:
$ tail -1000 -F /Users/vagrant/.calabash/iOSDeviceManager/logs/current.log
./features/support/01_launch.rb:27:in `Before'
25 }
26
27 launcher.relaunch(options)
28end
29
30# gem install syntax to get syntax highlighting
Given the app has launched
features/steps/sample_steps.rb:1
And I have done a specific thing
features/steps/sample_steps.rb:7
When I do something
features/steps/sample_steps.rb:32
Then something should happen
features/steps/sample_steps.rb:41
Here is the bitrise.yml:
---
format_version: '5'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: xamarin
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
- activate-ssh-key#3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone#4.0.11: {}
- script#1.1.5:
title: Do anything with Script step
- certificate-and-profile-installer#1.9.3: {}
- nuget-restore#1.0.7: {}
- xamarin-archive#1.5.0:
inputs:
- xamarin_solution: "$BITRISE_PROJECT_PATH"
- xamarin_configuration: "$BITRISE_XAMARIN_CONFIGURATION"
- xamarin_platform: "$BITRISE_XAMARIN_PLATFORM"
- calabash-ios-uitest#1.3.1:
inputs:
- work_dir: "./iOS"
- deploy-to-bitrise-io#1.3.12: {}
- create-android-emulator#1.1.5:
inputs:
- name: FOO
- start-android-emulator#1.3.2: {}
- calabash-android-uitest#1.2.1:
inputs:
- work_dir: "./Droid"
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Multiplatform.sln
- opts:
is_expand: false
BITRISE_XAMARIN_CONFIGURATION: calabash
- opts:
is_expand: false
BITRISE_XAMARIN_PLATFORM: Any CPU
I asked the people from Bitrise and apparently calabsh-ios support Xcode 6 and 7 which are old and Bitrise doesn't provide a stack for that version.
https://github.com/calabash/calabash-ios

Polymer-dart: http://www.xxx/index.bootstrap.initialize.dart Failed to load resource - where is it?

I have a Dart (1_16_0_dev_2) Polymer web app. I see >the problem here< , but I still have it. My yaml is :
dependencies:
browser: ^0.10.0
polymer: ^1.0.0-rc.16
polymer_elements: ^1.0.0-rc.8
transformers:
- polymer:
entry_points:
- web/index.html
- $dart2js:
$include: '**/*.bootstrap.initialize.dart' (I've tried with and without this line)
minify: true
commandLineOptions:
- --trust-type-annotations
- --trust-primitives
I've tried without the dart2js too. I can view my website in (some!?) Chromes on different devices, but Dartium gives this complaint
http://www.xxx/index.bootstrap.initialize.dart Failed to load resource: the server responded with a status of 404 (Not Found)
(and I assume it's why FireFox and Edge show a blank page).
What am I doing wrong please?
Thanks,
cheers,
s
I was missing:
<script src="packages/web_components/webcomponents-lite.min.js"></script>
in index.html. Now it works in Firefox, and Dartium isn't looking for the bootstrap file.

Custom Angular Dart Component Package

I have an angular dart component I created that I am trying to use in my main project. I am using path packages to reference it. The component's constructor (in the dart file) is being called, but I get errors that the .css and .html file cannot be found. The paths it is looking for them in seem to exist, so I'm not sure why it cannot find them.
I have other custom components I am using throughout my code, but there is no html or css files associated with them and they were fine, it seems to be limited to the html and css files.
Here are snippets of my code
test.dart located in test_component/lib/test_component/
library TestCom;
import 'package:angular/angular.dart';
#Component(
selector: 'tester',
templateUrl: 'test.html',
cssUrl: 'test.css')
class TestComponent {
String t = "this is the test component";
TestComponent() {
print("Test Component STARTED");
}
}
test.html located in test_component/lib/test_component/
<h3>{{t}}</h3>
pubspec.yaml located in test_component
name: TestModule
dependencies:
angular: "^1.1.2+2"
browser: any
transformers:
- angular:
html_files:
- lib/test_component/test.html
main.dart located in main/src/main/dart/web
import 'package:TestModule/test_component/test.dart';
class MyAppModule extends Module {
MyAppModule() {
bind(TestComponent);
}
}
index.html located in main/src/main/dart/web/
<tester></tester>
pubspec.yaml located in main/src/main/dart
name: main_package
dependencies:
angular: "^1.1.2+2"
browser: any
shadow_dom: any
json_object: any
bootjack: any
crypto: any
xml: "^2.3.2"
TestModule:
path: ../../../../test_component
transformers:
- angular:
After I run pub get, in the packages folder of my main project, TestModule/test_component/ exists with test.css, test.dart, and test.html in it. I'm not sure why when I run it, it can not find the .html and .css files.
This is what is displayed in the console when I run it
Observatory listening at http://127.0.0.1:54254/
Test Component STARTED
index.html:1 GET http://127.0.0.1:3030/packages/TestModule/test_component/test.css 404 (Not Found)
index.html:1 GET http://127.0.0.1:3030/packages/TestModule/test_component/test.html 404 (Not Found)
2 HTTP 404: <html><head><title>404 Not Found</title></head><body>File not found</body></html>
STACKTRACE:
null
Try this
name: TestModule
dependencies:
angular: "^1.1.2+2"
browser: any
transformers:
- angular:
html_files:
- packages/TestModule/test_component/test.html
For the css file however, I think you only need to put them into the same folder as the component's Dart file.

dart-polymer: failed to load resource using core-elements

I want to use the core-scaffold element from the core-elements package. I imported
<link rel="import" href="packages/core_elements/core-scaffold.html">
<link rel="import" href="packages/core_elements/core-header-panel.html">
<link rel="import" href="packages/core_elements/core-menu.html">
<link rel="import" href="packages/core_elements/core-item.html">
into my html file. If i want to run the website i get
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-scaffold.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-header-panel.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-menu.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-item.html
I also use some elements from the page-elements package without any problems...
This is my pubspec.yaml file
name: Test
description: A sample web application
dependencies:
browser: any
polymer: ">=0.15.0 <0.16.0"
core_elements: ">=0.3.0 <0.4.0"
paper_elements: ">=0.4.0 <0.5.0"
transformers:
- polymer
I tried to delete and reload the core-elements package with pub get. But it doesnt help.
ok solved the problem. In the Polymere guide they used "-" in the links. The packages which the dart editor downloads use "_" in the links.
So its not core-header-panel. Its core_header_panel.

Grails: Response headers full and no response sent

| Error 2012-10-29 14:51:19,847 [http-bio-8443-exec-3] ERROR http11.Http11Processor - Error processing request
Message: An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the connector or write less data into the response headers.
Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
| Error 2012-10-29 14:51:19,850 [http-bio-8443-exec-3] ERROR http11.Http11Processor - Error finishing response
Message: An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the connector or write less data into the response headers.
Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
This happens very randomly in my local development environment (grails run-app -https). No matter what the browser is.
I'm running Grails 2.1.0 on Mac OSX with the following plugins:
aws-sdk 1.3.12 -- AWS SDK Grails Plugin
cookie-session 0.1.2 -- Cookie Session Plugin
hibernate 2.1.0 -- Hibernate for Grails
jquery 1.7.1 -- JQuery for Grails
jquery-ui 1.8.15 -- jQuery UI resources
mail 1.0 -- Provides Mail support to a running Grails application
newrelic 0.1 -- Newrelic Plugin
qrcode 0.3 -- QR Code plugin
quartz 1.0-RC2 -- Quartz plugin for Grails
resources 1.1.6 -- Resources
spring-security-core1.2.7.3 -- Spring Security Core Plugin
tomcat 2.1.0 -- Apache Tomcat plugin for Grails
webxml 1.4.1 -- WebXmlConfig
Any ideas what could cause this?
EDIT:
Noticed that this seems to happen after logging in (Spring security login form) when the browser is forwarded to j_spring_security_check. With Chrome & Firefox it's possible to stop this happening for a while by reseting the browser. IE doesn't behave similarly, instead just keeps giving this error (the error is shown only in grails console).
There's something that fills the headers. Possibly the cookie-session plugin?

Resources