Giter Club home page Giter Club logo

craploader's People

Contributors

andykent avatar gregersrygg avatar sindresorhus avatar steffenweber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

craploader's Issues

Call to AdTech ends up delivering two ads instead of one

With AdTech as our main ad provider we are having issues with multiple calls within the same page. The call to AdTech has a parameter for the creative size - for instance 225 for a 728x90, 170 for a 300x250.
If the first call on the page is a 300x250 and the second one a 728x90, we end up with two 300x250 ads, with one of them ending up in the container for the 728x90 ad. And I'm unable to figure out yet why this is happening.
I can provide you with a test page but I can't post the calls here publicly. If you want, I can mail you the test page. My email: peter dot lorent and it is a gmail account.
Otherwise, you can maybe give me some pointers where I should start looking in the craploader script.

Modifications on dom elements are ignored

The getElementByIdReplacement checks the buffer and returns a fake element when the script needs this, but the element is never injected to the document. So if a script modifies the element, those changes are lost.

<script> tags not handled correctly if nested in other tags

I've found yet another crappy ad with a script tag that does not exist at the top-level but inside another tag.

Test case:

<!DOCTYPE html>
<html>
<body>

<div id="placeholder"></div>
<script src="/clientscripts/crapLoader.js"></script>
<script>crapLoader.loadScript('./crap-ad.js', 'placeholder');</script>

</body>
</html>

crap-ad.js:

document.write('<div><scr'+'ipt>var x = 1;</scr'+'ipt><span>HTML</span><'+'/div>');

The correct output (without crapLoader) is:

<div><span>HTML</span></div>

With crapLoader the result is:

<div></div><span>HTML</span>

The "split" function works fine (with support.splitWithCapturingParentheses = true):

["<div>", "<script>var x = 1;</script>", "<span>HTML</span></div>"] 

The problem seems to be that later in the function "checkWriteBuffer" the HTML fragments are written to the document independently. I do not yet have an idea how to fix this issue.

[Btw, with support.splitWithCapturingParentheses = false the split does not work correctly, but that's another bug that is independent from this issue here:]

["<script>var x = 1;</script>", "<span>HTML</span></div>"]

[Test Case] Nested document.write calls fail

The following test-case fails (empty output). It succeeds (output "success") when crapLoader is disabled.

<!DOCTYPE html>
<html>
<body>
<script src="crapLoader.js"></script>
<script>
crapLoader.hijack({
    debug: true,
    parallel: false
});
</script>
<script>
document.write('<sc'+'ript type=\"text\/javasc'+'ript\">');
document.write('document.write(\'<div id=\"myid\"><\/div>\');');
document.write('var mydiv = document.getElementById(\"myid\");');
document.write('mydiv.innerHTML = "success";');
document.write('<\/sc'+'ript>');
</script>
</body>
</html>

The JavaScript in the last <script> tag is a reduced test-case of a real-world JavaScript ad. I have no influence on the code and know that it is crap. But I guess that is exactly what crapLoader is about. ;-)

Tested Browsers: Chrome 20, Firefox 14

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.